home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
400-499
/
ff473.lzh
/
CNewsSrc
/
cnews_src.lzh
/
libc
/
warning.c
< prev
Wrap
C/C++ Source or Header
|
1990-12-25
|
776b
|
41 lines
/*
* warning - print best error message possible and clear errno
*/
#include <stdio.h>
#include <errno.h>
#ifndef __STDC__
extern int errno;
#endif
#include <string.h>
#ifdef AMIGA
# define GETENV envparm
#else
# define GETENV getenv
#endif /* AMIGA */
void
warning(s1, s2)
char *s1;
char *s2;
{
char *cmdname;
char *message = strerror(errno);
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 (message != NULL)
fprintf(stderr, " (%s)", message);
fprintf(stderr, "\n");
(void) fflush(stderr);
errno = 0;
}