From 4ecd5f379a9ede899bebfe6091fd0b1acba5a49c 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 | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index b9120ef2..be4b3b54 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.33 2009/07/04 09:01:55 kristaps Exp $ */ +/* $Id: main.c,v 1.34 2009/07/04 11:10:36 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -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 v1.2.3