X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fmove_field.c;fp=test%2Fmove_field.c;h=e337319edf1edc4a5dda3f3530e5b6036d8a8207;hp=874b189bb3d694ad793c08db6ab7a5284a967e79;hb=a09e8b13568e210a03ca4ad64e8552c0edea07c5;hpb=6641601a9dd7f34deeaa978899b3730b27635afb diff --git a/test/move_field.c b/test/move_field.c index 874b189b..e337319e 100644 --- a/test/move_field.c +++ b/test/move_field.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: move_field.c,v 1.13 2022/05/21 20:59:46 tom Exp $ + * $Id: move_field.c,v 1.14 2022/12/10 23:31:31 tom Exp $ * * Demonstrate move_field(). */ @@ -474,9 +474,44 @@ demo_forms(void) nl(); } +static void +usage(int ok) +{ + static const char *msg[] = + { + "Usage: move_field [options]" + ,"" + ,USAGE_COMMON + }; + size_t n; + + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + + ExitProgram(ok ? EXIT_SUCCESS : EXIT_FAILURE); +} +/* *INDENT-OFF* */ +VERSION_COMMON() +/* *INDENT-ON* */ + int -main(void) +main(int argc, char *argv[]) { + int ch; + + while ((ch = getopt(argc, argv, OPTS_COMMON)) != -1) { + switch (ch) { + case OPTS_VERSION: + show_version(argv); + ExitProgram(EXIT_SUCCESS); + default: + usage(ch == OPTS_USAGE); + /* NOTREACHED */ + } + } + if (optind < argc) + usage(FALSE); + setlocale(LC_ALL, ""); initscr();