X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fmessage.c;fp=src%2Flibpspp%2Fmessage.c;h=d71df204ea46a5dd4774246e11b1f2ef25a6e361;hb=dbc380877ebcd07d42053d1fc34f61c4383fb63a;hp=faeb83a449d3e3058507e163d9bd7049192ea917;hpb=4ae5f1b099bc4de1f59898bc609e34dcb722b39c;p=pspp diff --git a/src/libpspp/message.c b/src/libpspp/message.c index faeb83a449..d71df204ea 100644 --- a/src/libpspp/message.c +++ b/src/libpspp/message.c @@ -52,12 +52,14 @@ static int messages_disabled; void -vmsg (enum msg_class class, const char *format, va_list args) +vmsg (enum msg_class class, const struct msg_location *location, + const char *format, va_list args) { struct msg *m = xmalloc (sizeof *m); *m = (struct msg) { .category = msg_class_to_category (class), .severity = msg_class_to_severity (class), + .location = msg_location_dup (location), .text = xvasprintf (format, args), }; msg_emit (m); @@ -70,11 +72,21 @@ msg (enum msg_class class, const char *format, ...) { va_list args; va_start (args, format); - vmsg (class, format, args); + vmsg (class, NULL, format, args); va_end (args); } - +/* Outputs error message in CLASS, with text FORMAT, formatted with printf. + LOCATION is the reported location for the message. */ +void +msg_at (enum msg_class class, const struct msg_location *location, + const char *format, ...) +{ + va_list args; + va_start (args, format); + vmsg (class, location, format, args); + va_end (args); +} void msg_error (int errnum, const char *format, ...)