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.
if (!pid) {
run_applet_and_exit(cmd->argv[0],cmd->argc,cmd->argv);
execvp(cmd->argv[0],cmd->argv);
- printf("No %s",cmd->argv[0]);
+ printf("No %s", cmd->argv[0]);
exit(EXIT_FAILURE);
} else waitpid(pid, &status, 0);
}
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);
}