File pdisk.sys_errlist.patch of Package pdisk
errors.c: In function `fatal':
errors.c:145: warning: implicit declaration of function `exit'
gcc -o pdisk pdisk.o dump.o partition_map.o bitfield.o convert.o deblock_media.o file_media.o errors.o hfs_misc.o io.o media.o pathname.o util.o validate.o
errors.o(.text+0x20a): In function `fatal':
/home/olaf/src/pdisk/pdisk/errors.c:137: warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
errors.o(.text+0x1ea):/home/olaf/src/pdisk/pdisk/errors.c:136: warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
gcc -o cvt_pt cvt_pt.o partition_map.o bitfield.o convert.o deblock_media.o file_media.o errors.o hfs_misc.o io.o media.o pathname.o util.o
errors.o(.text+0x20a): In function `fatal':
/home/olaf/src/pdisk/pdisk/errors.c:137: warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead
errors.o(.text+0x1ea):/home/olaf/src/pdisk/pdisk/errors.c:136: warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead
errors.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
Index: pdisk/errors.c
===================================================================
--- pdisk.orig/errors.c
+++ pdisk/errors.c
@@ -29,9 +29,7 @@
#include <stdio.h>
// for exit()
-#ifndef __linux__
#include <stdlib.h>
-#endif
// for strrchr
#include <string.h>
@@ -132,12 +130,18 @@ fatal(int value, char *fmt, ...)
vfprintf(stderr, fmt, ap);
va_end(ap);
-#if defined(__linux__) || defined(NeXT) || defined(__unix__)
+#if defined(NeXT)
if (value > 0 && value < sys_nerr) {
fprintf(stderr, " (%s)\n", sys_errlist[value]);
} else {
fprintf(stderr, "\n");
}
+#elif defined(__linux__)
+ if (value > 0) {
+ fprintf(stderr, " (%s)\n", strerror(value));
+ } else {
+ fprintf(stderr, "\n");
+ }
#else
fprintf(stderr, "\n");
printf("Processing stopped: Choose 'Quit' from the file menu to quit.\n\n");
@@ -161,12 +165,18 @@ error(int value, char *fmt, ...)
vfprintf(stderr, fmt, ap);
va_end(ap);
-#if defined(__linux__) || defined(NeXT) || defined(__unix__)
+#if defined(NeXT)
if (value > 0 && value < sys_nerr) {
fprintf(stderr, " (%s)\n", sys_errlist[value]);
} else {
fprintf(stderr, "\n");
}
+#elif defined(__linux__)
+ if (value > 0) {
+ fprintf(stderr, " (%s)\n", strerror(value));
+ } else {
+ fprintf(stderr, "\n");
+ }
#else
fprintf(stderr, "\n");
#endif