summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorToby Goodwin <toby@paccrat.org>2014-09-02 08:01:39 +0100
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:22:10 +0100
commita8699a58d8632f21e897ea5c4900a15483a9a8ca (patch)
treefd8e7910807eb91bcd79d498582959f1d750f9c6 /main.c
parentd884971193ef4934424b77ae862e8b0ecf70bab3 (diff)
release: rc-1.7.2
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);