- /*
- * Get the terminfo entry into memory, and tell ncurses that we want to
- * use function keys. That will make it add any user-defined keys that
- * appear in the terminfo.
- */
- newterm(getenv("TERM"), stderr, stdin);
- keypad(stdscr, TRUE);
- endwin();
+ while ((n = getopt(argc, argv, "ms")) != -1) {
+ switch (n) {
+ case 'm':
+ do_meta = TRUE;
+ break;
+ case 's':
+ do_setup = TRUE;
+ break;
+ default:
+ usage();
+ /* NOTREACHED */
+ }
+ }
+
+ if (do_setup) {
+ /*
+ * Get the terminfo entry into memory, and tell ncurses that we want to
+ * use function keys. That will make it add any user-defined keys that
+ * appear in the terminfo.
+ */
+ newterm(getenv("TERM"), stderr, stdin);
+ keypad(stdscr, TRUE);
+ if (do_meta)
+ meta(stdscr, TRUE);
+ endwin();
+ }