0544059f3df004f2d54e8978809ddfcbdee23645 braney Mon Feb 25 14:36:53 2013 -0800 modify twoBit library to auto-recognize whether it's dealing with a URL or local file (per code review #10237) diff --git src/lib/common.c src/lib/common.c index 503ccbc..1d498cd 100644 --- src/lib/common.c +++ src/lib/common.c @@ -3461,15 +3461,21 @@ char *dateAddTo(char *date,char *format,int addYears,int addMonths,int addDays) /* Add years,months,days to a formatted date and returns the new date as a cloned string * format is a strptime/strftime format: %F = yyyy-mm-dd */ { char *newDate = needMem(12); struct tm tp; if (strptime(date,format, &tp)) { dateAdd(&tp,addYears,addMonths,addDays); // tp.tm_year only contains years since 1900 strftime(newDate,12,format,&tp); } return cloneString(newDate); // newDate is never freed! } +boolean hasProtocol(char *urlOrPath) +/* Return TRUE if it looks like it has http://, ftp:// etc. */ +{ +return stringIn("://", urlOrPath) != NULL; +} +