From e6ddf4c3e0c6aaf858de1f25130e2b6c092d25a6 Mon Sep 17 00:00:00 2001 From: "hp.com!davidm" Date: Sat, 29 Mar 2003 07:32:50 +0000 Subject: [PATCH] (main): Fix command-line parsing to allow for more than one argument. (Logical change 1.71) --- tests/test-ptrace.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/test-ptrace.c b/tests/test-ptrace.c index 04a124fe..556fa754 100644 --- a/tests/test-ptrace.c +++ b/tests/test-ptrace.c @@ -137,17 +137,18 @@ main (int argc, char **argv) argv = args; } else if (argc > 1) - { - if (strcmp (argv[optind], "-v") == 0) - ++optind, verbose = 1; - if (strcmp (argv[optind], "-i") == 0) - ++optind, trace_mode = INSTRUCTION; /* backtrace at each insn */ - else if (strcmp (argv[optind], "-s") == 0) - ++optind, trace_mode = SYSCALL; /* backtrace at each syscall */ - else if (strcmp (argv[optind], "-t") == 0) - /* Execute until syscall(-1), then backtrace at each insn. */ - ++optind, trace_mode = TRIGGER; - } + while (argv[optind][0] == '-') + { + if (strcmp (argv[optind], "-v") == 0) + ++optind, verbose = 1; + if (strcmp (argv[optind], "-i") == 0) + ++optind, trace_mode = INSTRUCTION; /* backtrace at each insn */ + else if (strcmp (argv[optind], "-s") == 0) + ++optind, trace_mode = SYSCALL; /* backtrace at each syscall */ + else if (strcmp (argv[optind], "-t") == 0) + /* Execute until syscall(-1), then backtrace at each insn. */ + ++optind, trace_mode = TRIGGER; + } target_pid = fork (); if (!target_pid)