Hello, On 17/07/2012 16:44, Janus Weil wrote: > Hi, > >> Ditto here. Though, I think you are in danger of exceeding the buffer - if >> not here, then further down. > > admitted - the buffer length could clearly be a problem (in connection > with translation). > > >> Wouldn't it be simplyer to keep the error print for Warning/Error, assign >> the messages to a "const char * msg" and then pass the msg to error_print? >> That would be two calls to error_print, but would avoid buffer issues, calls >> to strcpy/strcat, and would work with i18n. > > Actually I also tried something like this, but couldn't get it to work > (the biggest problem being that stuff will not show up in one line > after the locus printout). > Another possibility is adding an argument to error_print containing the standard version information either as a string or as an enum; an argument that is ignored if it has an invalid value (NULL string, ...), typically for errors irrelevant to the standard version. I'm fine with Tobias' suggestion too.
> >> Okay, that won't work as one has to call error_print only once. Maybe >> something like the following will work: >> >> const char *msg, *msg2; >> char *buffer; >> msg = _("Warning: "); >> msg2 = _("Deleted feature:"); >> buffer = (char *) alloca (strlen (msg) + strlen (msg2)+1); >> strcpy(buffer, msg); >> strcat (buffer, msg2); >> error_print (buffer, _(gmsgid), argp); >> >> where the buffer itself is not send through _(). > > With this you are almost back to my last version, except that you > allocate the buffer dynamically. ... which is better ;-). Nice patch anyway. Mikael