m4-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to m4/src/Attic/m4.c,v [branch-1_4]


From: Eric Blake
Subject: Changes to m4/src/Attic/m4.c,v [branch-1_4]
Date: Fri, 04 Aug 2006 13:19:45 +0000

CVSROOT:        /sources/m4
Module name:    m4
Branch:         branch-1_4
Changes by:     Eric Blake <ericb>      06/08/04 13:19:41

Index: src/m4.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/m4.c,v
retrieving revision 1.1.1.1.2.24
retrieving revision 1.1.1.1.2.25
diff -u -b -r1.1.1.1.2.24 -r1.1.1.1.2.25
--- src/m4.c    30 Jul 2006 23:46:51 -0000      1.1.1.1.2.24
+++ src/m4.c    4 Aug 2006 13:19:41 -0000       1.1.1.1.2.25
@@ -86,18 +86,27 @@
 
 /* Error handling functions.  */
 
-/*-------------------------------------------------------------------------.
-| Print source and line reference on standard error, as a prefix for error |
-| messages.  Flush standard output first.                                 |
-`-------------------------------------------------------------------------*/
+/* TRUE if error_at_line was called.  Too bad the error module doesn't
+   let us pass a parameter to the callback, or take a va_list
+   argument.  */
+boolean suppress_line;
+
+/*---------------------------------------------------------------.
+| Callback used by error to print program name, source, and line |
+| reference.                                                    |
+`---------------------------------------------------------------*/
 
 void
 reference_error (void)
 {
-  int e = errno;
-  fflush (stdout);
-  fprintf (stderr, "%s:%d: ", current_file, current_line);
-  errno = e;
+  /* error already flushed stdout before calling us.  */
+  if (suppress_line)
+    {
+      fprintf (stderr, "%s:", program_name);
+      suppress_line = FALSE;
+    }
+  else
+    fprintf (stderr, "%s:%s:%d: ", program_name, current_file, current_line);
 }
 
 #ifdef USE_STACKOVF
@@ -269,6 +278,7 @@
   FILE *fp;
 
   program_name = argv[0];
+  error_print_progname = reference_error;
   retcode = EXIT_SUCCESS;
 
   include_init ();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]