diff options
author | Eric Jackson <ericj@cvs.openbsd.org> | 2002-01-08 04:59:25 +0000 |
---|---|---|
committer | Eric Jackson <ericj@cvs.openbsd.org> | 2002-01-08 04:59:25 +0000 |
commit | 9703d5d7427a67e288d88e49cadce6a1851fd6dc (patch) | |
tree | 8c7bd36f6e77d0b456480846882aa1c44bec2891 /usr.bin/modstat | |
parent | 64795e7106cd5675f1dedcfe16ab40223780fb03 (diff) |
deal with 32 vs 64 bit pointers. from netbsd.
misc cleanup as well
Diffstat (limited to 'usr.bin/modstat')
-rw-r--r-- | usr.bin/modstat/modstat.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/usr.bin/modstat/modstat.c b/usr.bin/modstat/modstat.c index 0f9d103cd2d..113c2b3c5d2 100644 --- a/usr.bin/modstat/modstat.c +++ b/usr.bin/modstat/modstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: modstat.c,v 1.14 2001/08/18 22:06:44 deraadt Exp $ */ +/* $OpenBSD: modstat.c,v 1.15 2002/01/08 04:59:24 ericj Exp $ */ /* * Copyright (c) 1993 Terrence R. Lambert. @@ -48,13 +48,7 @@ #include <errno.h> #include "pathnames.h" -void -usage() -{ - - fprintf(stderr, "usage: modstat [-i moduleid] [-n modulename]\n"); - exit(1); -} +#define POINTERSIZE ((int)(2 * sizeof(void*))) static char *type_names[] = { "SYSCALL", @@ -65,11 +59,17 @@ static char *type_names[] = { "MISC" }; -int -dostat(devfd, modnum, modname) - int devfd; - int modnum; - char *modname; +static void +usage() +{ + extern char *__progname; + + (void)fprintf(stderr, "usage: %s [-i id] [-n name]\n", __progname); + exit(1); +} + +static int +dostat(int devfd, int modnum, char *modname) { char name[MAXLKMNAME]; struct lmc_stat sbuf; @@ -98,10 +98,10 @@ dostat(devfd, modnum, modname) } /* Decode this stat buffer... */ - printf("%-7s %3d %3ld %08lx %04lx %8lx %3ld %s\n", - type_names[sbuf.type], sbuf.id, sbuf.offset, - (long)sbuf.area, (long)sbuf.size, (long)sbuf.private, - (long)sbuf.ver, sbuf.name); + printf("%-7s %3d %3ld %0*lx %04lx %0*x %3ld %s\n", + type_names[sbuf.type], sbuf.id, sbuf.offset, POINTERSIZE, + (long)sbuf.area, (long)sbuf.size, POINTERSIZE, + (long)sbuf.private, (long)sbuf.ver, sbuf.name); return 0; } @@ -145,7 +145,8 @@ main(argc, argv) setegid(getgid()); setgid(getgid()); - printf("Type Id Off Loadaddr Size Info Rev Module Name\n"); + printf("Type Id Off %-*s Size %-*s Rev Module Name\n", + POINTERSIZE, "Loadaddr", POINTERSIZE, "Info"); if (modnum != -1 || modname != NULL) { if (dostat(devfd, modnum, modname)) |