mirror of
https://git.savannah.gnu.org/git/make.git
synced 2025-02-07 06:47:52 +00:00
Formerly misc.c.~28~
This commit is contained in:
parent
63160928cd
commit
12113c5925
1 changed files with 19 additions and 14 deletions
33
misc.c
33
misc.c
|
@ -267,19 +267,30 @@ makefile_fatal (file, lineno, s1, s2, s3, s4, s5, s6)
|
||||||
die (1);
|
die (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_STRERROR
|
||||||
|
char *
|
||||||
|
strerror (errnum)
|
||||||
|
int errnum;
|
||||||
|
{
|
||||||
|
extern int errno, sys_nerr;
|
||||||
|
extern char *sys_errlist[];
|
||||||
|
static char buf[] = "Unknown error 12345678901234567890";
|
||||||
|
|
||||||
|
if (errno < sys_nerr)
|
||||||
|
return sys_errlist[errnum];
|
||||||
|
|
||||||
|
sprintf ("Unknown error %d", buf, errnum);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Print an error message from errno. */
|
/* Print an error message from errno. */
|
||||||
|
|
||||||
void
|
void
|
||||||
perror_with_name (str, name)
|
perror_with_name (str, name)
|
||||||
char *str, *name;
|
char *str, *name;
|
||||||
{
|
{
|
||||||
extern int errno, sys_nerr;
|
error ("%s%s: %s", str, name, strerror (errno));
|
||||||
extern char *sys_errlist[];
|
|
||||||
|
|
||||||
if (errno < sys_nerr)
|
|
||||||
error ("%s%s: %s", str, name, sys_errlist[errno]);
|
|
||||||
else
|
|
||||||
error ("%s%s: Unknown error %d", str, name, errno);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print an error message from errno and exit. */
|
/* Print an error message from errno and exit. */
|
||||||
|
@ -288,13 +299,7 @@ void
|
||||||
pfatal_with_name (name)
|
pfatal_with_name (name)
|
||||||
char *name;
|
char *name;
|
||||||
{
|
{
|
||||||
extern int errno, sys_nerr;
|
fatal ("%s: %s", name, strerror (errno));
|
||||||
extern char *sys_errlist[];
|
|
||||||
|
|
||||||
if (errno < sys_nerr)
|
|
||||||
fatal ("%s: %s", name, sys_errlist[errno]);
|
|
||||||
else
|
|
||||||
fatal ("%s: Unknown error %d", name, errno);
|
|
||||||
|
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue