diff options
| author | Erik Andersen <andersen@codepoet.org> | 2000-04-13 01:18:56 +0000 |
|---|---|---|
| committer | Erik Andersen <andersen@codepoet.org> | 2000-04-13 01:18:56 +0000 |
| commit | 61677feff7f549a48267c2c0c50a7420de6e2599 (patch) | |
| tree | 1ea829e51641647a35c552e289f4482ab9f5db27 /miscutils | |
| parent | 62dc17a3b100496a5c7433cc598d674e244cb6f8 (diff) | |
| download | busybox-w32-61677feff7f549a48267c2c0c50a7420de6e2599.tar.gz busybox-w32-61677feff7f549a48267c2c0c50a7420de6e2599.tar.bz2 busybox-w32-61677feff7f549a48267c2c0c50a7420de6e2599.zip | |
Upates to include copyright 2000 to everything
-Erik
Diffstat (limited to 'miscutils')
| -rw-r--r-- | miscutils/dutmp.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c index 45eab8ae7..cf0d466ef 100644 --- a/miscutils/dutmp.c +++ b/miscutils/dutmp.c | |||
| @@ -13,34 +13,35 @@ | |||
| 13 | 13 | ||
| 14 | #include "internal.h" | 14 | #include "internal.h" |
| 15 | #include <stdio.h> | 15 | #include <stdio.h> |
| 16 | #include <errno.h> | ||
| 16 | #include <utmp.h> | 17 | #include <utmp.h> |
| 18 | #define BB_DECLARE_EXTERN | ||
| 19 | #define bb_need_io_error | ||
| 20 | #include "messages.c" | ||
| 17 | 21 | ||
| 18 | static const char dutmp_usage[] = "dutmp\n" | 22 | static const char dutmp_usage[] = "dutmp\n" |
| 19 | "\n" | 23 | "\n" |
| 20 | |||
| 21 | "\tDump file or stdin utmp file format to stdout, pipe delimited.\n" | 24 | "\tDump file or stdin utmp file format to stdout, pipe delimited.\n" |
| 22 | "\tdutmp /var/run/utmp\n"; | 25 | "\tdutmp /var/run/utmp\n"; |
| 23 | 26 | ||
| 24 | extern int dutmp_main(int argc, char **argv) | 27 | extern int dutmp_main(int argc, char **argv) |
| 25 | { | 28 | { |
| 26 | 29 | ||
| 27 | FILE *f = stdin; | 30 | FILE *f; |
| 28 | struct utmp ut; | 31 | struct utmp ut; |
| 29 | 32 | ||
| 30 | if ((argc < 2) || (**(argv + 1) == '-')) { | 33 | if (argc<2) { |
| 34 | f = stdin; | ||
| 35 | } else if (*argv[1] == '-' ) { | ||
| 31 | usage(dutmp_usage); | 36 | usage(dutmp_usage); |
| 32 | } | 37 | } else { |
| 33 | 38 | f = fopen(argv[1], "r"); | |
| 34 | if (**(++argv) == 0) { | 39 | if (f == NULL) { |
| 35 | f = fopen(*(++argv), "r"); | 40 | fatalError(io_error, argv[1], strerror(errno)); |
| 36 | if (f < 0) { | ||
| 37 | perror(*argv); | ||
| 38 | exit(FALSE); | ||
| 39 | } | 41 | } |
| 40 | } | 42 | } |
| 41 | 43 | ||
| 42 | while (fread(&ut, 1, sizeof(struct utmp), f)) { | 44 | while (fread(&ut, sizeof(struct utmp), 1, f)) { |
| 43 | // printf("%d:%d:%s:%s:%s:%s:%d:%d:%ld:%ld:%ld:%x\n", | ||
| 44 | printf("%d|%d|%s|%s|%s|%s|%d|%d|%ld|%ld|%ld|%x\n", | 45 | printf("%d|%d|%s|%s|%s|%s|%d|%d|%ld|%ld|%ld|%x\n", |
| 45 | ut.ut_type, ut.ut_pid, ut.ut_line, | 46 | ut.ut_type, ut.ut_pid, ut.ut_line, |
| 46 | ut.ut_id, ut.ut_user, ut.ut_host, | 47 | ut.ut_id, ut.ut_user, ut.ut_host, |
