From 70a21186f92ee19a995080744ce9a320345c05cb Mon Sep 17 00:00:00 2001 From: tjg Date: Wed, 24 Sep 2003 10:15:11 +0000 Subject: Tidiness: minor improvements to input.c. --- main.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 6ce7317..4da3014 100644 --- a/main.c +++ b/main.c @@ -2,11 +2,15 @@ #include "rc.h" -bool dashdee, dashee, dashvee, dashex, dashell, dashEYE, dasheye, - dashen, dashpee, dashess, interactive; +#include + +#include "input.h" + +bool dashdee, dashee, dashvee, dashex, dasheye, + dashen, dashpee, interactive; pid_t rc_pid; -static bool dashoh; +static bool dashEYE, dashell, dashoh, dashess; static void assigndefault(char *,...); static void checkfd(int, enum redirtype); @@ -86,6 +90,28 @@ quitopts: null[0] = NULL; starassign(dollarzero, null, FALSE); /* assign $0 to $* */ inithandler(); + + if (dashell) { + char *rcrc; + int fd; + + rcrc = concat(varlookup("home"), word("/.rcrc", NULL))->w; + fd = rc_open(rcrc, rFrom); + if (fd == -1) { + if (errno != ENOENT) + uerror(rcrc); + } else { + bool push_interactive; + + pushfd(fd); + push_interactive = interactive; + interactive = FALSE; + doit(TRUE); + interactive = push_interactive; + close(fd); + } + } + if (dashsee[0] != NULL || dashess) { /* input from -c or -s? */ if (*argv != NULL) starassign(dollarzero, argv, FALSE); -- cgit v1.2.3