diff options
-rw-r--r-- | swu.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -1,4 +1,5 @@ #include <unistd.h> +#include <getopt.h> #include <stdio.h> #include <stdlib.h> #include <stdarg.h> @@ -286,6 +287,19 @@ help(void) //FIXME } +struct option opt[] = { + { "all", 0, NULL, 'a' }, + { "human-readable", 0, NULL, 'H' }, + { "help", 0, NULL, 'h' }, + { "name", 0, NULL, 'n' }, + { "pid", 0, NULL, 'p' }, + { "reverse", 0, NULL, 'r' }, + { "size", 0, NULL, 's' }, + { "total", 0, NULL, 't' }, + { "verbose", 0, NULL, 'v' }, + { NULL } +}; + int main(int argc, char **argv) { @@ -296,7 +310,7 @@ main(int argc, char **argv) ++progname; else progname = argv[0]; - while ((c = getopt(argc, argv, "aHhnprstv")) != EOF) { + while ((c = getopt_long(argc, argv, "acHhnprstv", opt, NULL)) != EOF) { switch (c) { case 'a': show_all = 1; @@ -319,6 +333,7 @@ main(int argc, char **argv) case 's': cmp = cmp_size; break; + case 'c': case 't': show_total = 1; break; |