diff options
author | wkoszek <wkoszek@FreeBSD.org> | 2006-02-27 21:55:47 +0000 |
---|---|---|
committer | wkoszek <wkoszek@FreeBSD.org> | 2006-02-27 21:55:47 +0000 |
commit | 463414cc5c354239b0a668c5b7cddda7a97fdf10 (patch) | |
tree | 8722377c2f69f9db94b8fb98e992cc6174fb33d9 /sbin | |
parent | 9ef509c4ccb35f505bff80d96852865173be5c15 (diff) | |
download | FreeBSD-src-463414cc5c354239b0a668c5b7cddda7a97fdf10.zip FreeBSD-src-463414cc5c354239b0a668c5b7cddda7a97fdf10.tar.gz |
Big style(9) fix. This commit brings no functional change.
Approved by: cognet (mentor)
MFC after: 1 week
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/kldunload/kldunload.c | 109 |
1 files changed, 56 insertions, 53 deletions
diff --git a/sbin/kldunload/kldunload.c b/sbin/kldunload/kldunload.c index cdf8f04..cafc7ea 100644 --- a/sbin/kldunload/kldunload.c +++ b/sbin/kldunload/kldunload.c @@ -27,78 +27,81 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <sys/param.h> +#include <sys/linker.h> + #include <err.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <sys/param.h> -#include <sys/linker.h> static void usage(void) { - fprintf(stderr, "usage: kldunload [-fv] -i id\n"); - fprintf(stderr, " kldunload [-fv] [-n] name\n"); - exit(1); + fprintf(stderr, "usage: kldunload [-fv] -i id\n"); + fprintf(stderr, " kldunload [-fv] [-n] name\n"); + exit(1); } int main(int argc, char** argv) { - int c; - int verbose = 0; - int fileid = 0; - int force = LINKER_UNLOAD_NORMAL; - char* filename = NULL; + struct kld_file_stat stat; + int c; + int verbose = 0; + int fileid = 0; + int force = LINKER_UNLOAD_NORMAL; + char *filename = NULL; - while ((c = getopt(argc, argv, "fi:n:v")) != -1) - switch (c) { - case 'f': - force = LINKER_UNLOAD_FORCE; - break; - case 'i': - fileid = atoi(optarg); - if (!fileid) - errx(1, "Invalid ID %s", optarg); - break; - case 'n': - filename = optarg; - break; - case 'v': - verbose = 1; - break; - default: - usage(); + while ((c = getopt(argc, argv, "fi:n:v")) != -1) { + switch (c) { + case 'f': + force = LINKER_UNLOAD_FORCE; + break; + case 'i': + fileid = atoi(optarg); + if (!fileid) + errx(1, "Invalid ID %s", optarg); + break; + case 'n': + filename = optarg; + break; + case 'v': + verbose = 1; + break; + default: + usage(); + } } - argc -= optind; - argv += optind; - if (fileid == 0 && filename == NULL && (argc == 1)) { - filename = *argv; - argc--; - } - - if (argc != 0 || (fileid != 0 && filename != NULL)) - usage(); + argc -= optind; + argv += optind; - if (fileid == 0 && filename == NULL) - usage(); + if (fileid == 0 && filename == NULL && (argc == 1)) { + filename = *argv; + argc--; + } - if (filename != NULL) { - if ((fileid = kldfind(filename)) < 0) - err(1, "can't find file %s", filename); - } + if (argc != 0 || (fileid != 0 && filename != NULL)) + usage(); - if (verbose) { - struct kld_file_stat stat; - stat.version = sizeof stat; - if (kldstat(fileid, &stat) < 0) - err(1, "can't stat file"); - printf("Unloading %s, id=%d\n", stat.name, fileid); - } + if (fileid == 0 && filename == NULL) + usage(); + + if (filename != NULL) { + if ((fileid = kldfind(filename)) < 0) + err(1, "can't find file %s", filename); + } + + if (verbose) { + stat.version = sizeof stat; + if (kldstat(fileid, &stat) < 0) + err(1, "can't stat file"); + printf("Unloading %s, id=%d\n", stat.name, fileid); + } - if (kldunloadf(fileid, force) < 0) - err(1, "can't unload file"); + if (kldunloadf(fileid, force) < 0) + err(1, "can't unload file"); - return 0; + return 0; } |