CON_RED
};
- int err = !!(level == LVL_ERROR);
- int color = (err) ? console.color_err : console.color_out;
+ int err = !!(level == LVL_ERROR);
+ int color = (err) ? console.color_err : console.color_out;
+ int (*print)(const char *, ...) = (err) ? &con_err : &con_out;
- /* this might confuse you :P */
- ((err) ? &con_err : &con_out)(
- (color) ?
- "\033[0;%dm%s:%d: \033[0;%dm%s: \033[0m" :
- "%s:%d: %s: ",
-
- CON_CYAN,
- name,
- (int)line,
- sel[level],
- msgtype
- );
+ if (color)
+ print("\033[0;%dm%s:%d: \033[0;%dm%s: \033[0m", CON_CYAN, name, (int)line, sel[level], msgtype);
+ else
+ print("%s:%d: %s: ", name, (int)line, msgtype);
con_verr(msg, ap);
fprintf (stderr, "\n");
opts_memchk = true;
continue;
}
+ if (!strcmp(argv[0]+1, "nocolor")) {
+ con_color(0);
+ continue;
+ }
switch (argv[0][1]) {
/* -h, show usage but exit with 0 */
}
/* returns the line number, or -1 on error */
-static bool progs_nextline(char **out, size_t *alen,FILE *src)
-{
+static bool progs_nextline(char **out, size_t *alen,FILE *src) {
int len;
char *line;
char *start;