]> git.mdlowis.com Git - proto/rc.git/commitdiff
tabs to spaces print-removal
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 11 Apr 2017 12:19:32 +0000 (08:19 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 11 Apr 2017 12:19:32 +0000 (08:19 -0400)
builtins.c
main.c

index 1cb825901473c0bb7b10cd8e6e41bc81f5d872d0..e28547ed5f5feaa84b864b7ec36e7cf540dfc82e 100644 (file)
@@ -17,20 +17,20 @@ static struct {
     builtin_t *p;
     char *name;
 } builtins[] = {
-       { b_break,       "break"   },
-       { b_builtin, "builtin" },
-       { b_cd,          "cd"      },
-       { b_echo,        "echo"    },
-       { b_eval,        "eval"    },
-       { b_exec,        "exec"    },
-       { b_exit,        "exit"    },
-       { b_limit,       "limit"   },
-       { b_newpgrp, "newpgrp" },
-       { b_return,      "return"  },
-       { b_shift,       "shift"   },
-       { b_umask,       "umask"   },
-       { b_wait,        "wait"    },
-       { b_dot,         "."       },
+    { b_break,     "break"   },
+    { b_builtin, "builtin" },
+    { b_cd,         "cd"      },
+    { b_echo,     "echo"    },
+    { b_eval,     "eval"    },
+    { b_exec,     "exec"    },
+    { b_exit,     "exit"    },
+    { b_limit,     "limit"   },
+    { b_newpgrp, "newpgrp" },
+    { b_return,     "return"  },
+    { b_shift,     "shift"   },
+    { b_umask,     "umask"   },
+    { b_wait,     "wait"    },
+    { b_dot,     "."       },
 };
 
 extern builtin_t *isbuiltin(char *s) {
diff --git a/main.c b/main.c
index 32660fb6ca49623f9776c68fb588e13a83fd4ecb..8fd7bfa0b8fadc8fea18ed01342c42ac6a62d903 100644 (file)
--- a/main.c
+++ b/main.c
@@ -6,38 +6,29 @@ char* ARGV0;
 bool interactive;
 pid_t rc_pid;
 
-static bool dashEYE, dashell, dashoh;
-
 static void assigndefault(char *,...);
 static void checkfd(int, enum redirtype);
 
 void usage(void) {
     printf("Usage: %s [OPTION...] [FILE [ARG...]]\n", ARGV0);
+    exit(1);
 }
 
 /* open an fd on /dev/null if it is inherited closed */
 static void checkfd(int fd, enum redirtype r) {
-       int new = rc_open("/dev/null", r);
-       if (new != fd && new != -1)
-               close(new);
+    int new = rc_open("/dev/null", r);
+    if (new != fd && new != -1)
+        close(new);
 }
 
 extern int main(int argc, char *argv[], char *envp[]) {
-    char *dashsee[2], *dollarzero, *null[1];
+    char *dollarzero, *null[1];
     initprint();
-    dashsee[0] = dashsee[1] = NULL;
     dollarzero = argv[0];
     rc_pid = getpid();
-    dashell = (*argv[0] == '-'); /* login shell, per unix tradition */
-    
+        
     OPTBEGIN {
-        case 'e': dashee  = true; break;
-        case 'l': dashell = true; break;
-        case 'o': dashoh  = true; break;
-        case 'p': dashpee = true; break;
-        case 'c':
-            dashsee[0] = EOPTARG(usage());
-            break;
+        default: usage();
     } OPTEND;
 
     /* use isatty() iff neither -i nor -I is set, and iff the input is not from a script or -c flags */
@@ -68,15 +59,15 @@ extern int main(int argc, char *argv[], char *envp[]) {
 }
 
 static void assigndefault(char *name, ...) {
-       va_list ap;
-       List *l;
-       char *v;
-       va_start(ap, name);
-       for (l = NULL; (v = va_arg(ap, char *)) != NULL;)
-               l = append(l, word(v, NULL));
-       varassign(name, l, false);
-       set_exportable(name, false);
-       if (streq(name, "path"))
-               alias(name, l, false);
-       va_end(ap);
+    va_list ap;
+    List *l;
+    char *v;
+    va_start(ap, name);
+    for (l = NULL; (v = va_arg(ap, char *)) != NULL;)
+        l = append(l, word(v, NULL));
+    varassign(name, l, false);
+    set_exportable(name, false);
+    if (streq(name, "path"))
+        alias(name, l, false);
+    va_end(ap);
 }