X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=test%2Fmovewindow.c;h=7fe7329f967cf5aeb3fd095cea929bb3bcfaaf10;hb=a09e8b13568e210a03ca4ad64e8552c0edea07c5;hp=0ce107ca0355f509b1ad7d3b0458756f8a6955c8;hpb=eccca377f55c70b12e3e92621d94d1e1c1fcfb7d;p=ncurses.git diff --git a/test/movewindow.c b/test/movewindow.c index 0ce107ca..7fe7329f 100644 --- a/test/movewindow.c +++ b/test/movewindow.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 2006-2018,2019 Free Software Foundation, Inc. * + * Copyright 2018-2021,2022 Thomas E. Dickey * + * Copyright 2006-2013,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -26,7 +27,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: movewindow.c,v 1.50 2019/01/21 20:11:22 tom Exp $ + * $Id: movewindow.c,v 1.53 2022/12/10 23:31:31 tom Exp $ * * Demonstrate move functions for windows and derived windows from the curses * library. @@ -54,14 +55,6 @@ TODO: #undef derwin #endif -#if defined(NCURSES_CONST) -#define CONST_FMT NCURSES_CONST -#elif defined(PDCURSES) -#define CONST_FMT const -#else -#define CONST_FMT /* nothing */ -#endif - #undef LINE_MAX #define LINE_MIN 2 @@ -678,13 +671,46 @@ show_help(WINDOW *current) free(msgs); } +static void +usage(int ok) +{ + static const char *msg[] = + { + "Usage: movewindow [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(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +main(int argc, char *argv[]) { WINDOW *current_win; int ch; bool done = FALSE; + 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); + initscr(); cbreak(); noecho();