a74c645505a135d5c1e923afe477cdeb9c15bded markd Wed Jul 8 22:27:42 2020 -0700 added including multiple container directoies in genome dir path to gfServer diff --git src/inc/common.h src/inc/common.h index 2a33ab7..b891d4d 100644 --- src/inc/common.h +++ src/inc/common.h @@ -1123,30 +1123,38 @@ /* Remove suffix (last . in string and beyond) if any. */ void chopSuffixAt(char *s, char c); /* Remove end of string from last occurrence of char c. * chopSuffixAt(s, '.') is equivalent to regular chopSuffix. */ char *chopPrefix(char *s); /* This will replace the first '.' in a string with * 0, and return the character after this. If there * is no '.' in the string this will just return the * unchanged s passed in. */ char *chopPrefixAt(char *s, char c); /* Like chopPrefix, but can chop on any character, not just '.' */ +INLINE char *findTail(char *s, char c) +/* find the start of the string following the last occurrence of c. + * return the whole string if not found. Does not modify the string. */ +{ +char *cp = strrchr(s, c); +return (cp == NULL) ? s : cp+1; +} + FILE *mustOpen(char *fileName, char *mode); /* Open a file - or squawk and die. */ void mustWrite(FILE *file, void *buf, size_t size); /* Write to file or squawk and die. */ #define writeOne(file, var) mustWrite((file), &(var), sizeof(var)) /* Write out one variable to file. */ void mustRead(FILE *file, void *buf, size_t size); /* Read size bytes from a file or squawk and die. */ #define mustReadOne(file, var) mustRead((file), &(var), sizeof(var)) /* Read one variable from file or die. */