1f1ad77303a89026caa686b37d4199a62c94bf43 kent Tue Feb 1 12:38:07 2011 -0800 Making it so that track html description is fetched for hgc and hgTrackUi. To do this had to get a way to fetch a text file from a URL without putting up any warning messages if it was not there, which ended up requiring a new warning handler. diff --git src/lib/errabort.c src/lib/errabort.c index f91385a..70eb78d 100644 --- src/lib/errabort.c +++ src/lib/errabort.c @@ -27,30 +27,37 @@ static boolean debugPushPopErr = FALSE; // generate stack dump on push/pop error boolean errAbortInProgress = FALSE; /* Flag to indicate that an error abort is in progress. * Needed so that a warn handler can tell if it's really * being called because of a warning or an error. */ static void defaultVaWarn(char *format, va_list args) /* Default error message handler. */ { if (format != NULL) { fflush(stdout); vfprintf(stderr, format, args); fprintf(stderr, "\n"); } } +static void silentVaWarn(char *format, va_list args) +/* Warning handler that just hides it. Useful sometimes when high level code + * expects low level code may fail (as in finding a file on the net) but doesn't + * want user to be bothered about it. */ +{ +} + #define maxWarnHandlers 20 static WarnHandler warnArray[maxWarnHandlers] = {defaultVaWarn,}; static int warnIx = 0; void vaWarn(char *format, va_list args) /* Call top of warning stack to issue warning. */ { warnArray[warnIx](format, args); } void warn(char *format, ...) /* Issue a warning message. */ { va_list args; va_start(args, format); @@ -224,21 +231,27 @@ } static void warnAbortHandler(char *format, va_list args) /* warn handler that also aborts. */ { defaultVaWarn(format, args); noWarnAbort(); } void pushWarnAbort() /* Push handler that will abort on warnings. */ { pushWarnHandler(warnAbortHandler); } +void pushSilentWarnHandler() +/* Set warning handler to be quiet. Do a popWarnHandler to restore. */ +{ +pushWarnHandler(silentVaWarn); +} + void errAbortDebugnPushPopErr() /* generate stack dump if there is a error in the push/pop functions */ { debugPushPopErr = TRUE; }