Bug 2536

Summary: standardized formatting of warnings and errors
Product: glibc Reporter: Dave Yost <Dave>
Component: libcAssignee: Ulrich Drepper <drepper.fsp>
Status: RESOLVED WONTFIX    
Severity: enhancement CC: glibc-bugs
Priority: P2 Flags: fweimer: security-
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Dave Yost 2006-04-11 23:31:51 UTC
It would be nice if there were a reliable way to grep for errors in the output of make.  But this is 
unachievable today because every tool that make runs has its own style of reporting errors and 
warnings.  There should be a standard way.

I propose a new library function:
  #define TROUBLE_ERROR "error: "
  #define TROUBLE_WARNING "warning: "
  extern char* trouble(char* trouble, char* message);
If a TROUBLE_STANDARD environment variable is present, the returned string is prepended with the 
first argument. Otherwise, the returned string is the same as the given message.

If the TROUBLE_PREFIXES environment variable is present, it can replace default prefixes as desired.  For 
example:
  export TROUBLE_PREFIXES='~error:~***ERROR: ~warning: ~*WARNING: ~'
where ~ can be any character a la sed replacement.

All gnu commands should be updated to use the new mechanism. In case legacy software is going to 
look at the output, and the software requires the exact previous error syntax, full backward 
compatibility is retained by not defining the TROUBLE_STANDARD environment variable.
Comment 1 Ulrich Drepper 2006-04-12 16:17:09 UTC
There is fmtmsg and nobody uses it.