aboutsummaryrefslogtreecommitdiff
path: root/cat/cmdline.c
diff options
context:
space:
mode:
Diffstat (limited to 'cat/cmdline.c')
-rw-r--r--cat/cmdline.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/cat/cmdline.c b/cat/cmdline.c
index ea1e0eed6d0a..851b63de06e5 100644
--- a/cat/cmdline.c
+++ b/cat/cmdline.c
@@ -114,12 +114,18 @@ bsdcat_getopt(struct bsdcat *bsdcat)
enum { state_start = 0, state_old_tar, state_next_word,
state_short, state_long };
- const struct bsdcat_option *popt, *match = NULL, *match2 = NULL;
- const char *p, *long_prefix = "--";
+ const struct bsdcat_option *popt, *match, *match2;
+ const char *p, *long_prefix;
size_t optlength;
- int opt = '?';
- int required = 0;
+ int opt;
+ int required;
+again:
+ match = NULL;
+ match2 = NULL;
+ long_prefix = "--";
+ opt = '?';
+ required = 0;
bsdcat->argument = NULL;
/* First time through, initialize everything. */
@@ -172,7 +178,7 @@ bsdcat_getopt(struct bsdcat *bsdcat)
if (opt == '\0') {
/* End of this group; recurse to get next option. */
bsdcat->getopt_state = state_next_word;
- return bsdcat_getopt(bsdcat);
+ goto again;
}
/* Does this option take an argument? */