-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove dependency on glibc-specific error.h
- Loading branch information
1 parent
2e2a8bd
commit f8bf0e9
Showing
6 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <stdarg.h> | ||
#include <stdio.h> | ||
#include <errno.h> | ||
#include <string.h> | ||
#include <stdlib.h> | ||
|
||
extern char *program_invocation_name; | ||
|
||
/* mimics GNU libc error() behavior */ | ||
void error(int status, int errnum, const char *format, ...) { | ||
va_list args; | ||
va_start(args, format); | ||
|
||
fflush (stdout); | ||
fprintf(stderr, "%s: ", program_invocation_name); | ||
|
||
vfprintf(stderr, format, args); | ||
va_end(args); | ||
|
||
if (errnum) { | ||
fprintf(stderr, ": %s", strerror(errnum)); | ||
} | ||
|
||
fprintf(stderr, "\n"); | ||
|
||
if (status) { | ||
exit(status); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef DCFLDD_ERROR_H | ||
#define DCFLDD_ERROR_H | ||
|
||
void error(int status, int errnum, const char *format, ...); | ||
|
||
#endif /* DCFLDD_ERROR_H */ |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters