From 27b7ab355bc660471df40eb7d5f86178f961855b Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sat, 4 Jul 2009 11:10:36 +0000 Subject: suboptarg is not portable to Linux (fixed). --- main.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 4be1965d..7dafb720 100644 --- a/main.c +++ b/main.c @@ -554,7 +554,7 @@ toptions(enum outt *tflags, char *arg) static int foptions(int *fflags, char *arg) { - char *v; + char *v, *o; char *toks[6]; toks[0] = "ign-scope"; @@ -564,7 +564,8 @@ foptions(int *fflags, char *arg) toks[4] = "strict"; toks[5] = NULL; - while (*arg) + while (*arg) { + o = arg; switch (getsubopt(&arg, toks, &v)) { case (0): *fflags |= IGN_SCOPE; @@ -583,9 +584,10 @@ foptions(int *fflags, char *arg) NO_IGN_MACRO | NO_IGN_CHARS; break; default: - warnx("bad argument: -f%s", suboptarg); + warnx("bad argument: -f%s", o); return(0); } + } return(1); } @@ -594,7 +596,7 @@ foptions(int *fflags, char *arg) static int woptions(int *wflags, char *arg) { - char *v; + char *v, *o; char *toks[5]; toks[0] = "all"; @@ -603,7 +605,8 @@ woptions(int *wflags, char *arg) toks[3] = "error"; toks[4] = NULL; - while (*arg) + while (*arg) { + o = arg; switch (getsubopt(&arg, toks, &v)) { case (0): *wflags |= WARN_WALL; @@ -618,9 +621,10 @@ woptions(int *wflags, char *arg) *wflags |= WARN_WERR; break; default: - warnx("bad argument: -W%s", suboptarg); + warnx("bad argument: -W%s", o); return(0); } + } return(1); } -- cgit