[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to m4/src/Attic/output.c,v [branch-1_4]
From: |
Eric Blake |
Subject: |
Changes to m4/src/Attic/output.c,v [branch-1_4] |
Date: |
Mon, 22 Oct 2007 16:38:36 +0000 |
CVSROOT: /sources/m4
Module name: m4
Branch: branch-1_4
Changes by: Eric Blake <ericb> 07/10/22 16:38:34
Index: src/output.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/output.c,v
retrieving revision 1.1.1.1.2.25
retrieving revision 1.1.1.1.2.26
diff -u -b -r1.1.1.1.2.25 -r1.1.1.1.2.26
--- src/output.c 4 Aug 2007 20:40:13 -0000 1.1.1.1.2.25
+++ src/output.c 22 Oct 2007 16:38:34 -0000 1.1.1.1.2.26
@@ -197,7 +197,9 @@
free (tail);
tail = strrchr (buffer, '-') + 1;
}
- sprintf (tail, "%d", divnum);
+ if (sprintf (tail, "%d", divnum) < 0)
+ M4ERROR ((EXIT_FAILURE, errno,
+ "cannot create temporary file for diversion"));
return buffer;
}
@@ -468,7 +470,6 @@
shipout_text (struct obstack *obs, const char *text, int length, int line)
{
static bool start_of_output_line = true;
- char linebuf[20];
const char *cursor;
/* If output goes to an obstack, merely add TEXT to it. */
@@ -519,7 +520,7 @@
start_of_output_line = false;
output_current_line++;
#ifdef DEBUG_OUTPUT
- fprintf (stderr, "DEBUG: line %d, cur %d, cur out %d\n",
+ xfprintf (stderr, "DEBUG: line %d, cur %d, cur out %d\n",
line, current_line, output_current_line);
#endif
@@ -529,8 +530,13 @@
if (output_current_line != line)
{
- sprintf (linebuf, "#line %d", line);
- for (cursor = linebuf; *cursor; cursor++)
+ OUTPUT_CHARACTER ('#');
+ OUTPUT_CHARACTER ('l');
+ OUTPUT_CHARACTER ('i');
+ OUTPUT_CHARACTER ('n');
+ OUTPUT_CHARACTER ('e');
+ OUTPUT_CHARACTER (' ');
+ for (cursor = ntoa (line, 10); *cursor; cursor++)
OUTPUT_CHARACTER (*cursor);
if (output_current_line < 1 && current_file[0] != '\0')
{
@@ -553,7 +559,7 @@
start_of_output_line = false;
output_current_line++;
#ifdef DEBUG_OUTPUT
- fprintf (stderr, "DEBUG: line %d, cur %d, cur out %d\n",
+ xfprintf (stderr, "DEBUG: line %d, cur %d, cur out %d\n",
line, current_line, output_current_line);
#endif
}
@@ -807,7 +813,7 @@
if (diversion->size || diversion->used)
{
if (diversion->size)
- fprintf (file, "D%d,%d\n", diversion->divnum, diversion->used);
+ xfprintf (file, "D%d,%d\n", diversion->divnum, diversion->used);
else
{
struct stat file_stat;
@@ -817,7 +823,7 @@
if (file_stat.st_size < 0
|| file_stat.st_size != (unsigned long int) file_stat.st_size)
M4ERROR ((EXIT_FAILURE, 0, "diversion too large"));
- fprintf (file, "D%d,%lu\n", diversion->divnum,
+ xfprintf (file, "D%d,%lu\n", diversion->divnum,
(unsigned long int) file_stat.st_size);
}
@@ -832,5 +838,5 @@
/* Save the active diversion number, if not already. */
if (saved_number != last_inserted)
- fprintf (file, "D%d,0\n\n", saved_number);
+ xfprintf (file, "D%d,0\n\n", saved_number);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Changes to m4/src/Attic/output.c,v [branch-1_4],
Eric Blake <=