|
|
| version 1.6, 2004/03/27 01:46:10 | version 1.7, 2004/04/22 18:33:52 |
|---|---|
| Line 57 jmp_buf toplevel; | Line 57 jmp_buf toplevel; |
| static struct cmd *getcmd(char *); | static struct cmd *getcmd(char *); |
| int | int |
| main(int argc, char *argv[]) | main(int argc, char **argv) |
| { | { |
| struct cmd *c; | struct cmd *c; |
| Line 68 main(int argc, char *argv[]) | Line 68 main(int argc, char *argv[]) |
| */ | */ |
| if (priv_resources() < 0) | if (priv_resources() < 0) |
| errx(1, "could not get privileged resources"); | errx(1, "could not get privileged resources"); |
| (void) setuid(getuid()); | setuid(getuid()); |
| if (--argc > 0) { | if (--argc > 0) { |
| c = getcmd(*++argv); | c = getcmd(*++argv); |
| Line 91 main(int argc, char *argv[]) | Line 91 main(int argc, char *argv[]) |
| fromatty = isatty(fileno(stdin)); | fromatty = isatty(fileno(stdin)); |
| if (setjmp(toplevel)) | if (setjmp(toplevel)) |
| putchar('\n'); | putchar('\n'); |
| (void) signal(SIGINT, intr); | signal(SIGINT, intr); |
| for (;;) { | for (;;) { |
| if (fromatty) { | if (fromatty) { |
| printf("timedc> "); | printf("timedc> "); |
| (void) fflush(stdout); | fflush(stdout); |
| } | } |
| if (fgets(cmdline, sizeof(cmdline), stdin) == 0) | if (fgets(cmdline, sizeof(cmdline), stdin) == 0) |
| quit(); | quit(); |
| Line 125 main(int argc, char *argv[]) | Line 125 main(int argc, char *argv[]) |
| void | void |
| intr(int signo) | intr(int signo) |
| { | { |
| if (!fromatty) | if (!fromatty) |
| exit(0); | exit(0); |
| longjmp(toplevel, 1); | longjmp(toplevel, 1); |
| } | } |
| static struct cmd * | static struct cmd * |
| getcmd(char *name) | getcmd(char *name) |
| { | { |
| Line 188 makeargv(void) | Line 186 makeargv(void) |
| *argp++ = 0; | *argp++ = 0; |
| } | } |
| #define HELPINDENT (sizeof ("directory")) | #define HELPINDENT (sizeof("directory")) |
| /* | /* |
| * Help command. | * Help command. |
| */ | */ |
| void | void |
| help(int argc, char *argv[]) | help(int argc, char **argv) |
| { | { |
| struct cmd *c; | struct cmd *c; |
| if (argc == 1) { | if (argc == 1) { |
| register int i, j, w; | int i, j, w; |
| int columns, width = 0, lines; | int columns, width = 0, lines; |
| extern int NCMDS; | extern int NCMDS; |
| Line 233 help(int argc, char *argv[]) | Line 231 help(int argc, char *argv[]) |
| return; | return; |
| } | } |
| while (--argc > 0) { | while (--argc > 0) { |
| register char *arg; | char *arg; |
| arg = *++argv; | arg = *++argv; |
| c = getcmd(arg); | c = getcmd(arg); |
| if (c == (struct cmd *)-1) | if (c == (struct cmd *)-1) |