From 7f4368a639b66cca2f5b63ac61c48b09900c08c4 Mon Sep 17 00:00:00 2001 From: David Wasley Date: Thu, 19 Feb 1981 05:57:32 -0800 Subject: [PATCH] date and time created 81/02/18 21:57:32 by dlw SCCS-vsn: usr.bin/f77/libU77/perror_.c 1.1 --- usr/src/usr.bin/f77/libU77/perror_.c | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 usr/src/usr.bin/f77/libU77/perror_.c diff --git a/usr/src/usr.bin/f77/libU77/perror_.c b/usr/src/usr.bin/f77/libU77/perror_.c new file mode 100644 index 0000000000..3276484f55 --- /dev/null +++ b/usr/src/usr.bin/f77/libU77/perror_.c @@ -0,0 +1,42 @@ +/* +char id_perror[] = "@(#)perror_.c 1.1"; + * + * write a standard error message to the standard error output + * + * calling sequence: + * call perror(string) + * where: + * string will be written preceeding the standard error message + */ + +#include +#include "../libI77/fiodefs.h" +#include "../libI77/f_errno.h" + +extern char *sys_errlist[]; +extern int sys_nerr; +extern char *f_errlist[]; +extern int f_nerr; +extern unit units[]; + +perror_(s, len) +char *s; long len; +{ + char buf[40]; + char *mesg = s + len; + + while (len > 0 && *--mesg == ' ') + len--; + if (errno >=0 && errno < sys_nerr) + mesg = sys_errlist[errno]; + else if (errno >= F_ER && errno < (F_ER + f_nerr)) + mesg = f_errlist[errno - F_ER]; + else + { + sprintf(buf, "%d: unknown error number", errno); + mesg = buf; + } + while (len-- > 0) + putc(*s++, units[STDERR].ufd); + fprintf(units[STDERR].ufd, ": %s\n", mesg); +} -- 2.20.1