rmtodd@uokmax.UUCP (Richard Michael Todd) (07/04/87)
There is a bug in the implementation of puts. The stdio.h file has
#define puts(s) fputs(s,stdout)
This is not quite correct. The UNIX man pages state quite clearly that
puts() puts out a newline after the string is printed, and fputs does not.
To fix this, delete the definition for puts from stdio.h and add to
the library file fputs.c:
puts(s) char *s; {
fputs(s,stdout);
fputc('\n',stdout);
}
___________________________________________________________________________
Richard Todd
USSnail:820 Annie Court,Norman OK 73069
UUCP: {allegra!cbosgd|ihnp4}!okstate!uokmax!rmtodd
geoff@utstat.UUCP (07/05/87)
In article <614@uokmax.UUCP> rmtodd@uokmax.UUCP (Richard Todd) writes: [the new puts should be:] > puts(s) char *s; { > fputs(s,stdout); > fputc('\n',stdout); > } puts returns EOF on errors, so it should really be something like this: #include <stdio.h> puts(s) char *s; { return fputs(s, stdout) == EOF || putchar('\n') == EOF? EOF: 0; } -- Geoff Collyer utzoo!utstat!geoff, utstat.toronto.{edu,cdn}!geoff