AmendHub

Download:

jcs

/

subtext

/

amendments

/

18

util: Add panic() which is like err() but without a return code


jcs made amendment 18 over 2 years ago
--- util.c Mon Dec 6 15:57:08 2021 +++ util.c Wed Dec 8 14:37:59 2021 @@ -216,35 +216,47 @@ vwarn(short alert_func, const char *format, va_list ap } void -warn(const char *format, ...) +panic(const char *format, ...) { va_list ap; va_start(ap, format); - vwarn(CAUTION_ALERT, format, ap); + vwarn(STOP_ALERT, format, ap); va_end(ap); + + ExitToShell(); } void -warnx(const char *format, ...) +err(short ret, const char *format, ...) { va_list ap; va_start(ap, format); + vwarn(STOP_ALERT, format, ap); + va_end(ap); + + ExitToShell(); +} + +void +warn(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); vwarn(CAUTION_ALERT, format, ap); va_end(ap); } void -err(short retcode, const char *format, ...) +warnx(const char *format, ...) { va_list ap; va_start(ap, format); - vwarn(STOP_ALERT, format, ap); + vwarn(CAUTION_ALERT, format, ap); va_end(ap); - - ExitToShell(); } void --- util.h Mon Dec 6 15:57:30 2021 +++ util.h Wed Dec 8 14:35:51 2021 @@ -72,9 +72,10 @@ int strnatcasecmp(char const *a, char const *b); unsigned long xorshift32(void); void err_init(void); +void panic(const char *format, ...); +void err(short ret, const char *format, ...); void warnx(const char *format, ...); void warn(const char *format, ...); -void err(short retcode, const char *format, ...); void note(const char *format, ...); short ask(const char *format, ...); #define ASK_YES 1