diff options
author | Matt Kraai <kraai@debian.org> | 2000-07-14 01:51:25 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2000-07-14 01:51:25 +0000 |
commit | d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb (patch) | |
tree | 62127f20fc07758e445d8c4e186306cbe83d77b1 | |
parent | 4ac6cb534d78d63d7b0a206118c56bad7024b9f8 (diff) | |
download | busybox-w32-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.tar.gz busybox-w32-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.tar.bz2 busybox-w32-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.zip |
Use errorMsg rather than fprintf.
-rw-r--r-- | applets/busybox.c | 5 | ||||
-rw-r--r-- | archival/gunzip.c | 7 | ||||
-rw-r--r-- | busybox.c | 5 | ||||
-rw-r--r-- | chmod_chown_chgrp.c | 6 | ||||
-rw-r--r-- | console-tools/deallocvt.c | 8 | ||||
-rw-r--r-- | console-tools/dumpkmap.c | 4 | ||||
-rw-r--r-- | console-tools/loadacm.c | 18 | ||||
-rw-r--r-- | console-tools/loadfont.c | 18 | ||||
-rw-r--r-- | console-tools/loadkmap.c | 10 | ||||
-rw-r--r-- | coreutils/cut.c | 24 | ||||
-rw-r--r-- | coreutils/dd.c | 8 | ||||
-rw-r--r-- | coreutils/df.c | 2 | ||||
-rw-r--r-- | coreutils/du.c | 6 | ||||
-rw-r--r-- | coreutils/head.c | 7 | ||||
-rw-r--r-- | coreutils/ln.c | 3 | ||||
-rw-r--r-- | coreutils/logname.c | 2 | ||||
-rw-r--r-- | coreutils/mkdir.c | 6 | ||||
-rw-r--r-- | coreutils/rmdir.c | 2 | ||||
-rw-r--r-- | coreutils/sort.c | 4 | ||||
-rw-r--r-- | coreutils/tail.c | 5 | ||||
-rw-r--r-- | coreutils/tee.c | 4 | ||||
-rw-r--r-- | coreutils/uniq.c | 6 | ||||
-rw-r--r-- | coreutils/whoami.c | 3 | ||||
-rw-r--r-- | cp_mv.c | 39 | ||||
-rw-r--r-- | cut.c | 24 | ||||
-rw-r--r-- | dc.c | 6 | ||||
-rw-r--r-- | dd.c | 8 | ||||
-rw-r--r-- | deallocvt.c | 8 | ||||
-rw-r--r-- | df.c | 2 | ||||
-rw-r--r-- | du.c | 6 | ||||
-rw-r--r-- | dumpkmap.c | 4 | ||||
-rw-r--r-- | editors/sed.c | 6 | ||||
-rw-r--r-- | fbset.c | 2 | ||||
-rw-r--r-- | findutils/grep.c | 2 | ||||
-rw-r--r-- | fsck_minix.c | 2 | ||||
-rw-r--r-- | grep.c | 2 | ||||
-rw-r--r-- | gunzip.c | 7 | ||||
-rw-r--r-- | head.c | 7 | ||||
-rw-r--r-- | hostname.c | 5 | ||||
-rw-r--r-- | insmod.c | 77 | ||||
-rw-r--r-- | lash.c | 20 | ||||
-rw-r--r-- | ln.c | 3 | ||||
-rw-r--r-- | loadacm.c | 18 | ||||
-rw-r--r-- | loadfont.c | 18 | ||||
-rw-r--r-- | loadkmap.c | 10 | ||||
-rw-r--r-- | logger.c | 6 | ||||
-rw-r--r-- | logname.c | 2 | ||||
-rw-r--r-- | messages.c | 10 | ||||
-rw-r--r-- | miscutils/dc.c | 6 | ||||
-rw-r--r-- | miscutils/mt.c | 2 | ||||
-rw-r--r-- | mkdir.c | 6 | ||||
-rw-r--r-- | mkfs_minix.c | 6 | ||||
-rw-r--r-- | mkswap.c | 33 | ||||
-rw-r--r-- | modutils/insmod.c | 77 | ||||
-rw-r--r-- | mount.c | 8 | ||||
-rw-r--r-- | mt.c | 2 | ||||
-rw-r--r-- | networking/hostname.c | 5 | ||||
-rw-r--r-- | networking/ping.c | 16 | ||||
-rw-r--r-- | nfsmount.c | 34 | ||||
-rw-r--r-- | ping.c | 16 | ||||
-rw-r--r-- | procps/ps.c | 6 | ||||
-rw-r--r-- | ps.c | 6 | ||||
-rw-r--r-- | rmdir.c | 2 | ||||
-rw-r--r-- | sed.c | 6 | ||||
-rw-r--r-- | sh.c | 20 | ||||
-rw-r--r-- | shell/lash.c | 20 | ||||
-rw-r--r-- | sort.c | 4 | ||||
-rw-r--r-- | sysklogd/logger.c | 6 | ||||
-rw-r--r-- | tail.c | 5 | ||||
-rw-r--r-- | tee.c | 4 | ||||
-rw-r--r-- | umount.c | 8 | ||||
-rw-r--r-- | uniq.c | 6 | ||||
-rw-r--r-- | util-linux/fbset.c | 2 | ||||
-rw-r--r-- | util-linux/fsck_minix.c | 2 | ||||
-rw-r--r-- | util-linux/mkfs_minix.c | 6 | ||||
-rw-r--r-- | util-linux/mkswap.c | 33 | ||||
-rw-r--r-- | util-linux/mount.c | 8 | ||||
-rw-r--r-- | util-linux/nfsmount.c | 34 | ||||
-rw-r--r-- | util-linux/umount.c | 8 | ||||
-rw-r--r-- | utility.c | 7 | ||||
-rw-r--r-- | whoami.c | 3 |
81 files changed, 391 insertions, 473 deletions
diff --git a/applets/busybox.c b/applets/busybox.c index a355cdd1d..15f8e3f24 100644 --- a/applets/busybox.c +++ b/applets/busybox.c | |||
@@ -392,7 +392,7 @@ static char *busybox_fullpath() | |||
392 | if (len != -1) { | 392 | if (len != -1) { |
393 | path[len] = 0; | 393 | path[len] = 0; |
394 | } else { | 394 | } else { |
395 | fprintf(stderr, "busybox : %s : %s\n", proc, strerror(errno)); | 395 | errorMsg("%s: %s\n", proc, strerror(errno)); |
396 | return NULL; | 396 | return NULL; |
397 | } | 397 | } |
398 | return strdup(path); | 398 | return strdup(path); |
@@ -422,7 +422,7 @@ static int install_links(const char *busybox, int use_symbolic_links) | |||
422 | puts(command); | 422 | puts(command); |
423 | #endif | 423 | #endif |
424 | if (rc) { | 424 | if (rc) { |
425 | fprintf(stderr,"busybox : %s : %s\n", command, strerror(errno)); | 425 | errorMsg("%s: %s\n", command, strerror(errno)); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | return rc; | 428 | return rc; |
@@ -438,6 +438,7 @@ int main(int argc, char **argv) | |||
438 | { | 438 | { |
439 | char *s; | 439 | char *s; |
440 | const struct BB_applet *a = applets; | 440 | const struct BB_applet *a = applets; |
441 | applet_name = "busybox"; | ||
441 | 442 | ||
442 | #ifdef BB_FEATURE_INSTALLER | 443 | #ifdef BB_FEATURE_INSTALLER |
443 | /* | 444 | /* |
diff --git a/archival/gunzip.c b/archival/gunzip.c index 89e46a686..de68bd19b 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c | |||
@@ -659,7 +659,7 @@ int gunzip_main(int argc, char **argv) | |||
659 | if (*argv == '\0') | 659 | if (*argv == '\0') |
660 | usage(gunzip_usage); | 660 | usage(gunzip_usage); |
661 | if (strlen(*argv) > MAX_PATH_LEN) { | 661 | if (strlen(*argv) > MAX_PATH_LEN) { |
662 | fprintf(stderr, name_too_long, "gunzip"); | 662 | errorMsg(name_too_long); |
663 | exit(WARNING); | 663 | exit(WARNING); |
664 | } | 664 | } |
665 | strcpy(ifname, *argv); | 665 | strcpy(ifname, *argv); |
@@ -698,7 +698,7 @@ int gunzip_main(int argc, char **argv) | |||
698 | 698 | ||
699 | /* And get to work */ | 699 | /* And get to work */ |
700 | if (strlen(ifname) > MAX_PATH_LEN - 4) { | 700 | if (strlen(ifname) > MAX_PATH_LEN - 4) { |
701 | fprintf(stderr, name_too_long, "gunzip"); | 701 | errorMsg(name_too_long); |
702 | exit(WARNING); | 702 | exit(WARNING); |
703 | } | 703 | } |
704 | strcpy(ofname, ifname); | 704 | strcpy(ofname, ifname); |
@@ -780,8 +780,7 @@ int in; /* input file descriptor */ | |||
780 | 780 | ||
781 | method = (int) get_byte(); | 781 | method = (int) get_byte(); |
782 | if (method != DEFLATED) { | 782 | if (method != DEFLATED) { |
783 | fprintf(stderr, | 783 | errorMsg("unknown method %d -- get newer version of gzip\n", |
784 | "unknown method %d -- get newer version of gzip\n", | ||
785 | method); | 784 | method); |
786 | exit_code = ERROR; | 785 | exit_code = ERROR; |
787 | return -1; | 786 | return -1; |
@@ -392,7 +392,7 @@ static char *busybox_fullpath() | |||
392 | if (len != -1) { | 392 | if (len != -1) { |
393 | path[len] = 0; | 393 | path[len] = 0; |
394 | } else { | 394 | } else { |
395 | fprintf(stderr, "busybox : %s : %s\n", proc, strerror(errno)); | 395 | errorMsg("%s: %s\n", proc, strerror(errno)); |
396 | return NULL; | 396 | return NULL; |
397 | } | 397 | } |
398 | return strdup(path); | 398 | return strdup(path); |
@@ -422,7 +422,7 @@ static int install_links(const char *busybox, int use_symbolic_links) | |||
422 | puts(command); | 422 | puts(command); |
423 | #endif | 423 | #endif |
424 | if (rc) { | 424 | if (rc) { |
425 | fprintf(stderr,"busybox : %s : %s\n", command, strerror(errno)); | 425 | errorMsg("%s: %s\n", command, strerror(errno)); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | return rc; | 428 | return rc; |
@@ -438,6 +438,7 @@ int main(int argc, char **argv) | |||
438 | { | 438 | { |
439 | char *s; | 439 | char *s; |
440 | const struct BB_applet *a = applets; | 440 | const struct BB_applet *a = applets; |
441 | applet_name = "busybox"; | ||
441 | 442 | ||
442 | #ifdef BB_FEATURE_INSTALLER | 443 | #ifdef BB_FEATURE_INSTALLER |
443 | /* | 444 | /* |
diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c index 98b292568..cf6a50895 100644 --- a/chmod_chown_chgrp.c +++ b/chmod_chown_chgrp.c | |||
@@ -123,7 +123,7 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |||
123 | recursiveFlag = TRUE; | 123 | recursiveFlag = TRUE; |
124 | break; | 124 | break; |
125 | default: | 125 | default: |
126 | fprintf(stderr, invalid_option, applet_name, **argv); | 126 | errorMsg(invalid_option, **argv); |
127 | usage(appUsage); | 127 | usage(appUsage); |
128 | } | 128 | } |
129 | } | 129 | } |
@@ -131,7 +131,7 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |||
131 | } | 131 | } |
132 | 132 | ||
133 | if (argc == 0 || *argv == NULL) { | 133 | if (argc == 0 || *argv == NULL) { |
134 | fprintf(stderr, too_few_args, applet_name); | 134 | errorMsg(too_few_args); |
135 | usage(appUsage); | 135 | usage(appUsage); |
136 | } | 136 | } |
137 | 137 | ||
@@ -176,7 +176,7 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |||
176 | 176 | ||
177 | /* Ok, ready to do the deed now */ | 177 | /* Ok, ready to do the deed now */ |
178 | if (argc <= 1) { | 178 | if (argc <= 1) { |
179 | fatalError( "too few arguments\n"); | 179 | fatalError(too_few_args); |
180 | } | 180 | } |
181 | while (argc-- > 1) { | 181 | while (argc-- > 1) { |
182 | if (recursiveAction (*(++argv), recursiveFlag, FALSE, FALSE, | 182 | if (recursiveAction (*(++argv), recursiveFlag, FALSE, FALSE, |
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index 53d4d9a7c..906f3a9fa 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c | |||
@@ -39,14 +39,12 @@ int deallocvt_main(int argc, char *argv[]) | |||
39 | for (i = 1; i < argc; i++) { | 39 | for (i = 1; i < argc; i++) { |
40 | num = atoi(argv[i]); | 40 | num = atoi(argv[i]); |
41 | if (num == 0) | 41 | if (num == 0) |
42 | fprintf(stderr, "%s: 0: illegal VT number\n", applet_name); | 42 | errorMsg("0: illegal VT number\n"); |
43 | else if (num == 1) | 43 | else if (num == 1) |
44 | fprintf(stderr, "%s: VT 1 cannot be deallocated\n", | 44 | errorMsg("VT 1 cannot be deallocated\n"); |
45 | applet_name); | ||
46 | else if (ioctl(fd, VT_DISALLOCATE, num)) { | 45 | else if (ioctl(fd, VT_DISALLOCATE, num)) { |
47 | perror("VT_DISALLOCATE"); | 46 | perror("VT_DISALLOCATE"); |
48 | fprintf(stderr, "%s: could not deallocate console %d\n", | 47 | errorMsg("could not deallocate console %d\n", num); |
49 | applet_name, num); | ||
50 | exit( FALSE); | 48 | exit( FALSE); |
51 | } | 49 | } |
52 | } | 50 | } |
diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c index a497a07d1..f18050529 100644 --- a/console-tools/dumpkmap.c +++ b/console-tools/dumpkmap.c | |||
@@ -58,7 +58,7 @@ int dumpkmap_main(int argc, char **argv) | |||
58 | 58 | ||
59 | fd = open("/dev/tty0", O_RDWR); | 59 | fd = open("/dev/tty0", O_RDWR); |
60 | if (fd < 0) { | 60 | if (fd < 0) { |
61 | fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); | 61 | errorMsg("Error opening /dev/tty0: %s\n", strerror(errno)); |
62 | return 1; | 62 | return 1; |
63 | } | 63 | } |
64 | 64 | ||
@@ -86,7 +86,7 @@ int dumpkmap_main(int argc, char **argv) | |||
86 | ke.kb_table = i; | 86 | ke.kb_table = i; |
87 | if (ioctl(fd, KDGKBENT, &ke) < 0) { | 87 | if (ioctl(fd, KDGKBENT, &ke) < 0) { |
88 | 88 | ||
89 | fprintf(stderr, "ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); | 89 | errorMsg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); |
90 | } | 90 | } |
91 | else { | 91 | else { |
92 | write(1,&ke.kb_value,2); | 92 | write(1,&ke.kb_value,2); |
diff --git a/console-tools/loadacm.c b/console-tools/loadacm.c index a64c691d2..9eebf3bb5 100644 --- a/console-tools/loadacm.c +++ b/console-tools/loadacm.c | |||
@@ -46,12 +46,12 @@ int loadacm_main(int argc, char **argv) | |||
46 | 46 | ||
47 | fd = open("/dev/tty", O_RDWR); | 47 | fd = open("/dev/tty", O_RDWR); |
48 | if (fd < 0) { | 48 | if (fd < 0) { |
49 | fprintf(stderr, "Error opening /dev/tty1: %s\n", strerror(errno)); | 49 | errorMsg("Error opening /dev/tty1: %s\n", strerror(errno)); |
50 | return( FALSE); | 50 | return( FALSE); |
51 | } | 51 | } |
52 | 52 | ||
53 | if (screen_map_load(fd, stdin)) { | 53 | if (screen_map_load(fd, stdin)) { |
54 | fprintf(stderr, "Error loading acm: %s\n", strerror(errno)); | 54 | errorMsg("Error loading acm: %s\n", strerror(errno)); |
55 | return( FALSE); | 55 | return( FALSE); |
56 | } | 56 | } |
57 | 57 | ||
@@ -79,8 +79,7 @@ int screen_map_load(int fd, FILE * fp) | |||
79 | if (parse_failed) { | 79 | if (parse_failed) { |
80 | if (-1 == fseek(fp, 0, SEEK_SET)) { | 80 | if (-1 == fseek(fp, 0, SEEK_SET)) { |
81 | if (errno == ESPIPE) | 81 | if (errno == ESPIPE) |
82 | fprintf(stderr, | 82 | errorMsg("16bit screen-map MUST be a regular file.\n"), |
83 | "16bit screen-map MUST be a regular file.\n"), | ||
84 | exit(1); | 83 | exit(1); |
85 | else | 84 | else |
86 | perror("fseek failed reading binary 16bit screen-map"), | 85 | perror("fseek failed reading binary 16bit screen-map"), |
@@ -91,7 +90,7 @@ int screen_map_load(int fd, FILE * fp) | |||
91 | perror("Cannot read [new] map from file"), exit(1); | 90 | perror("Cannot read [new] map from file"), exit(1); |
92 | #if 0 | 91 | #if 0 |
93 | else | 92 | else |
94 | fprintf(stderr, "Input screen-map is binary.\n"); | 93 | errorMsg("Input screen-map is binary.\n"); |
95 | #endif | 94 | #endif |
96 | } | 95 | } |
97 | 96 | ||
@@ -108,8 +107,7 @@ int screen_map_load(int fd, FILE * fp) | |||
108 | /* rewind... */ | 107 | /* rewind... */ |
109 | if (-1 == fseek(fp, 0, SEEK_SET)) { | 108 | if (-1 == fseek(fp, 0, SEEK_SET)) { |
110 | if (errno == ESPIPE) | 109 | if (errno == ESPIPE) |
111 | fprintf(stderr, | 110 | errorMsg("Assuming 8bit screen-map - MUST be a regular file.\n"), |
112 | "Assuming 8bit screen-map - MUST be a regular file.\n"), | ||
113 | exit(1); | 111 | exit(1); |
114 | else | 112 | else |
115 | perror("fseek failed assuming 8bit screen-map"), exit(1); | 113 | perror("fseek failed assuming 8bit screen-map"), exit(1); |
@@ -122,7 +120,7 @@ int screen_map_load(int fd, FILE * fp) | |||
122 | if (-1 == fseek(fp, 0, SEEK_SET)) { | 120 | if (-1 == fseek(fp, 0, SEEK_SET)) { |
123 | if (errno == ESPIPE) | 121 | if (errno == ESPIPE) |
124 | /* should not - it succedeed above */ | 122 | /* should not - it succedeed above */ |
125 | fprintf(stderr, "fseek() returned ESPIPE !\n"), | 123 | errorMsg("fseek() returned ESPIPE !\n"), |
126 | exit(1); | 124 | exit(1); |
127 | else | 125 | else |
128 | perror("fseek for binary 8bit screen-map"), exit(1); | 126 | perror("fseek for binary 8bit screen-map"), exit(1); |
@@ -132,7 +130,7 @@ int screen_map_load(int fd, FILE * fp) | |||
132 | perror("Cannot read [old] map from file"), exit(1); | 130 | perror("Cannot read [old] map from file"), exit(1); |
133 | #if 0 | 131 | #if 0 |
134 | else | 132 | else |
135 | fprintf(stderr, "Input screen-map is binary.\n"); | 133 | errorMsg("Input screen-map is binary.\n"); |
136 | #endif | 134 | #endif |
137 | } | 135 | } |
138 | 136 | ||
@@ -141,7 +139,7 @@ int screen_map_load(int fd, FILE * fp) | |||
141 | else | 139 | else |
142 | return 0; | 140 | return 0; |
143 | } | 141 | } |
144 | fprintf(stderr, "Error parsing symbolic map\n"); | 142 | errorMsg("Error parsing symbolic map\n"); |
145 | return(1); | 143 | return(1); |
146 | } | 144 | } |
147 | 145 | ||
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index 7eaf40e82..b3f9f4f11 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c | |||
@@ -56,7 +56,7 @@ extern int loadfont_main(int argc, char **argv) | |||
56 | 56 | ||
57 | fd = open("/dev/tty0", O_RDWR); | 57 | fd = open("/dev/tty0", O_RDWR); |
58 | if (fd < 0) { | 58 | if (fd < 0) { |
59 | fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); | 59 | errorMsg("Error opening /dev/tty0: %s\n", strerror(errno)); |
60 | return( FALSE); | 60 | return( FALSE); |
61 | } | 61 | } |
62 | loadnewfont(fd); | 62 | loadnewfont(fd); |
@@ -72,7 +72,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize) | |||
72 | memset(buf, 0, sizeof(buf)); | 72 | memset(buf, 0, sizeof(buf)); |
73 | 73 | ||
74 | if (unit < 1 || unit > 32) { | 74 | if (unit < 1 || unit > 32) { |
75 | fprintf(stderr, "Bad character size %d\n", unit); | 75 | errorMsg("Bad character size %d\n", unit); |
76 | exit(1); | 76 | exit(1); |
77 | } | 77 | } |
78 | 78 | ||
@@ -112,7 +112,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize) | |||
112 | up = (struct unipair *) malloc(maxct * sizeof(struct unipair)); | 112 | up = (struct unipair *) malloc(maxct * sizeof(struct unipair)); |
113 | 113 | ||
114 | if (!up) { | 114 | if (!up) { |
115 | fprintf(stderr, "Out of memory?\n"); | 115 | errorMsg("Out of memory?\n"); |
116 | exit(1); | 116 | exit(1); |
117 | } | 117 | } |
118 | for (glyph = 0; glyph < fontsize; glyph++) { | 118 | for (glyph = 0; glyph < fontsize; glyph++) { |
@@ -137,8 +137,8 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize) | |||
137 | if (ioctl(fd, PIO_UNIMAPCLR, &advice)) { | 137 | if (ioctl(fd, PIO_UNIMAPCLR, &advice)) { |
138 | #ifdef ENOIOCTLCMD | 138 | #ifdef ENOIOCTLCMD |
139 | if (errno == ENOIOCTLCMD) { | 139 | if (errno == ENOIOCTLCMD) { |
140 | fprintf(stderr, "It seems this kernel is older than 1.1.92\n"); | 140 | errorMsg("It seems this kernel is older than 1.1.92\n"); |
141 | fprintf(stderr, "No Unicode mapping table loaded.\n"); | 141 | errorMsg("No Unicode mapping table loaded.\n"); |
142 | } else | 142 | } else |
143 | #endif | 143 | #endif |
144 | perror("PIO_UNIMAPCLR"); | 144 | perror("PIO_UNIMAPCLR"); |
@@ -198,13 +198,13 @@ static void loadnewfont(int fd) | |||
198 | goto no_psf; | 198 | goto no_psf; |
199 | 199 | ||
200 | if (psfhdr.mode > PSF_MAXMODE) { | 200 | if (psfhdr.mode > PSF_MAXMODE) { |
201 | fprintf(stderr, "Unsupported psf file mode\n"); | 201 | errorMsg("Unsupported psf file mode\n"); |
202 | exit(1); | 202 | exit(1); |
203 | } | 203 | } |
204 | fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256); | 204 | fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256); |
205 | #if !defined( PIO_FONTX ) || defined( __sparc__ ) | 205 | #if !defined( PIO_FONTX ) || defined( __sparc__ ) |
206 | if (fontsize != 256) { | 206 | if (fontsize != 256) { |
207 | fprintf(stderr, "Only fontsize 256 supported\n"); | 207 | errorMsg("Only fontsize 256 supported\n"); |
208 | exit(1); | 208 | exit(1); |
209 | } | 209 | } |
210 | #endif | 210 | #endif |
@@ -214,7 +214,7 @@ static void loadnewfont(int fd) | |||
214 | 214 | ||
215 | head = head0 + fontsize * unit; | 215 | head = head0 + fontsize * unit; |
216 | if (head > inputlth || (!hastable && head != inputlth)) { | 216 | if (head > inputlth || (!hastable && head != inputlth)) { |
217 | fprintf(stderr, "Input file: bad length\n"); | 217 | errorMsg("Input file: bad length\n"); |
218 | exit(1); | 218 | exit(1); |
219 | } | 219 | } |
220 | do_loadfont(fd, inbuf + head0, unit, fontsize); | 220 | do_loadfont(fd, inbuf + head0, unit, fontsize); |
@@ -231,7 +231,7 @@ static void loadnewfont(int fd) | |||
231 | } else { | 231 | } else { |
232 | /* bare font */ | 232 | /* bare font */ |
233 | if (inputlth & 0377) { | 233 | if (inputlth & 0377) { |
234 | fprintf(stderr, "Bad input file size\n"); | 234 | errorMsg("Bad input file size\n"); |
235 | exit(1); | 235 | exit(1); |
236 | } | 236 | } |
237 | offset = 0; | 237 | offset = 0; |
diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c index c2e4c94ed..72247a6e4 100644 --- a/console-tools/loadkmap.c +++ b/console-tools/loadkmap.c | |||
@@ -59,25 +59,25 @@ int loadkmap_main(int argc, char **argv) | |||
59 | 59 | ||
60 | fd = open("/dev/tty0", O_RDWR); | 60 | fd = open("/dev/tty0", O_RDWR); |
61 | if (fd < 0) { | 61 | if (fd < 0) { |
62 | fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); | 62 | errorMsg("Error opening /dev/tty0: %s\n", strerror(errno)); |
63 | exit(FALSE); | 63 | exit(FALSE); |
64 | } | 64 | } |
65 | 65 | ||
66 | read(0, buff, 7); | 66 | read(0, buff, 7); |
67 | if (0 != strncmp(buff, magic, 7)) { | 67 | if (0 != strncmp(buff, magic, 7)) { |
68 | fprintf(stderr, "This is not a valid binary keymap.\n"); | 68 | errorMsg("This is not a valid binary keymap.\n"); |
69 | exit(FALSE); | 69 | exit(FALSE); |
70 | } | 70 | } |
71 | 71 | ||
72 | if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) { | 72 | if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) { |
73 | fprintf(stderr, "Error reading keymap flags: %s\n", | 73 | errorMsg("Error reading keymap flags: %s\n", |
74 | strerror(errno)); | 74 | strerror(errno)); |
75 | exit(FALSE); | 75 | exit(FALSE); |
76 | } | 76 | } |
77 | 77 | ||
78 | ibuff = (u_short *) malloc(ibuffsz); | 78 | ibuff = (u_short *) malloc(ibuffsz); |
79 | if (!ibuff) { | 79 | if (!ibuff) { |
80 | fprintf(stderr, "Out of memory.\n"); | 80 | errorMsg("Out of memory.\n"); |
81 | exit(FALSE); | 81 | exit(FALSE); |
82 | } | 82 | } |
83 | 83 | ||
@@ -87,7 +87,7 @@ int loadkmap_main(int argc, char **argv) | |||
87 | while (pos < ibuffsz) { | 87 | while (pos < ibuffsz) { |
88 | if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) | 88 | if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) |
89 | < 0) { | 89 | < 0) { |
90 | fprintf(stderr, "Error reading keymap: %s\n", | 90 | errorMsg("Error reading keymap: %s\n", |
91 | strerror(errno)); | 91 | strerror(errno)); |
92 | exit(FALSE); | 92 | exit(FALSE); |
93 | } | 93 | } |
diff --git a/coreutils/cut.c b/coreutils/cut.c index 820074e60..783d526a5 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
@@ -84,13 +84,13 @@ void cut(void); | |||
84 | void warn(int warn_number, char *option) | 84 | void warn(int warn_number, char *option) |
85 | { | 85 | { |
86 | static char *warn_msg[] = { | 86 | static char *warn_msg[] = { |
87 | "%s: Option -%s allowed only with -f\n", | 87 | "Option -%s allowed only with -f\n", |
88 | "%s: -%s overrides earlier option\n", | 88 | "-%s overrides earlier option\n", |
89 | "%s: -%s not allowed in current mode\n", | 89 | "-%s not allowed in current mode\n", |
90 | "%s: Cannot open %s\n" | 90 | "Cannot open %s\n" |
91 | }; | 91 | }; |
92 | 92 | ||
93 | fprintf(stderr, warn_msg[warn_number], applet_name, option); | 93 | errorMsg(warn_msg[warn_number], option); |
94 | exit_status = warn_number + 1; | 94 | exit_status = warn_number + 1; |
95 | 95 | ||
96 | } | 96 | } |
@@ -98,15 +98,15 @@ void warn(int warn_number, char *option) | |||
98 | void cuterror(int err) | 98 | void cuterror(int err) |
99 | { | 99 | { |
100 | static char *err_mes[] = { | 100 | static char *err_mes[] = { |
101 | "%s: syntax error\n", | 101 | "syntax error\n", |
102 | "%s: position must be >0\n", | 102 | "position must be >0\n", |
103 | "%s: line longer than BUFSIZ\n", | 103 | "line longer than BUFSIZ\n", |
104 | "%s: range must not decrease from left to right\n", | 104 | "range must not decrease from left to right\n", |
105 | "%s: MAX_FIELD exceeded\n", | 105 | "MAX_FIELD exceeded\n", |
106 | "%s: MAX_ARGS exceeded\n" | 106 | "MAX_ARGS exceeded\n" |
107 | }; | 107 | }; |
108 | 108 | ||
109 | fprintf(stderr, err_mes[err - 101], applet_name); | 109 | errorMsg(err_mes[err - 101]); |
110 | exit(err); | 110 | exit(err); |
111 | } | 111 | } |
112 | 112 | ||
diff --git a/coreutils/dd.c b/coreutils/dd.c index 5d9993d8b..6261dfef5 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -86,26 +86,26 @@ extern int dd_main(int argc, char **argv) | |||
86 | else if (strncmp("count", *argv, 5) == 0) { | 86 | else if (strncmp("count", *argv, 5) == 0) { |
87 | count = getNum((strchr(*argv, '=')) + 1); | 87 | count = getNum((strchr(*argv, '=')) + 1); |
88 | if (count <= 0) { | 88 | if (count <= 0) { |
89 | fprintf(stderr, "Bad count value %s\n", *argv); | 89 | errorMsg("Bad count value %s\n", *argv); |
90 | goto usage; | 90 | goto usage; |
91 | } | 91 | } |
92 | } else if (strncmp(*argv, "bs", 2) == 0) { | 92 | } else if (strncmp(*argv, "bs", 2) == 0) { |
93 | blockSize = getNum((strchr(*argv, '=')) + 1); | 93 | blockSize = getNum((strchr(*argv, '=')) + 1); |
94 | if (blockSize <= 0) { | 94 | if (blockSize <= 0) { |
95 | fprintf(stderr, "Bad block size value %s\n", *argv); | 95 | errorMsg("Bad block size value %s\n", *argv); |
96 | goto usage; | 96 | goto usage; |
97 | } | 97 | } |
98 | } else if (strncmp(*argv, "skip", 4) == 0) { | 98 | } else if (strncmp(*argv, "skip", 4) == 0) { |
99 | skipBlocks = getNum((strchr(*argv, '=')) + 1); | 99 | skipBlocks = getNum((strchr(*argv, '=')) + 1); |
100 | if (skipBlocks <= 0) { | 100 | if (skipBlocks <= 0) { |
101 | fprintf(stderr, "Bad skip value %s\n", *argv); | 101 | errorMsg("Bad skip value %s\n", *argv); |
102 | goto usage; | 102 | goto usage; |
103 | } | 103 | } |
104 | 104 | ||
105 | } else if (strncmp(*argv, "seek", 4) == 0) { | 105 | } else if (strncmp(*argv, "seek", 4) == 0) { |
106 | seekBlocks = getNum((strchr(*argv, '=')) + 1); | 106 | seekBlocks = getNum((strchr(*argv, '=')) + 1); |
107 | if (seekBlocks <= 0) { | 107 | if (seekBlocks <= 0) { |
108 | fprintf(stderr, "Bad seek value %s\n", *argv); | 108 | errorMsg("Bad seek value %s\n", *argv); |
109 | goto usage; | 109 | goto usage; |
110 | } | 110 | } |
111 | 111 | ||
diff --git a/coreutils/df.c b/coreutils/df.c index ba3227f30..62226ceb8 100644 --- a/coreutils/df.c +++ b/coreutils/df.c | |||
@@ -82,7 +82,7 @@ extern int df_main(int argc, char **argv) | |||
82 | } | 82 | } |
83 | while (argc > 1) { | 83 | while (argc > 1) { |
84 | if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) { | 84 | if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) { |
85 | fprintf(stderr, "%s: can't find mount point.\n", argv[1]); | 85 | errorMsg("%s: can't find mount point.\n", argv[1]); |
86 | exit(FALSE); | 86 | exit(FALSE); |
87 | } | 87 | } |
88 | status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir); | 88 | status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir); |
diff --git a/coreutils/du.c b/coreutils/du.c index b8e296ddd..b1ca95436 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -108,7 +108,7 @@ static long du(char *filename) | |||
108 | } | 108 | } |
109 | 109 | ||
110 | if (len + strlen(name) + 1 > BUFSIZ) { | 110 | if (len + strlen(name) + 1 > BUFSIZ) { |
111 | fprintf(stderr, name_too_long, "du"); | 111 | errorMsg(name_too_long); |
112 | du_depth--; | 112 | du_depth--; |
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
@@ -158,7 +158,7 @@ int du_main(int argc, char **argv) | |||
158 | usage(du_usage); | 158 | usage(du_usage); |
159 | break; | 159 | break; |
160 | default: | 160 | default: |
161 | fprintf(stderr, "du: invalid option -- %c\n", opt); | 161 | errorMsg("invalid option -- %c\n", opt); |
162 | usage(du_usage); | 162 | usage(du_usage); |
163 | } | 163 | } |
164 | } else { | 164 | } else { |
@@ -184,7 +184,7 @@ int du_main(int argc, char **argv) | |||
184 | return(0); | 184 | return(0); |
185 | } | 185 | } |
186 | 186 | ||
187 | /* $Id: du.c,v 1.20 2000/06/19 17:25:39 andersen Exp $ */ | 187 | /* $Id: du.c,v 1.21 2000/07/14 01:51:25 kraai Exp $ */ |
188 | /* | 188 | /* |
189 | Local Variables: | 189 | Local Variables: |
190 | c-file-style: "linux" | 190 | c-file-style: "linux" |
diff --git a/coreutils/head.c b/coreutils/head.c index f42f4837d..b82678dc2 100644 --- a/coreutils/head.c +++ b/coreutils/head.c | |||
@@ -75,7 +75,7 @@ int head_main(int argc, char **argv) | |||
75 | case 'h': | 75 | case 'h': |
76 | usage(head_usage); | 76 | usage(head_usage); |
77 | default: | 77 | default: |
78 | fprintf(stderr, "head: invalid option -- %c\n", opt); | 78 | errorMsg("invalid option -- %c\n", opt); |
79 | usage(head_usage); | 79 | usage(head_usage); |
80 | } | 80 | } |
81 | } else { | 81 | } else { |
@@ -95,8 +95,7 @@ int head_main(int argc, char **argv) | |||
95 | 95 | ||
96 | src = fopen(argv[i], "r"); | 96 | src = fopen(argv[i], "r"); |
97 | if (!src) { | 97 | if (!src) { |
98 | fprintf(stderr, "head: %s: %s\n", argv[i], | 98 | errorMsg("%s: %s\n", argv[i], strerror(errno)); |
99 | strerror(errno)); | ||
100 | } else { | 99 | } else { |
101 | /* emulating GNU behaviour */ | 100 | /* emulating GNU behaviour */ |
102 | if (need_headers) { | 101 | if (need_headers) { |
@@ -112,4 +111,4 @@ int head_main(int argc, char **argv) | |||
112 | return(0); | 111 | return(0); |
113 | } | 112 | } |
114 | 113 | ||
115 | /* $Id: head.c,v 1.11 2000/06/19 17:25:39 andersen Exp $ */ | 114 | /* $Id: head.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */ |
diff --git a/coreutils/ln.c b/coreutils/ln.c index ac1f68e00..9f7774380 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -23,7 +23,6 @@ | |||
23 | 23 | ||
24 | #include "internal.h" | 24 | #include "internal.h" |
25 | #define BB_DECLARE_EXTERN | 25 | #define BB_DECLARE_EXTERN |
26 | #define bb_need_name_too_long | ||
27 | #define bb_need_not_a_directory | 26 | #define bb_need_not_a_directory |
28 | #include "messages.c" | 27 | #include "messages.c" |
29 | 28 | ||
@@ -92,7 +91,7 @@ extern int ln_main(int argc, char **argv) | |||
92 | 91 | ||
93 | linkIntoDirFlag = isDirectory(linkName, followLinks, NULL); | 92 | linkIntoDirFlag = isDirectory(linkName, followLinks, NULL); |
94 | if ((argc >= 3) && linkIntoDirFlag == FALSE) { | 93 | if ((argc >= 3) && linkIntoDirFlag == FALSE) { |
95 | fprintf(stderr, not_a_directory, "ln", linkName); | 94 | errorMsg(not_a_directory, linkName); |
96 | exit FALSE; | 95 | exit FALSE; |
97 | } | 96 | } |
98 | 97 | ||
diff --git a/coreutils/logname.c b/coreutils/logname.c index 4b4483cc1..12ebfbde6 100644 --- a/coreutils/logname.c +++ b/coreutils/logname.c | |||
@@ -41,6 +41,6 @@ extern int logname_main(int argc, char **argv) | |||
41 | puts(user); | 41 | puts(user); |
42 | exit(TRUE); | 42 | exit(TRUE); |
43 | } | 43 | } |
44 | fprintf(stderr, "no login name\n"); | 44 | errorMsg("no login name\n"); |
45 | return(FALSE); | 45 | return(FALSE); |
46 | } | 46 | } |
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index b18c949b8..f6e08cadc 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c | |||
@@ -62,7 +62,7 @@ extern int mkdir_main(int argc, char **argv) | |||
62 | /* Find the specified modes */ | 62 | /* Find the specified modes */ |
63 | mode = 0; | 63 | mode = 0; |
64 | if (parse_mode(*(++argv), &mode) == FALSE) { | 64 | if (parse_mode(*(++argv), &mode) == FALSE) { |
65 | fprintf(stderr, "Unknown mode: %s\n", *argv); | 65 | errorMsg("Unknown mode: %s\n", *argv); |
66 | exit FALSE; | 66 | exit FALSE; |
67 | } | 67 | } |
68 | /* Set the umask for this process so it doesn't | 68 | /* Set the umask for this process so it doesn't |
@@ -91,13 +91,13 @@ extern int mkdir_main(int argc, char **argv) | |||
91 | char buf[BUFSIZ + 1]; | 91 | char buf[BUFSIZ + 1]; |
92 | 92 | ||
93 | if (strlen(*argv) > BUFSIZ - 1) { | 93 | if (strlen(*argv) > BUFSIZ - 1) { |
94 | fprintf(stderr, name_too_long, "mkdir"); | 94 | errorMsg(name_too_long); |
95 | exit FALSE; | 95 | exit FALSE; |
96 | } | 96 | } |
97 | strcpy(buf, *argv); | 97 | strcpy(buf, *argv); |
98 | status = stat(buf, &statBuf); | 98 | status = stat(buf, &statBuf); |
99 | if (parentFlag == FALSE && status != -1 && errno != ENOENT) { | 99 | if (parentFlag == FALSE && status != -1 && errno != ENOENT) { |
100 | fprintf(stderr, "%s: File exists\n", buf); | 100 | errorMsg("%s: File exists\n", buf); |
101 | exit FALSE; | 101 | exit FALSE; |
102 | } | 102 | } |
103 | if (parentFlag == TRUE) { | 103 | if (parentFlag == TRUE) { |
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index c88f42cf5..4edb9b6b3 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c | |||
@@ -40,7 +40,7 @@ extern int rmdir_main(int argc, char **argv) | |||
40 | 40 | ||
41 | while (--argc > 0) { | 41 | while (--argc > 0) { |
42 | if (rmdir(*(++argv)) == -1) { | 42 | if (rmdir(*(++argv)) == -1) { |
43 | fprintf(stderr, "%s: %s\n", applet_name, strerror(errno)); | 43 | errorMsg("%s\n", strerror(errno)); |
44 | exit(FALSE); | 44 | exit(FALSE); |
45 | } | 45 | } |
46 | } | 46 | } |
diff --git a/coreutils/sort.c b/coreutils/sort.c index a28122d51..c754989ea 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -263,7 +263,7 @@ int sort_main(int argc, char **argv) | |||
263 | break; | 263 | break; |
264 | #endif | 264 | #endif |
265 | default: | 265 | default: |
266 | fprintf(stderr, "sort: invalid option -- %c\n", opt); | 266 | errorMsg("invalid option -- %c\n", opt); |
267 | usage(sort_usage); | 267 | usage(sort_usage); |
268 | } | 268 | } |
269 | } else { | 269 | } else { |
@@ -304,4 +304,4 @@ int sort_main(int argc, char **argv) | |||
304 | return(0); | 304 | return(0); |
305 | } | 305 | } |
306 | 306 | ||
307 | /* $Id: sort.c,v 1.18 2000/06/28 22:15:26 markw Exp $ */ | 307 | /* $Id: sort.c,v 1.19 2000/07/14 01:51:25 kraai Exp $ */ |
diff --git a/coreutils/tail.c b/coreutils/tail.c index 3189d204f..601f0873d 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
@@ -375,7 +375,7 @@ extern int tail_main(int argc, char **argv) | |||
375 | usage(tail_usage); | 375 | usage(tail_usage); |
376 | default: | 376 | default: |
377 | if ((n_units = atoi(&argv[i][1])) < 1) { | 377 | if ((n_units = atoi(&argv[i][1])) < 1) { |
378 | fprintf(stderr, "tail: invalid option -- %c\n", opt); | 378 | errorMsg("invalid option -- %c\n", opt); |
379 | usage(tail_usage); | 379 | usage(tail_usage); |
380 | } | 380 | } |
381 | } | 381 | } |
@@ -386,8 +386,7 @@ extern int tail_main(int argc, char **argv) | |||
386 | 386 | ||
387 | if (i + 1 < argc) { | 387 | if (i + 1 < argc) { |
388 | if (forever) { | 388 | if (forever) { |
389 | fprintf(stderr, | 389 | errorMsg("option -f is invalid with multiple files\n"); |
390 | "tail: option -f is invalid with multiple files\n"); | ||
391 | usage(tail_usage); | 390 | usage(tail_usage); |
392 | } | 391 | } |
393 | print_headers = 1; | 392 | print_headers = 1; |
diff --git a/coreutils/tee.c b/coreutils/tee.c index c9b5410d3..67b42a24d 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c | |||
@@ -104,7 +104,7 @@ int tee_main(int argc, char **argv) | |||
104 | /* init FILE pointers */ | 104 | /* init FILE pointers */ |
105 | FileList = calloc(FL_MAX, sizeof(FILE*)); | 105 | FileList = calloc(FL_MAX, sizeof(FILE*)); |
106 | if (!FileList) { | 106 | if (!FileList) { |
107 | fprintf(stderr, "tee: %s\n", strerror(errno)); | 107 | errorMsg("%s\n", strerror(errno)); |
108 | exit(1); | 108 | exit(1); |
109 | } | 109 | } |
110 | FL_end = 0; | 110 | FL_end = 0; |
@@ -133,4 +133,4 @@ int tee_main(int argc, char **argv) | |||
133 | return(0); | 133 | return(0); |
134 | } | 134 | } |
135 | 135 | ||
136 | /* $Id: tee.c,v 1.11 2000/06/19 17:25:40 andersen Exp $ */ | 136 | /* $Id: tee.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */ |
diff --git a/coreutils/uniq.c b/coreutils/uniq.c index 64acf046a..16b257670 100644 --- a/coreutils/uniq.c +++ b/coreutils/uniq.c | |||
@@ -127,11 +127,11 @@ set_file_pointers(int schema, FILE ** in, FILE ** out, char **argv) | |||
127 | break; | 127 | break; |
128 | } | 128 | } |
129 | if (*in == NULL) { | 129 | if (*in == NULL) { |
130 | fprintf(stderr, "uniq: %s: %s\n", argv[0], strerror(errno)); | 130 | errorMsg("%s: %s\n", argv[0], strerror(errno)); |
131 | return errno; | 131 | return errno; |
132 | } | 132 | } |
133 | if (*out == NULL) { | 133 | if (*out == NULL) { |
134 | fprintf(stderr, "uniq: %s: %s\n", argv[1], strerror(errno)); | 134 | errorMsg("%s: %s\n", argv[1], strerror(errno)); |
135 | return errno; | 135 | return errno; |
136 | } | 136 | } |
137 | return 0; | 137 | return 0; |
@@ -187,4 +187,4 @@ int uniq_main(int argc, char **argv) | |||
187 | return(0); | 187 | return(0); |
188 | } | 188 | } |
189 | 189 | ||
190 | /* $Id: uniq.c,v 1.11 2000/06/19 17:25:40 andersen Exp $ */ | 190 | /* $Id: uniq.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */ |
diff --git a/coreutils/whoami.c b/coreutils/whoami.c index 983c6725d..01dff81f9 100644 --- a/coreutils/whoami.c +++ b/coreutils/whoami.c | |||
@@ -43,7 +43,6 @@ extern int whoami_main(int argc, char **argv) | |||
43 | puts(user); | 43 | puts(user); |
44 | exit(TRUE); | 44 | exit(TRUE); |
45 | } | 45 | } |
46 | fprintf(stderr, "%s: cannot find username for UID %u\n", applet_name, | 46 | errorMsg("cannot find username for UID %u\n", (unsigned) uid); |
47 | (unsigned) uid); | ||
48 | return(FALSE); | 47 | return(FALSE); |
49 | } | 48 | } |
@@ -89,8 +89,7 @@ static void name_too_long__exit (void) __attribute__((noreturn)); | |||
89 | static | 89 | static |
90 | void name_too_long__exit (void) | 90 | void name_too_long__exit (void) |
91 | { | 91 | { |
92 | fprintf(stderr, name_too_long, applet_name); | 92 | fatalError(name_too_long); |
93 | exit(FALSE); | ||
94 | } | 93 | } |
95 | 94 | ||
96 | static void | 95 | static void |
@@ -124,14 +123,14 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk) | |||
124 | 123 | ||
125 | if (srcDirFlag == TRUE) { | 124 | if (srcDirFlag == TRUE) { |
126 | if (recursiveFlag == FALSE) { | 125 | if (recursiveFlag == FALSE) { |
127 | fprintf(stderr, omitting_directory, applet_name, baseSrcName); | 126 | errorMsg(omitting_directory, baseSrcName); |
128 | return TRUE; | 127 | return TRUE; |
129 | } | 128 | } |
130 | srcBasename = (strstr(fileName, baseSrcName) | 129 | srcBasename = (strstr(fileName, baseSrcName) |
131 | + strlen(baseSrcName)); | 130 | + strlen(baseSrcName)); |
132 | 131 | ||
133 | if (destLen + strlen(srcBasename) > BUFSIZ) { | 132 | if (destLen + strlen(srcBasename) > BUFSIZ) { |
134 | fprintf(stderr, name_too_long, applet_name); | 133 | errorMsg(name_too_long); |
135 | return FALSE; | 134 | return FALSE; |
136 | } | 135 | } |
137 | strcat(destName, srcBasename); | 136 | strcat(destName, srcBasename); |
@@ -145,8 +144,8 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk) | |||
145 | if (mv_Action_first_time && (dz_i == is_mv)) { | 144 | if (mv_Action_first_time && (dz_i == is_mv)) { |
146 | mv_Action_first_time = errno = 0; | 145 | mv_Action_first_time = errno = 0; |
147 | if (rename(fileName, destName) < 0 && errno != EXDEV) { | 146 | if (rename(fileName, destName) < 0 && errno != EXDEV) { |
148 | fprintf(stderr, "%s: rename(%s, %s): %s\n", | 147 | errorMsg("rename(%s, %s): %s\n", fileName, destName, |
149 | applet_name, fileName, destName, strerror(errno)); | 148 | strerror(errno)); |
150 | goto do_copyFile; /* Try anyway... */ | 149 | goto do_copyFile; /* Try anyway... */ |
151 | } | 150 | } |
152 | else if (errno == EXDEV) | 151 | else if (errno == EXDEV) |
@@ -158,8 +157,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk) | |||
158 | if (preserveFlag == TRUE && statbuf->st_nlink > 1) { | 157 | if (preserveFlag == TRUE && statbuf->st_nlink > 1) { |
159 | if (is_in_ino_dev_hashtable(statbuf, &name)) { | 158 | if (is_in_ino_dev_hashtable(statbuf, &name)) { |
160 | if (link(name, destName) < 0) { | 159 | if (link(name, destName) < 0) { |
161 | fprintf(stderr, "%s: link(%s, %s): %s\n", | 160 | errorMsg("link(%s, %s): %s\n", name, destName, strerror(errno)); |
162 | applet_name, name, destName, strerror(errno)); | ||
163 | return FALSE; | 161 | return FALSE; |
164 | } | 162 | } |
165 | return TRUE; | 163 | return TRUE; |
@@ -178,11 +176,11 @@ rm_Action(const char *fileName, struct stat *statbuf, void* junk) | |||
178 | 176 | ||
179 | if (S_ISDIR(statbuf->st_mode)) { | 177 | if (S_ISDIR(statbuf->st_mode)) { |
180 | if (rmdir(fileName) < 0) { | 178 | if (rmdir(fileName) < 0) { |
181 | fprintf(stderr, "%s: rmdir(%s): %s\n", applet_name, fileName, strerror(errno)); | 179 | errorMsg("rmdir(%s): %s\n", fileName, strerror(errno)); |
182 | status = FALSE; | 180 | status = FALSE; |
183 | } | 181 | } |
184 | } else if (unlink(fileName) < 0) { | 182 | } else if (unlink(fileName) < 0) { |
185 | fprintf(stderr, "%s: unlink(%s): %s\n", applet_name, fileName, strerror(errno)); | 183 | errorMsg("unlink(%s): %s\n", fileName, strerror(errno)); |
186 | status = FALSE; | 184 | status = FALSE; |
187 | } | 185 | } |
188 | return status; | 186 | return status; |
@@ -236,7 +234,7 @@ extern int cp_mv_main(int argc, char **argv) | |||
236 | 234 | ||
237 | 235 | ||
238 | if (strlen(argv[argc - 1]) > BUFSIZ) { | 236 | if (strlen(argv[argc - 1]) > BUFSIZ) { |
239 | fprintf(stderr, name_too_long, "cp"); | 237 | errorMsg(name_too_long); |
240 | goto exit_false; | 238 | goto exit_false; |
241 | } | 239 | } |
242 | strcpy(baseDestName, argv[argc - 1]); | 240 | strcpy(baseDestName, argv[argc - 1]); |
@@ -246,7 +244,7 @@ extern int cp_mv_main(int argc, char **argv) | |||
246 | 244 | ||
247 | destDirFlag = isDirectory(baseDestName, TRUE, &destStatBuf); | 245 | destDirFlag = isDirectory(baseDestName, TRUE, &destStatBuf); |
248 | if ((argc > 3) && destDirFlag == FALSE) { | 246 | if ((argc > 3) && destDirFlag == FALSE) { |
249 | fprintf(stderr, not_a_directory, "cp", baseDestName); | 247 | errorMsg(not_a_directory, baseDestName); |
250 | goto exit_false; | 248 | goto exit_false; |
251 | } | 249 | } |
252 | 250 | ||
@@ -272,29 +270,28 @@ extern int cp_mv_main(int argc, char **argv) | |||
272 | char *pushd, *d, *p; | 270 | char *pushd, *d, *p; |
273 | 271 | ||
274 | if ((pushd = getcwd(NULL, BUFSIZ + 1)) == NULL) { | 272 | if ((pushd = getcwd(NULL, BUFSIZ + 1)) == NULL) { |
275 | fprintf(stderr, "%s: getcwd(): %s\n", applet_name, strerror(errno)); | 273 | errorMsg("getcwd(): %s\n", strerror(errno)); |
276 | continue; | 274 | continue; |
277 | } | 275 | } |
278 | if (chdir(baseDestName) < 0) { | 276 | if (chdir(baseDestName) < 0) { |
279 | fprintf(stderr, "%s: chdir(%s): %s\n", applet_name, baseSrcName, strerror(errno)); | 277 | errorMsg("chdir(%s): %s\n", baseSrcName, strerror(errno)); |
280 | continue; | 278 | continue; |
281 | } | 279 | } |
282 | if ((d = getcwd(NULL, BUFSIZ + 1)) == NULL) { | 280 | if ((d = getcwd(NULL, BUFSIZ + 1)) == NULL) { |
283 | fprintf(stderr, "%s: getcwd(): %s\n", applet_name, strerror(errno)); | 281 | errorMsg("getcwd(): %s\n", strerror(errno)); |
284 | continue; | 282 | continue; |
285 | } | 283 | } |
286 | while (!state && *d != '\0') { | 284 | while (!state && *d != '\0') { |
287 | if (stat(d, &sb) < 0) { /* stat not lstat - always dereference targets */ | 285 | if (stat(d, &sb) < 0) { /* stat not lstat - always dereference targets */ |
288 | fprintf(stderr, "%s: stat(%s) :%s\n", applet_name, d, strerror(errno)); | 286 | errorMsg("stat(%s): %s\n", d, strerror(errno)); |
289 | state = -1; | 287 | state = -1; |
290 | continue; | 288 | continue; |
291 | } | 289 | } |
292 | if ((sb.st_ino == srcStatBuf.st_ino) && | 290 | if ((sb.st_ino == srcStatBuf.st_ino) && |
293 | (sb.st_dev == srcStatBuf.st_dev)) { | 291 | (sb.st_dev == srcStatBuf.st_dev)) { |
294 | fprintf(stderr, | 292 | errorMsg("Cannot %s `%s' into a subdirectory of itself, " |
295 | "%s: Cannot %s `%s' " | 293 | "`%s/%s'\n", applet_name, baseSrcName, |
296 | "into a subdirectory of itself, `%s/%s'\n", | 294 | baseDestName, baseSrcName); |
297 | applet_name, applet_name, baseSrcName, baseDestName, baseSrcName); | ||
298 | state = -1; | 295 | state = -1; |
299 | continue; | 296 | continue; |
300 | } | 297 | } |
@@ -303,7 +300,7 @@ extern int cp_mv_main(int argc, char **argv) | |||
303 | } | 300 | } |
304 | } | 301 | } |
305 | if (chdir(pushd) < 0) { | 302 | if (chdir(pushd) < 0) { |
306 | fprintf(stderr, "%s: chdir(%s): %s\n", applet_name, pushd, strerror(errno)); | 303 | errorMsg("chdir(%s): %s\n", pushd, strerror(errno)); |
307 | free(pushd); | 304 | free(pushd); |
308 | free(d); | 305 | free(d); |
309 | continue; | 306 | continue; |
@@ -84,13 +84,13 @@ void cut(void); | |||
84 | void warn(int warn_number, char *option) | 84 | void warn(int warn_number, char *option) |
85 | { | 85 | { |
86 | static char *warn_msg[] = { | 86 | static char *warn_msg[] = { |
87 | "%s: Option -%s allowed only with -f\n", | 87 | "Option -%s allowed only with -f\n", |
88 | "%s: -%s overrides earlier option\n", | 88 | "-%s overrides earlier option\n", |
89 | "%s: -%s not allowed in current mode\n", | 89 | "-%s not allowed in current mode\n", |
90 | "%s: Cannot open %s\n" | 90 | "Cannot open %s\n" |
91 | }; | 91 | }; |
92 | 92 | ||
93 | fprintf(stderr, warn_msg[warn_number], applet_name, option); | 93 | errorMsg(warn_msg[warn_number], option); |
94 | exit_status = warn_number + 1; | 94 | exit_status = warn_number + 1; |
95 | 95 | ||
96 | } | 96 | } |
@@ -98,15 +98,15 @@ void warn(int warn_number, char *option) | |||
98 | void cuterror(int err) | 98 | void cuterror(int err) |
99 | { | 99 | { |
100 | static char *err_mes[] = { | 100 | static char *err_mes[] = { |
101 | "%s: syntax error\n", | 101 | "syntax error\n", |
102 | "%s: position must be >0\n", | 102 | "position must be >0\n", |
103 | "%s: line longer than BUFSIZ\n", | 103 | "line longer than BUFSIZ\n", |
104 | "%s: range must not decrease from left to right\n", | 104 | "range must not decrease from left to right\n", |
105 | "%s: MAX_FIELD exceeded\n", | 105 | "MAX_FIELD exceeded\n", |
106 | "%s: MAX_ARGS exceeded\n" | 106 | "MAX_ARGS exceeded\n" |
107 | }; | 107 | }; |
108 | 108 | ||
109 | fprintf(stderr, err_mes[err - 101], applet_name); | 109 | errorMsg(err_mes[err - 101]); |
110 | exit(err); | 110 | exit(err); |
111 | } | 111 | } |
112 | 112 | ||
@@ -22,7 +22,7 @@ static unsigned int pointer; | |||
22 | static void push(double a) | 22 | static void push(double a) |
23 | { | 23 | { |
24 | if (pointer >= (sizeof(stack) / sizeof(*stack))) { | 24 | if (pointer >= (sizeof(stack) / sizeof(*stack))) { |
25 | fprintf(stderr, "dc: stack overflow\n"); | 25 | errorMsg("stack overflow\n"); |
26 | exit(-1); | 26 | exit(-1); |
27 | } else | 27 | } else |
28 | stack[pointer++] = a; | 28 | stack[pointer++] = a; |
@@ -31,7 +31,7 @@ static void push(double a) | |||
31 | static double pop() | 31 | static double pop() |
32 | { | 32 | { |
33 | if (pointer == 0) { | 33 | if (pointer == 0) { |
34 | fprintf(stderr, "dc: stack underflow\n"); | 34 | errorMsg("stack underflow\n"); |
35 | exit(-1); | 35 | exit(-1); |
36 | } | 36 | } |
37 | return stack[--pointer]; | 37 | return stack[--pointer]; |
@@ -132,7 +132,7 @@ static void stack_machine(const char *argument) | |||
132 | } | 132 | } |
133 | o++; | 133 | o++; |
134 | } | 134 | } |
135 | fprintf(stderr, "dc: %s: syntax error.\n", argument); | 135 | errorMsg("%s: syntax error.\n", argument); |
136 | exit(-1); | 136 | exit(-1); |
137 | } | 137 | } |
138 | 138 | ||
@@ -86,26 +86,26 @@ extern int dd_main(int argc, char **argv) | |||
86 | else if (strncmp("count", *argv, 5) == 0) { | 86 | else if (strncmp("count", *argv, 5) == 0) { |
87 | count = getNum((strchr(*argv, '=')) + 1); | 87 | count = getNum((strchr(*argv, '=')) + 1); |
88 | if (count <= 0) { | 88 | if (count <= 0) { |
89 | fprintf(stderr, "Bad count value %s\n", *argv); | 89 | errorMsg("Bad count value %s\n", *argv); |
90 | goto usage; | 90 | goto usage; |
91 | } | 91 | } |
92 | } else if (strncmp(*argv, "bs", 2) == 0) { | 92 | } else if (strncmp(*argv, "bs", 2) == 0) { |
93 | blockSize = getNum((strchr(*argv, '=')) + 1); | 93 | blockSize = getNum((strchr(*argv, '=')) + 1); |
94 | if (blockSize <= 0) { | 94 | if (blockSize <= 0) { |
95 | fprintf(stderr, "Bad block size value %s\n", *argv); | 95 | errorMsg("Bad block size value %s\n", *argv); |
96 | goto usage; | 96 | goto usage; |
97 | } | 97 | } |
98 | } else if (strncmp(*argv, "skip", 4) == 0) { | 98 | } else if (strncmp(*argv, "skip", 4) == 0) { |
99 | skipBlocks = getNum((strchr(*argv, '=')) + 1); | 99 | skipBlocks = getNum((strchr(*argv, '=')) + 1); |
100 | if (skipBlocks <= 0) { | 100 | if (skipBlocks <= 0) { |
101 | fprintf(stderr, "Bad skip value %s\n", *argv); | 101 | errorMsg("Bad skip value %s\n", *argv); |
102 | goto usage; | 102 | goto usage; |
103 | } | 103 | } |
104 | 104 | ||
105 | } else if (strncmp(*argv, "seek", 4) == 0) { | 105 | } else if (strncmp(*argv, "seek", 4) == 0) { |
106 | seekBlocks = getNum((strchr(*argv, '=')) + 1); | 106 | seekBlocks = getNum((strchr(*argv, '=')) + 1); |
107 | if (seekBlocks <= 0) { | 107 | if (seekBlocks <= 0) { |
108 | fprintf(stderr, "Bad seek value %s\n", *argv); | 108 | errorMsg("Bad seek value %s\n", *argv); |
109 | goto usage; | 109 | goto usage; |
110 | } | 110 | } |
111 | 111 | ||
diff --git a/deallocvt.c b/deallocvt.c index 53d4d9a7c..906f3a9fa 100644 --- a/deallocvt.c +++ b/deallocvt.c | |||
@@ -39,14 +39,12 @@ int deallocvt_main(int argc, char *argv[]) | |||
39 | for (i = 1; i < argc; i++) { | 39 | for (i = 1; i < argc; i++) { |
40 | num = atoi(argv[i]); | 40 | num = atoi(argv[i]); |
41 | if (num == 0) | 41 | if (num == 0) |
42 | fprintf(stderr, "%s: 0: illegal VT number\n", applet_name); | 42 | errorMsg("0: illegal VT number\n"); |
43 | else if (num == 1) | 43 | else if (num == 1) |
44 | fprintf(stderr, "%s: VT 1 cannot be deallocated\n", | 44 | errorMsg("VT 1 cannot be deallocated\n"); |
45 | applet_name); | ||
46 | else if (ioctl(fd, VT_DISALLOCATE, num)) { | 45 | else if (ioctl(fd, VT_DISALLOCATE, num)) { |
47 | perror("VT_DISALLOCATE"); | 46 | perror("VT_DISALLOCATE"); |
48 | fprintf(stderr, "%s: could not deallocate console %d\n", | 47 | errorMsg("could not deallocate console %d\n", num); |
49 | applet_name, num); | ||
50 | exit( FALSE); | 48 | exit( FALSE); |
51 | } | 49 | } |
52 | } | 50 | } |
@@ -82,7 +82,7 @@ extern int df_main(int argc, char **argv) | |||
82 | } | 82 | } |
83 | while (argc > 1) { | 83 | while (argc > 1) { |
84 | if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) { | 84 | if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) { |
85 | fprintf(stderr, "%s: can't find mount point.\n", argv[1]); | 85 | errorMsg("%s: can't find mount point.\n", argv[1]); |
86 | exit(FALSE); | 86 | exit(FALSE); |
87 | } | 87 | } |
88 | status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir); | 88 | status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir); |
@@ -108,7 +108,7 @@ static long du(char *filename) | |||
108 | } | 108 | } |
109 | 109 | ||
110 | if (len + strlen(name) + 1 > BUFSIZ) { | 110 | if (len + strlen(name) + 1 > BUFSIZ) { |
111 | fprintf(stderr, name_too_long, "du"); | 111 | errorMsg(name_too_long); |
112 | du_depth--; | 112 | du_depth--; |
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
@@ -158,7 +158,7 @@ int du_main(int argc, char **argv) | |||
158 | usage(du_usage); | 158 | usage(du_usage); |
159 | break; | 159 | break; |
160 | default: | 160 | default: |
161 | fprintf(stderr, "du: invalid option -- %c\n", opt); | 161 | errorMsg("invalid option -- %c\n", opt); |
162 | usage(du_usage); | 162 | usage(du_usage); |
163 | } | 163 | } |
164 | } else { | 164 | } else { |
@@ -184,7 +184,7 @@ int du_main(int argc, char **argv) | |||
184 | return(0); | 184 | return(0); |
185 | } | 185 | } |
186 | 186 | ||
187 | /* $Id: du.c,v 1.20 2000/06/19 17:25:39 andersen Exp $ */ | 187 | /* $Id: du.c,v 1.21 2000/07/14 01:51:25 kraai Exp $ */ |
188 | /* | 188 | /* |
189 | Local Variables: | 189 | Local Variables: |
190 | c-file-style: "linux" | 190 | c-file-style: "linux" |
diff --git a/dumpkmap.c b/dumpkmap.c index a497a07d1..f18050529 100644 --- a/dumpkmap.c +++ b/dumpkmap.c | |||
@@ -58,7 +58,7 @@ int dumpkmap_main(int argc, char **argv) | |||
58 | 58 | ||
59 | fd = open("/dev/tty0", O_RDWR); | 59 | fd = open("/dev/tty0", O_RDWR); |
60 | if (fd < 0) { | 60 | if (fd < 0) { |
61 | fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); | 61 | errorMsg("Error opening /dev/tty0: %s\n", strerror(errno)); |
62 | return 1; | 62 | return 1; |
63 | } | 63 | } |
64 | 64 | ||
@@ -86,7 +86,7 @@ int dumpkmap_main(int argc, char **argv) | |||
86 | ke.kb_table = i; | 86 | ke.kb_table = i; |
87 | if (ioctl(fd, KDGKBENT, &ke) < 0) { | 87 | if (ioctl(fd, KDGKBENT, &ke) < 0) { |
88 | 88 | ||
89 | fprintf(stderr, "ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); | 89 | errorMsg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); |
90 | } | 90 | } |
91 | else { | 91 | else { |
92 | write(1,&ke.kb_value,2); | 92 | write(1,&ke.kb_value,2); |
diff --git a/editors/sed.c b/editors/sed.c index 770a56eeb..3a7360fc5 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -207,8 +207,8 @@ static int get_address(const char *str, int *line, regex_t **regex) | |||
207 | idx++; /* so it points to the next character after the last '/' */ | 207 | idx++; /* so it points to the next character after the last '/' */ |
208 | } | 208 | } |
209 | else { | 209 | else { |
210 | fprintf(stderr, "sed.c:get_address: no address found in string\n"); | 210 | errorMsg("get_address: no address found in string\n" |
211 | fprintf(stderr, "\t(you probably didn't check the string you passed me)\n"); | 211 | "\t(you probably didn't check the string you passed me)\n"); |
212 | idx = -1; | 212 | idx = -1; |
213 | } | 213 | } |
214 | 214 | ||
@@ -612,7 +612,7 @@ extern int sed_main(int argc, char **argv) | |||
612 | for (i = optind; i < argc; i++) { | 612 | for (i = optind; i < argc; i++) { |
613 | file = fopen(argv[i], "r"); | 613 | file = fopen(argv[i], "r"); |
614 | if (file == NULL) { | 614 | if (file == NULL) { |
615 | fprintf(stderr, "sed: %s: %s\n", argv[i], strerror(errno)); | 615 | errorMsg("%s: %s\n", argv[i], strerror(errno)); |
616 | } else { | 616 | } else { |
617 | process_file(file); | 617 | process_file(file); |
618 | fclose(file); | 618 | fclose(file); |
@@ -387,7 +387,7 @@ extern int fbset_main(int argc, char **argv) | |||
387 | PERROR("fbset(ioctl)"); | 387 | PERROR("fbset(ioctl)"); |
388 | if (g_options & OPT_READMODE) { | 388 | if (g_options & OPT_READMODE) { |
389 | if (!readmode(&var, modefile, mode)) { | 389 | if (!readmode(&var, modefile, mode)) { |
390 | fprintf(stderr, "Unknown video mode `%s'\n", mode); | 390 | errorMsg("Unknown video mode `%s'\n", mode); |
391 | exit(1); | 391 | exit(1); |
392 | } | 392 | } |
393 | } | 393 | } |
diff --git a/findutils/grep.c b/findutils/grep.c index 77b510002..03945fa25 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -165,7 +165,7 @@ extern int grep_main(int argc, char **argv) | |||
165 | file = fopen(cur_file, "r"); | 165 | file = fopen(cur_file, "r"); |
166 | if (file == NULL) { | 166 | if (file == NULL) { |
167 | if (!suppress_err_msgs) | 167 | if (!suppress_err_msgs) |
168 | fprintf(stderr, "grep: %s: %s\n", cur_file, strerror(errno)); | 168 | errorMsg("%s: %s\n", cur_file, strerror(errno)); |
169 | } else { | 169 | } else { |
170 | grep_file(file); | 170 | grep_file(file); |
171 | fclose(file); | 171 | fclose(file); |
diff --git a/fsck_minix.c b/fsck_minix.c index 685e0ee6c..74281a71e 100644 --- a/fsck_minix.c +++ b/fsck_minix.c | |||
@@ -311,7 +311,7 @@ static void show_usage(void) | |||
311 | 311 | ||
312 | static void die(const char *str) | 312 | static void die(const char *str) |
313 | { | 313 | { |
314 | fprintf(stderr, "%s: %s\n", applet_name, str); | 314 | errorMsg("%s\n", str); |
315 | leave(8); | 315 | leave(8); |
316 | } | 316 | } |
317 | 317 | ||
@@ -165,7 +165,7 @@ extern int grep_main(int argc, char **argv) | |||
165 | file = fopen(cur_file, "r"); | 165 | file = fopen(cur_file, "r"); |
166 | if (file == NULL) { | 166 | if (file == NULL) { |
167 | if (!suppress_err_msgs) | 167 | if (!suppress_err_msgs) |
168 | fprintf(stderr, "grep: %s: %s\n", cur_file, strerror(errno)); | 168 | errorMsg("%s: %s\n", cur_file, strerror(errno)); |
169 | } else { | 169 | } else { |
170 | grep_file(file); | 170 | grep_file(file); |
171 | fclose(file); | 171 | fclose(file); |
@@ -659,7 +659,7 @@ int gunzip_main(int argc, char **argv) | |||
659 | if (*argv == '\0') | 659 | if (*argv == '\0') |
660 | usage(gunzip_usage); | 660 | usage(gunzip_usage); |
661 | if (strlen(*argv) > MAX_PATH_LEN) { | 661 | if (strlen(*argv) > MAX_PATH_LEN) { |
662 | fprintf(stderr, name_too_long, "gunzip"); | 662 | errorMsg(name_too_long); |
663 | exit(WARNING); | 663 | exit(WARNING); |
664 | } | 664 | } |
665 | strcpy(ifname, *argv); | 665 | strcpy(ifname, *argv); |
@@ -698,7 +698,7 @@ int gunzip_main(int argc, char **argv) | |||
698 | 698 | ||
699 | /* And get to work */ | 699 | /* And get to work */ |
700 | if (strlen(ifname) > MAX_PATH_LEN - 4) { | 700 | if (strlen(ifname) > MAX_PATH_LEN - 4) { |
701 | fprintf(stderr, name_too_long, "gunzip"); | 701 | errorMsg(name_too_long); |
702 | exit(WARNING); | 702 | exit(WARNING); |
703 | } | 703 | } |
704 | strcpy(ofname, ifname); | 704 | strcpy(ofname, ifname); |
@@ -780,8 +780,7 @@ int in; /* input file descriptor */ | |||
780 | 780 | ||
781 | method = (int) get_byte(); | 781 | method = (int) get_byte(); |
782 | if (method != DEFLATED) { | 782 | if (method != DEFLATED) { |
783 | fprintf(stderr, | 783 | errorMsg("unknown method %d -- get newer version of gzip\n", |
784 | "unknown method %d -- get newer version of gzip\n", | ||
785 | method); | 784 | method); |
786 | exit_code = ERROR; | 785 | exit_code = ERROR; |
787 | return -1; | 786 | return -1; |
@@ -75,7 +75,7 @@ int head_main(int argc, char **argv) | |||
75 | case 'h': | 75 | case 'h': |
76 | usage(head_usage); | 76 | usage(head_usage); |
77 | default: | 77 | default: |
78 | fprintf(stderr, "head: invalid option -- %c\n", opt); | 78 | errorMsg("invalid option -- %c\n", opt); |
79 | usage(head_usage); | 79 | usage(head_usage); |
80 | } | 80 | } |
81 | } else { | 81 | } else { |
@@ -95,8 +95,7 @@ int head_main(int argc, char **argv) | |||
95 | 95 | ||
96 | src = fopen(argv[i], "r"); | 96 | src = fopen(argv[i], "r"); |
97 | if (!src) { | 97 | if (!src) { |
98 | fprintf(stderr, "head: %s: %s\n", argv[i], | 98 | errorMsg("%s: %s\n", argv[i], strerror(errno)); |
99 | strerror(errno)); | ||
100 | } else { | 99 | } else { |
101 | /* emulating GNU behaviour */ | 100 | /* emulating GNU behaviour */ |
102 | if (need_headers) { | 101 | if (need_headers) { |
@@ -112,4 +111,4 @@ int head_main(int argc, char **argv) | |||
112 | return(0); | 111 | return(0); |
113 | } | 112 | } |
114 | 113 | ||
115 | /* $Id: head.c,v 1.11 2000/06/19 17:25:39 andersen Exp $ */ | 114 | /* $Id: head.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */ |
diff --git a/hostname.c b/hostname.c index e909138e4..60f66c073 100644 --- a/hostname.c +++ b/hostname.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * $Id: hostname.c,v 1.10 2000/06/19 17:25:39 andersen Exp $ | 3 | * $Id: hostname.c,v 1.11 2000/07/14 01:51:25 kraai Exp $ |
4 | * Mini hostname implementation for busybox | 4 | * Mini hostname implementation for busybox |
5 | * | 5 | * |
6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
@@ -55,8 +55,7 @@ void do_sethostname(char *s, int isfile) | |||
55 | if (!isfile) { | 55 | if (!isfile) { |
56 | if (sethostname(s, strlen(s)) < 0) { | 56 | if (sethostname(s, strlen(s)) < 0) { |
57 | if (errno == EPERM) | 57 | if (errno == EPERM) |
58 | fprintf(stderr, | 58 | errorMsg("you must be root to change the hostname\n"); |
59 | "hostname: you must be root to change the hostname\n"); | ||
60 | else | 59 | else |
61 | perror("sethostname"); | 60 | perror("sethostname"); |
62 | exit(1); | 61 | exit(1); |
@@ -70,7 +70,7 @@ | |||
70 | #ifndef MODUTILS_MODULE_H | 70 | #ifndef MODUTILS_MODULE_H |
71 | #define MODUTILS_MODULE_H 1 | 71 | #define MODUTILS_MODULE_H 1 |
72 | 72 | ||
73 | #ident "$Id: insmod.c,v 1.15 2000/07/11 17:52:22 andersen Exp $" | 73 | #ident "$Id: insmod.c,v 1.16 2000/07/14 01:51:25 kraai Exp $" |
74 | 74 | ||
75 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 75 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
76 | We do not use the kernel headers directly because we do not wish | 76 | We do not use the kernel headers directly because we do not wish |
@@ -276,7 +276,7 @@ int delete_module(const char *); | |||
276 | #ifndef MODUTILS_OBJ_H | 276 | #ifndef MODUTILS_OBJ_H |
277 | #define MODUTILS_OBJ_H 1 | 277 | #define MODUTILS_OBJ_H 1 |
278 | 278 | ||
279 | #ident "$Id: insmod.c,v 1.15 2000/07/11 17:52:22 andersen Exp $" | 279 | #ident "$Id: insmod.c,v 1.16 2000/07/14 01:51:25 kraai Exp $" |
280 | 280 | ||
281 | /* The relocatable object is manipulated using elfin types. */ | 281 | /* The relocatable object is manipulated using elfin types. */ |
282 | 282 | ||
@@ -938,7 +938,7 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name, | |||
938 | /* Don't report an error if the symbol is coming from | 938 | /* Don't report an error if the symbol is coming from |
939 | the kernel or some external module. */ | 939 | the kernel or some external module. */ |
940 | if (secidx <= SHN_HIRESERVE) | 940 | if (secidx <= SHN_HIRESERVE) |
941 | fprintf(stderr, "%s multiply defined\n", name); | 941 | errorMsg("%s multiply defined\n", name); |
942 | return sym; | 942 | return sym; |
943 | } | 943 | } |
944 | } | 944 | } |
@@ -1201,7 +1201,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1201 | 1201 | ||
1202 | /* Also check that the parameter was not resolved from the kernel. */ | 1202 | /* Also check that the parameter was not resolved from the kernel. */ |
1203 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { | 1203 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { |
1204 | fprintf(stderr, "symbol for parameter %s not found\n", p); | 1204 | errorMsg("symbol for parameter %s not found\n", p); |
1205 | return 0; | 1205 | return 0; |
1206 | } | 1206 | } |
1207 | 1207 | ||
@@ -1214,7 +1214,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1214 | str = alloca(strlen(q)); | 1214 | str = alloca(strlen(q)); |
1215 | for (r = str, q++; *q != '"'; ++q, ++r) { | 1215 | for (r = str, q++; *q != '"'; ++q, ++r) { |
1216 | if (*q == '\0') { | 1216 | if (*q == '\0') { |
1217 | fprintf(stderr, "improperly terminated string argument for %s\n", p); | 1217 | errorMsg("improperly terminated string argument for %s\n", p); |
1218 | return 0; | 1218 | return 0; |
1219 | } else if (*q == '\\') | 1219 | } else if (*q == '\\') |
1220 | switch (*++q) { | 1220 | switch (*++q) { |
@@ -1567,7 +1567,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1567 | p = get_modinfo_value(f, key); | 1567 | p = get_modinfo_value(f, key); |
1568 | key += 5; | 1568 | key += 5; |
1569 | if (p == NULL) { | 1569 | if (p == NULL) { |
1570 | fprintf(stderr, "invalid parameter %s\n", key); | 1570 | errorMsg("invalid parameter %s\n", key); |
1571 | return 0; | 1571 | return 0; |
1572 | } | 1572 | } |
1573 | 1573 | ||
@@ -1575,7 +1575,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1575 | 1575 | ||
1576 | /* Also check that the parameter was not resolved from the kernel. */ | 1576 | /* Also check that the parameter was not resolved from the kernel. */ |
1577 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { | 1577 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { |
1578 | fprintf(stderr, "symbol for parameter %s not found\n", key); | 1578 | errorMsg("symbol for parameter %s not found\n", key); |
1579 | return 0; | 1579 | return 0; |
1580 | } | 1580 | } |
1581 | 1581 | ||
@@ -1603,8 +1603,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1603 | str = alloca(strlen(q)); | 1603 | str = alloca(strlen(q)); |
1604 | for (r = str, q++; *q != '"'; ++q, ++r) { | 1604 | for (r = str, q++; *q != '"'; ++q, ++r) { |
1605 | if (*q == '\0') { | 1605 | if (*q == '\0') { |
1606 | fprintf(stderr, | 1606 | errorMsg("improperly terminated string argument for %s\n", |
1607 | "improperly terminated string argument for %s\n", | ||
1608 | key); | 1607 | key); |
1609 | return 0; | 1608 | return 0; |
1610 | } else if (*q == '\\') | 1609 | } else if (*q == '\\') |
@@ -1698,8 +1697,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1698 | /* Get the size of each member */ | 1697 | /* Get the size of each member */ |
1699 | /* Probably we should do that outside the loop ? */ | 1698 | /* Probably we should do that outside the loop ? */ |
1700 | if (!isdigit(*(p + 1))) { | 1699 | if (!isdigit(*(p + 1))) { |
1701 | fprintf(stderr, | 1700 | errorMsg("parameter type 'c' for %s must be followed by" |
1702 | "parameter type 'c' for %s must be followed by" | ||
1703 | " the maximum size\n", key); | 1701 | " the maximum size\n", key); |
1704 | return 0; | 1702 | return 0; |
1705 | } | 1703 | } |
@@ -1707,8 +1705,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1707 | 1705 | ||
1708 | /* Check length */ | 1706 | /* Check length */ |
1709 | if (strlen(str) >= charssize) { | 1707 | if (strlen(str) >= charssize) { |
1710 | fprintf(stderr, | 1708 | errorMsg("string too long for %s (max %ld)\n", key, |
1711 | "string too long for %s (max %ld)\n", key, | ||
1712 | charssize - 1); | 1709 | charssize - 1); |
1713 | return 0; | 1710 | return 0; |
1714 | } | 1711 | } |
@@ -1737,8 +1734,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1737 | break; | 1734 | break; |
1738 | 1735 | ||
1739 | default: | 1736 | default: |
1740 | fprintf(stderr, "unknown parameter type '%c' for %s\n", | 1737 | errorMsg("unknown parameter type '%c' for %s\n", *p, key); |
1741 | *p, key); | ||
1742 | return 0; | 1738 | return 0; |
1743 | } | 1739 | } |
1744 | } | 1740 | } |
@@ -1757,22 +1753,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1757 | 1753 | ||
1758 | case ',': | 1754 | case ',': |
1759 | if (++n > max) { | 1755 | if (++n > max) { |
1760 | fprintf(stderr, "too many values for %s (max %d)\n", | 1756 | errorMsg("too many values for %s (max %d)\n", key, max); |
1761 | key, max); | ||
1762 | return 0; | 1757 | return 0; |
1763 | } | 1758 | } |
1764 | ++q; | 1759 | ++q; |
1765 | break; | 1760 | break; |
1766 | 1761 | ||
1767 | default: | 1762 | default: |
1768 | fprintf(stderr, "invalid argument syntax for %s\n", key); | 1763 | errorMsg("invalid argument syntax for %s\n", key); |
1769 | return 0; | 1764 | return 0; |
1770 | } | 1765 | } |
1771 | } | 1766 | } |
1772 | 1767 | ||
1773 | end_of_arg: | 1768 | end_of_arg: |
1774 | if (n < min) { | 1769 | if (n < min) { |
1775 | fprintf(stderr, "too few values for %s (min %d)\n", key, min); | 1770 | errorMsg("too few values for %s (min %d)\n", key, min); |
1776 | return 0; | 1771 | return 0; |
1777 | } | 1772 | } |
1778 | 1773 | ||
@@ -2157,7 +2152,7 @@ int obj_check_undefineds(struct obj_file *f) | |||
2157 | sym->secidx = SHN_ABS; | 2152 | sym->secidx = SHN_ABS; |
2158 | sym->value = 0; | 2153 | sym->value = 0; |
2159 | } else { | 2154 | } else { |
2160 | fprintf(stderr, "unresolved symbol %s\n", sym->name); | 2155 | errorMsg("unresolved symbol %s\n", sym->name); |
2161 | ret = 0; | 2156 | ret = 0; |
2162 | } | 2157 | } |
2163 | } | 2158 | } |
@@ -2380,11 +2375,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base) | |||
2380 | errmsg = "Unhandled relocation"; | 2375 | errmsg = "Unhandled relocation"; |
2381 | bad_reloc: | 2376 | bad_reloc: |
2382 | if (extsym) { | 2377 | if (extsym) { |
2383 | fprintf(stderr, "%s of type %ld for %s\n", errmsg, | 2378 | errorMsg("%s of type %ld for %s\n", errmsg, |
2384 | (long) ELFW(R_TYPE) (rel->r_info), | 2379 | (long) ELFW(R_TYPE) (rel->r_info), |
2385 | strtab + extsym->st_name); | 2380 | strtab + extsym->st_name); |
2386 | } else { | 2381 | } else { |
2387 | fprintf(stderr, "%s of type %ld\n", errmsg, | 2382 | errorMsg("%s of type %ld\n", errmsg, |
2388 | (long) ELFW(R_TYPE) (rel->r_info)); | 2383 | (long) ELFW(R_TYPE) (rel->r_info)); |
2389 | } | 2384 | } |
2390 | ret = 0; | 2385 | ret = 0; |
@@ -2469,25 +2464,25 @@ struct obj_file *obj_load(FILE * fp) | |||
2469 | || f->header.e_ident[EI_MAG1] != ELFMAG1 | 2464 | || f->header.e_ident[EI_MAG1] != ELFMAG1 |
2470 | || f->header.e_ident[EI_MAG2] != ELFMAG2 | 2465 | || f->header.e_ident[EI_MAG2] != ELFMAG2 |
2471 | || f->header.e_ident[EI_MAG3] != ELFMAG3) { | 2466 | || f->header.e_ident[EI_MAG3] != ELFMAG3) { |
2472 | fprintf(stderr, "not an ELF file\n"); | 2467 | errorMsg("not an ELF file\n"); |
2473 | return NULL; | 2468 | return NULL; |
2474 | } | 2469 | } |
2475 | if (f->header.e_ident[EI_CLASS] != ELFCLASSM | 2470 | if (f->header.e_ident[EI_CLASS] != ELFCLASSM |
2476 | || f->header.e_ident[EI_DATA] != ELFDATAM | 2471 | || f->header.e_ident[EI_DATA] != ELFDATAM |
2477 | || f->header.e_ident[EI_VERSION] != EV_CURRENT | 2472 | || f->header.e_ident[EI_VERSION] != EV_CURRENT |
2478 | || !MATCH_MACHINE(f->header.e_machine)) { | 2473 | || !MATCH_MACHINE(f->header.e_machine)) { |
2479 | fprintf(stderr, "ELF file not for this architecture\n"); | 2474 | errorMsg("ELF file not for this architecture\n"); |
2480 | return NULL; | 2475 | return NULL; |
2481 | } | 2476 | } |
2482 | if (f->header.e_type != ET_REL) { | 2477 | if (f->header.e_type != ET_REL) { |
2483 | fprintf(stderr, "ELF file not a relocatable object\n"); | 2478 | errorMsg("ELF file not a relocatable object\n"); |
2484 | return NULL; | 2479 | return NULL; |
2485 | } | 2480 | } |
2486 | 2481 | ||
2487 | /* Read the section headers. */ | 2482 | /* Read the section headers. */ |
2488 | 2483 | ||
2489 | if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { | 2484 | if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { |
2490 | fprintf(stderr, "section header size mismatch: %lu != %lu\n", | 2485 | errorMsg("section header size mismatch: %lu != %lu\n", |
2491 | (unsigned long) f->header.e_shentsize, | 2486 | (unsigned long) f->header.e_shentsize, |
2492 | (unsigned long) sizeof(ElfW(Shdr))); | 2487 | (unsigned long) sizeof(ElfW(Shdr))); |
2493 | return NULL; | 2488 | return NULL; |
@@ -2540,13 +2535,11 @@ struct obj_file *obj_load(FILE * fp) | |||
2540 | 2535 | ||
2541 | #if SHT_RELM == SHT_REL | 2536 | #if SHT_RELM == SHT_REL |
2542 | case SHT_RELA: | 2537 | case SHT_RELA: |
2543 | fprintf(stderr, | 2538 | errorMsg("RELA relocations not supported on this architecture\n"); |
2544 | "RELA relocations not supported on this architecture\n"); | ||
2545 | return NULL; | 2539 | return NULL; |
2546 | #else | 2540 | #else |
2547 | case SHT_REL: | 2541 | case SHT_REL: |
2548 | fprintf(stderr, | 2542 | errorMsg("REL relocations not supported on this architecture\n"); |
2549 | "REL relocations not supported on this architecture\n"); | ||
2550 | return NULL; | 2543 | return NULL; |
2551 | #endif | 2544 | #endif |
2552 | 2545 | ||
@@ -2559,7 +2552,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2559 | break; | 2552 | break; |
2560 | } | 2553 | } |
2561 | 2554 | ||
2562 | fprintf(stderr, "can't handle sections of type %ld\n", | 2555 | errorMsg("can't handle sections of type %ld\n", |
2563 | (long) sec->header.sh_type); | 2556 | (long) sec->header.sh_type); |
2564 | return NULL; | 2557 | return NULL; |
2565 | } | 2558 | } |
@@ -2588,7 +2581,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2588 | ElfW(Sym) * sym; | 2581 | ElfW(Sym) * sym; |
2589 | 2582 | ||
2590 | if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { | 2583 | if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { |
2591 | fprintf(stderr, "symbol size mismatch: %lu != %lu\n", | 2584 | errorMsg("symbol size mismatch: %lu != %lu\n", |
2592 | (unsigned long) sec->header.sh_entsize, | 2585 | (unsigned long) sec->header.sh_entsize, |
2593 | (unsigned long) sizeof(ElfW(Sym))); | 2586 | (unsigned long) sizeof(ElfW(Sym))); |
2594 | return NULL; | 2587 | return NULL; |
@@ -2620,8 +2613,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2620 | 2613 | ||
2621 | case SHT_RELM: | 2614 | case SHT_RELM: |
2622 | if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { | 2615 | if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { |
2623 | fprintf(stderr, | 2616 | errorMsg("relocation entry size mismatch: %lu != %lu\n", |
2624 | "relocation entry size mismatch: %lu != %lu\n", | ||
2625 | (unsigned long) sec->header.sh_entsize, | 2617 | (unsigned long) sec->header.sh_entsize, |
2626 | (unsigned long) sizeof(ElfW(RelM))); | 2618 | (unsigned long) sizeof(ElfW(RelM))); |
2627 | return NULL; | 2619 | return NULL; |
@@ -2754,20 +2746,20 @@ extern int insmod_main( int argc, char **argv) | |||
2754 | } else { | 2746 | } else { |
2755 | m_version = old_get_module_version(f, m_strversion); | 2747 | m_version = old_get_module_version(f, m_strversion); |
2756 | if (m_version == -1) { | 2748 | if (m_version == -1) { |
2757 | fprintf(stderr, | 2749 | errorMsg("couldn't find the kernel version the module was " |
2758 | "couldn't find the kernel version the module was compiled for\n"); | 2750 | "compiled for\n"); |
2759 | goto out; | 2751 | goto out; |
2760 | } | 2752 | } |
2761 | } | 2753 | } |
2762 | 2754 | ||
2763 | if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) { | 2755 | if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) { |
2764 | if (flag_force_load) { | 2756 | if (flag_force_load) { |
2765 | fprintf(stderr, "Warning: kernel-module version mismatch\n" | 2757 | errorMsg("Warning: kernel-module version mismatch\n" |
2766 | "\t%s was compiled for kernel version %s\n" | 2758 | "\t%s was compiled for kernel version %s\n" |
2767 | "\twhile this kernel is version %s\n", | 2759 | "\twhile this kernel is version %s\n", |
2768 | m_filename, m_strversion, k_strversion); | 2760 | m_filename, m_strversion, k_strversion); |
2769 | } else { | 2761 | } else { |
2770 | fprintf(stderr, "kernel-module version mismatch\n" | 2762 | errorMsg("kernel-module version mismatch\n" |
2771 | "\t%s was compiled for kernel version %s\n" | 2763 | "\t%s was compiled for kernel version %s\n" |
2772 | "\twhile this kernel is version %s.\n", | 2764 | "\twhile this kernel is version %s.\n", |
2773 | m_filename, m_strversion, k_strversion); | 2765 | m_filename, m_strversion, k_strversion); |
@@ -2785,7 +2777,7 @@ extern int insmod_main( int argc, char **argv) | |||
2785 | goto out; | 2777 | goto out; |
2786 | k_crcs = new_is_kernel_checksummed(); | 2778 | k_crcs = new_is_kernel_checksummed(); |
2787 | #else | 2779 | #else |
2788 | fprintf(stderr, "Not configured to support new kernels\n"); | 2780 | errorMsg("Not configured to support new kernels\n"); |
2789 | goto out; | 2781 | goto out; |
2790 | #endif | 2782 | #endif |
2791 | } else { | 2783 | } else { |
@@ -2794,7 +2786,7 @@ extern int insmod_main( int argc, char **argv) | |||
2794 | goto out; | 2786 | goto out; |
2795 | k_crcs = old_is_kernel_checksummed(); | 2787 | k_crcs = old_is_kernel_checksummed(); |
2796 | #else | 2788 | #else |
2797 | fprintf(stderr, "Not configured to support old kernels\n"); | 2789 | errorMsg("Not configured to support old kernels\n"); |
2798 | goto out; | 2790 | goto out; |
2799 | #endif | 2791 | #endif |
2800 | } | 2792 | } |
@@ -2851,11 +2843,10 @@ extern int insmod_main( int argc, char **argv) | |||
2851 | case 0: | 2843 | case 0: |
2852 | break; | 2844 | break; |
2853 | case EEXIST: | 2845 | case EEXIST: |
2854 | fprintf(stderr, "A module named %s already exists\n", m_name); | 2846 | errorMsg("A module named %s already exists\n", m_name); |
2855 | goto out; | 2847 | goto out; |
2856 | case ENOMEM: | 2848 | case ENOMEM: |
2857 | fprintf(stderr, | 2849 | errorMsg("Can't allocate kernel memory for module; needed %lu bytes\n", |
2858 | "Can't allocate kernel memory for module; needed %lu bytes\n", | ||
2859 | m_size); | 2850 | m_size); |
2860 | goto out; | 2851 | goto out; |
2861 | default: | 2852 | default: |
@@ -207,12 +207,12 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) | |||
207 | 207 | ||
208 | if (!jobList->head) { | 208 | if (!jobList->head) { |
209 | if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { | 209 | if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { |
210 | fprintf(stderr, "%s: exactly one argument is expected\n", | 210 | errorMsg("%s: exactly one argument is expected\n", |
211 | cmd->progs[0].argv[0]); | 211 | cmd->progs[0].argv[0]); |
212 | return FALSE; | 212 | return FALSE; |
213 | } | 213 | } |
214 | if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { | 214 | if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { |
215 | fprintf(stderr, "%s: bad argument '%s'\n", | 215 | errorMsg("%s: bad argument '%s'\n", |
216 | cmd->progs[0].argv[0], cmd->progs[0].argv[1]); | 216 | cmd->progs[0].argv[0], cmd->progs[0].argv[1]); |
217 | return FALSE; | 217 | return FALSE; |
218 | for (job = jobList->head; job; job = job->next) { | 218 | for (job = jobList->head; job; job = job->next) { |
@@ -226,7 +226,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) | |||
226 | } | 226 | } |
227 | 227 | ||
228 | if (!job) { | 228 | if (!job) { |
229 | fprintf(stderr, "%s: unknown job %d\n", | 229 | errorMsg("%s: unknown job %d\n", |
230 | cmd->progs[0].argv[0], jobNum); | 230 | cmd->progs[0].argv[0], jobNum); |
231 | return FALSE; | 231 | return FALSE; |
232 | } | 232 | } |
@@ -519,7 +519,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr, | |||
519 | 519 | ||
520 | rc = glob(prog->argv[argc - 1], flags, NULL, &prog->globResult); | 520 | rc = glob(prog->argv[argc - 1], flags, NULL, &prog->globResult); |
521 | if (rc == GLOB_NOSPACE) { | 521 | if (rc == GLOB_NOSPACE) { |
522 | fprintf(stderr, "out of space during glob operation\n"); | 522 | errorMsg("out of space during glob operation\n"); |
523 | return; | 523 | return; |
524 | } else if (rc == GLOB_NOMATCH || | 524 | } else if (rc == GLOB_NOMATCH || |
525 | (!rc && (prog->globResult.gl_pathc - i) == 1 && | 525 | (!rc && (prog->globResult.gl_pathc - i) == 1 && |
@@ -607,7 +607,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
607 | if (*src == '\\') { | 607 | if (*src == '\\') { |
608 | src++; | 608 | src++; |
609 | if (!*src) { | 609 | if (!*src) { |
610 | fprintf(stderr, "character expected after \\\n"); | 610 | errorMsg("character expected after \\\n"); |
611 | freeJob(job); | 611 | freeJob(job); |
612 | return 1; | 612 | return 1; |
613 | } | 613 | } |
@@ -686,7 +686,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
686 | chptr++; | 686 | chptr++; |
687 | 687 | ||
688 | if (!*chptr) { | 688 | if (!*chptr) { |
689 | fprintf(stderr, "file name expected after %c\n", *src); | 689 | errorMsg("file name expected after %c\n", *src); |
690 | freeJob(job); | 690 | freeJob(job); |
691 | job->numProgs=0; | 691 | job->numProgs=0; |
692 | return 1; | 692 | return 1; |
@@ -705,7 +705,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
705 | if (*prog->argv[argc]) | 705 | if (*prog->argv[argc]) |
706 | argc++; | 706 | argc++; |
707 | if (!argc) { | 707 | if (!argc) { |
708 | fprintf(stderr, "empty command in pipe1.\n"); | 708 | errorMsg("empty command in pipe1\n"); |
709 | freeJob(job); | 709 | freeJob(job); |
710 | job->numProgs=0; | 710 | job->numProgs=0; |
711 | return 1; | 711 | return 1; |
@@ -731,7 +731,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
731 | src++; | 731 | src++; |
732 | 732 | ||
733 | if (!*src) { | 733 | if (!*src) { |
734 | fprintf(stderr, "empty command in pipe2\n"); | 734 | errorMsg("empty command in pipe2\n"); |
735 | freeJob(job); | 735 | freeJob(job); |
736 | job->numProgs=0; | 736 | job->numProgs=0; |
737 | return 1; | 737 | return 1; |
@@ -750,7 +750,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
750 | case '\\': | 750 | case '\\': |
751 | src++; | 751 | src++; |
752 | if (!*src) { | 752 | if (!*src) { |
753 | fprintf(stderr, "character expected after \\\n"); | 753 | errorMsg("character expected after \\\n"); |
754 | freeJob(job); | 754 | freeJob(job); |
755 | return 1; | 755 | return 1; |
756 | } | 756 | } |
@@ -965,7 +965,7 @@ static int setupRedirections(struct childProgram *prog) | |||
965 | if (openfd < 0) { | 965 | if (openfd < 0) { |
966 | /* this could get lost if stderr has been redirected, but | 966 | /* this could get lost if stderr has been redirected, but |
967 | bash and ash both lose it as well (though zsh doesn't!) */ | 967 | bash and ash both lose it as well (though zsh doesn't!) */ |
968 | fprintf(stderr, "error opening %s: %s\n", redir->filename, | 968 | errorMsg("error opening %s: %s\n", redir->filename, |
969 | strerror(errno)); | 969 | strerror(errno)); |
970 | return 1; | 970 | return 1; |
971 | } | 971 | } |
@@ -23,7 +23,6 @@ | |||
23 | 23 | ||
24 | #include "internal.h" | 24 | #include "internal.h" |
25 | #define BB_DECLARE_EXTERN | 25 | #define BB_DECLARE_EXTERN |
26 | #define bb_need_name_too_long | ||
27 | #define bb_need_not_a_directory | 26 | #define bb_need_not_a_directory |
28 | #include "messages.c" | 27 | #include "messages.c" |
29 | 28 | ||
@@ -92,7 +91,7 @@ extern int ln_main(int argc, char **argv) | |||
92 | 91 | ||
93 | linkIntoDirFlag = isDirectory(linkName, followLinks, NULL); | 92 | linkIntoDirFlag = isDirectory(linkName, followLinks, NULL); |
94 | if ((argc >= 3) && linkIntoDirFlag == FALSE) { | 93 | if ((argc >= 3) && linkIntoDirFlag == FALSE) { |
95 | fprintf(stderr, not_a_directory, "ln", linkName); | 94 | errorMsg(not_a_directory, linkName); |
96 | exit FALSE; | 95 | exit FALSE; |
97 | } | 96 | } |
98 | 97 | ||
@@ -46,12 +46,12 @@ int loadacm_main(int argc, char **argv) | |||
46 | 46 | ||
47 | fd = open("/dev/tty", O_RDWR); | 47 | fd = open("/dev/tty", O_RDWR); |
48 | if (fd < 0) { | 48 | if (fd < 0) { |
49 | fprintf(stderr, "Error opening /dev/tty1: %s\n", strerror(errno)); | 49 | errorMsg("Error opening /dev/tty1: %s\n", strerror(errno)); |
50 | return( FALSE); | 50 | return( FALSE); |
51 | } | 51 | } |
52 | 52 | ||
53 | if (screen_map_load(fd, stdin)) { | 53 | if (screen_map_load(fd, stdin)) { |
54 | fprintf(stderr, "Error loading acm: %s\n", strerror(errno)); | 54 | errorMsg("Error loading acm: %s\n", strerror(errno)); |
55 | return( FALSE); | 55 | return( FALSE); |
56 | } | 56 | } |
57 | 57 | ||
@@ -79,8 +79,7 @@ int screen_map_load(int fd, FILE * fp) | |||
79 | if (parse_failed) { | 79 | if (parse_failed) { |
80 | if (-1 == fseek(fp, 0, SEEK_SET)) { | 80 | if (-1 == fseek(fp, 0, SEEK_SET)) { |
81 | if (errno == ESPIPE) | 81 | if (errno == ESPIPE) |
82 | fprintf(stderr, | 82 | errorMsg("16bit screen-map MUST be a regular file.\n"), |
83 | "16bit screen-map MUST be a regular file.\n"), | ||
84 | exit(1); | 83 | exit(1); |
85 | else | 84 | else |
86 | perror("fseek failed reading binary 16bit screen-map"), | 85 | perror("fseek failed reading binary 16bit screen-map"), |
@@ -91,7 +90,7 @@ int screen_map_load(int fd, FILE * fp) | |||
91 | perror("Cannot read [new] map from file"), exit(1); | 90 | perror("Cannot read [new] map from file"), exit(1); |
92 | #if 0 | 91 | #if 0 |
93 | else | 92 | else |
94 | fprintf(stderr, "Input screen-map is binary.\n"); | 93 | errorMsg("Input screen-map is binary.\n"); |
95 | #endif | 94 | #endif |
96 | } | 95 | } |
97 | 96 | ||
@@ -108,8 +107,7 @@ int screen_map_load(int fd, FILE * fp) | |||
108 | /* rewind... */ | 107 | /* rewind... */ |
109 | if (-1 == fseek(fp, 0, SEEK_SET)) { | 108 | if (-1 == fseek(fp, 0, SEEK_SET)) { |
110 | if (errno == ESPIPE) | 109 | if (errno == ESPIPE) |
111 | fprintf(stderr, | 110 | errorMsg("Assuming 8bit screen-map - MUST be a regular file.\n"), |
112 | "Assuming 8bit screen-map - MUST be a regular file.\n"), | ||
113 | exit(1); | 111 | exit(1); |
114 | else | 112 | else |
115 | perror("fseek failed assuming 8bit screen-map"), exit(1); | 113 | perror("fseek failed assuming 8bit screen-map"), exit(1); |
@@ -122,7 +120,7 @@ int screen_map_load(int fd, FILE * fp) | |||
122 | if (-1 == fseek(fp, 0, SEEK_SET)) { | 120 | if (-1 == fseek(fp, 0, SEEK_SET)) { |
123 | if (errno == ESPIPE) | 121 | if (errno == ESPIPE) |
124 | /* should not - it succedeed above */ | 122 | /* should not - it succedeed above */ |
125 | fprintf(stderr, "fseek() returned ESPIPE !\n"), | 123 | errorMsg("fseek() returned ESPIPE !\n"), |
126 | exit(1); | 124 | exit(1); |
127 | else | 125 | else |
128 | perror("fseek for binary 8bit screen-map"), exit(1); | 126 | perror("fseek for binary 8bit screen-map"), exit(1); |
@@ -132,7 +130,7 @@ int screen_map_load(int fd, FILE * fp) | |||
132 | perror("Cannot read [old] map from file"), exit(1); | 130 | perror("Cannot read [old] map from file"), exit(1); |
133 | #if 0 | 131 | #if 0 |
134 | else | 132 | else |
135 | fprintf(stderr, "Input screen-map is binary.\n"); | 133 | errorMsg("Input screen-map is binary.\n"); |
136 | #endif | 134 | #endif |
137 | } | 135 | } |
138 | 136 | ||
@@ -141,7 +139,7 @@ int screen_map_load(int fd, FILE * fp) | |||
141 | else | 139 | else |
142 | return 0; | 140 | return 0; |
143 | } | 141 | } |
144 | fprintf(stderr, "Error parsing symbolic map\n"); | 142 | errorMsg("Error parsing symbolic map\n"); |
145 | return(1); | 143 | return(1); |
146 | } | 144 | } |
147 | 145 | ||
diff --git a/loadfont.c b/loadfont.c index 7eaf40e82..b3f9f4f11 100644 --- a/loadfont.c +++ b/loadfont.c | |||
@@ -56,7 +56,7 @@ extern int loadfont_main(int argc, char **argv) | |||
56 | 56 | ||
57 | fd = open("/dev/tty0", O_RDWR); | 57 | fd = open("/dev/tty0", O_RDWR); |
58 | if (fd < 0) { | 58 | if (fd < 0) { |
59 | fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); | 59 | errorMsg("Error opening /dev/tty0: %s\n", strerror(errno)); |
60 | return( FALSE); | 60 | return( FALSE); |
61 | } | 61 | } |
62 | loadnewfont(fd); | 62 | loadnewfont(fd); |
@@ -72,7 +72,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize) | |||
72 | memset(buf, 0, sizeof(buf)); | 72 | memset(buf, 0, sizeof(buf)); |
73 | 73 | ||
74 | if (unit < 1 || unit > 32) { | 74 | if (unit < 1 || unit > 32) { |
75 | fprintf(stderr, "Bad character size %d\n", unit); | 75 | errorMsg("Bad character size %d\n", unit); |
76 | exit(1); | 76 | exit(1); |
77 | } | 77 | } |
78 | 78 | ||
@@ -112,7 +112,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize) | |||
112 | up = (struct unipair *) malloc(maxct * sizeof(struct unipair)); | 112 | up = (struct unipair *) malloc(maxct * sizeof(struct unipair)); |
113 | 113 | ||
114 | if (!up) { | 114 | if (!up) { |
115 | fprintf(stderr, "Out of memory?\n"); | 115 | errorMsg("Out of memory?\n"); |
116 | exit(1); | 116 | exit(1); |
117 | } | 117 | } |
118 | for (glyph = 0; glyph < fontsize; glyph++) { | 118 | for (glyph = 0; glyph < fontsize; glyph++) { |
@@ -137,8 +137,8 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize) | |||
137 | if (ioctl(fd, PIO_UNIMAPCLR, &advice)) { | 137 | if (ioctl(fd, PIO_UNIMAPCLR, &advice)) { |
138 | #ifdef ENOIOCTLCMD | 138 | #ifdef ENOIOCTLCMD |
139 | if (errno == ENOIOCTLCMD) { | 139 | if (errno == ENOIOCTLCMD) { |
140 | fprintf(stderr, "It seems this kernel is older than 1.1.92\n"); | 140 | errorMsg("It seems this kernel is older than 1.1.92\n"); |
141 | fprintf(stderr, "No Unicode mapping table loaded.\n"); | 141 | errorMsg("No Unicode mapping table loaded.\n"); |
142 | } else | 142 | } else |
143 | #endif | 143 | #endif |
144 | perror("PIO_UNIMAPCLR"); | 144 | perror("PIO_UNIMAPCLR"); |
@@ -198,13 +198,13 @@ static void loadnewfont(int fd) | |||
198 | goto no_psf; | 198 | goto no_psf; |
199 | 199 | ||
200 | if (psfhdr.mode > PSF_MAXMODE) { | 200 | if (psfhdr.mode > PSF_MAXMODE) { |
201 | fprintf(stderr, "Unsupported psf file mode\n"); | 201 | errorMsg("Unsupported psf file mode\n"); |
202 | exit(1); | 202 | exit(1); |
203 | } | 203 | } |
204 | fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256); | 204 | fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256); |
205 | #if !defined( PIO_FONTX ) || defined( __sparc__ ) | 205 | #if !defined( PIO_FONTX ) || defined( __sparc__ ) |
206 | if (fontsize != 256) { | 206 | if (fontsize != 256) { |
207 | fprintf(stderr, "Only fontsize 256 supported\n"); | 207 | errorMsg("Only fontsize 256 supported\n"); |
208 | exit(1); | 208 | exit(1); |
209 | } | 209 | } |
210 | #endif | 210 | #endif |
@@ -214,7 +214,7 @@ static void loadnewfont(int fd) | |||
214 | 214 | ||
215 | head = head0 + fontsize * unit; | 215 | head = head0 + fontsize * unit; |
216 | if (head > inputlth || (!hastable && head != inputlth)) { | 216 | if (head > inputlth || (!hastable && head != inputlth)) { |
217 | fprintf(stderr, "Input file: bad length\n"); | 217 | errorMsg("Input file: bad length\n"); |
218 | exit(1); | 218 | exit(1); |
219 | } | 219 | } |
220 | do_loadfont(fd, inbuf + head0, unit, fontsize); | 220 | do_loadfont(fd, inbuf + head0, unit, fontsize); |
@@ -231,7 +231,7 @@ static void loadnewfont(int fd) | |||
231 | } else { | 231 | } else { |
232 | /* bare font */ | 232 | /* bare font */ |
233 | if (inputlth & 0377) { | 233 | if (inputlth & 0377) { |
234 | fprintf(stderr, "Bad input file size\n"); | 234 | errorMsg("Bad input file size\n"); |
235 | exit(1); | 235 | exit(1); |
236 | } | 236 | } |
237 | offset = 0; | 237 | offset = 0; |
diff --git a/loadkmap.c b/loadkmap.c index c2e4c94ed..72247a6e4 100644 --- a/loadkmap.c +++ b/loadkmap.c | |||
@@ -59,25 +59,25 @@ int loadkmap_main(int argc, char **argv) | |||
59 | 59 | ||
60 | fd = open("/dev/tty0", O_RDWR); | 60 | fd = open("/dev/tty0", O_RDWR); |
61 | if (fd < 0) { | 61 | if (fd < 0) { |
62 | fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno)); | 62 | errorMsg("Error opening /dev/tty0: %s\n", strerror(errno)); |
63 | exit(FALSE); | 63 | exit(FALSE); |
64 | } | 64 | } |
65 | 65 | ||
66 | read(0, buff, 7); | 66 | read(0, buff, 7); |
67 | if (0 != strncmp(buff, magic, 7)) { | 67 | if (0 != strncmp(buff, magic, 7)) { |
68 | fprintf(stderr, "This is not a valid binary keymap.\n"); | 68 | errorMsg("This is not a valid binary keymap.\n"); |
69 | exit(FALSE); | 69 | exit(FALSE); |
70 | } | 70 | } |
71 | 71 | ||
72 | if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) { | 72 | if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) { |
73 | fprintf(stderr, "Error reading keymap flags: %s\n", | 73 | errorMsg("Error reading keymap flags: %s\n", |
74 | strerror(errno)); | 74 | strerror(errno)); |
75 | exit(FALSE); | 75 | exit(FALSE); |
76 | } | 76 | } |
77 | 77 | ||
78 | ibuff = (u_short *) malloc(ibuffsz); | 78 | ibuff = (u_short *) malloc(ibuffsz); |
79 | if (!ibuff) { | 79 | if (!ibuff) { |
80 | fprintf(stderr, "Out of memory.\n"); | 80 | errorMsg("Out of memory.\n"); |
81 | exit(FALSE); | 81 | exit(FALSE); |
82 | } | 82 | } |
83 | 83 | ||
@@ -87,7 +87,7 @@ int loadkmap_main(int argc, char **argv) | |||
87 | while (pos < ibuffsz) { | 87 | while (pos < ibuffsz) { |
88 | if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) | 88 | if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) |
89 | < 0) { | 89 | < 0) { |
90 | fprintf(stderr, "Error reading keymap: %s\n", | 90 | errorMsg("Error reading keymap: %s\n", |
91 | strerror(errno)); | 91 | strerror(errno)); |
92 | exit(FALSE); | 92 | exit(FALSE); |
93 | } | 93 | } |
@@ -96,7 +96,7 @@ static int pencode(char *s) | |||
96 | *s = '\0'; | 96 | *s = '\0'; |
97 | fac = decode(save, facilitynames); | 97 | fac = decode(save, facilitynames); |
98 | if (fac < 0) { | 98 | if (fac < 0) { |
99 | fprintf(stderr, "unknown facility name: %s\n", save); | 99 | errorMsg("unknown facility name: %s\n", save); |
100 | exit(FALSE); | 100 | exit(FALSE); |
101 | } | 101 | } |
102 | *s++ = '.'; | 102 | *s++ = '.'; |
@@ -105,7 +105,7 @@ static int pencode(char *s) | |||
105 | } | 105 | } |
106 | lev = decode(s, prioritynames); | 106 | lev = decode(s, prioritynames); |
107 | if (lev < 0) { | 107 | if (lev < 0) { |
108 | fprintf(stderr, "unknown priority name: %s\n", save); | 108 | errorMsg("unknown priority name: %s\n", save); |
109 | exit(FALSE); | 109 | exit(FALSE); |
110 | } | 110 | } |
111 | return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK)); | 111 | return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK)); |
@@ -166,7 +166,7 @@ extern int logger_main(int argc, char **argv) | |||
166 | if (argc >= 1) { | 166 | if (argc >= 1) { |
167 | message = *argv; | 167 | message = *argv; |
168 | } else { | 168 | } else { |
169 | fprintf(stderr, "No message\n"); | 169 | errorMsg("No message\n"); |
170 | exit(FALSE); | 170 | exit(FALSE); |
171 | } | 171 | } |
172 | } | 172 | } |
@@ -41,6 +41,6 @@ extern int logname_main(int argc, char **argv) | |||
41 | puts(user); | 41 | puts(user); |
42 | exit(TRUE); | 42 | exit(TRUE); |
43 | } | 43 | } |
44 | fprintf(stderr, "no login name\n"); | 44 | errorMsg("no login name\n"); |
45 | return(FALSE); | 45 | return(FALSE); |
46 | } | 46 | } |
diff --git a/messages.c b/messages.c index f2374eeb5..428db9eaa 100644 --- a/messages.c +++ b/messages.c | |||
@@ -48,13 +48,13 @@ | |||
48 | 48 | ||
49 | 49 | ||
50 | #if defined bb_need_name_too_long || ! defined BB_DECLARE_EXTERN | 50 | #if defined bb_need_name_too_long || ! defined BB_DECLARE_EXTERN |
51 | BB_DEF_MESSAGE(name_too_long, "%s: file name too long\n") | 51 | BB_DEF_MESSAGE(name_too_long, "file name too long\n") |
52 | #endif | 52 | #endif |
53 | #if defined bb_need_omitting_directory || ! defined BB_DECLARE_EXTERN | 53 | #if defined bb_need_omitting_directory || ! defined BB_DECLARE_EXTERN |
54 | BB_DEF_MESSAGE(omitting_directory, "%s: %s: omitting directory\n") | 54 | BB_DEF_MESSAGE(omitting_directory, "%s: omitting directory\n") |
55 | #endif | 55 | #endif |
56 | #if defined bb_need_not_a_directory || ! defined BB_DECLARE_EXTERN | 56 | #if defined bb_need_not_a_directory || ! defined BB_DECLARE_EXTERN |
57 | BB_DEF_MESSAGE(not_a_directory, "%s: %s: not a directory\n") | 57 | BB_DEF_MESSAGE(not_a_directory, "%s: not a directory\n") |
58 | #endif | 58 | #endif |
59 | #if defined bb_need_memory_exhausted || ! defined BB_DECLARE_EXTERN | 59 | #if defined bb_need_memory_exhausted || ! defined BB_DECLARE_EXTERN |
60 | BB_DEF_MESSAGE(memory_exhausted, "memory exhausted\n") | 60 | BB_DEF_MESSAGE(memory_exhausted, "memory exhausted\n") |
@@ -63,7 +63,7 @@ | |||
63 | BB_DEF_MESSAGE(invalid_date, "invalid date `%s'\n") | 63 | BB_DEF_MESSAGE(invalid_date, "invalid date `%s'\n") |
64 | #endif | 64 | #endif |
65 | #if defined bb_need_invalid_option || ! defined BB_DECLARE_EXTERN | 65 | #if defined bb_need_invalid_option || ! defined BB_DECLARE_EXTERN |
66 | BB_DEF_MESSAGE(invalid_option, "%s: invalid option -- %c\n") | 66 | BB_DEF_MESSAGE(invalid_option, "invalid option -- %c\n") |
67 | #endif | 67 | #endif |
68 | #if defined bb_need_io_error || ! defined BB_DECLARE_EXTERN | 68 | #if defined bb_need_io_error || ! defined BB_DECLARE_EXTERN |
69 | BB_DEF_MESSAGE(io_error, "%s: input/output error -- %s\n") | 69 | BB_DEF_MESSAGE(io_error, "%s: input/output error -- %s\n") |
@@ -75,7 +75,7 @@ | |||
75 | BB_DEF_MESSAGE(write_error, "Write Error\n") | 75 | BB_DEF_MESSAGE(write_error, "Write Error\n") |
76 | #endif | 76 | #endif |
77 | #if defined bb_need_too_few_args || ! defined BB_DECLARE_EXTERN | 77 | #if defined bb_need_too_few_args || ! defined BB_DECLARE_EXTERN |
78 | BB_DEF_MESSAGE(too_few_args, "%s: too few arguments\n") | 78 | BB_DEF_MESSAGE(too_few_args, "too few arguments\n") |
79 | #endif | 79 | #endif |
80 | 80 | ||
81 | 81 | ||
diff --git a/miscutils/dc.c b/miscutils/dc.c index 5bf3bc984..7b13cb943 100644 --- a/miscutils/dc.c +++ b/miscutils/dc.c | |||
@@ -22,7 +22,7 @@ static unsigned int pointer; | |||
22 | static void push(double a) | 22 | static void push(double a) |
23 | { | 23 | { |
24 | if (pointer >= (sizeof(stack) / sizeof(*stack))) { | 24 | if (pointer >= (sizeof(stack) / sizeof(*stack))) { |
25 | fprintf(stderr, "dc: stack overflow\n"); | 25 | errorMsg("stack overflow\n"); |
26 | exit(-1); | 26 | exit(-1); |
27 | } else | 27 | } else |
28 | stack[pointer++] = a; | 28 | stack[pointer++] = a; |
@@ -31,7 +31,7 @@ static void push(double a) | |||
31 | static double pop() | 31 | static double pop() |
32 | { | 32 | { |
33 | if (pointer == 0) { | 33 | if (pointer == 0) { |
34 | fprintf(stderr, "dc: stack underflow\n"); | 34 | errorMsg("stack underflow\n"); |
35 | exit(-1); | 35 | exit(-1); |
36 | } | 36 | } |
37 | return stack[--pointer]; | 37 | return stack[--pointer]; |
@@ -132,7 +132,7 @@ static void stack_machine(const char *argument) | |||
132 | } | 132 | } |
133 | o++; | 133 | o++; |
134 | } | 134 | } |
135 | fprintf(stderr, "dc: %s: syntax error.\n", argument); | 135 | errorMsg("%s: syntax error.\n", argument); |
136 | exit(-1); | 136 | exit(-1); |
137 | } | 137 | } |
138 | 138 | ||
diff --git a/miscutils/mt.c b/miscutils/mt.c index 304d66485..4ab478270 100644 --- a/miscutils/mt.c +++ b/miscutils/mt.c | |||
@@ -81,7 +81,7 @@ extern int mt_main(int argc, char **argv) | |||
81 | } | 81 | } |
82 | 82 | ||
83 | if (code->name == 0) { | 83 | if (code->name == 0) { |
84 | fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]); | 84 | errorMsg("unrecognized opcode %s.\n", argv[1]); |
85 | exit (FALSE); | 85 | exit (FALSE); |
86 | } | 86 | } |
87 | 87 | ||
@@ -62,7 +62,7 @@ extern int mkdir_main(int argc, char **argv) | |||
62 | /* Find the specified modes */ | 62 | /* Find the specified modes */ |
63 | mode = 0; | 63 | mode = 0; |
64 | if (parse_mode(*(++argv), &mode) == FALSE) { | 64 | if (parse_mode(*(++argv), &mode) == FALSE) { |
65 | fprintf(stderr, "Unknown mode: %s\n", *argv); | 65 | errorMsg("Unknown mode: %s\n", *argv); |
66 | exit FALSE; | 66 | exit FALSE; |
67 | } | 67 | } |
68 | /* Set the umask for this process so it doesn't | 68 | /* Set the umask for this process so it doesn't |
@@ -91,13 +91,13 @@ extern int mkdir_main(int argc, char **argv) | |||
91 | char buf[BUFSIZ + 1]; | 91 | char buf[BUFSIZ + 1]; |
92 | 92 | ||
93 | if (strlen(*argv) > BUFSIZ - 1) { | 93 | if (strlen(*argv) > BUFSIZ - 1) { |
94 | fprintf(stderr, name_too_long, "mkdir"); | 94 | errorMsg(name_too_long); |
95 | exit FALSE; | 95 | exit FALSE; |
96 | } | 96 | } |
97 | strcpy(buf, *argv); | 97 | strcpy(buf, *argv); |
98 | status = stat(buf, &statBuf); | 98 | status = stat(buf, &statBuf); |
99 | if (parentFlag == FALSE && status != -1 && errno != ENOENT) { | 99 | if (parentFlag == FALSE && status != -1 && errno != ENOENT) { |
100 | fprintf(stderr, "%s: File exists\n", buf); | 100 | errorMsg("%s: File exists\n", buf); |
101 | exit FALSE; | 101 | exit FALSE; |
102 | } | 102 | } |
103 | if (parentFlag == TRUE) { | 103 | if (parentFlag == TRUE) { |
diff --git a/mkfs_minix.c b/mkfs_minix.c index b6f958f46..e4dedaf82 100644 --- a/mkfs_minix.c +++ b/mkfs_minix.c | |||
@@ -263,7 +263,7 @@ static unsigned long req_nr_inodes = 0; | |||
263 | */ | 263 | */ |
264 | static volatile void die(char *str) | 264 | static volatile void die(char *str) |
265 | { | 265 | { |
266 | fprintf(stderr, "%s: %s\n", applet_name, str); | 266 | errorMsg("%s\n", str); |
267 | exit(8); | 267 | exit(8); |
268 | } | 268 | } |
269 | 269 | ||
@@ -814,8 +814,8 @@ extern int mkfs_minix_main(int argc, char **argv) | |||
814 | #ifdef HAVE_MINIX2 | 814 | #ifdef HAVE_MINIX2 |
815 | version2 = 1; | 815 | version2 = 1; |
816 | #else | 816 | #else |
817 | fprintf(stderr, "%s: not compiled with minix v2 support\n", | 817 | errorMsg("%s: not compiled with minix v2 support\n", |
818 | applet_name, device_name); | 818 | device_name); |
819 | exit(-1); | 819 | exit(-1); |
820 | #endif | 820 | #endif |
821 | break; | 821 | break; |
@@ -116,7 +116,7 @@ static void init_signature_page() | |||
116 | 116 | ||
117 | #ifdef PAGE_SIZE | 117 | #ifdef PAGE_SIZE |
118 | if (pagesize != PAGE_SIZE) | 118 | if (pagesize != PAGE_SIZE) |
119 | fprintf(stderr, "Assuming pages of size %d\n", pagesize); | 119 | errorMsg("Assuming pages of size %d\n", pagesize); |
120 | #endif | 120 | #endif |
121 | signature_page = (int *) xmalloc(pagesize); | 121 | signature_page = (int *) xmalloc(pagesize); |
122 | memset(signature_page, 0, pagesize); | 122 | memset(signature_page, 0, pagesize); |
@@ -204,7 +204,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr) | |||
204 | 204 | ||
205 | void die(const char *str) | 205 | void die(const char *str) |
206 | { | 206 | { |
207 | fprintf(stderr, "%s: %s\n", applet_name, str); | 207 | errorMsg("%s\n", str); |
208 | exit(FALSE); | 208 | exit(FALSE); |
209 | } | 209 | } |
210 | 210 | ||
@@ -345,18 +345,14 @@ int mkswap_main(int argc, char **argv) | |||
345 | } | 345 | } |
346 | } | 346 | } |
347 | if (!device_name) { | 347 | if (!device_name) { |
348 | fprintf(stderr, | 348 | errorMsg("error: Nowhere to set up swap on?\n"); |
349 | "%s: error: Nowhere to set up swap on?\n", applet_name); | ||
350 | usage(mkswap_usage); | 349 | usage(mkswap_usage); |
351 | } | 350 | } |
352 | sz = get_size(device_name); | 351 | sz = get_size(device_name); |
353 | if (!PAGES) { | 352 | if (!PAGES) { |
354 | PAGES = sz; | 353 | PAGES = sz; |
355 | } else if (PAGES > sz && !force) { | 354 | } else if (PAGES > sz && !force) { |
356 | fprintf(stderr, | 355 | errorMsg("error: size %ld is larger than device size %d\n", |
357 | "%s: error: " | ||
358 | "size %ld is larger than device size %d\n", | ||
359 | applet_name, | ||
360 | PAGES * (pagesize / 1024), sz * (pagesize / 1024)); | 356 | PAGES * (pagesize / 1024), sz * (pagesize / 1024)); |
361 | exit(FALSE); | 357 | exit(FALSE); |
362 | } | 358 | } |
@@ -372,14 +368,12 @@ int mkswap_main(int argc, char **argv) | |||
372 | version = 1; | 368 | version = 1; |
373 | } | 369 | } |
374 | if (version != 0 && version != 1) { | 370 | if (version != 0 && version != 1) { |
375 | fprintf(stderr, "%s: error: unknown version %d\n", | 371 | errorMsg("error: unknown version %d\n", version); |
376 | applet_name, version); | ||
377 | usage(mkswap_usage); | 372 | usage(mkswap_usage); |
378 | } | 373 | } |
379 | if (PAGES < 10) { | 374 | if (PAGES < 10) { |
380 | fprintf(stderr, | 375 | errorMsg("error: swap area needs to be at least %ldkB\n", |
381 | "%s: error: swap area needs to be at least %ldkB\n", | 376 | (long) (10 * pagesize / 1024)); |
382 | applet_name, (long) (10 * pagesize / 1024)); | ||
383 | usage(mkswap_usage); | 377 | usage(mkswap_usage); |
384 | } | 378 | } |
385 | #if 0 | 379 | #if 0 |
@@ -397,8 +391,8 @@ int mkswap_main(int argc, char **argv) | |||
397 | #endif | 391 | #endif |
398 | if (PAGES > maxpages) { | 392 | if (PAGES > maxpages) { |
399 | PAGES = maxpages; | 393 | PAGES = maxpages; |
400 | fprintf(stderr, "%s: warning: truncating swap area to %ldkB\n", | 394 | errorMsg("warning: truncating swap area to %ldkB\n", |
401 | applet_name, PAGES * pagesize / 1024); | 395 | PAGES * pagesize / 1024); |
402 | } | 396 | } |
403 | 397 | ||
404 | DEV = open(device_name, O_RDWR); | 398 | DEV = open(device_name, O_RDWR); |
@@ -424,11 +418,10 @@ int mkswap_main(int argc, char **argv) | |||
424 | for (sum = 0; q >= (unsigned short *) buffer;) | 418 | for (sum = 0; q >= (unsigned short *) buffer;) |
425 | sum ^= *q--; | 419 | sum ^= *q--; |
426 | if (!sum) { | 420 | if (!sum) { |
427 | fprintf(stderr, "\ | 421 | errorMsg("Device '%s' contains a valid Sun disklabel.\n" |
428 | %s: Device '%s' contains a valid Sun disklabel.\n\ | 422 | "This probably means creating v0 swap would destroy your partition table\n" |
429 | This probably means creating v0 swap would destroy your partition table\n\ | 423 | "No swap created. If you really want to create swap v0 on that device, use\n" |
430 | No swap created. If you really want to create swap v0 on that device, use\n\ | 424 | "the -f option to force it.\n", device_name); |
431 | the -f option to force it.\n", applet_name, device_name); | ||
432 | exit(FALSE); | 425 | exit(FALSE); |
433 | } | 426 | } |
434 | } | 427 | } |
diff --git a/modutils/insmod.c b/modutils/insmod.c index 7e90dfbd9..b3d5ac837 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -70,7 +70,7 @@ | |||
70 | #ifndef MODUTILS_MODULE_H | 70 | #ifndef MODUTILS_MODULE_H |
71 | #define MODUTILS_MODULE_H 1 | 71 | #define MODUTILS_MODULE_H 1 |
72 | 72 | ||
73 | #ident "$Id: insmod.c,v 1.15 2000/07/11 17:52:22 andersen Exp $" | 73 | #ident "$Id: insmod.c,v 1.16 2000/07/14 01:51:25 kraai Exp $" |
74 | 74 | ||
75 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 75 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
76 | We do not use the kernel headers directly because we do not wish | 76 | We do not use the kernel headers directly because we do not wish |
@@ -276,7 +276,7 @@ int delete_module(const char *); | |||
276 | #ifndef MODUTILS_OBJ_H | 276 | #ifndef MODUTILS_OBJ_H |
277 | #define MODUTILS_OBJ_H 1 | 277 | #define MODUTILS_OBJ_H 1 |
278 | 278 | ||
279 | #ident "$Id: insmod.c,v 1.15 2000/07/11 17:52:22 andersen Exp $" | 279 | #ident "$Id: insmod.c,v 1.16 2000/07/14 01:51:25 kraai Exp $" |
280 | 280 | ||
281 | /* The relocatable object is manipulated using elfin types. */ | 281 | /* The relocatable object is manipulated using elfin types. */ |
282 | 282 | ||
@@ -938,7 +938,7 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name, | |||
938 | /* Don't report an error if the symbol is coming from | 938 | /* Don't report an error if the symbol is coming from |
939 | the kernel or some external module. */ | 939 | the kernel or some external module. */ |
940 | if (secidx <= SHN_HIRESERVE) | 940 | if (secidx <= SHN_HIRESERVE) |
941 | fprintf(stderr, "%s multiply defined\n", name); | 941 | errorMsg("%s multiply defined\n", name); |
942 | return sym; | 942 | return sym; |
943 | } | 943 | } |
944 | } | 944 | } |
@@ -1201,7 +1201,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1201 | 1201 | ||
1202 | /* Also check that the parameter was not resolved from the kernel. */ | 1202 | /* Also check that the parameter was not resolved from the kernel. */ |
1203 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { | 1203 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { |
1204 | fprintf(stderr, "symbol for parameter %s not found\n", p); | 1204 | errorMsg("symbol for parameter %s not found\n", p); |
1205 | return 0; | 1205 | return 0; |
1206 | } | 1206 | } |
1207 | 1207 | ||
@@ -1214,7 +1214,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1214 | str = alloca(strlen(q)); | 1214 | str = alloca(strlen(q)); |
1215 | for (r = str, q++; *q != '"'; ++q, ++r) { | 1215 | for (r = str, q++; *q != '"'; ++q, ++r) { |
1216 | if (*q == '\0') { | 1216 | if (*q == '\0') { |
1217 | fprintf(stderr, "improperly terminated string argument for %s\n", p); | 1217 | errorMsg("improperly terminated string argument for %s\n", p); |
1218 | return 0; | 1218 | return 0; |
1219 | } else if (*q == '\\') | 1219 | } else if (*q == '\\') |
1220 | switch (*++q) { | 1220 | switch (*++q) { |
@@ -1567,7 +1567,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1567 | p = get_modinfo_value(f, key); | 1567 | p = get_modinfo_value(f, key); |
1568 | key += 5; | 1568 | key += 5; |
1569 | if (p == NULL) { | 1569 | if (p == NULL) { |
1570 | fprintf(stderr, "invalid parameter %s\n", key); | 1570 | errorMsg("invalid parameter %s\n", key); |
1571 | return 0; | 1571 | return 0; |
1572 | } | 1572 | } |
1573 | 1573 | ||
@@ -1575,7 +1575,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1575 | 1575 | ||
1576 | /* Also check that the parameter was not resolved from the kernel. */ | 1576 | /* Also check that the parameter was not resolved from the kernel. */ |
1577 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { | 1577 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { |
1578 | fprintf(stderr, "symbol for parameter %s not found\n", key); | 1578 | errorMsg("symbol for parameter %s not found\n", key); |
1579 | return 0; | 1579 | return 0; |
1580 | } | 1580 | } |
1581 | 1581 | ||
@@ -1603,8 +1603,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1603 | str = alloca(strlen(q)); | 1603 | str = alloca(strlen(q)); |
1604 | for (r = str, q++; *q != '"'; ++q, ++r) { | 1604 | for (r = str, q++; *q != '"'; ++q, ++r) { |
1605 | if (*q == '\0') { | 1605 | if (*q == '\0') { |
1606 | fprintf(stderr, | 1606 | errorMsg("improperly terminated string argument for %s\n", |
1607 | "improperly terminated string argument for %s\n", | ||
1608 | key); | 1607 | key); |
1609 | return 0; | 1608 | return 0; |
1610 | } else if (*q == '\\') | 1609 | } else if (*q == '\\') |
@@ -1698,8 +1697,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1698 | /* Get the size of each member */ | 1697 | /* Get the size of each member */ |
1699 | /* Probably we should do that outside the loop ? */ | 1698 | /* Probably we should do that outside the loop ? */ |
1700 | if (!isdigit(*(p + 1))) { | 1699 | if (!isdigit(*(p + 1))) { |
1701 | fprintf(stderr, | 1700 | errorMsg("parameter type 'c' for %s must be followed by" |
1702 | "parameter type 'c' for %s must be followed by" | ||
1703 | " the maximum size\n", key); | 1701 | " the maximum size\n", key); |
1704 | return 0; | 1702 | return 0; |
1705 | } | 1703 | } |
@@ -1707,8 +1705,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1707 | 1705 | ||
1708 | /* Check length */ | 1706 | /* Check length */ |
1709 | if (strlen(str) >= charssize) { | 1707 | if (strlen(str) >= charssize) { |
1710 | fprintf(stderr, | 1708 | errorMsg("string too long for %s (max %ld)\n", key, |
1711 | "string too long for %s (max %ld)\n", key, | ||
1712 | charssize - 1); | 1709 | charssize - 1); |
1713 | return 0; | 1710 | return 0; |
1714 | } | 1711 | } |
@@ -1737,8 +1734,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1737 | break; | 1734 | break; |
1738 | 1735 | ||
1739 | default: | 1736 | default: |
1740 | fprintf(stderr, "unknown parameter type '%c' for %s\n", | 1737 | errorMsg("unknown parameter type '%c' for %s\n", *p, key); |
1741 | *p, key); | ||
1742 | return 0; | 1738 | return 0; |
1743 | } | 1739 | } |
1744 | } | 1740 | } |
@@ -1757,22 +1753,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1757 | 1753 | ||
1758 | case ',': | 1754 | case ',': |
1759 | if (++n > max) { | 1755 | if (++n > max) { |
1760 | fprintf(stderr, "too many values for %s (max %d)\n", | 1756 | errorMsg("too many values for %s (max %d)\n", key, max); |
1761 | key, max); | ||
1762 | return 0; | 1757 | return 0; |
1763 | } | 1758 | } |
1764 | ++q; | 1759 | ++q; |
1765 | break; | 1760 | break; |
1766 | 1761 | ||
1767 | default: | 1762 | default: |
1768 | fprintf(stderr, "invalid argument syntax for %s\n", key); | 1763 | errorMsg("invalid argument syntax for %s\n", key); |
1769 | return 0; | 1764 | return 0; |
1770 | } | 1765 | } |
1771 | } | 1766 | } |
1772 | 1767 | ||
1773 | end_of_arg: | 1768 | end_of_arg: |
1774 | if (n < min) { | 1769 | if (n < min) { |
1775 | fprintf(stderr, "too few values for %s (min %d)\n", key, min); | 1770 | errorMsg("too few values for %s (min %d)\n", key, min); |
1776 | return 0; | 1771 | return 0; |
1777 | } | 1772 | } |
1778 | 1773 | ||
@@ -2157,7 +2152,7 @@ int obj_check_undefineds(struct obj_file *f) | |||
2157 | sym->secidx = SHN_ABS; | 2152 | sym->secidx = SHN_ABS; |
2158 | sym->value = 0; | 2153 | sym->value = 0; |
2159 | } else { | 2154 | } else { |
2160 | fprintf(stderr, "unresolved symbol %s\n", sym->name); | 2155 | errorMsg("unresolved symbol %s\n", sym->name); |
2161 | ret = 0; | 2156 | ret = 0; |
2162 | } | 2157 | } |
2163 | } | 2158 | } |
@@ -2380,11 +2375,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base) | |||
2380 | errmsg = "Unhandled relocation"; | 2375 | errmsg = "Unhandled relocation"; |
2381 | bad_reloc: | 2376 | bad_reloc: |
2382 | if (extsym) { | 2377 | if (extsym) { |
2383 | fprintf(stderr, "%s of type %ld for %s\n", errmsg, | 2378 | errorMsg("%s of type %ld for %s\n", errmsg, |
2384 | (long) ELFW(R_TYPE) (rel->r_info), | 2379 | (long) ELFW(R_TYPE) (rel->r_info), |
2385 | strtab + extsym->st_name); | 2380 | strtab + extsym->st_name); |
2386 | } else { | 2381 | } else { |
2387 | fprintf(stderr, "%s of type %ld\n", errmsg, | 2382 | errorMsg("%s of type %ld\n", errmsg, |
2388 | (long) ELFW(R_TYPE) (rel->r_info)); | 2383 | (long) ELFW(R_TYPE) (rel->r_info)); |
2389 | } | 2384 | } |
2390 | ret = 0; | 2385 | ret = 0; |
@@ -2469,25 +2464,25 @@ struct obj_file *obj_load(FILE * fp) | |||
2469 | || f->header.e_ident[EI_MAG1] != ELFMAG1 | 2464 | || f->header.e_ident[EI_MAG1] != ELFMAG1 |
2470 | || f->header.e_ident[EI_MAG2] != ELFMAG2 | 2465 | || f->header.e_ident[EI_MAG2] != ELFMAG2 |
2471 | || f->header.e_ident[EI_MAG3] != ELFMAG3) { | 2466 | || f->header.e_ident[EI_MAG3] != ELFMAG3) { |
2472 | fprintf(stderr, "not an ELF file\n"); | 2467 | errorMsg("not an ELF file\n"); |
2473 | return NULL; | 2468 | return NULL; |
2474 | } | 2469 | } |
2475 | if (f->header.e_ident[EI_CLASS] != ELFCLASSM | 2470 | if (f->header.e_ident[EI_CLASS] != ELFCLASSM |
2476 | || f->header.e_ident[EI_DATA] != ELFDATAM | 2471 | || f->header.e_ident[EI_DATA] != ELFDATAM |
2477 | || f->header.e_ident[EI_VERSION] != EV_CURRENT | 2472 | || f->header.e_ident[EI_VERSION] != EV_CURRENT |
2478 | || !MATCH_MACHINE(f->header.e_machine)) { | 2473 | || !MATCH_MACHINE(f->header.e_machine)) { |
2479 | fprintf(stderr, "ELF file not for this architecture\n"); | 2474 | errorMsg("ELF file not for this architecture\n"); |
2480 | return NULL; | 2475 | return NULL; |
2481 | } | 2476 | } |
2482 | if (f->header.e_type != ET_REL) { | 2477 | if (f->header.e_type != ET_REL) { |
2483 | fprintf(stderr, "ELF file not a relocatable object\n"); | 2478 | errorMsg("ELF file not a relocatable object\n"); |
2484 | return NULL; | 2479 | return NULL; |
2485 | } | 2480 | } |
2486 | 2481 | ||
2487 | /* Read the section headers. */ | 2482 | /* Read the section headers. */ |
2488 | 2483 | ||
2489 | if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { | 2484 | if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { |
2490 | fprintf(stderr, "section header size mismatch: %lu != %lu\n", | 2485 | errorMsg("section header size mismatch: %lu != %lu\n", |
2491 | (unsigned long) f->header.e_shentsize, | 2486 | (unsigned long) f->header.e_shentsize, |
2492 | (unsigned long) sizeof(ElfW(Shdr))); | 2487 | (unsigned long) sizeof(ElfW(Shdr))); |
2493 | return NULL; | 2488 | return NULL; |
@@ -2540,13 +2535,11 @@ struct obj_file *obj_load(FILE * fp) | |||
2540 | 2535 | ||
2541 | #if SHT_RELM == SHT_REL | 2536 | #if SHT_RELM == SHT_REL |
2542 | case SHT_RELA: | 2537 | case SHT_RELA: |
2543 | fprintf(stderr, | 2538 | errorMsg("RELA relocations not supported on this architecture\n"); |
2544 | "RELA relocations not supported on this architecture\n"); | ||
2545 | return NULL; | 2539 | return NULL; |
2546 | #else | 2540 | #else |
2547 | case SHT_REL: | 2541 | case SHT_REL: |
2548 | fprintf(stderr, | 2542 | errorMsg("REL relocations not supported on this architecture\n"); |
2549 | "REL relocations not supported on this architecture\n"); | ||
2550 | return NULL; | 2543 | return NULL; |
2551 | #endif | 2544 | #endif |
2552 | 2545 | ||
@@ -2559,7 +2552,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2559 | break; | 2552 | break; |
2560 | } | 2553 | } |
2561 | 2554 | ||
2562 | fprintf(stderr, "can't handle sections of type %ld\n", | 2555 | errorMsg("can't handle sections of type %ld\n", |
2563 | (long) sec->header.sh_type); | 2556 | (long) sec->header.sh_type); |
2564 | return NULL; | 2557 | return NULL; |
2565 | } | 2558 | } |
@@ -2588,7 +2581,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2588 | ElfW(Sym) * sym; | 2581 | ElfW(Sym) * sym; |
2589 | 2582 | ||
2590 | if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { | 2583 | if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { |
2591 | fprintf(stderr, "symbol size mismatch: %lu != %lu\n", | 2584 | errorMsg("symbol size mismatch: %lu != %lu\n", |
2592 | (unsigned long) sec->header.sh_entsize, | 2585 | (unsigned long) sec->header.sh_entsize, |
2593 | (unsigned long) sizeof(ElfW(Sym))); | 2586 | (unsigned long) sizeof(ElfW(Sym))); |
2594 | return NULL; | 2587 | return NULL; |
@@ -2620,8 +2613,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2620 | 2613 | ||
2621 | case SHT_RELM: | 2614 | case SHT_RELM: |
2622 | if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { | 2615 | if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { |
2623 | fprintf(stderr, | 2616 | errorMsg("relocation entry size mismatch: %lu != %lu\n", |
2624 | "relocation entry size mismatch: %lu != %lu\n", | ||
2625 | (unsigned long) sec->header.sh_entsize, | 2617 | (unsigned long) sec->header.sh_entsize, |
2626 | (unsigned long) sizeof(ElfW(RelM))); | 2618 | (unsigned long) sizeof(ElfW(RelM))); |
2627 | return NULL; | 2619 | return NULL; |
@@ -2754,20 +2746,20 @@ extern int insmod_main( int argc, char **argv) | |||
2754 | } else { | 2746 | } else { |
2755 | m_version = old_get_module_version(f, m_strversion); | 2747 | m_version = old_get_module_version(f, m_strversion); |
2756 | if (m_version == -1) { | 2748 | if (m_version == -1) { |
2757 | fprintf(stderr, | 2749 | errorMsg("couldn't find the kernel version the module was " |
2758 | "couldn't find the kernel version the module was compiled for\n"); | 2750 | "compiled for\n"); |
2759 | goto out; | 2751 | goto out; |
2760 | } | 2752 | } |
2761 | } | 2753 | } |
2762 | 2754 | ||
2763 | if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) { | 2755 | if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) { |
2764 | if (flag_force_load) { | 2756 | if (flag_force_load) { |
2765 | fprintf(stderr, "Warning: kernel-module version mismatch\n" | 2757 | errorMsg("Warning: kernel-module version mismatch\n" |
2766 | "\t%s was compiled for kernel version %s\n" | 2758 | "\t%s was compiled for kernel version %s\n" |
2767 | "\twhile this kernel is version %s\n", | 2759 | "\twhile this kernel is version %s\n", |
2768 | m_filename, m_strversion, k_strversion); | 2760 | m_filename, m_strversion, k_strversion); |
2769 | } else { | 2761 | } else { |
2770 | fprintf(stderr, "kernel-module version mismatch\n" | 2762 | errorMsg("kernel-module version mismatch\n" |
2771 | "\t%s was compiled for kernel version %s\n" | 2763 | "\t%s was compiled for kernel version %s\n" |
2772 | "\twhile this kernel is version %s.\n", | 2764 | "\twhile this kernel is version %s.\n", |
2773 | m_filename, m_strversion, k_strversion); | 2765 | m_filename, m_strversion, k_strversion); |
@@ -2785,7 +2777,7 @@ extern int insmod_main( int argc, char **argv) | |||
2785 | goto out; | 2777 | goto out; |
2786 | k_crcs = new_is_kernel_checksummed(); | 2778 | k_crcs = new_is_kernel_checksummed(); |
2787 | #else | 2779 | #else |
2788 | fprintf(stderr, "Not configured to support new kernels\n"); | 2780 | errorMsg("Not configured to support new kernels\n"); |
2789 | goto out; | 2781 | goto out; |
2790 | #endif | 2782 | #endif |
2791 | } else { | 2783 | } else { |
@@ -2794,7 +2786,7 @@ extern int insmod_main( int argc, char **argv) | |||
2794 | goto out; | 2786 | goto out; |
2795 | k_crcs = old_is_kernel_checksummed(); | 2787 | k_crcs = old_is_kernel_checksummed(); |
2796 | #else | 2788 | #else |
2797 | fprintf(stderr, "Not configured to support old kernels\n"); | 2789 | errorMsg("Not configured to support old kernels\n"); |
2798 | goto out; | 2790 | goto out; |
2799 | #endif | 2791 | #endif |
2800 | } | 2792 | } |
@@ -2851,11 +2843,10 @@ extern int insmod_main( int argc, char **argv) | |||
2851 | case 0: | 2843 | case 0: |
2852 | break; | 2844 | break; |
2853 | case EEXIST: | 2845 | case EEXIST: |
2854 | fprintf(stderr, "A module named %s already exists\n", m_name); | 2846 | errorMsg("A module named %s already exists\n", m_name); |
2855 | goto out; | 2847 | goto out; |
2856 | case ENOMEM: | 2848 | case ENOMEM: |
2857 | fprintf(stderr, | 2849 | errorMsg("Can't allocate kernel memory for module; needed %lu bytes\n", |
2858 | "Can't allocate kernel memory for module; needed %lu bytes\n", | ||
2859 | m_size); | 2850 | m_size); |
2860 | goto out; | 2851 | goto out; |
2861 | default: | 2852 | default: |
@@ -157,15 +157,15 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
157 | 157 | ||
158 | specialfile = find_unused_loop_device(); | 158 | specialfile = find_unused_loop_device(); |
159 | if (specialfile == NULL) { | 159 | if (specialfile == NULL) { |
160 | fprintf(stderr, "Could not find a spare loop device\n"); | 160 | errorMsg("Could not find a spare loop device\n"); |
161 | return (FALSE); | 161 | return (FALSE); |
162 | } | 162 | } |
163 | if (set_loop(specialfile, lofile, 0, &loro)) { | 163 | if (set_loop(specialfile, lofile, 0, &loro)) { |
164 | fprintf(stderr, "Could not setup loop device\n"); | 164 | errorMsg("Could not setup loop device\n"); |
165 | return (FALSE); | 165 | return (FALSE); |
166 | } | 166 | } |
167 | if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ | 167 | if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ |
168 | fprintf(stderr, "WARNING: loop device is read-only\n"); | 168 | errorMsg("WARNING: loop device is read-only\n"); |
169 | flags &= ~MS_RDONLY; | 169 | flags &= ~MS_RDONLY; |
170 | } | 170 | } |
171 | } | 171 | } |
@@ -329,7 +329,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
329 | 329 | ||
330 | if (status == FALSE) { | 330 | if (status == FALSE) { |
331 | if (whineOnErrors == TRUE) { | 331 | if (whineOnErrors == TRUE) { |
332 | fprintf(stderr, "Mounting %s on %s failed: %s\n", | 332 | errorMsg("Mounting %s on %s failed: %s\n", |
333 | blockDevice, directory, strerror(errno)); | 333 | blockDevice, directory, strerror(errno)); |
334 | } | 334 | } |
335 | return (FALSE); | 335 | return (FALSE); |
@@ -81,7 +81,7 @@ extern int mt_main(int argc, char **argv) | |||
81 | } | 81 | } |
82 | 82 | ||
83 | if (code->name == 0) { | 83 | if (code->name == 0) { |
84 | fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]); | 84 | errorMsg("unrecognized opcode %s.\n", argv[1]); |
85 | exit (FALSE); | 85 | exit (FALSE); |
86 | } | 86 | } |
87 | 87 | ||
diff --git a/networking/hostname.c b/networking/hostname.c index e909138e4..60f66c073 100644 --- a/networking/hostname.c +++ b/networking/hostname.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * $Id: hostname.c,v 1.10 2000/06/19 17:25:39 andersen Exp $ | 3 | * $Id: hostname.c,v 1.11 2000/07/14 01:51:25 kraai Exp $ |
4 | * Mini hostname implementation for busybox | 4 | * Mini hostname implementation for busybox |
5 | * | 5 | * |
6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
@@ -55,8 +55,7 @@ void do_sethostname(char *s, int isfile) | |||
55 | if (!isfile) { | 55 | if (!isfile) { |
56 | if (sethostname(s, strlen(s)) < 0) { | 56 | if (sethostname(s, strlen(s)) < 0) { |
57 | if (errno == EPERM) | 57 | if (errno == EPERM) |
58 | fprintf(stderr, | 58 | errorMsg("you must be root to change the hostname\n"); |
59 | "hostname: you must be root to change the hostname\n"); | ||
60 | else | 59 | else |
61 | perror("sethostname"); | 60 | perror("sethostname"); |
62 | exit(1); | 61 | exit(1); |
diff --git a/networking/ping.c b/networking/ping.c index 0359abbd1..52cb07be7 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * $Id: ping.c,v 1.20 2000/07/12 17:02:35 kraai Exp $ | 3 | * $Id: ping.c,v 1.21 2000/07/14 01:51:25 kraai Exp $ |
4 | * Mini ping implementation for busybox | 4 | * Mini ping implementation for busybox |
5 | * | 5 | * |
6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
@@ -208,7 +208,7 @@ static void ping(const char *host) | |||
208 | 208 | ||
209 | pingaddr.sin_family = AF_INET; | 209 | pingaddr.sin_family = AF_INET; |
210 | if (!(h = gethostbyname(host))) { | 210 | if (!(h = gethostbyname(host))) { |
211 | fprintf(stderr, "ping: unknown host %s\n", host); | 211 | errorMsg("unknown host %s\n", host); |
212 | exit(1); | 212 | exit(1); |
213 | } | 213 | } |
214 | memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); | 214 | memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); |
@@ -225,7 +225,7 @@ static void ping(const char *host) | |||
225 | if (c < 0 || c != sizeof(packet)) { | 225 | if (c < 0 || c != sizeof(packet)) { |
226 | if (c < 0) | 226 | if (c < 0) |
227 | perror("ping: sendto"); | 227 | perror("ping: sendto"); |
228 | fprintf(stderr, "ping: write incomplete\n"); | 228 | errorMsg("write incomplete\n"); |
229 | exit(1); | 229 | exit(1); |
230 | } | 230 | } |
231 | 231 | ||
@@ -433,8 +433,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) | |||
433 | printf("\n"); | 433 | printf("\n"); |
434 | } else | 434 | } else |
435 | if (icmppkt->icmp_type != ICMP_ECHO) | 435 | if (icmppkt->icmp_type != ICMP_ECHO) |
436 | fprintf(stderr, | 436 | errorMsg("Warning: Got ICMP %d (%s)\n", |
437 | "Warning: Got ICMP %d (%s)\n", | ||
438 | icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); | 437 | icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); |
439 | } | 438 | } |
440 | 439 | ||
@@ -452,7 +451,7 @@ static void ping(const char *host) | |||
452 | if ((pingsock = socket(AF_INET, SOCK_RAW, | 451 | if ((pingsock = socket(AF_INET, SOCK_RAW, |
453 | (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */ | 452 | (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */ |
454 | if (errno == EPERM) { | 453 | if (errno == EPERM) { |
455 | fprintf(stderr, "ping: permission denied. (are you root?)\n"); | 454 | errorMsg("permission denied. (are you root?)\n"); |
456 | } else { | 455 | } else { |
457 | perror("ping: creating a raw socket"); | 456 | perror("ping: creating a raw socket"); |
458 | } | 457 | } |
@@ -466,13 +465,12 @@ static void ping(const char *host) | |||
466 | 465 | ||
467 | pingaddr.sin_family = AF_INET; | 466 | pingaddr.sin_family = AF_INET; |
468 | if (!(h = gethostbyname(host))) { | 467 | if (!(h = gethostbyname(host))) { |
469 | fprintf(stderr, "ping: unknown host %s\n", host); | 468 | errorMsg("unknown host %s\n", host); |
470 | exit(1); | 469 | exit(1); |
471 | } | 470 | } |
472 | 471 | ||
473 | if (h->h_addrtype != AF_INET) { | 472 | if (h->h_addrtype != AF_INET) { |
474 | fprintf(stderr, | 473 | errorMsg("unknown address type; only AF_INET is currently supported.\n"); |
475 | "ping: unknown address type; only AF_INET is currently supported.\n"); | ||
476 | exit(1); | 474 | exit(1); |
477 | } | 475 | } |
478 | 476 | ||
diff --git a/nfsmount.c b/nfsmount.c index 8cdfebfce..ad0b5842d 100644 --- a/nfsmount.c +++ b/nfsmount.c | |||
@@ -312,8 +312,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
312 | msock = fsock = -1; | 312 | msock = fsock = -1; |
313 | mclient = NULL; | 313 | mclient = NULL; |
314 | if (strlen(spec) >= sizeof(hostdir)) { | 314 | if (strlen(spec) >= sizeof(hostdir)) { |
315 | fprintf(stderr, _("mount: " | 315 | errorMsg("excessively long host:dir argument\n"); |
316 | "excessively long host:dir argument\n")); | ||
317 | goto fail; | 316 | goto fail; |
318 | } | 317 | } |
319 | strcpy(hostdir, spec); | 318 | strcpy(hostdir, spec); |
@@ -325,12 +324,10 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
325 | until they can be fully supported. (mack@sgi.com) */ | 324 | until they can be fully supported. (mack@sgi.com) */ |
326 | if ((s = strchr(hostdir, ','))) { | 325 | if ((s = strchr(hostdir, ','))) { |
327 | *s = '\0'; | 326 | *s = '\0'; |
328 | fprintf(stderr, _("mount: warning: " | 327 | errorMsg("warning: multiple hostnames not supported\n"); |
329 | "multiple hostnames not supported\n")); | ||
330 | } | 328 | } |
331 | } else { | 329 | } else { |
332 | fprintf(stderr, _("mount: " | 330 | errorMsg("directory to mount not in host:dir format\n"); |
333 | "directory to mount not in host:dir format\n")); | ||
334 | goto fail; | 331 | goto fail; |
335 | } | 332 | } |
336 | 333 | ||
@@ -340,13 +337,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
340 | #endif | 337 | #endif |
341 | { | 338 | { |
342 | if ((hp = gethostbyname(hostname)) == NULL) { | 339 | if ((hp = gethostbyname(hostname)) == NULL) { |
343 | fprintf(stderr, _("mount: can't get address for %s\n"), | 340 | errorMsg("can't get address for %s\n", hostname); |
344 | hostname); | ||
345 | goto fail; | 341 | goto fail; |
346 | } else { | 342 | } else { |
347 | if (hp->h_length > sizeof(struct in_addr)) { | 343 | if (hp->h_length > sizeof(struct in_addr)) { |
348 | fprintf(stderr, | 344 | errorMsg("got bad hp->h_length\n"); |
349 | _("mount: got bad hp->h_length\n")); | ||
350 | hp->h_length = sizeof(struct in_addr); | 345 | hp->h_length = sizeof(struct in_addr); |
351 | } | 346 | } |
352 | memcpy(&server_addr.sin_addr, | 347 | memcpy(&server_addr.sin_addr, |
@@ -363,8 +358,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
363 | if (!old_opts) | 358 | if (!old_opts) |
364 | old_opts = ""; | 359 | old_opts = ""; |
365 | if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { | 360 | if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { |
366 | fprintf(stderr, _("mount: " | 361 | errorMsg("excessively long option argument\n"); |
367 | "excessively long option argument\n")); | ||
368 | goto fail; | 362 | goto fail; |
369 | } | 363 | } |
370 | sprintf(new_opts, "%s%saddr=%s", | 364 | sprintf(new_opts, "%s%saddr=%s", |
@@ -524,11 +518,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
524 | data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); | 518 | data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); |
525 | #endif | 519 | #endif |
526 | if (nfsvers > MAX_NFSPROT) { | 520 | if (nfsvers > MAX_NFSPROT) { |
527 | fprintf(stderr, "NFSv%d not supported!\n", nfsvers); | 521 | errorMsg("NFSv%d not supported!\n", nfsvers); |
528 | return 0; | 522 | return 0; |
529 | } | 523 | } |
530 | if (mountvers > MAX_NFSPROT) { | 524 | if (mountvers > MAX_NFSPROT) { |
531 | fprintf(stderr, "NFSv%d not supported!\n", nfsvers); | 525 | errorMsg("NFSv%d not supported!\n", nfsvers); |
532 | return 0; | 526 | return 0; |
533 | } | 527 | } |
534 | if (nfsvers && !mountvers) | 528 | if (nfsvers && !mountvers) |
@@ -588,13 +582,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
588 | mount_server_addr.sin_addr.s_addr = inet_addr(hostname); | 582 | mount_server_addr.sin_addr.s_addr = inet_addr(hostname); |
589 | } else { | 583 | } else { |
590 | if ((hp = gethostbyname(mounthost)) == NULL) { | 584 | if ((hp = gethostbyname(mounthost)) == NULL) { |
591 | fprintf(stderr, _("mount: can't get address for %s\n"), | 585 | errorMsg("can't get address for %s\n", hostname); |
592 | hostname); | ||
593 | goto fail; | 586 | goto fail; |
594 | } else { | 587 | } else { |
595 | if (hp->h_length > sizeof(struct in_addr)) { | 588 | if (hp->h_length > sizeof(struct in_addr)) { |
596 | fprintf(stderr, | 589 | errorMsg("got bad hp->h_length?\n"); |
597 | _("mount: got bad hp->h_length?\n")); | ||
598 | hp->h_length = sizeof(struct in_addr); | 590 | hp->h_length = sizeof(struct in_addr); |
599 | } | 591 | } |
600 | mount_server_addr.sin_family = AF_INET; | 592 | mount_server_addr.sin_family = AF_INET; |
@@ -729,8 +721,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
729 | 721 | ||
730 | if (nfsvers == 2) { | 722 | if (nfsvers == 2) { |
731 | if (status.nfsv2.fhs_status != 0) { | 723 | if (status.nfsv2.fhs_status != 0) { |
732 | fprintf(stderr, | 724 | errorMsg("%s:%s failed, reason given by server: %s\n", |
733 | "mount: %s:%s failed, reason given by server: %s\n", | ||
734 | hostname, dirname, | 725 | hostname, dirname, |
735 | nfs_strerror(status.nfsv2.fhs_status)); | 726 | nfs_strerror(status.nfsv2.fhs_status)); |
736 | goto fail; | 727 | goto fail; |
@@ -748,8 +739,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
748 | #if NFS_MOUNT_VERSION >= 4 | 739 | #if NFS_MOUNT_VERSION >= 4 |
749 | fhandle3 *fhandle; | 740 | fhandle3 *fhandle; |
750 | if (status.nfsv3.fhs_status != 0) { | 741 | if (status.nfsv3.fhs_status != 0) { |
751 | fprintf(stderr, | 742 | errorMsg("%s:%s failed, reason given by server: %s\n", |
752 | "mount: %s:%s failed, reason given by server: %s\n", | ||
753 | hostname, dirname, | 743 | hostname, dirname, |
754 | nfs_strerror(status.nfsv3.fhs_status)); | 744 | nfs_strerror(status.nfsv3.fhs_status)); |
755 | goto fail; | 745 | goto fail; |
@@ -1,6 +1,6 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | 1 | /* vi: set sw=4 ts=4: */ |
2 | /* | 2 | /* |
3 | * $Id: ping.c,v 1.20 2000/07/12 17:02:35 kraai Exp $ | 3 | * $Id: ping.c,v 1.21 2000/07/14 01:51:25 kraai Exp $ |
4 | * Mini ping implementation for busybox | 4 | * Mini ping implementation for busybox |
5 | * | 5 | * |
6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 6 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
@@ -208,7 +208,7 @@ static void ping(const char *host) | |||
208 | 208 | ||
209 | pingaddr.sin_family = AF_INET; | 209 | pingaddr.sin_family = AF_INET; |
210 | if (!(h = gethostbyname(host))) { | 210 | if (!(h = gethostbyname(host))) { |
211 | fprintf(stderr, "ping: unknown host %s\n", host); | 211 | errorMsg("unknown host %s\n", host); |
212 | exit(1); | 212 | exit(1); |
213 | } | 213 | } |
214 | memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); | 214 | memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); |
@@ -225,7 +225,7 @@ static void ping(const char *host) | |||
225 | if (c < 0 || c != sizeof(packet)) { | 225 | if (c < 0 || c != sizeof(packet)) { |
226 | if (c < 0) | 226 | if (c < 0) |
227 | perror("ping: sendto"); | 227 | perror("ping: sendto"); |
228 | fprintf(stderr, "ping: write incomplete\n"); | 228 | errorMsg("write incomplete\n"); |
229 | exit(1); | 229 | exit(1); |
230 | } | 230 | } |
231 | 231 | ||
@@ -433,8 +433,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) | |||
433 | printf("\n"); | 433 | printf("\n"); |
434 | } else | 434 | } else |
435 | if (icmppkt->icmp_type != ICMP_ECHO) | 435 | if (icmppkt->icmp_type != ICMP_ECHO) |
436 | fprintf(stderr, | 436 | errorMsg("Warning: Got ICMP %d (%s)\n", |
437 | "Warning: Got ICMP %d (%s)\n", | ||
438 | icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); | 437 | icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); |
439 | } | 438 | } |
440 | 439 | ||
@@ -452,7 +451,7 @@ static void ping(const char *host) | |||
452 | if ((pingsock = socket(AF_INET, SOCK_RAW, | 451 | if ((pingsock = socket(AF_INET, SOCK_RAW, |
453 | (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */ | 452 | (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */ |
454 | if (errno == EPERM) { | 453 | if (errno == EPERM) { |
455 | fprintf(stderr, "ping: permission denied. (are you root?)\n"); | 454 | errorMsg("permission denied. (are you root?)\n"); |
456 | } else { | 455 | } else { |
457 | perror("ping: creating a raw socket"); | 456 | perror("ping: creating a raw socket"); |
458 | } | 457 | } |
@@ -466,13 +465,12 @@ static void ping(const char *host) | |||
466 | 465 | ||
467 | pingaddr.sin_family = AF_INET; | 466 | pingaddr.sin_family = AF_INET; |
468 | if (!(h = gethostbyname(host))) { | 467 | if (!(h = gethostbyname(host))) { |
469 | fprintf(stderr, "ping: unknown host %s\n", host); | 468 | errorMsg("unknown host %s\n", host); |
470 | exit(1); | 469 | exit(1); |
471 | } | 470 | } |
472 | 471 | ||
473 | if (h->h_addrtype != AF_INET) { | 472 | if (h->h_addrtype != AF_INET) { |
474 | fprintf(stderr, | 473 | errorMsg("unknown address type; only AF_INET is currently supported.\n"); |
475 | "ping: unknown address type; only AF_INET is currently supported.\n"); | ||
476 | exit(1); | 474 | exit(1); |
477 | } | 475 | } |
478 | 476 | ||
diff --git a/procps/ps.c b/procps/ps.c index a8d000546..682135944 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -97,20 +97,20 @@ static void parse_proc_status(char *S, proc_t * P) | |||
97 | if (tmp) | 97 | if (tmp) |
98 | sscanf(tmp, "Pid:\t%d\n" "PPid:\t%d\n", &P->pid, &P->ppid); | 98 | sscanf(tmp, "Pid:\t%d\n" "PPid:\t%d\n", &P->pid, &P->ppid); |
99 | else | 99 | else |
100 | fprintf(stderr, "Internal error!\n"); | 100 | errorMsg("Internal error!\n"); |
101 | 101 | ||
102 | /* For busybox, ignoring effective, saved, etc */ | 102 | /* For busybox, ignoring effective, saved, etc */ |
103 | tmp = strstr(S, "Uid:"); | 103 | tmp = strstr(S, "Uid:"); |
104 | if (tmp) | 104 | if (tmp) |
105 | sscanf(tmp, "Uid:\t%d", &P->ruid); | 105 | sscanf(tmp, "Uid:\t%d", &P->ruid); |
106 | else | 106 | else |
107 | fprintf(stderr, "Internal error!\n"); | 107 | errorMsg("Internal error!\n"); |
108 | 108 | ||
109 | tmp = strstr(S, "Gid:"); | 109 | tmp = strstr(S, "Gid:"); |
110 | if (tmp) | 110 | if (tmp) |
111 | sscanf(tmp, "Gid:\t%d", &P->rgid); | 111 | sscanf(tmp, "Gid:\t%d", &P->rgid); |
112 | else | 112 | else |
113 | fprintf(stderr, "Internal error!\n"); | 113 | errorMsg("Internal error!\n"); |
114 | 114 | ||
115 | } | 115 | } |
116 | 116 | ||
@@ -97,20 +97,20 @@ static void parse_proc_status(char *S, proc_t * P) | |||
97 | if (tmp) | 97 | if (tmp) |
98 | sscanf(tmp, "Pid:\t%d\n" "PPid:\t%d\n", &P->pid, &P->ppid); | 98 | sscanf(tmp, "Pid:\t%d\n" "PPid:\t%d\n", &P->pid, &P->ppid); |
99 | else | 99 | else |
100 | fprintf(stderr, "Internal error!\n"); | 100 | errorMsg("Internal error!\n"); |
101 | 101 | ||
102 | /* For busybox, ignoring effective, saved, etc */ | 102 | /* For busybox, ignoring effective, saved, etc */ |
103 | tmp = strstr(S, "Uid:"); | 103 | tmp = strstr(S, "Uid:"); |
104 | if (tmp) | 104 | if (tmp) |
105 | sscanf(tmp, "Uid:\t%d", &P->ruid); | 105 | sscanf(tmp, "Uid:\t%d", &P->ruid); |
106 | else | 106 | else |
107 | fprintf(stderr, "Internal error!\n"); | 107 | errorMsg("Internal error!\n"); |
108 | 108 | ||
109 | tmp = strstr(S, "Gid:"); | 109 | tmp = strstr(S, "Gid:"); |
110 | if (tmp) | 110 | if (tmp) |
111 | sscanf(tmp, "Gid:\t%d", &P->rgid); | 111 | sscanf(tmp, "Gid:\t%d", &P->rgid); |
112 | else | 112 | else |
113 | fprintf(stderr, "Internal error!\n"); | 113 | errorMsg("Internal error!\n"); |
114 | 114 | ||
115 | } | 115 | } |
116 | 116 | ||
@@ -40,7 +40,7 @@ extern int rmdir_main(int argc, char **argv) | |||
40 | 40 | ||
41 | while (--argc > 0) { | 41 | while (--argc > 0) { |
42 | if (rmdir(*(++argv)) == -1) { | 42 | if (rmdir(*(++argv)) == -1) { |
43 | fprintf(stderr, "%s: %s\n", applet_name, strerror(errno)); | 43 | errorMsg("%s\n", strerror(errno)); |
44 | exit(FALSE); | 44 | exit(FALSE); |
45 | } | 45 | } |
46 | } | 46 | } |
@@ -207,8 +207,8 @@ static int get_address(const char *str, int *line, regex_t **regex) | |||
207 | idx++; /* so it points to the next character after the last '/' */ | 207 | idx++; /* so it points to the next character after the last '/' */ |
208 | } | 208 | } |
209 | else { | 209 | else { |
210 | fprintf(stderr, "sed.c:get_address: no address found in string\n"); | 210 | errorMsg("get_address: no address found in string\n" |
211 | fprintf(stderr, "\t(you probably didn't check the string you passed me)\n"); | 211 | "\t(you probably didn't check the string you passed me)\n"); |
212 | idx = -1; | 212 | idx = -1; |
213 | } | 213 | } |
214 | 214 | ||
@@ -612,7 +612,7 @@ extern int sed_main(int argc, char **argv) | |||
612 | for (i = optind; i < argc; i++) { | 612 | for (i = optind; i < argc; i++) { |
613 | file = fopen(argv[i], "r"); | 613 | file = fopen(argv[i], "r"); |
614 | if (file == NULL) { | 614 | if (file == NULL) { |
615 | fprintf(stderr, "sed: %s: %s\n", argv[i], strerror(errno)); | 615 | errorMsg("%s: %s\n", argv[i], strerror(errno)); |
616 | } else { | 616 | } else { |
617 | process_file(file); | 617 | process_file(file); |
618 | fclose(file); | 618 | fclose(file); |
@@ -207,12 +207,12 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) | |||
207 | 207 | ||
208 | if (!jobList->head) { | 208 | if (!jobList->head) { |
209 | if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { | 209 | if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { |
210 | fprintf(stderr, "%s: exactly one argument is expected\n", | 210 | errorMsg("%s: exactly one argument is expected\n", |
211 | cmd->progs[0].argv[0]); | 211 | cmd->progs[0].argv[0]); |
212 | return FALSE; | 212 | return FALSE; |
213 | } | 213 | } |
214 | if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { | 214 | if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { |
215 | fprintf(stderr, "%s: bad argument '%s'\n", | 215 | errorMsg("%s: bad argument '%s'\n", |
216 | cmd->progs[0].argv[0], cmd->progs[0].argv[1]); | 216 | cmd->progs[0].argv[0], cmd->progs[0].argv[1]); |
217 | return FALSE; | 217 | return FALSE; |
218 | for (job = jobList->head; job; job = job->next) { | 218 | for (job = jobList->head; job; job = job->next) { |
@@ -226,7 +226,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) | |||
226 | } | 226 | } |
227 | 227 | ||
228 | if (!job) { | 228 | if (!job) { |
229 | fprintf(stderr, "%s: unknown job %d\n", | 229 | errorMsg("%s: unknown job %d\n", |
230 | cmd->progs[0].argv[0], jobNum); | 230 | cmd->progs[0].argv[0], jobNum); |
231 | return FALSE; | 231 | return FALSE; |
232 | } | 232 | } |
@@ -519,7 +519,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr, | |||
519 | 519 | ||
520 | rc = glob(prog->argv[argc - 1], flags, NULL, &prog->globResult); | 520 | rc = glob(prog->argv[argc - 1], flags, NULL, &prog->globResult); |
521 | if (rc == GLOB_NOSPACE) { | 521 | if (rc == GLOB_NOSPACE) { |
522 | fprintf(stderr, "out of space during glob operation\n"); | 522 | errorMsg("out of space during glob operation\n"); |
523 | return; | 523 | return; |
524 | } else if (rc == GLOB_NOMATCH || | 524 | } else if (rc == GLOB_NOMATCH || |
525 | (!rc && (prog->globResult.gl_pathc - i) == 1 && | 525 | (!rc && (prog->globResult.gl_pathc - i) == 1 && |
@@ -607,7 +607,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
607 | if (*src == '\\') { | 607 | if (*src == '\\') { |
608 | src++; | 608 | src++; |
609 | if (!*src) { | 609 | if (!*src) { |
610 | fprintf(stderr, "character expected after \\\n"); | 610 | errorMsg("character expected after \\\n"); |
611 | freeJob(job); | 611 | freeJob(job); |
612 | return 1; | 612 | return 1; |
613 | } | 613 | } |
@@ -686,7 +686,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
686 | chptr++; | 686 | chptr++; |
687 | 687 | ||
688 | if (!*chptr) { | 688 | if (!*chptr) { |
689 | fprintf(stderr, "file name expected after %c\n", *src); | 689 | errorMsg("file name expected after %c\n", *src); |
690 | freeJob(job); | 690 | freeJob(job); |
691 | job->numProgs=0; | 691 | job->numProgs=0; |
692 | return 1; | 692 | return 1; |
@@ -705,7 +705,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
705 | if (*prog->argv[argc]) | 705 | if (*prog->argv[argc]) |
706 | argc++; | 706 | argc++; |
707 | if (!argc) { | 707 | if (!argc) { |
708 | fprintf(stderr, "empty command in pipe1.\n"); | 708 | errorMsg("empty command in pipe1\n"); |
709 | freeJob(job); | 709 | freeJob(job); |
710 | job->numProgs=0; | 710 | job->numProgs=0; |
711 | return 1; | 711 | return 1; |
@@ -731,7 +731,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
731 | src++; | 731 | src++; |
732 | 732 | ||
733 | if (!*src) { | 733 | if (!*src) { |
734 | fprintf(stderr, "empty command in pipe2\n"); | 734 | errorMsg("empty command in pipe2\n"); |
735 | freeJob(job); | 735 | freeJob(job); |
736 | job->numProgs=0; | 736 | job->numProgs=0; |
737 | return 1; | 737 | return 1; |
@@ -750,7 +750,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
750 | case '\\': | 750 | case '\\': |
751 | src++; | 751 | src++; |
752 | if (!*src) { | 752 | if (!*src) { |
753 | fprintf(stderr, "character expected after \\\n"); | 753 | errorMsg("character expected after \\\n"); |
754 | freeJob(job); | 754 | freeJob(job); |
755 | return 1; | 755 | return 1; |
756 | } | 756 | } |
@@ -965,7 +965,7 @@ static int setupRedirections(struct childProgram *prog) | |||
965 | if (openfd < 0) { | 965 | if (openfd < 0) { |
966 | /* this could get lost if stderr has been redirected, but | 966 | /* this could get lost if stderr has been redirected, but |
967 | bash and ash both lose it as well (though zsh doesn't!) */ | 967 | bash and ash both lose it as well (though zsh doesn't!) */ |
968 | fprintf(stderr, "error opening %s: %s\n", redir->filename, | 968 | errorMsg("error opening %s: %s\n", redir->filename, |
969 | strerror(errno)); | 969 | strerror(errno)); |
970 | return 1; | 970 | return 1; |
971 | } | 971 | } |
diff --git a/shell/lash.c b/shell/lash.c index f4564f7f7..048394ab6 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -207,12 +207,12 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) | |||
207 | 207 | ||
208 | if (!jobList->head) { | 208 | if (!jobList->head) { |
209 | if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { | 209 | if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { |
210 | fprintf(stderr, "%s: exactly one argument is expected\n", | 210 | errorMsg("%s: exactly one argument is expected\n", |
211 | cmd->progs[0].argv[0]); | 211 | cmd->progs[0].argv[0]); |
212 | return FALSE; | 212 | return FALSE; |
213 | } | 213 | } |
214 | if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { | 214 | if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { |
215 | fprintf(stderr, "%s: bad argument '%s'\n", | 215 | errorMsg("%s: bad argument '%s'\n", |
216 | cmd->progs[0].argv[0], cmd->progs[0].argv[1]); | 216 | cmd->progs[0].argv[0], cmd->progs[0].argv[1]); |
217 | return FALSE; | 217 | return FALSE; |
218 | for (job = jobList->head; job; job = job->next) { | 218 | for (job = jobList->head; job; job = job->next) { |
@@ -226,7 +226,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) | |||
226 | } | 226 | } |
227 | 227 | ||
228 | if (!job) { | 228 | if (!job) { |
229 | fprintf(stderr, "%s: unknown job %d\n", | 229 | errorMsg("%s: unknown job %d\n", |
230 | cmd->progs[0].argv[0], jobNum); | 230 | cmd->progs[0].argv[0], jobNum); |
231 | return FALSE; | 231 | return FALSE; |
232 | } | 232 | } |
@@ -519,7 +519,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr, | |||
519 | 519 | ||
520 | rc = glob(prog->argv[argc - 1], flags, NULL, &prog->globResult); | 520 | rc = glob(prog->argv[argc - 1], flags, NULL, &prog->globResult); |
521 | if (rc == GLOB_NOSPACE) { | 521 | if (rc == GLOB_NOSPACE) { |
522 | fprintf(stderr, "out of space during glob operation\n"); | 522 | errorMsg("out of space during glob operation\n"); |
523 | return; | 523 | return; |
524 | } else if (rc == GLOB_NOMATCH || | 524 | } else if (rc == GLOB_NOMATCH || |
525 | (!rc && (prog->globResult.gl_pathc - i) == 1 && | 525 | (!rc && (prog->globResult.gl_pathc - i) == 1 && |
@@ -607,7 +607,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
607 | if (*src == '\\') { | 607 | if (*src == '\\') { |
608 | src++; | 608 | src++; |
609 | if (!*src) { | 609 | if (!*src) { |
610 | fprintf(stderr, "character expected after \\\n"); | 610 | errorMsg("character expected after \\\n"); |
611 | freeJob(job); | 611 | freeJob(job); |
612 | return 1; | 612 | return 1; |
613 | } | 613 | } |
@@ -686,7 +686,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
686 | chptr++; | 686 | chptr++; |
687 | 687 | ||
688 | if (!*chptr) { | 688 | if (!*chptr) { |
689 | fprintf(stderr, "file name expected after %c\n", *src); | 689 | errorMsg("file name expected after %c\n", *src); |
690 | freeJob(job); | 690 | freeJob(job); |
691 | job->numProgs=0; | 691 | job->numProgs=0; |
692 | return 1; | 692 | return 1; |
@@ -705,7 +705,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
705 | if (*prog->argv[argc]) | 705 | if (*prog->argv[argc]) |
706 | argc++; | 706 | argc++; |
707 | if (!argc) { | 707 | if (!argc) { |
708 | fprintf(stderr, "empty command in pipe1.\n"); | 708 | errorMsg("empty command in pipe1\n"); |
709 | freeJob(job); | 709 | freeJob(job); |
710 | job->numProgs=0; | 710 | job->numProgs=0; |
711 | return 1; | 711 | return 1; |
@@ -731,7 +731,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
731 | src++; | 731 | src++; |
732 | 732 | ||
733 | if (!*src) { | 733 | if (!*src) { |
734 | fprintf(stderr, "empty command in pipe2\n"); | 734 | errorMsg("empty command in pipe2\n"); |
735 | freeJob(job); | 735 | freeJob(job); |
736 | job->numProgs=0; | 736 | job->numProgs=0; |
737 | return 1; | 737 | return 1; |
@@ -750,7 +750,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
750 | case '\\': | 750 | case '\\': |
751 | src++; | 751 | src++; |
752 | if (!*src) { | 752 | if (!*src) { |
753 | fprintf(stderr, "character expected after \\\n"); | 753 | errorMsg("character expected after \\\n"); |
754 | freeJob(job); | 754 | freeJob(job); |
755 | return 1; | 755 | return 1; |
756 | } | 756 | } |
@@ -965,7 +965,7 @@ static int setupRedirections(struct childProgram *prog) | |||
965 | if (openfd < 0) { | 965 | if (openfd < 0) { |
966 | /* this could get lost if stderr has been redirected, but | 966 | /* this could get lost if stderr has been redirected, but |
967 | bash and ash both lose it as well (though zsh doesn't!) */ | 967 | bash and ash both lose it as well (though zsh doesn't!) */ |
968 | fprintf(stderr, "error opening %s: %s\n", redir->filename, | 968 | errorMsg("error opening %s: %s\n", redir->filename, |
969 | strerror(errno)); | 969 | strerror(errno)); |
970 | return 1; | 970 | return 1; |
971 | } | 971 | } |
@@ -263,7 +263,7 @@ int sort_main(int argc, char **argv) | |||
263 | break; | 263 | break; |
264 | #endif | 264 | #endif |
265 | default: | 265 | default: |
266 | fprintf(stderr, "sort: invalid option -- %c\n", opt); | 266 | errorMsg("invalid option -- %c\n", opt); |
267 | usage(sort_usage); | 267 | usage(sort_usage); |
268 | } | 268 | } |
269 | } else { | 269 | } else { |
@@ -304,4 +304,4 @@ int sort_main(int argc, char **argv) | |||
304 | return(0); | 304 | return(0); |
305 | } | 305 | } |
306 | 306 | ||
307 | /* $Id: sort.c,v 1.18 2000/06/28 22:15:26 markw Exp $ */ | 307 | /* $Id: sort.c,v 1.19 2000/07/14 01:51:25 kraai Exp $ */ |
diff --git a/sysklogd/logger.c b/sysklogd/logger.c index d32ccaaf3..71d703085 100644 --- a/sysklogd/logger.c +++ b/sysklogd/logger.c | |||
@@ -96,7 +96,7 @@ static int pencode(char *s) | |||
96 | *s = '\0'; | 96 | *s = '\0'; |
97 | fac = decode(save, facilitynames); | 97 | fac = decode(save, facilitynames); |
98 | if (fac < 0) { | 98 | if (fac < 0) { |
99 | fprintf(stderr, "unknown facility name: %s\n", save); | 99 | errorMsg("unknown facility name: %s\n", save); |
100 | exit(FALSE); | 100 | exit(FALSE); |
101 | } | 101 | } |
102 | *s++ = '.'; | 102 | *s++ = '.'; |
@@ -105,7 +105,7 @@ static int pencode(char *s) | |||
105 | } | 105 | } |
106 | lev = decode(s, prioritynames); | 106 | lev = decode(s, prioritynames); |
107 | if (lev < 0) { | 107 | if (lev < 0) { |
108 | fprintf(stderr, "unknown priority name: %s\n", save); | 108 | errorMsg("unknown priority name: %s\n", save); |
109 | exit(FALSE); | 109 | exit(FALSE); |
110 | } | 110 | } |
111 | return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK)); | 111 | return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK)); |
@@ -166,7 +166,7 @@ extern int logger_main(int argc, char **argv) | |||
166 | if (argc >= 1) { | 166 | if (argc >= 1) { |
167 | message = *argv; | 167 | message = *argv; |
168 | } else { | 168 | } else { |
169 | fprintf(stderr, "No message\n"); | 169 | errorMsg("No message\n"); |
170 | exit(FALSE); | 170 | exit(FALSE); |
171 | } | 171 | } |
172 | } | 172 | } |
@@ -375,7 +375,7 @@ extern int tail_main(int argc, char **argv) | |||
375 | usage(tail_usage); | 375 | usage(tail_usage); |
376 | default: | 376 | default: |
377 | if ((n_units = atoi(&argv[i][1])) < 1) { | 377 | if ((n_units = atoi(&argv[i][1])) < 1) { |
378 | fprintf(stderr, "tail: invalid option -- %c\n", opt); | 378 | errorMsg("invalid option -- %c\n", opt); |
379 | usage(tail_usage); | 379 | usage(tail_usage); |
380 | } | 380 | } |
381 | } | 381 | } |
@@ -386,8 +386,7 @@ extern int tail_main(int argc, char **argv) | |||
386 | 386 | ||
387 | if (i + 1 < argc) { | 387 | if (i + 1 < argc) { |
388 | if (forever) { | 388 | if (forever) { |
389 | fprintf(stderr, | 389 | errorMsg("option -f is invalid with multiple files\n"); |
390 | "tail: option -f is invalid with multiple files\n"); | ||
391 | usage(tail_usage); | 390 | usage(tail_usage); |
392 | } | 391 | } |
393 | print_headers = 1; | 392 | print_headers = 1; |
@@ -104,7 +104,7 @@ int tee_main(int argc, char **argv) | |||
104 | /* init FILE pointers */ | 104 | /* init FILE pointers */ |
105 | FileList = calloc(FL_MAX, sizeof(FILE*)); | 105 | FileList = calloc(FL_MAX, sizeof(FILE*)); |
106 | if (!FileList) { | 106 | if (!FileList) { |
107 | fprintf(stderr, "tee: %s\n", strerror(errno)); | 107 | errorMsg("%s\n", strerror(errno)); |
108 | exit(1); | 108 | exit(1); |
109 | } | 109 | } |
110 | FL_end = 0; | 110 | FL_end = 0; |
@@ -133,4 +133,4 @@ int tee_main(int argc, char **argv) | |||
133 | return(0); | 133 | return(0); |
134 | } | 134 | } |
135 | 135 | ||
136 | /* $Id: tee.c,v 1.11 2000/06/19 17:25:40 andersen Exp $ */ | 136 | /* $Id: tee.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */ |
@@ -101,7 +101,7 @@ void mtab_read(void) | |||
101 | return; | 101 | return; |
102 | 102 | ||
103 | if ((fp = setmntent(mtab_file, "r")) == NULL) { | 103 | if ((fp = setmntent(mtab_file, "r")) == NULL) { |
104 | fprintf(stderr, "Cannot open %s\n", mtab_file); | 104 | errorMsg("Cannot open %s\n", mtab_file); |
105 | return; | 105 | return; |
106 | } | 106 | } |
107 | while ((e = getmntent(fp))) { | 107 | while ((e = getmntent(fp))) { |
@@ -209,11 +209,9 @@ static int do_umount(const char *name, int useMtab) | |||
209 | status = mount(blockDevice, name, NULL, | 209 | status = mount(blockDevice, name, NULL, |
210 | MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); | 210 | MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); |
211 | if (status == 0) { | 211 | if (status == 0) { |
212 | fprintf(stderr, "umount: %s busy - remounted read-only\n", | 212 | errorMsg("%s busy - remounted read-only\n", blockDevice); |
213 | blockDevice); | ||
214 | } else { | 213 | } else { |
215 | fprintf(stderr, "umount: Cannot remount %s read-only\n", | 214 | errorMsg("Cannot remount %s read-only\n", blockDevice); |
216 | blockDevice); | ||
217 | } | 215 | } |
218 | } | 216 | } |
219 | if (status == 0) { | 217 | if (status == 0) { |
@@ -127,11 +127,11 @@ set_file_pointers(int schema, FILE ** in, FILE ** out, char **argv) | |||
127 | break; | 127 | break; |
128 | } | 128 | } |
129 | if (*in == NULL) { | 129 | if (*in == NULL) { |
130 | fprintf(stderr, "uniq: %s: %s\n", argv[0], strerror(errno)); | 130 | errorMsg("%s: %s\n", argv[0], strerror(errno)); |
131 | return errno; | 131 | return errno; |
132 | } | 132 | } |
133 | if (*out == NULL) { | 133 | if (*out == NULL) { |
134 | fprintf(stderr, "uniq: %s: %s\n", argv[1], strerror(errno)); | 134 | errorMsg("%s: %s\n", argv[1], strerror(errno)); |
135 | return errno; | 135 | return errno; |
136 | } | 136 | } |
137 | return 0; | 137 | return 0; |
@@ -187,4 +187,4 @@ int uniq_main(int argc, char **argv) | |||
187 | return(0); | 187 | return(0); |
188 | } | 188 | } |
189 | 189 | ||
190 | /* $Id: uniq.c,v 1.11 2000/06/19 17:25:40 andersen Exp $ */ | 190 | /* $Id: uniq.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */ |
diff --git a/util-linux/fbset.c b/util-linux/fbset.c index 9fde6a19d..2fcc7c294 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c | |||
@@ -387,7 +387,7 @@ extern int fbset_main(int argc, char **argv) | |||
387 | PERROR("fbset(ioctl)"); | 387 | PERROR("fbset(ioctl)"); |
388 | if (g_options & OPT_READMODE) { | 388 | if (g_options & OPT_READMODE) { |
389 | if (!readmode(&var, modefile, mode)) { | 389 | if (!readmode(&var, modefile, mode)) { |
390 | fprintf(stderr, "Unknown video mode `%s'\n", mode); | 390 | errorMsg("Unknown video mode `%s'\n", mode); |
391 | exit(1); | 391 | exit(1); |
392 | } | 392 | } |
393 | } | 393 | } |
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 685e0ee6c..74281a71e 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
@@ -311,7 +311,7 @@ static void show_usage(void) | |||
311 | 311 | ||
312 | static void die(const char *str) | 312 | static void die(const char *str) |
313 | { | 313 | { |
314 | fprintf(stderr, "%s: %s\n", applet_name, str); | 314 | errorMsg("%s\n", str); |
315 | leave(8); | 315 | leave(8); |
316 | } | 316 | } |
317 | 317 | ||
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index b6f958f46..e4dedaf82 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c | |||
@@ -263,7 +263,7 @@ static unsigned long req_nr_inodes = 0; | |||
263 | */ | 263 | */ |
264 | static volatile void die(char *str) | 264 | static volatile void die(char *str) |
265 | { | 265 | { |
266 | fprintf(stderr, "%s: %s\n", applet_name, str); | 266 | errorMsg("%s\n", str); |
267 | exit(8); | 267 | exit(8); |
268 | } | 268 | } |
269 | 269 | ||
@@ -814,8 +814,8 @@ extern int mkfs_minix_main(int argc, char **argv) | |||
814 | #ifdef HAVE_MINIX2 | 814 | #ifdef HAVE_MINIX2 |
815 | version2 = 1; | 815 | version2 = 1; |
816 | #else | 816 | #else |
817 | fprintf(stderr, "%s: not compiled with minix v2 support\n", | 817 | errorMsg("%s: not compiled with minix v2 support\n", |
818 | applet_name, device_name); | 818 | device_name); |
819 | exit(-1); | 819 | exit(-1); |
820 | #endif | 820 | #endif |
821 | break; | 821 | break; |
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index 20096361f..5a33945c8 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c | |||
@@ -116,7 +116,7 @@ static void init_signature_page() | |||
116 | 116 | ||
117 | #ifdef PAGE_SIZE | 117 | #ifdef PAGE_SIZE |
118 | if (pagesize != PAGE_SIZE) | 118 | if (pagesize != PAGE_SIZE) |
119 | fprintf(stderr, "Assuming pages of size %d\n", pagesize); | 119 | errorMsg("Assuming pages of size %d\n", pagesize); |
120 | #endif | 120 | #endif |
121 | signature_page = (int *) xmalloc(pagesize); | 121 | signature_page = (int *) xmalloc(pagesize); |
122 | memset(signature_page, 0, pagesize); | 122 | memset(signature_page, 0, pagesize); |
@@ -204,7 +204,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr) | |||
204 | 204 | ||
205 | void die(const char *str) | 205 | void die(const char *str) |
206 | { | 206 | { |
207 | fprintf(stderr, "%s: %s\n", applet_name, str); | 207 | errorMsg("%s\n", str); |
208 | exit(FALSE); | 208 | exit(FALSE); |
209 | } | 209 | } |
210 | 210 | ||
@@ -345,18 +345,14 @@ int mkswap_main(int argc, char **argv) | |||
345 | } | 345 | } |
346 | } | 346 | } |
347 | if (!device_name) { | 347 | if (!device_name) { |
348 | fprintf(stderr, | 348 | errorMsg("error: Nowhere to set up swap on?\n"); |
349 | "%s: error: Nowhere to set up swap on?\n", applet_name); | ||
350 | usage(mkswap_usage); | 349 | usage(mkswap_usage); |
351 | } | 350 | } |
352 | sz = get_size(device_name); | 351 | sz = get_size(device_name); |
353 | if (!PAGES) { | 352 | if (!PAGES) { |
354 | PAGES = sz; | 353 | PAGES = sz; |
355 | } else if (PAGES > sz && !force) { | 354 | } else if (PAGES > sz && !force) { |
356 | fprintf(stderr, | 355 | errorMsg("error: size %ld is larger than device size %d\n", |
357 | "%s: error: " | ||
358 | "size %ld is larger than device size %d\n", | ||
359 | applet_name, | ||
360 | PAGES * (pagesize / 1024), sz * (pagesize / 1024)); | 356 | PAGES * (pagesize / 1024), sz * (pagesize / 1024)); |
361 | exit(FALSE); | 357 | exit(FALSE); |
362 | } | 358 | } |
@@ -372,14 +368,12 @@ int mkswap_main(int argc, char **argv) | |||
372 | version = 1; | 368 | version = 1; |
373 | } | 369 | } |
374 | if (version != 0 && version != 1) { | 370 | if (version != 0 && version != 1) { |
375 | fprintf(stderr, "%s: error: unknown version %d\n", | 371 | errorMsg("error: unknown version %d\n", version); |
376 | applet_name, version); | ||
377 | usage(mkswap_usage); | 372 | usage(mkswap_usage); |
378 | } | 373 | } |
379 | if (PAGES < 10) { | 374 | if (PAGES < 10) { |
380 | fprintf(stderr, | 375 | errorMsg("error: swap area needs to be at least %ldkB\n", |
381 | "%s: error: swap area needs to be at least %ldkB\n", | 376 | (long) (10 * pagesize / 1024)); |
382 | applet_name, (long) (10 * pagesize / 1024)); | ||
383 | usage(mkswap_usage); | 377 | usage(mkswap_usage); |
384 | } | 378 | } |
385 | #if 0 | 379 | #if 0 |
@@ -397,8 +391,8 @@ int mkswap_main(int argc, char **argv) | |||
397 | #endif | 391 | #endif |
398 | if (PAGES > maxpages) { | 392 | if (PAGES > maxpages) { |
399 | PAGES = maxpages; | 393 | PAGES = maxpages; |
400 | fprintf(stderr, "%s: warning: truncating swap area to %ldkB\n", | 394 | errorMsg("warning: truncating swap area to %ldkB\n", |
401 | applet_name, PAGES * pagesize / 1024); | 395 | PAGES * pagesize / 1024); |
402 | } | 396 | } |
403 | 397 | ||
404 | DEV = open(device_name, O_RDWR); | 398 | DEV = open(device_name, O_RDWR); |
@@ -424,11 +418,10 @@ int mkswap_main(int argc, char **argv) | |||
424 | for (sum = 0; q >= (unsigned short *) buffer;) | 418 | for (sum = 0; q >= (unsigned short *) buffer;) |
425 | sum ^= *q--; | 419 | sum ^= *q--; |
426 | if (!sum) { | 420 | if (!sum) { |
427 | fprintf(stderr, "\ | 421 | errorMsg("Device '%s' contains a valid Sun disklabel.\n" |
428 | %s: Device '%s' contains a valid Sun disklabel.\n\ | 422 | "This probably means creating v0 swap would destroy your partition table\n" |
429 | This probably means creating v0 swap would destroy your partition table\n\ | 423 | "No swap created. If you really want to create swap v0 on that device, use\n" |
430 | No swap created. If you really want to create swap v0 on that device, use\n\ | 424 | "the -f option to force it.\n", device_name); |
431 | the -f option to force it.\n", applet_name, device_name); | ||
432 | exit(FALSE); | 425 | exit(FALSE); |
433 | } | 426 | } |
434 | } | 427 | } |
diff --git a/util-linux/mount.c b/util-linux/mount.c index 900ab30a7..455e4a1c1 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -157,15 +157,15 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
157 | 157 | ||
158 | specialfile = find_unused_loop_device(); | 158 | specialfile = find_unused_loop_device(); |
159 | if (specialfile == NULL) { | 159 | if (specialfile == NULL) { |
160 | fprintf(stderr, "Could not find a spare loop device\n"); | 160 | errorMsg("Could not find a spare loop device\n"); |
161 | return (FALSE); | 161 | return (FALSE); |
162 | } | 162 | } |
163 | if (set_loop(specialfile, lofile, 0, &loro)) { | 163 | if (set_loop(specialfile, lofile, 0, &loro)) { |
164 | fprintf(stderr, "Could not setup loop device\n"); | 164 | errorMsg("Could not setup loop device\n"); |
165 | return (FALSE); | 165 | return (FALSE); |
166 | } | 166 | } |
167 | if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ | 167 | if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ |
168 | fprintf(stderr, "WARNING: loop device is read-only\n"); | 168 | errorMsg("WARNING: loop device is read-only\n"); |
169 | flags &= ~MS_RDONLY; | 169 | flags &= ~MS_RDONLY; |
170 | } | 170 | } |
171 | } | 171 | } |
@@ -329,7 +329,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
329 | 329 | ||
330 | if (status == FALSE) { | 330 | if (status == FALSE) { |
331 | if (whineOnErrors == TRUE) { | 331 | if (whineOnErrors == TRUE) { |
332 | fprintf(stderr, "Mounting %s on %s failed: %s\n", | 332 | errorMsg("Mounting %s on %s failed: %s\n", |
333 | blockDevice, directory, strerror(errno)); | 333 | blockDevice, directory, strerror(errno)); |
334 | } | 334 | } |
335 | return (FALSE); | 335 | return (FALSE); |
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c index 8cdfebfce..ad0b5842d 100644 --- a/util-linux/nfsmount.c +++ b/util-linux/nfsmount.c | |||
@@ -312,8 +312,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
312 | msock = fsock = -1; | 312 | msock = fsock = -1; |
313 | mclient = NULL; | 313 | mclient = NULL; |
314 | if (strlen(spec) >= sizeof(hostdir)) { | 314 | if (strlen(spec) >= sizeof(hostdir)) { |
315 | fprintf(stderr, _("mount: " | 315 | errorMsg("excessively long host:dir argument\n"); |
316 | "excessively long host:dir argument\n")); | ||
317 | goto fail; | 316 | goto fail; |
318 | } | 317 | } |
319 | strcpy(hostdir, spec); | 318 | strcpy(hostdir, spec); |
@@ -325,12 +324,10 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
325 | until they can be fully supported. (mack@sgi.com) */ | 324 | until they can be fully supported. (mack@sgi.com) */ |
326 | if ((s = strchr(hostdir, ','))) { | 325 | if ((s = strchr(hostdir, ','))) { |
327 | *s = '\0'; | 326 | *s = '\0'; |
328 | fprintf(stderr, _("mount: warning: " | 327 | errorMsg("warning: multiple hostnames not supported\n"); |
329 | "multiple hostnames not supported\n")); | ||
330 | } | 328 | } |
331 | } else { | 329 | } else { |
332 | fprintf(stderr, _("mount: " | 330 | errorMsg("directory to mount not in host:dir format\n"); |
333 | "directory to mount not in host:dir format\n")); | ||
334 | goto fail; | 331 | goto fail; |
335 | } | 332 | } |
336 | 333 | ||
@@ -340,13 +337,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
340 | #endif | 337 | #endif |
341 | { | 338 | { |
342 | if ((hp = gethostbyname(hostname)) == NULL) { | 339 | if ((hp = gethostbyname(hostname)) == NULL) { |
343 | fprintf(stderr, _("mount: can't get address for %s\n"), | 340 | errorMsg("can't get address for %s\n", hostname); |
344 | hostname); | ||
345 | goto fail; | 341 | goto fail; |
346 | } else { | 342 | } else { |
347 | if (hp->h_length > sizeof(struct in_addr)) { | 343 | if (hp->h_length > sizeof(struct in_addr)) { |
348 | fprintf(stderr, | 344 | errorMsg("got bad hp->h_length\n"); |
349 | _("mount: got bad hp->h_length\n")); | ||
350 | hp->h_length = sizeof(struct in_addr); | 345 | hp->h_length = sizeof(struct in_addr); |
351 | } | 346 | } |
352 | memcpy(&server_addr.sin_addr, | 347 | memcpy(&server_addr.sin_addr, |
@@ -363,8 +358,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
363 | if (!old_opts) | 358 | if (!old_opts) |
364 | old_opts = ""; | 359 | old_opts = ""; |
365 | if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { | 360 | if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { |
366 | fprintf(stderr, _("mount: " | 361 | errorMsg("excessively long option argument\n"); |
367 | "excessively long option argument\n")); | ||
368 | goto fail; | 362 | goto fail; |
369 | } | 363 | } |
370 | sprintf(new_opts, "%s%saddr=%s", | 364 | sprintf(new_opts, "%s%saddr=%s", |
@@ -524,11 +518,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
524 | data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); | 518 | data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); |
525 | #endif | 519 | #endif |
526 | if (nfsvers > MAX_NFSPROT) { | 520 | if (nfsvers > MAX_NFSPROT) { |
527 | fprintf(stderr, "NFSv%d not supported!\n", nfsvers); | 521 | errorMsg("NFSv%d not supported!\n", nfsvers); |
528 | return 0; | 522 | return 0; |
529 | } | 523 | } |
530 | if (mountvers > MAX_NFSPROT) { | 524 | if (mountvers > MAX_NFSPROT) { |
531 | fprintf(stderr, "NFSv%d not supported!\n", nfsvers); | 525 | errorMsg("NFSv%d not supported!\n", nfsvers); |
532 | return 0; | 526 | return 0; |
533 | } | 527 | } |
534 | if (nfsvers && !mountvers) | 528 | if (nfsvers && !mountvers) |
@@ -588,13 +582,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
588 | mount_server_addr.sin_addr.s_addr = inet_addr(hostname); | 582 | mount_server_addr.sin_addr.s_addr = inet_addr(hostname); |
589 | } else { | 583 | } else { |
590 | if ((hp = gethostbyname(mounthost)) == NULL) { | 584 | if ((hp = gethostbyname(mounthost)) == NULL) { |
591 | fprintf(stderr, _("mount: can't get address for %s\n"), | 585 | errorMsg("can't get address for %s\n", hostname); |
592 | hostname); | ||
593 | goto fail; | 586 | goto fail; |
594 | } else { | 587 | } else { |
595 | if (hp->h_length > sizeof(struct in_addr)) { | 588 | if (hp->h_length > sizeof(struct in_addr)) { |
596 | fprintf(stderr, | 589 | errorMsg("got bad hp->h_length?\n"); |
597 | _("mount: got bad hp->h_length?\n")); | ||
598 | hp->h_length = sizeof(struct in_addr); | 590 | hp->h_length = sizeof(struct in_addr); |
599 | } | 591 | } |
600 | mount_server_addr.sin_family = AF_INET; | 592 | mount_server_addr.sin_family = AF_INET; |
@@ -729,8 +721,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
729 | 721 | ||
730 | if (nfsvers == 2) { | 722 | if (nfsvers == 2) { |
731 | if (status.nfsv2.fhs_status != 0) { | 723 | if (status.nfsv2.fhs_status != 0) { |
732 | fprintf(stderr, | 724 | errorMsg("%s:%s failed, reason given by server: %s\n", |
733 | "mount: %s:%s failed, reason given by server: %s\n", | ||
734 | hostname, dirname, | 725 | hostname, dirname, |
735 | nfs_strerror(status.nfsv2.fhs_status)); | 726 | nfs_strerror(status.nfsv2.fhs_status)); |
736 | goto fail; | 727 | goto fail; |
@@ -748,8 +739,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
748 | #if NFS_MOUNT_VERSION >= 4 | 739 | #if NFS_MOUNT_VERSION >= 4 |
749 | fhandle3 *fhandle; | 740 | fhandle3 *fhandle; |
750 | if (status.nfsv3.fhs_status != 0) { | 741 | if (status.nfsv3.fhs_status != 0) { |
751 | fprintf(stderr, | 742 | errorMsg("%s:%s failed, reason given by server: %s\n", |
752 | "mount: %s:%s failed, reason given by server: %s\n", | ||
753 | hostname, dirname, | 743 | hostname, dirname, |
754 | nfs_strerror(status.nfsv3.fhs_status)); | 744 | nfs_strerror(status.nfsv3.fhs_status)); |
755 | goto fail; | 745 | goto fail; |
diff --git a/util-linux/umount.c b/util-linux/umount.c index 59dcb6651..1b250fd3a 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c | |||
@@ -101,7 +101,7 @@ void mtab_read(void) | |||
101 | return; | 101 | return; |
102 | 102 | ||
103 | if ((fp = setmntent(mtab_file, "r")) == NULL) { | 103 | if ((fp = setmntent(mtab_file, "r")) == NULL) { |
104 | fprintf(stderr, "Cannot open %s\n", mtab_file); | 104 | errorMsg("Cannot open %s\n", mtab_file); |
105 | return; | 105 | return; |
106 | } | 106 | } |
107 | while ((e = getmntent(fp))) { | 107 | while ((e = getmntent(fp))) { |
@@ -209,11 +209,9 @@ static int do_umount(const char *name, int useMtab) | |||
209 | status = mount(blockDevice, name, NULL, | 209 | status = mount(blockDevice, name, NULL, |
210 | MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); | 210 | MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); |
211 | if (status == 0) { | 211 | if (status == 0) { |
212 | fprintf(stderr, "umount: %s busy - remounted read-only\n", | 212 | errorMsg("%s busy - remounted read-only\n", blockDevice); |
213 | blockDevice); | ||
214 | } else { | 213 | } else { |
215 | fprintf(stderr, "umount: Cannot remount %s read-only\n", | 214 | errorMsg("Cannot remount %s read-only\n", blockDevice); |
216 | blockDevice); | ||
217 | } | 215 | } |
218 | } | 216 | } |
219 | if (status == 0) { | 217 | if (status == 0) { |
@@ -299,7 +299,7 @@ copyFile(const char *srcName, const char *destName, | |||
299 | 299 | ||
300 | if ((srcStatBuf.st_dev == dstStatBuf.st_dev) && | 300 | if ((srcStatBuf.st_dev == dstStatBuf.st_dev) && |
301 | (srcStatBuf.st_ino == dstStatBuf.st_ino)) { | 301 | (srcStatBuf.st_ino == dstStatBuf.st_ino)) { |
302 | fprintf(stderr, "Copying file \"%s\" to itself\n", srcName); | 302 | errorMsg("Copying file \"%s\" to itself\n", srcName); |
303 | return FALSE; | 303 | return FALSE; |
304 | } | 304 | } |
305 | 305 | ||
@@ -630,7 +630,7 @@ int recursiveAction(const char *fileName, | |||
630 | continue; | 630 | continue; |
631 | } | 631 | } |
632 | if (strlen(fileName) + strlen(next->d_name) + 1 > BUFSIZ) { | 632 | if (strlen(fileName) + strlen(next->d_name) + 1 > BUFSIZ) { |
633 | fprintf(stderr, name_too_long, "ftw"); | 633 | errorMsg(name_too_long); |
634 | return FALSE; | 634 | return FALSE; |
635 | } | 635 | } |
636 | memset(nextFile, 0, sizeof(nextFile)); | 636 | memset(nextFile, 0, sizeof(nextFile)); |
@@ -995,8 +995,7 @@ int get_console_fd(char *tty_name) | |||
995 | if (is_a_console(fd)) | 995 | if (is_a_console(fd)) |
996 | return fd; | 996 | return fd; |
997 | 997 | ||
998 | fprintf(stderr, | 998 | errorMsg("Couldnt get a file descriptor referring to the console\n"); |
999 | "Couldnt get a file descriptor referring to the console\n"); | ||
1000 | return -1; /* total failure */ | 999 | return -1; /* total failure */ |
1001 | } | 1000 | } |
1002 | 1001 | ||
@@ -43,7 +43,6 @@ extern int whoami_main(int argc, char **argv) | |||
43 | puts(user); | 43 | puts(user); |
44 | exit(TRUE); | 44 | exit(TRUE); |
45 | } | 45 | } |
46 | fprintf(stderr, "%s: cannot find username for UID %u\n", applet_name, | 46 | errorMsg("cannot find username for UID %u\n", (unsigned) uid); |
47 | (unsigned) uid); | ||
48 | return(FALSE); | 47 | return(FALSE); |
49 | } | 48 | } |