summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authortjg <tjg>2003-09-24 10:15:11 +0000
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:23:23 +0100
commit70a21186f92ee19a995080744ce9a320345c05cb (patch)
tree41540bb3724cbc5c8a36228e5723211338e22090 /main.c
parent02c12b81c0b9b19a7b1372c8e6842337a9f00959 (diff)
Tidiness: minor improvements to input.c.
Diffstat (limited to 'main.c')
-rw-r--r--main.c32
1 files changed, 29 insertions, 3 deletions
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 <errno.h>
+
+#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);