From c8536924ae4ff8999d08c3f5e6b1ef5dbb2e9a2e Mon Sep 17 00:00:00 2001 From: kramm Date: Thu, 1 Nov 2001 12:06:56 +0000 Subject: [PATCH] short options may now be combined. (-xvf style) --- lib/args.h | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/lib/args.h b/lib/args.h index 733ab75..551623e 100644 --- a/lib/args.h +++ b/lib/args.h @@ -15,8 +15,8 @@ extern int args_callback_longoption(char*,char*); extern int args_callback_command(char*,char*); extern void args_callback_usage(char*name); -int argn; -char**argv; +//int argn; +//char**argv; void processargs(int argn2,char**argv2) { @@ -50,7 +50,28 @@ void processargs(int argn2,char**argv2) args_callback_usage(argv2[0]); exit(1); } - t+=args_callback_option(&argv2[t][1],next); + if(argv2[t][1]) // this might be something like e.g. -xvf + { + char buf[2]; + buf[1]=0; + int s=1; + int ret; + do{ + if(argv2[t][s+1]) { + buf[0] = argv2[t][s]; + ret = args_callback_option(buf,&argv2[t][s+1]); + } + else { + t+= args_callback_option(&argv2[t][s], next); + break; + } + s++; + } while(!ret); + } + else // - usually means "read stdout" + { + t+=args_callback_option(&argv2[t][1],next); + } } } else -- 1.7.10.4