src/lib/common.c 1.138

1.138 2009/11/22 00:18:03 kent
Adding simplifyPathToDir
Index: src/lib/common.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/common.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -b -B -U 4 -r1.137 -r1.138
--- src/lib/common.c	20 Nov 2009 17:44:45 -0000	1.137
+++ src/lib/common.c	22 Nov 2009 00:18:03 -0000	1.138
@@ -1082,8 +1082,18 @@
     return 0;
 return s[strlen(s)-1];
 }
 
+char *matchingCharBeforeInLimits(char *limit, char *s, char c)
+/* Look for character c sometime before s, but going no further than limit.
+ * Return NULL if not found. */
+{
+while (--s >= limit)
+    if (*s == c)
+        return s;
+return NULL;
+}
+
 char *memMatch(char *needle, int nLen, char *haystack, int hLen)
 /* Returns first place where needle (of nLen chars) matches
  * haystack (of hLen chars) */
 {