--- rxvt-unicode/src/misc.C 2004/03/06 00:05:01 1.10 +++ rxvt-unicode/src/misc.C 2004/03/17 05:15:02 1.12 @@ -70,15 +70,67 @@ */ /* EXTPROTO */ void -rxvt_print_error (const char *fmt,...) +rxvt_vlog (const char *fmt, va_list arg_ptr) +{ + char msg[1024]; + + vsnprintf (msg, sizeof msg, fmt, arg_ptr); + + if (GET_R && GET_R->log_hook) + (*GET_R->log_hook) (msg); + else + write (STDOUT_FILENO, msg, strlen (msg)); +} + +/* EXTPROTO */ +void +rxvt_log (const char *fmt,...) +{ + va_list arg_ptr; + + va_start (arg_ptr, fmt); + rxvt_vlog (fmt, arg_ptr); + va_end (arg_ptr); +} + +/* + * Print an error message + */ +/* EXTPROTO */ +void +rxvt_warn (const char *fmt,...) { va_list arg_ptr; + rxvt_log ("%s: ", RESNAME); + + va_start (arg_ptr, fmt); + rxvt_vlog (fmt, arg_ptr); + va_end (arg_ptr); +} + +/* EXTPROTO */ +void +rxvt_fatal (const char *fmt,...) +{ + va_list arg_ptr; + + rxvt_log ("%s: ", RESNAME); + va_start (arg_ptr, fmt); - fprintf (stderr, RESNAME ": "); - vfprintf (stderr, fmt, arg_ptr); - fprintf (stderr, "\n"); + rxvt_vlog (fmt, arg_ptr); va_end (arg_ptr); + + rxvt_exit_failure (); +} + +class rxvt_failure_exception rxvt_failure_exception; + +/* EXTPROTO */ +void +rxvt_exit_failure () +{ + throw (rxvt_failure_exception); } /*