aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@gnu.org>1996-08-28 22:07:28 +0000
committerDoug Evans <dje@gnu.org>1996-08-28 22:07:28 +0000
commit309a88759be543e45aa902af611a3ad6188204ff (patch)
tree5ec155cb701c86eec55230d71d6d5523d941ea71
parentff482cef956efbb0ef3131e61f15a11fa53cdcc3 (diff)
downloadgcc-309a88759be543e45aa902af611a3ad6188204ff.zip
gcc-309a88759be543e45aa902af611a3ad6188204ff.tar.gz
gcc-309a88759be543e45aa902af611a3ad6188204ff.tar.bz2
(print_single_switch): Ultrix fprintf returns 0 on success.
From-SVN: r12676
-rw-r--r--gcc/toplev.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index ee35c30..bd4b3bd 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -4120,7 +4120,8 @@ print_version (file, indent)
}
/* Print an option value and return the adjusted position in the line.
- ??? We don't handle error returns from fprintf (disk full). */
+ ??? We don't handle error returns from fprintf (disk full); presumably
+ other code will catch a disk full though. */
int
print_single_switch (file, pos, max, indent, sep, term, type, name)
@@ -4128,17 +4129,23 @@ print_single_switch (file, pos, max, indent, sep, term, type, name)
int pos, max;
char *indent, *sep, *term, *type, *name;
{
+ /* The ultrix fprintf returns 0 on success, so compute the result we want
+ here since we need it for the following test. */
+ int len = strlen (sep) + strlen (type) + strlen (name);
+
if (pos != 0
- && pos + strlen (sep) + strlen (type) + strlen (name) > max)
+ && pos + len > max)
{
fprintf (file, "%s", term);
pos = 0;
}
if (pos == 0)
{
- pos = fprintf (file, "%s", indent);
+ fprintf (file, "%s", indent);
+ pos = strlen (indent);
}
- pos += fprintf (file, "%s%s%s", sep, type, name);
+ fprintf (file, "%s%s%s", sep, type, name);
+ pos += len;
return pos;
}