src/lib/common.c 1.143
1.143 2010/01/04 19:12:41 kent
Merging viewInTheMiddle branch.
Index: src/lib/common.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/common.c,v
retrieving revision 1.142
retrieving revision 1.143
diff -b -B -U 4 -r1.142 -r1.143
--- src/lib/common.c 24 Dec 2009 04:55:40 -0000 1.142
+++ src/lib/common.c 4 Jan 2010 19:12:41 -0000 1.143
@@ -1648,8 +1648,21 @@
*e = 0;
return line;
}
+char *cloneFirstWord(char *line)
+/* Clone first word in line */
+{
+char *startFirstWord = skipLeadingSpaces(line);
+if (startFirstWord == NULL)
+ return NULL;
+char *endFirstWord = skipToSpaces(startFirstWord);
+if (endFirstWord == NULL)
+ return cloneString(startFirstWord);
+else
+ return cloneStringZ(startFirstWord, endFirstWord - startFirstWord);
+}
+
char *lastWordInLine(char *line)
/* Returns last word in line if any (white space separated).
* Returns NULL if string is empty. Removes any terminating white space
* from line. */