iomenu

interactive text selection menu
Log | Files | Refs | README | LICENSE

commit d6c740ae9f36ae68149a9c438664213aaff06e97
parent 7ffa2976a3b8c78a0eb5a4158d9dc7528d563c73
Author: Josuah Demangeon <mail@josuah.net>
Date:   Thu,  8 Mar 2018 15:57:21 +0100

switch to getopt

Diffstat:
Miomenu.c | 12+++++-------
1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/iomenu.c b/iomenu.c @@ -10,6 +10,7 @@ #include <string.h> #include <termios.h> #include <unistd.h> +#include <getopt.h> #include "utf8.h" #include "str.h" @@ -398,16 +399,13 @@ usage(void) exit(EXIT_FAILURE); } -/* -** XXX: switch to getopt. -*/ static void parse_opt(int argc, char *argv[]) { - for (argv++, argc--; argc > 0; argv++, argc--) { - if (argv[0][0] != '-') - usage(); - switch ((*argv)[1]) { + int c; + + while ((c = getopt(argc, argv, "#")) != -1) { + switch (c) { case '#': flag_hs = 1; break;