Attached is a patch (against v1.1.0), that makes a minor change to
the argument parsing code. When the parameter(s) of a filter argument
are retrieved the code skips past the argument name plus one character,
which it assumes is the '=' sign. I modified it to only skip the '=' if
it is in fact an equal sign. When this is done, it allows a more
convenient form for optional string values ("%s"), for example:
-J filter=arg[=string]
I can do a lookup on arg and provide a default if no value is present,
or use the provided string. Without the patch, a statement like '-J
filter=arg1:arg2', would yeild arg2 as the string value for arg1.
I don't think this change has any other side affect. It's
aesthetically more pleasing then having to write:
-J filter=arg1=:arg2
Allan
diff -ruN old/libtc/optstr.c new/libtc/optstr.c
--- old/libtc/optstr.c 2006-03-19 03:19:42.000000000 -0500
+++ new/libtc/optstr.c 2007-02-25 22:39:37.000000000 -0500
@@ -112,8 +112,10 @@
return 0;
}
- /* skip the `=' */
- ch += (strlen(name) + 1);
+ /* skip the `=' (if it is one) */
+ ch += strlen( name );
+ if( *ch == '=' )
+ ch++;
va_start(ap, fmt);