diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-02-21 05:31:21 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-02-21 05:31:21 +0000 |
commit | 9702d6e310685abbb461863c06089104762685fb (patch) | |
tree | 3eb1b5ecac29b82391629e95be5a2f5978e26b15 /sys-apps/setarch/files | |
parent | Marked ~hppa. (diff) | |
download | gentoo-2-9702d6e310685abbb461863c06089104762685fb.tar.gz gentoo-2-9702d6e310685abbb461863c06089104762685fb.tar.bz2 gentoo-2-9702d6e310685abbb461863c06089104762685fb.zip |
add support for a -h (help) option
(Portage version: 2.1_pre4-r1)
Diffstat (limited to 'sys-apps/setarch/files')
-rw-r--r-- | sys-apps/setarch/files/setarch-1.8-help.patch | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sys-apps/setarch/files/setarch-1.8-help.patch b/sys-apps/setarch/files/setarch-1.8-help.patch new file mode 100644 index 000000000000..7b09c64ed2b1 --- /dev/null +++ b/sys-apps/setarch/files/setarch-1.8-help.patch @@ -0,0 +1,44 @@ +--- setarch.c ++++ setarch.c +@@ -120,17 +121,27 @@ + return 0; + } + ++void show_usage(const char *progname) ++{ ++ int f; ++ printf("Usage: %s%s [options] <program> [program arguments]\n\n", progname, ++ (!strcmp(progname,"setarch")?" <arch>":"")); ++ printf("Options:\n"); ++ for (f=0; f<sizeof(flags)/sizeof(flags[0]); f++) ++ printf("\t-%c\tEnable %s\n", flags[f].c, flags[f].name); ++} ++ + int main(int argc, char *argv[]) + { ++ char *real_argv0; + char *p = strrchr(argv[0], '/'); + unsigned long options = 0; + int got_arch = 0, verbose = 0; + +- p = p ? p + 1 : argv[0]; ++ real_argv0 = p = p ? p + 1 : argv[0]; + + if(argc <= 1) { +- fprintf(stderr, "Usage: %s %s program arguments\n", +- p, !strcmp(p, "setarch")?"arch":""); ++ show_usage(real_argv0); + return 1; + } + +@@ -155,6 +166,10 @@ + verbose = 1; + continue; + } ++ if (arg[n] == 'h') { ++ show_usage(real_argv0); ++ return 0; ++ } + + for (f = 0; f < sizeof(flags)/sizeof(flags[0]); f++) { + if (arg[n] == flags[f].c) { |