diff options
Diffstat (limited to 'sbin/pdisk')
-rw-r--r-- | sbin/pdisk/Makefile | 4 | ||||
-rw-r--r-- | sbin/pdisk/convert.c | 4 | ||||
-rw-r--r-- | sbin/pdisk/dump.c | 4 | ||||
-rw-r--r-- | sbin/pdisk/errors.c | 18 | ||||
-rw-r--r-- | sbin/pdisk/file_media.c | 15 | ||||
-rw-r--r-- | sbin/pdisk/io.c | 8 | ||||
-rw-r--r-- | sbin/pdisk/pathname.c | 2 | ||||
-rw-r--r-- | sbin/pdisk/pdisk.c | 39 |
8 files changed, 2 insertions, 92 deletions
diff --git a/sbin/pdisk/Makefile b/sbin/pdisk/Makefile index 60d38024785..4e88ef16bcd 100644 --- a/sbin/pdisk/Makefile +++ b/sbin/pdisk/Makefile @@ -1,9 +1,9 @@ -# $Id: Makefile,v 1.7 2006/04/27 19:52:21 martin Exp $ +# $Id: Makefile,v 1.8 2006/05/11 17:20:40 martin Exp $ .if ${MACHINE} == "macppc" || ${MACHINE} == "mac68k" PROG= pdisk -CFLAGS+=-Wall -D__unix__ +CFLAGS+=-Wall SRCS= bitfield.c convert.c deblock_media.c dump.c errors.c \ file_media.c hfs_misc.c io.c media.c partition_map.c pathname.c \ diff --git a/sbin/pdisk/convert.c b/sbin/pdisk/convert.c index f18bc731f9d..65c08791508 100644 --- a/sbin/pdisk/convert.c +++ b/sbin/pdisk/convert.c @@ -27,14 +27,10 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef __linux__ -#include <endian.h> -#else #define LITTLE_ENDIAN 1234 #define BIG_ENDIAN 4321 #define BYTE_ORDER 4321 //#define BYTE_ORDER 1234 -#endif #include "convert.h" diff --git a/sbin/pdisk/dump.c b/sbin/pdisk/dump.c index 877d0ef8d9c..96add658455 100644 --- a/sbin/pdisk/dump.c +++ b/sbin/pdisk/dump.c @@ -62,9 +62,7 @@ typedef struct names { const char *full; } NAMES; -#ifdef __unix__ typedef unsigned long OSType; -#endif typedef struct PatchDescriptor { OSType patchSig; @@ -397,9 +395,7 @@ list_all_disks() while ((name = step_media_iterator(iter)) != 0) { if ((m = open_pathname_as_media(name, O_RDONLY)) == 0) { -#if defined(__linux__) || defined(__unix__) error(errno, "can't open file '%s'", name); -#endif } else { close_media(m); diff --git a/sbin/pdisk/errors.c b/sbin/pdisk/errors.c index d4441613dee..12e2d84a40c 100644 --- a/sbin/pdisk/errors.c +++ b/sbin/pdisk/errors.c @@ -59,11 +59,6 @@ // Global Variables // char *program_name; -#ifdef NeXT -extern int errno; -extern int sys_nerr; -extern const char * const sys_errlist[]; -#endif // @@ -77,15 +72,11 @@ extern const char * const sys_errlist[]; void init_program_name(char **argv) { -#if defined(__linux__) || defined(__unix__) if ((program_name = strrchr(argv[0], '/')) != (char *)NULL) { program_name++; } else { program_name = argv[0]; } -#else - program_name = "pdisk"; -#endif } @@ -131,16 +122,11 @@ fatal(int value, const char *fmt, ...) vfprintf(stderr, fmt, ap); va_end(ap); -#if defined(__linux__) || defined(NeXT) || defined(__unix__) if (value > 0 && value < sys_nerr) { fprintf(stderr, " (%s)\n", sys_errlist[value]); } else { fprintf(stderr, "\n"); } -#else - fprintf(stderr, "\n"); - printf("Processing stopped: Choose 'Quit' from the file menu to quit.\n\n"); -#endif exit(value); } @@ -160,13 +146,9 @@ error(int value, const char *fmt, ...) vfprintf(stderr, fmt, ap); va_end(ap); -#if defined(__linux__) || defined(NeXT) || defined(__unix__) if (value > 0 && value < sys_nerr) { fprintf(stderr, " (%s)\n", sys_errlist[value]); } else { fprintf(stderr, "\n"); } -#else - fprintf(stderr, "\n"); -#endif } diff --git a/sbin/pdisk/file_media.c b/sbin/pdisk/file_media.c index 2041477d85c..96c71ca4a36 100644 --- a/sbin/pdisk/file_media.c +++ b/sbin/pdisk/file_media.c @@ -48,18 +48,9 @@ /* * Defines */ -#ifdef __linux__ -#define LOFF_MAX 9223372036854775807LL -extern __loff_t llseek (int __fd, __loff_t __offset, int __whence); -#elif defined(__OpenBSD__) || defined(__APPLE__) #define loff_t off_t #define llseek lseek #define LOFF_MAX LLONG_MAX -#else -#define loff_t long -#define llseek lseek -#define LOFF_MAX LONG_MAX -#endif /* @@ -195,9 +186,7 @@ open_file_as_media(char *file, int oflag) FILE_MEDIA a; int fd; loff_t off; -#if defined(__linux__) || defined(__unix__) struct stat info; -#endif if (file_inited == 0) { file_init(); @@ -219,13 +208,11 @@ open_file_as_media(char *file, int oflag) a->m.do_os_reload = os_reload_file_media; a->fd = fd; a->regular_file = 0; -#if defined(__linux__) || defined(__unix__) if (fstat(fd, &info) < 0) { error(errno, "can't stat file '%s'", file); } else { a->regular_file = S_ISREG(info.st_mode); } -#endif } else { close(fd); } @@ -487,14 +474,12 @@ step_file_iterator(MEDIA_ITERATOR m) bump = 1; } else if ((fd = open(result, O_RDONLY)) >= 0) { close(fd); -#if defined(__linux__) || defined(__unix__) } else if (errno == ENXIO || errno == ENODEV) { if (a->style == kATA_Devices) { bump = -1; } else { bump = 1; } -#endif } if (bump) { if (bump > 0) { diff --git a/sbin/pdisk/io.c b/sbin/pdisk/io.c index 806f84a6959..287d4cd41f0 100644 --- a/sbin/pdisk/io.c +++ b/sbin/pdisk/io.c @@ -47,16 +47,8 @@ #define BAD_DIGIT 17 /* must be greater than any base */ #define STRING_CHUNK 16 #define UNGET_MAX_COUNT 10 -#ifndef __unix__ -#define SCSI_FD 8 -#endif -#ifdef NeXT -#define loff_t off_t -#define llseek lseek -#else #define loff_t long #define llseek lseek -#endif // diff --git a/sbin/pdisk/pathname.c b/sbin/pdisk/pathname.c index 9675483ca16..a149ddf1ffa 100644 --- a/sbin/pdisk/pathname.c +++ b/sbin/pdisk/pathname.c @@ -90,9 +90,7 @@ next_media_kind(long *state) switch (ix) { case 0: -#if defined(__linux__) || defined(__unix__) result = create_file_iterator(); -#endif ix = 1; if (result != 0) { break; diff --git a/sbin/pdisk/pdisk.c b/sbin/pdisk/pdisk.c index 83092d21917..04cacede1dc 100644 --- a/sbin/pdisk/pdisk.c +++ b/sbin/pdisk/pdisk.c @@ -30,15 +30,10 @@ // for printf() #include <stdio.h> -#if defined(__linux__) || defined(__OpenBSD__) #include <getopt.h> -#endif // for malloc() & free() #include <stdlib.h> - -#ifdef __unix__ #include <unistd.h> -#endif // for strncpy() & strlen() #include <string.h> @@ -137,17 +132,7 @@ void print_expert_notes(void); int main(int argc, char **argv) { -#if defined(__linux__) || defined(__unix__) int name_index; -#else - SIOUXSettings.rows = 100; - printf("This app uses the SIOUX console library\n"); - printf("Choose 'Quit' from the file menu to quit.\n\n"); - printf("Use fake disk names (/dev/scsi<bus>.<id>; i.e. /dev/scsi0.1, /dev/scsi1.3, etc.).\n\n"); - - SIOUXSettings.autocloseonquit = 0; /* Do we close the SIOUX window on program termination ... */ - SIOUXSettings.asktosaveonclose = 0; /* Do we offer to save on a close ... */ -#endif char *versionstr; init_program_name(argv); @@ -171,7 +156,6 @@ main(int argc, char **argv) free(versionstr); } -#if defined(__linux__) || defined(__unix__) name_index = get_options(argc, argv); if (vflag) { @@ -201,15 +185,6 @@ main(int argc, char **argv) do_help(); } return 0; -#else - interactive = 1; - - interact(); - - SIOUXSettings.autocloseonquit = 1; - //printf("Processing stopped: Choose 'Quit' from the file menu to quit.\n\n"); - return (0); -#endif } @@ -355,12 +330,10 @@ interact() } -#if defined(__linux__) || defined(__unix__) int get_options(int argc, char **argv) { int c; -#if defined(__linux__) || defined(__OpenBSD__) static struct option long_options[] = { // name has_arg &flag val @@ -377,11 +350,7 @@ get_options(int argc, char **argv) {0, 0, 0, 0} }; int option_index = 0; -#else - extern int opterr; /* who does error messages */ - extern int optopt; /* char that caused the error */ int getopt_error; /* getopt choked */ -#endif extern int optind; /* next argv index */ extern char *optarg; /* pointer to argument */ int flag = 0; @@ -398,23 +367,16 @@ get_options(int argc, char **argv) cflag = CFLAG_DEFAULT; fflag = FFLAG_DEFAULT; -#if defined(__linux__) || defined(__OpenBSD__) optind = 0; // reset option scanner logic while ((c = getopt_long(argc, argv, "hlvdraLicf", long_options, &option_index)) >= 0) -#else - opterr = 0; /* tell getopt to be quiet */ - while ((c = getopt(argc, argv, "hlvdraLicf")) != EOF) -#endif { -#if !(defined(__linux__) || defined(__OpenBSD__)) if (c == '?') { getopt_error = 1; c = optopt; } else { getopt_error = 0; } -#endif switch (c) { case kLongOption: // option_index would be used here @@ -466,7 +428,6 @@ get_options(int argc, char **argv) } return optind; } -#endif void |