src/lib/obscure.c 1.51

1.51 2009/11/25 07:16:38 kent
Adding 'hashThisEqThatLine.'
Index: src/lib/obscure.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/obscure.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -b -B -U 4 -r1.50 -r1.51
--- src/lib/obscure.c	24 Nov 2009 03:58:25 -0000	1.50
+++ src/lib/obscure.c	25 Nov 2009 07:16:38 -0000	1.51
@@ -408,11 +408,13 @@
 out[newSize-1] = quoteChar;
 return out;
 }
 
-struct hash *hashVarLine(char *line, int lineIx)
+struct hash *hashThisEqThatLine(char *line, int lineIx, boolean firstStartsWithLetter)
 /* Return a symbol table from a line of form:
- *   var1=val1 var2='quoted val2' var3="another val" */
+ *   1-this1=val1 2-this='quoted val2' var3="another val" 
+ * If firstStartsWithLetter is true, then the left side of the equals must start with
+ * and equals. */
 {
 char *dupe = cloneString(line);
 char *s = dupe, c;
 char *var, *val;
@@ -424,9 +426,9 @@
         break;
 
     if ((c = *var) == 0)
         break;
-    if (!isalpha(c))
+    if (firstStartsWithLetter && !isalpha(c))
 	errAbort("line %d of custom input: variable needs to start with letter '%s'", lineIx, var);
     val = strchr(var, '=');
     if (val == NULL)
         {
@@ -449,8 +451,15 @@
 freez(&dupe);
 return hash;
 }
 
+struct hash *hashVarLine(char *line, int lineIx)
+/* Return a symbol table from a line of form:
+ *   var1=val1 var2='quoted val2' var3="another val" */
+{
+return hashThisEqThatLine(line, lineIx, TRUE);
+}
+
 struct slName *stringToSlNames(char *string)
 /* Convert string to a list of slNames separated by
  * white space, but allowing multiple words in quotes.
  * Quotes if any are stripped.  */