traceroute: fix help text to not show -6 when traceroute6 is off
[oweals/busybox.git] / shell / bbsh.c
index 3be64eec7a9b989ade0d9b40a98b920c133c7284..c3726263aeda8cc79a1fc1cdd3c5e64e82b1bb9d 100644 (file)
@@ -54,7 +54,7 @@ struct command {
        int flags;              // exit, suspend, && ||
        int pid;                // pid (or exit code)
        int argc;
-       char *argv[0];
+       char *argv[];
 };
 
 // A collection of processes piped into/waiting on each other.
@@ -206,13 +206,13 @@ int bbsh_main(int argc, char **argv)
 
        getopt32(argv, "c:", &command);
 
-       f = argv[optind] ? xfopen(argv[optind],"r") : NULL;
+       f = argv[optind] ? xfopen_for_read(argv[optind]) : NULL;
        if (command) handle(command);
        else {
                unsigned cmdlen=0;
                for (;;) {
                        if (!f) putchar('$');
-                       if (1 > getline(&command, &cmdlen,f ? : stdin)) break;
+                       if (1 > getline(&command, &cmdlen, f ? f : stdin)) break;
 
                        handle(command);
                }