home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
300-399
/
ff319.lzh
/
CNewsSrc
/
cnews.orig.lzh
/
libc
/
warning.c
< prev
Wrap
C/C++ Source or Header
|
1989-06-27
|
634b
|
30 lines
/*
* warning - print best error message possible and clear errno
*/
#include <stdio.h>
void
warning(s1, s2)
char *s1;
char *s2;
{
char *cmdname;
extern int errno, sys_nerr;
extern char *sys_errlist[];
extern char *progname;
extern char *getenv();
(void) fflush(stdout); /* hack */
cmdname = getenv("CMDNAME");
if (cmdname != NULL && *cmdname != '\0')
fprintf(stderr, "%s:", cmdname); /* No space after :. */
if (progname != NULL)
fprintf(stderr, "%s: ", progname);
fprintf(stderr, s1, s2);
if (errno > 0 && errno < sys_nerr)
fprintf(stderr, " (%s)", sys_errlist[errno]);
fprintf(stderr, "\n");
errno = 0;
}