aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-02-16 18:41:12 +0000
committerEric Andersen <andersen@codepoet.org>2001-02-16 18:41:12 +0000
commit733c4ad6ebc092292053e0fb7a7e32c204a3b371 (patch)
tree45a871308c610b20f12f45cc7fef495747038f5c
parentfa4f146d7d3600df63f76b1d4d90620d983901c4 (diff)
downloadbusybox-w32-733c4ad6ebc092292053e0fb7a7e32c204a3b371.tar.gz
busybox-w32-733c4ad6ebc092292053e0fb7a7e32c204a3b371.tar.bz2
busybox-w32-733c4ad6ebc092292053e0fb7a7e32c204a3b371.zip
Do usage messages the same way all other apps fo them.
Skip printing of available options (can't do this easily). Based on a patch by Larry Doolittle. -Erik
-rw-r--r--applets/usage.h12
-rw-r--r--fbset.c26
-rw-r--r--include/usage.h12
-rw-r--r--usage.h12
-rw-r--r--util-linux/fbset.c26
5 files changed, 42 insertions, 46 deletions
diff --git a/applets/usage.h b/applets/usage.h
index c4d301b5e..c16a225a1 100644
--- a/applets/usage.h
+++ b/applets/usage.h
@@ -474,6 +474,18 @@ false_usage_index
474DO_COMMA 474DO_COMMA
475#endif 475#endif
476 476
477#if defined BB_FBSET
478#if defined USAGE_ENUM
479fbset_usage_index
480#elif defined USAGE_MESSAGES
481 "fbset [options] [mode]"
482#ifndef BB_FEATURE_TRIVIAL_HELP
483 "\n\nShows and modifies frame buffer device settings"
484#endif
485#endif
486DO_COMMA
487#endif
488
477#if defined BB_FDFLUSH 489#if defined BB_FDFLUSH
478#if defined USAGE_ENUM 490#if defined USAGE_ENUM
479fdflush_usage_index 491fdflush_usage_index
diff --git a/fbset.c b/fbset.c
index f20c284aa..9acabbecb 100644
--- a/fbset.c
+++ b/fbset.c
@@ -334,26 +334,6 @@ static void showmode(struct fb_var_screeninfo *v)
334 printf("endmode\n\n"); 334 printf("endmode\n\n");
335} 335}
336 336
337static void fbset_usage(void)
338{
339#ifndef BB_FEATURE_TRIVIAL_HELP
340 int i;
341#endif
342
343#ifndef STANDALONE
344 fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n",
345 BB_VER, BB_BT);
346#endif
347 fprintf(stderr, "Usage: fbset [options] [mode]\n");
348#ifndef BB_FEATURE_TRIVIAL_HELP
349 fprintf(stderr, "\nShows and modifies frame buffer device settings\n\n");
350 fprintf(stderr, "The following options are recognized:\n");
351 for (i = 0; g_cmdoptions[i].name; i++)
352 fprintf(stderr, "\t%s\n", g_cmdoptions[i].name);
353#endif
354 exit(-1);
355}
356
357#ifdef STANDALONE 337#ifdef STANDALONE
358int main(int argc, char **argv) 338int main(int argc, char **argv)
359#else 339#else
@@ -375,10 +355,10 @@ extern int fbset_main(int argc, char **argv)
375 for (i = 0; g_cmdoptions[i].name; i++) { 355 for (i = 0; g_cmdoptions[i].name; i++) {
376 if (!strcmp(thisarg, g_cmdoptions[i].name)) { 356 if (!strcmp(thisarg, g_cmdoptions[i].name)) {
377 if (argc - 1 < g_cmdoptions[i].param_count) 357 if (argc - 1 < g_cmdoptions[i].param_count)
378 fbset_usage(); 358 show_usage();
379 switch (g_cmdoptions[i].code) { 359 switch (g_cmdoptions[i].code) {
380 case CMD_HELP: 360 case CMD_HELP:
381 fbset_usage(); 361 show_usage();
382 case CMD_FB: 362 case CMD_FB:
383 fbdev = argv[1]; 363 fbdev = argv[1];
384 break; 364 break;
@@ -423,7 +403,7 @@ extern int fbset_main(int argc, char **argv)
423 mode = *argv; 403 mode = *argv;
424 g_options |= OPT_READMODE; 404 g_options |= OPT_READMODE;
425 } else { 405 } else {
426 fbset_usage(); 406 show_usage();
427 } 407 }
428 } 408 }
429 } 409 }
diff --git a/include/usage.h b/include/usage.h
index c4d301b5e..c16a225a1 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -474,6 +474,18 @@ false_usage_index
474DO_COMMA 474DO_COMMA
475#endif 475#endif
476 476
477#if defined BB_FBSET
478#if defined USAGE_ENUM
479fbset_usage_index
480#elif defined USAGE_MESSAGES
481 "fbset [options] [mode]"
482#ifndef BB_FEATURE_TRIVIAL_HELP
483 "\n\nShows and modifies frame buffer device settings"
484#endif
485#endif
486DO_COMMA
487#endif
488
477#if defined BB_FDFLUSH 489#if defined BB_FDFLUSH
478#if defined USAGE_ENUM 490#if defined USAGE_ENUM
479fdflush_usage_index 491fdflush_usage_index
diff --git a/usage.h b/usage.h
index c4d301b5e..c16a225a1 100644
--- a/usage.h
+++ b/usage.h
@@ -474,6 +474,18 @@ false_usage_index
474DO_COMMA 474DO_COMMA
475#endif 475#endif
476 476
477#if defined BB_FBSET
478#if defined USAGE_ENUM
479fbset_usage_index
480#elif defined USAGE_MESSAGES
481 "fbset [options] [mode]"
482#ifndef BB_FEATURE_TRIVIAL_HELP
483 "\n\nShows and modifies frame buffer device settings"
484#endif
485#endif
486DO_COMMA
487#endif
488
477#if defined BB_FDFLUSH 489#if defined BB_FDFLUSH
478#if defined USAGE_ENUM 490#if defined USAGE_ENUM
479fdflush_usage_index 491fdflush_usage_index
diff --git a/util-linux/fbset.c b/util-linux/fbset.c
index f20c284aa..9acabbecb 100644
--- a/util-linux/fbset.c
+++ b/util-linux/fbset.c
@@ -334,26 +334,6 @@ static void showmode(struct fb_var_screeninfo *v)
334 printf("endmode\n\n"); 334 printf("endmode\n\n");
335} 335}
336 336
337static void fbset_usage(void)
338{
339#ifndef BB_FEATURE_TRIVIAL_HELP
340 int i;
341#endif
342
343#ifndef STANDALONE
344 fprintf(stderr, "BusyBox v%s (%s) multi-call binary -- GPL2\n\n",
345 BB_VER, BB_BT);
346#endif
347 fprintf(stderr, "Usage: fbset [options] [mode]\n");
348#ifndef BB_FEATURE_TRIVIAL_HELP
349 fprintf(stderr, "\nShows and modifies frame buffer device settings\n\n");
350 fprintf(stderr, "The following options are recognized:\n");
351 for (i = 0; g_cmdoptions[i].name; i++)
352 fprintf(stderr, "\t%s\n", g_cmdoptions[i].name);
353#endif
354 exit(-1);
355}
356
357#ifdef STANDALONE 337#ifdef STANDALONE
358int main(int argc, char **argv) 338int main(int argc, char **argv)
359#else 339#else
@@ -375,10 +355,10 @@ extern int fbset_main(int argc, char **argv)
375 for (i = 0; g_cmdoptions[i].name; i++) { 355 for (i = 0; g_cmdoptions[i].name; i++) {
376 if (!strcmp(thisarg, g_cmdoptions[i].name)) { 356 if (!strcmp(thisarg, g_cmdoptions[i].name)) {
377 if (argc - 1 < g_cmdoptions[i].param_count) 357 if (argc - 1 < g_cmdoptions[i].param_count)
378 fbset_usage(); 358 show_usage();
379 switch (g_cmdoptions[i].code) { 359 switch (g_cmdoptions[i].code) {
380 case CMD_HELP: 360 case CMD_HELP:
381 fbset_usage(); 361 show_usage();
382 case CMD_FB: 362 case CMD_FB:
383 fbdev = argv[1]; 363 fbdev = argv[1];
384 break; 364 break;
@@ -423,7 +403,7 @@ extern int fbset_main(int argc, char **argv)
423 mode = *argv; 403 mode = *argv;
424 g_options |= OPT_READMODE; 404 g_options |= OPT_READMODE;
425 } else { 405 } else {
426 fbset_usage(); 406 show_usage();
427 } 407 }
428 } 408 }
429 } 409 }