src/lib/options.c 1.28

1.28 2009/12/02 01:28:29 kent
Making the this=that option parsing smart about not trying to parse code, filenames, and other things as option. Previously it knew not to treat URLs with = as options.
Index: src/lib/options.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/options.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -b -B -U 4 -r1.27 -r1.28
--- src/lib/options.c	23 Sep 2009 18:42:28 -0000	1.27
+++ src/lib/options.c	2 Dec 2009 01:28:29 -0000	1.28
@@ -136,14 +136,21 @@
  * negative strand for some of the DNA oriented utilities. */
 if (arg[0] == '-' && (arg[1] == 0 || isspace(arg[1])))
     return FALSE;
 
-/* It's nice to be able to use url's in the command line, but they
- * may have = in them... */
-if (startsWith("http://", arg)
- || startsWith("https://", arg)
- || startsWith("ftp://", arg))
+/* We treat this=that as an option only if the '=' happens before any non-alphanumeric
+ * characters.  This lets us have URLs and SQL statements in the command line even though
+ * they can have equals in them. */
+if (eqPtr != NULL)
+    {
+    char *s, c;
+    for (s=arg; s < eqPtr; ++s)
+        {
+	c = *s;
+	if (c != '_' && !isalnum(c))
     return FALSE;
+	}
+    }
 
 name = arg;
 if (name[0] == '-')
     name++;