diff options
-rw-r--r-- | applets/busybox.c | 4 | ||||
-rw-r--r-- | ar.c | 24 | ||||
-rw-r--r-- | archival/ar.c | 24 | ||||
-rw-r--r-- | archival/gunzip.c | 22 | ||||
-rw-r--r-- | archival/gzip.c | 18 | ||||
-rw-r--r-- | archival/tar.c | 106 | ||||
-rw-r--r-- | busybox.c | 4 | ||||
-rw-r--r-- | busybox.h | 36 | ||||
-rw-r--r-- | chmod_chown_chgrp.c | 12 | ||||
-rw-r--r-- | chroot.c | 4 | ||||
-rw-r--r-- | cmdedit.c | 2 | ||||
-rw-r--r-- | console-tools/deallocvt.c | 6 | ||||
-rw-r--r-- | console-tools/dumpkmap.c | 4 | ||||
-rw-r--r-- | console-tools/loadacm.c | 16 | ||||
-rw-r--r-- | console-tools/loadfont.c | 28 | ||||
-rw-r--r-- | console-tools/loadkmap.c | 8 | ||||
-rw-r--r-- | console-tools/setkeycodes.c | 6 | ||||
-rw-r--r-- | coreutils/chroot.c | 4 | ||||
-rw-r--r-- | coreutils/cut.c | 18 | ||||
-rw-r--r-- | coreutils/date.c | 14 | ||||
-rw-r--r-- | coreutils/dd.c | 24 | ||||
-rw-r--r-- | coreutils/df.c | 8 | ||||
-rw-r--r-- | coreutils/du.c | 6 | ||||
-rw-r--r-- | coreutils/expr.c | 20 | ||||
-rw-r--r-- | coreutils/head.c | 2 | ||||
-rw-r--r-- | coreutils/id.c | 2 | ||||
-rw-r--r-- | coreutils/ln.c | 4 | ||||
-rw-r--r-- | coreutils/logname.c | 2 | ||||
-rw-r--r-- | coreutils/ls.c | 8 | ||||
-rw-r--r-- | coreutils/md5sum.c | 36 | ||||
-rw-r--r-- | coreutils/mkdir.c | 8 | ||||
-rw-r--r-- | coreutils/mknod.c | 2 | ||||
-rw-r--r-- | coreutils/pwd.c | 2 | ||||
-rw-r--r-- | coreutils/rm.c | 8 | ||||
-rw-r--r-- | coreutils/rmdir.c | 2 | ||||
-rw-r--r-- | coreutils/sort.c | 4 | ||||
-rw-r--r-- | coreutils/tail.c | 4 | ||||
-rw-r--r-- | coreutils/tee.c | 2 | ||||
-rw-r--r-- | coreutils/test.c | 10 | ||||
-rw-r--r-- | coreutils/touch.c | 4 | ||||
-rw-r--r-- | coreutils/tr.c | 2 | ||||
-rw-r--r-- | coreutils/uudecode.c | 24 | ||||
-rw-r--r-- | coreutils/uuencode.c | 6 | ||||
-rw-r--r-- | coreutils/whoami.c | 2 | ||||
-rw-r--r-- | cp_mv.c | 40 | ||||
-rw-r--r-- | cut.c | 18 | ||||
-rw-r--r-- | date.c | 14 | ||||
-rw-r--r-- | dc.c | 6 | ||||
-rw-r--r-- | dd.c | 24 | ||||
-rw-r--r-- | deallocvt.c | 6 | ||||
-rw-r--r-- | df.c | 8 | ||||
-rw-r--r-- | du.c | 6 | ||||
-rw-r--r-- | dumpkmap.c | 4 | ||||
-rw-r--r-- | dutmp.c | 2 | ||||
-rw-r--r-- | editors/sed.c | 22 | ||||
-rw-r--r-- | expr.c | 20 | ||||
-rw-r--r-- | fbset.c | 4 | ||||
-rw-r--r-- | find.c | 2 | ||||
-rw-r--r-- | findutils/find.c | 2 | ||||
-rw-r--r-- | findutils/grep.c | 2 | ||||
-rw-r--r-- | freeramdisk.c | 4 | ||||
-rw-r--r-- | fsck_minix.c | 2 | ||||
-rw-r--r-- | getopt.c | 10 | ||||
-rw-r--r-- | grep.c | 2 | ||||
-rw-r--r-- | gunzip.c | 22 | ||||
-rw-r--r-- | gzip.c | 18 | ||||
-rw-r--r-- | halt.c | 2 | ||||
-rw-r--r-- | head.c | 2 | ||||
-rw-r--r-- | hostname.c | 4 | ||||
-rw-r--r-- | id.c | 2 | ||||
-rw-r--r-- | include/busybox.h | 36 | ||||
-rw-r--r-- | init.c | 2 | ||||
-rw-r--r-- | init/halt.c | 2 | ||||
-rw-r--r-- | init/init.c | 2 | ||||
-rw-r--r-- | init/poweroff.c | 2 | ||||
-rw-r--r-- | init/reboot.c | 2 | ||||
-rw-r--r-- | insmod.c | 94 | ||||
-rw-r--r-- | kill.c | 14 | ||||
-rw-r--r-- | lash.c | 34 | ||||
-rw-r--r-- | ln.c | 4 | ||||
-rw-r--r-- | loadacm.c | 16 | ||||
-rw-r--r-- | loadfont.c | 28 | ||||
-rw-r--r-- | loadkmap.c | 8 | ||||
-rw-r--r-- | logger.c | 6 | ||||
-rw-r--r-- | logname.c | 2 | ||||
-rw-r--r-- | ls.c | 8 | ||||
-rw-r--r-- | lsmod.c | 8 | ||||
-rw-r--r-- | md5sum.c | 36 | ||||
-rw-r--r-- | miscutils/dc.c | 6 | ||||
-rw-r--r-- | miscutils/dutmp.c | 2 | ||||
-rw-r--r-- | miscutils/mt.c | 2 | ||||
-rw-r--r-- | miscutils/readlink.c | 2 | ||||
-rw-r--r-- | mkdir.c | 8 | ||||
-rw-r--r-- | mkfs_minix.c | 4 | ||||
-rw-r--r-- | mknod.c | 2 | ||||
-rw-r--r-- | mkswap.c | 16 | ||||
-rw-r--r-- | modutils/insmod.c | 94 | ||||
-rw-r--r-- | modutils/lsmod.c | 8 | ||||
-rw-r--r-- | mount.c | 28 | ||||
-rw-r--r-- | mt.c | 2 | ||||
-rw-r--r-- | mtab.c | 2 | ||||
-rw-r--r-- | nc.c | 2 | ||||
-rw-r--r-- | networking/hostname.c | 4 | ||||
-rw-r--r-- | networking/nc.c | 2 | ||||
-rw-r--r-- | networking/ping.c | 18 | ||||
-rw-r--r-- | networking/telnet.c | 6 | ||||
-rw-r--r-- | networking/wget.c | 30 | ||||
-rw-r--r-- | nfsmount.c | 24 | ||||
-rw-r--r-- | ping.c | 18 | ||||
-rw-r--r-- | poweroff.c | 2 | ||||
-rw-r--r-- | procps/kill.c | 14 | ||||
-rw-r--r-- | procps/ps.c | 18 | ||||
-rw-r--r-- | procps/renice.c | 2 | ||||
-rw-r--r-- | ps.c | 18 | ||||
-rw-r--r-- | pwd.c | 2 | ||||
-rw-r--r-- | rdate.c | 12 | ||||
-rw-r--r-- | readlink.c | 2 | ||||
-rw-r--r-- | reboot.c | 2 | ||||
-rw-r--r-- | renice.c | 2 | ||||
-rw-r--r-- | rm.c | 8 | ||||
-rw-r--r-- | rmdir.c | 2 | ||||
-rw-r--r-- | sed.c | 22 | ||||
-rw-r--r-- | setkeycodes.c | 6 | ||||
-rw-r--r-- | sh.c | 34 | ||||
-rw-r--r-- | shell/cmdedit.c | 2 | ||||
-rw-r--r-- | shell/lash.c | 34 | ||||
-rw-r--r-- | sort.c | 4 | ||||
-rw-r--r-- | swaponoff.c | 2 | ||||
-rw-r--r-- | sysklogd/logger.c | 6 | ||||
-rw-r--r-- | sysklogd/syslogd.c | 20 | ||||
-rw-r--r-- | syslogd.c | 20 | ||||
-rw-r--r-- | tail.c | 4 | ||||
-rw-r--r-- | tar.c | 106 | ||||
-rw-r--r-- | tee.c | 2 | ||||
-rw-r--r-- | telnet.c | 6 | ||||
-rw-r--r-- | test.c | 10 | ||||
-rw-r--r-- | touch.c | 4 | ||||
-rw-r--r-- | tr.c | 2 | ||||
-rw-r--r-- | umount.c | 8 | ||||
-rw-r--r-- | util-linux/fbset.c | 4 | ||||
-rw-r--r-- | util-linux/freeramdisk.c | 4 | ||||
-rw-r--r-- | util-linux/fsck_minix.c | 2 | ||||
-rw-r--r-- | util-linux/getopt.c | 10 | ||||
-rw-r--r-- | util-linux/mkfs_minix.c | 4 | ||||
-rw-r--r-- | util-linux/mkswap.c | 16 | ||||
-rw-r--r-- | util-linux/mount.c | 28 | ||||
-rw-r--r-- | util-linux/nfsmount.c | 24 | ||||
-rw-r--r-- | util-linux/rdate.c | 12 | ||||
-rw-r--r-- | util-linux/swaponoff.c | 2 | ||||
-rw-r--r-- | util-linux/umount.c | 8 | ||||
-rw-r--r-- | utility.c | 106 | ||||
-rw-r--r-- | uudecode.c | 24 | ||||
-rw-r--r-- | uuencode.c | 6 | ||||
-rw-r--r-- | wget.c | 30 | ||||
-rw-r--r-- | whoami.c | 2 |
155 files changed, 1021 insertions, 1021 deletions
diff --git a/applets/busybox.c b/applets/busybox.c index 857367b5f..212d46742 100644 --- a/applets/busybox.c +++ b/applets/busybox.c | |||
@@ -54,7 +54,7 @@ static char *busybox_fullpath() | |||
54 | if (len != -1) { | 54 | if (len != -1) { |
55 | path[len] = 0; | 55 | path[len] = 0; |
56 | } else { | 56 | } else { |
57 | errorMsg("%s: %s\n", proc, strerror(errno)); | 57 | error_msg("%s: %s\n", proc, strerror(errno)); |
58 | return NULL; | 58 | return NULL; |
59 | } | 59 | } |
60 | return strdup(path); | 60 | return strdup(path); |
@@ -78,7 +78,7 @@ static void install_links(const char *busybox, int use_symbolic_links) | |||
78 | rc = Link(busybox, command); | 78 | rc = Link(busybox, command); |
79 | 79 | ||
80 | if (rc) { | 80 | if (rc) { |
81 | errorMsg("%s: %s\n", command, strerror(errno)); | 81 | error_msg("%s: %s\n", command, strerror(errno)); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | } | 84 | } |
@@ -106,7 +106,7 @@ static int checkTarMagic(int srcFd) | |||
106 | 106 | ||
107 | headerStart = lseek(srcFd, 0, SEEK_CUR); | 107 | headerStart = lseek(srcFd, 0, SEEK_CUR); |
108 | lseek(srcFd, (off_t) 257, SEEK_CUR); | 108 | lseek(srcFd, (off_t) 257, SEEK_CUR); |
109 | fullRead(srcFd, magic, 6); | 109 | full_read(srcFd, magic, 6); |
110 | lseek(srcFd, headerStart, SEEK_SET); | 110 | lseek(srcFd, headerStart, SEEK_SET); |
111 | if (strncmp(magic, "ustar", 5)!=0) | 111 | if (strncmp(magic, "ustar", 5)!=0) |
112 | return(FALSE); | 112 | return(FALSE); |
@@ -123,7 +123,7 @@ static int readTarHeader(int srcFd, headerL_t *current) | |||
123 | off_t initialOffset; | 123 | off_t initialOffset; |
124 | 124 | ||
125 | initialOffset = lseek(srcFd, 0, SEEK_CUR); | 125 | initialOffset = lseek(srcFd, 0, SEEK_CUR); |
126 | if (fullRead(srcFd, (char *) &rawTarHeader, 512) != 512) { | 126 | if (full_read(srcFd, (char *) &rawTarHeader, 512) != 512) { |
127 | lseek(srcFd, initialOffset, SEEK_SET); | 127 | lseek(srcFd, initialOffset, SEEK_SET); |
128 | return(FALSE); | 128 | return(FALSE); |
129 | } | 129 | } |
@@ -157,8 +157,8 @@ static int checkArMagic(int srcFd) | |||
157 | char arMagic[8]; | 157 | char arMagic[8]; |
158 | 158 | ||
159 | headerStart = lseek(srcFd, 0, SEEK_CUR); | 159 | headerStart = lseek(srcFd, 0, SEEK_CUR); |
160 | if (fullRead(srcFd, arMagic, 8) != 8) { | 160 | if (full_read(srcFd, arMagic, 8) != 8) { |
161 | errorMsg("fatal error\n"); | 161 | error_msg("fatal error\n"); |
162 | return (FALSE); | 162 | return (FALSE); |
163 | } | 163 | } |
164 | lseek(srcFd, headerStart, SEEK_SET); | 164 | lseek(srcFd, headerStart, SEEK_SET); |
@@ -178,7 +178,7 @@ static int readArEntry(int srcFd, headerL_t *entry) | |||
178 | off_t initialOffset; | 178 | off_t initialOffset; |
179 | 179 | ||
180 | initialOffset = lseek(srcFd, 0, SEEK_CUR); | 180 | initialOffset = lseek(srcFd, 0, SEEK_CUR); |
181 | if (fullRead(srcFd, (char *) &rawArHeader, 60) != 60) { | 181 | if (full_read(srcFd, (char *) &rawArHeader, 60) != 60) { |
182 | lseek(srcFd, initialOffset, SEEK_SET); | 182 | lseek(srcFd, initialOffset, SEEK_SET); |
183 | return(FALSE); | 183 | return(FALSE); |
184 | } | 184 | } |
@@ -215,7 +215,7 @@ static int readArEntry(int srcFd, headerL_t *entry) | |||
215 | 215 | ||
216 | if (entry->size > MAX_NAME_LENGTH) | 216 | if (entry->size > MAX_NAME_LENGTH) |
217 | entry->size = MAX_NAME_LENGTH; | 217 | entry->size = MAX_NAME_LENGTH; |
218 | fullRead(srcFd, tempName, entry->size); | 218 | full_read(srcFd, tempName, entry->size); |
219 | tempName[entry->size-3]='\0'; | 219 | tempName[entry->size-3]='\0'; |
220 | 220 | ||
221 | /* read the second header for this entry */ | 221 | /* read the second header for this entry */ |
@@ -226,7 +226,7 @@ static int readArEntry(int srcFd, headerL_t *entry) | |||
226 | if ((entry->name[0]='/') && (entry->name[1]='0')) | 226 | if ((entry->name[0]='/') && (entry->name[1]='0')) |
227 | strcpy(entry->name, tempName); | 227 | strcpy(entry->name, tempName); |
228 | else { | 228 | else { |
229 | errorMsg("Invalid long filename\n"); | 229 | error_msg("Invalid long filename\n"); |
230 | return(FALSE); | 230 | return(FALSE); |
231 | } | 231 | } |
232 | } | 232 | } |
@@ -343,7 +343,7 @@ extern int ar_main(int argc, char **argv) | |||
343 | usage(ar_usage); | 343 | usage(ar_usage); |
344 | 344 | ||
345 | if ( (srcFd = open(argv[optind], O_RDONLY)) < 0) | 345 | if ( (srcFd = open(argv[optind], O_RDONLY)) < 0) |
346 | fatalError("Cannot read %s\n", argv[optind]); | 346 | error_msg_and_die("Cannot read %s\n", argv[optind]); |
347 | 347 | ||
348 | optind++; | 348 | optind++; |
349 | entry = (headerL_t *) xmalloc(sizeof(headerL_t)); | 349 | entry = (headerL_t *) xmalloc(sizeof(headerL_t)); |
@@ -368,8 +368,8 @@ extern int ar_main(int argc, char **argv) | |||
368 | 368 | ||
369 | while(extractList->next != NULL) { | 369 | while(extractList->next != NULL) { |
370 | if (funct & EXT_TO_FILE) { | 370 | if (funct & EXT_TO_FILE) { |
371 | if (isDirectory(extractList->name, TRUE, NULL)==FALSE) | 371 | if (is_directory(extractList->name, TRUE, NULL)==FALSE) |
372 | createPath(extractList->name, 0666); | 372 | create_path(extractList->name, 0666); |
373 | dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode); | 373 | dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode); |
374 | lseek(srcFd, extractList->offset, SEEK_SET); | 374 | lseek(srcFd, extractList->offset, SEEK_SET); |
375 | copy_file_chunk(srcFd, dstFd, (size_t) extractList->size); | 375 | copy_file_chunk(srcFd, dstFd, (size_t) extractList->size); |
@@ -380,9 +380,9 @@ extern int ar_main(int argc, char **argv) | |||
380 | } | 380 | } |
381 | if ( (funct & DISPLAY) || (funct & VERBOSE)) { | 381 | if ( (funct & DISPLAY) || (funct & VERBOSE)) { |
382 | if (funct & VERBOSE) | 382 | if (funct & VERBOSE) |
383 | printf("%s %d/%d %8d %s ", modeString(extractList->mode), | 383 | printf("%s %d/%d %8d %s ", mode_string(extractList->mode), |
384 | extractList->uid, extractList->gid, | 384 | extractList->uid, extractList->gid, |
385 | extractList->size, timeString(extractList->mtime)); | 385 | extractList->size, time_string(extractList->mtime)); |
386 | printf("%s\n", extractList->name); | 386 | printf("%s\n", extractList->name); |
387 | } | 387 | } |
388 | extractList=extractList->next; | 388 | extractList=extractList->next; |
diff --git a/archival/ar.c b/archival/ar.c index a9a0a0a71..88cdd4f9f 100644 --- a/archival/ar.c +++ b/archival/ar.c | |||
@@ -106,7 +106,7 @@ static int checkTarMagic(int srcFd) | |||
106 | 106 | ||
107 | headerStart = lseek(srcFd, 0, SEEK_CUR); | 107 | headerStart = lseek(srcFd, 0, SEEK_CUR); |
108 | lseek(srcFd, (off_t) 257, SEEK_CUR); | 108 | lseek(srcFd, (off_t) 257, SEEK_CUR); |
109 | fullRead(srcFd, magic, 6); | 109 | full_read(srcFd, magic, 6); |
110 | lseek(srcFd, headerStart, SEEK_SET); | 110 | lseek(srcFd, headerStart, SEEK_SET); |
111 | if (strncmp(magic, "ustar", 5)!=0) | 111 | if (strncmp(magic, "ustar", 5)!=0) |
112 | return(FALSE); | 112 | return(FALSE); |
@@ -123,7 +123,7 @@ static int readTarHeader(int srcFd, headerL_t *current) | |||
123 | off_t initialOffset; | 123 | off_t initialOffset; |
124 | 124 | ||
125 | initialOffset = lseek(srcFd, 0, SEEK_CUR); | 125 | initialOffset = lseek(srcFd, 0, SEEK_CUR); |
126 | if (fullRead(srcFd, (char *) &rawTarHeader, 512) != 512) { | 126 | if (full_read(srcFd, (char *) &rawTarHeader, 512) != 512) { |
127 | lseek(srcFd, initialOffset, SEEK_SET); | 127 | lseek(srcFd, initialOffset, SEEK_SET); |
128 | return(FALSE); | 128 | return(FALSE); |
129 | } | 129 | } |
@@ -157,8 +157,8 @@ static int checkArMagic(int srcFd) | |||
157 | char arMagic[8]; | 157 | char arMagic[8]; |
158 | 158 | ||
159 | headerStart = lseek(srcFd, 0, SEEK_CUR); | 159 | headerStart = lseek(srcFd, 0, SEEK_CUR); |
160 | if (fullRead(srcFd, arMagic, 8) != 8) { | 160 | if (full_read(srcFd, arMagic, 8) != 8) { |
161 | errorMsg("fatal error\n"); | 161 | error_msg("fatal error\n"); |
162 | return (FALSE); | 162 | return (FALSE); |
163 | } | 163 | } |
164 | lseek(srcFd, headerStart, SEEK_SET); | 164 | lseek(srcFd, headerStart, SEEK_SET); |
@@ -178,7 +178,7 @@ static int readArEntry(int srcFd, headerL_t *entry) | |||
178 | off_t initialOffset; | 178 | off_t initialOffset; |
179 | 179 | ||
180 | initialOffset = lseek(srcFd, 0, SEEK_CUR); | 180 | initialOffset = lseek(srcFd, 0, SEEK_CUR); |
181 | if (fullRead(srcFd, (char *) &rawArHeader, 60) != 60) { | 181 | if (full_read(srcFd, (char *) &rawArHeader, 60) != 60) { |
182 | lseek(srcFd, initialOffset, SEEK_SET); | 182 | lseek(srcFd, initialOffset, SEEK_SET); |
183 | return(FALSE); | 183 | return(FALSE); |
184 | } | 184 | } |
@@ -215,7 +215,7 @@ static int readArEntry(int srcFd, headerL_t *entry) | |||
215 | 215 | ||
216 | if (entry->size > MAX_NAME_LENGTH) | 216 | if (entry->size > MAX_NAME_LENGTH) |
217 | entry->size = MAX_NAME_LENGTH; | 217 | entry->size = MAX_NAME_LENGTH; |
218 | fullRead(srcFd, tempName, entry->size); | 218 | full_read(srcFd, tempName, entry->size); |
219 | tempName[entry->size-3]='\0'; | 219 | tempName[entry->size-3]='\0'; |
220 | 220 | ||
221 | /* read the second header for this entry */ | 221 | /* read the second header for this entry */ |
@@ -226,7 +226,7 @@ static int readArEntry(int srcFd, headerL_t *entry) | |||
226 | if ((entry->name[0]='/') && (entry->name[1]='0')) | 226 | if ((entry->name[0]='/') && (entry->name[1]='0')) |
227 | strcpy(entry->name, tempName); | 227 | strcpy(entry->name, tempName); |
228 | else { | 228 | else { |
229 | errorMsg("Invalid long filename\n"); | 229 | error_msg("Invalid long filename\n"); |
230 | return(FALSE); | 230 | return(FALSE); |
231 | } | 231 | } |
232 | } | 232 | } |
@@ -343,7 +343,7 @@ extern int ar_main(int argc, char **argv) | |||
343 | usage(ar_usage); | 343 | usage(ar_usage); |
344 | 344 | ||
345 | if ( (srcFd = open(argv[optind], O_RDONLY)) < 0) | 345 | if ( (srcFd = open(argv[optind], O_RDONLY)) < 0) |
346 | fatalError("Cannot read %s\n", argv[optind]); | 346 | error_msg_and_die("Cannot read %s\n", argv[optind]); |
347 | 347 | ||
348 | optind++; | 348 | optind++; |
349 | entry = (headerL_t *) xmalloc(sizeof(headerL_t)); | 349 | entry = (headerL_t *) xmalloc(sizeof(headerL_t)); |
@@ -368,8 +368,8 @@ extern int ar_main(int argc, char **argv) | |||
368 | 368 | ||
369 | while(extractList->next != NULL) { | 369 | while(extractList->next != NULL) { |
370 | if (funct & EXT_TO_FILE) { | 370 | if (funct & EXT_TO_FILE) { |
371 | if (isDirectory(extractList->name, TRUE, NULL)==FALSE) | 371 | if (is_directory(extractList->name, TRUE, NULL)==FALSE) |
372 | createPath(extractList->name, 0666); | 372 | create_path(extractList->name, 0666); |
373 | dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode); | 373 | dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode); |
374 | lseek(srcFd, extractList->offset, SEEK_SET); | 374 | lseek(srcFd, extractList->offset, SEEK_SET); |
375 | copy_file_chunk(srcFd, dstFd, (size_t) extractList->size); | 375 | copy_file_chunk(srcFd, dstFd, (size_t) extractList->size); |
@@ -380,9 +380,9 @@ extern int ar_main(int argc, char **argv) | |||
380 | } | 380 | } |
381 | if ( (funct & DISPLAY) || (funct & VERBOSE)) { | 381 | if ( (funct & DISPLAY) || (funct & VERBOSE)) { |
382 | if (funct & VERBOSE) | 382 | if (funct & VERBOSE) |
383 | printf("%s %d/%d %8d %s ", modeString(extractList->mode), | 383 | printf("%s %d/%d %8d %s ", mode_string(extractList->mode), |
384 | extractList->uid, extractList->gid, | 384 | extractList->uid, extractList->gid, |
385 | extractList->size, timeString(extractList->mtime)); | 385 | extractList->size, time_string(extractList->mtime)); |
386 | printf("%s\n", extractList->name); | 386 | printf("%s\n", extractList->name); |
387 | } | 387 | } |
388 | extractList=extractList->next; | 388 | extractList=extractList->next; |
diff --git a/archival/gunzip.c b/archival/gunzip.c index eeff9774a..a5846c378 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c | |||
@@ -113,7 +113,7 @@ static char *license_msg[] = { | |||
113 | 113 | ||
114 | /* Diagnostic functions */ | 114 | /* Diagnostic functions */ |
115 | #ifdef DEBUG | 115 | #ifdef DEBUG |
116 | # define Assert(cond,msg) {if(!(cond)) errorMsg(msg);} | 116 | # define Assert(cond,msg) {if(!(cond)) error_msg(msg);} |
117 | # define Trace(x) fprintf x | 117 | # define Trace(x) fprintf x |
118 | # define Tracev(x) {if (verbose) fprintf x ;} | 118 | # define Tracev(x) {if (verbose) fprintf x ;} |
119 | # define Tracevv(x) {if (verbose>1) fprintf x ;} | 119 | # define Tracevv(x) {if (verbose>1) fprintf x ;} |
@@ -297,7 +297,7 @@ int in; /* input file descriptor */ | |||
297 | 297 | ||
298 | method = (int) get_byte(); | 298 | method = (int) get_byte(); |
299 | if (method != DEFLATED) { | 299 | if (method != DEFLATED) { |
300 | errorMsg("unknown method %d -- get newer version of gzip\n", method); | 300 | error_msg("unknown method %d -- get newer version of gzip\n", method); |
301 | exit_code = ERROR; | 301 | exit_code = ERROR; |
302 | return -1; | 302 | return -1; |
303 | } | 303 | } |
@@ -1114,13 +1114,13 @@ int in, out; /* input and output file descriptors */ | |||
1114 | int res = inflate(); | 1114 | int res = inflate(); |
1115 | 1115 | ||
1116 | if (res == 3) { | 1116 | if (res == 3) { |
1117 | errorMsg(memory_exhausted); | 1117 | error_msg(memory_exhausted); |
1118 | } else if (res != 0) { | 1118 | } else if (res != 0) { |
1119 | errorMsg("invalid compressed data--format violated\n"); | 1119 | error_msg("invalid compressed data--format violated\n"); |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | } else { | 1122 | } else { |
1123 | errorMsg("internal error, invalid method\n"); | 1123 | error_msg("internal error, invalid method\n"); |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | /* Get the crc and original length */ | 1126 | /* Get the crc and original length */ |
@@ -1149,10 +1149,10 @@ int in, out; /* input and output file descriptors */ | |||
1149 | 1149 | ||
1150 | /* Validate decompression */ | 1150 | /* Validate decompression */ |
1151 | if (orig_crc != updcrc(outbuf, 0)) { | 1151 | if (orig_crc != updcrc(outbuf, 0)) { |
1152 | errorMsg("invalid compressed data--crc error\n"); | 1152 | error_msg("invalid compressed data--crc error\n"); |
1153 | } | 1153 | } |
1154 | if (orig_len != (ulg) bytes_out) { | 1154 | if (orig_len != (ulg) bytes_out) { |
1155 | errorMsg("invalid compressed data--length error\n"); | 1155 | error_msg("invalid compressed data--length error\n"); |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | /* Check if there are more entries in a pkzip file */ | 1158 | /* Check if there are more entries in a pkzip file */ |
@@ -1225,9 +1225,9 @@ int gunzip_main(int argc, char **argv) | |||
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | if (isatty(fileno(stdin)) && fromstdin==1 && force==0) | 1227 | if (isatty(fileno(stdin)) && fromstdin==1 && force==0) |
1228 | fatalError( "data not read from terminal. Use -f to force it.\n"); | 1228 | error_msg_and_die( "data not read from terminal. Use -f to force it.\n"); |
1229 | if (isatty(fileno(stdout)) && tostdout==1 && force==0) | 1229 | if (isatty(fileno(stdout)) && tostdout==1 && force==0) |
1230 | fatalError( "data not written to terminal. Use -f to force it.\n"); | 1230 | error_msg_and_die( "data not written to terminal. Use -f to force it.\n"); |
1231 | 1231 | ||
1232 | 1232 | ||
1233 | foreground = signal(SIGINT, SIG_IGN) != SIG_IGN; | 1233 | foreground = signal(SIGINT, SIG_IGN) != SIG_IGN; |
@@ -1265,7 +1265,7 @@ int gunzip_main(int argc, char **argv) | |||
1265 | if (argc <= 0) | 1265 | if (argc <= 0) |
1266 | usage(gunzip_usage); | 1266 | usage(gunzip_usage); |
1267 | if (strlen(*argv) > MAX_PATH_LEN) { | 1267 | if (strlen(*argv) > MAX_PATH_LEN) { |
1268 | errorMsg(name_too_long); | 1268 | error_msg(name_too_long); |
1269 | exit(WARNING); | 1269 | exit(WARNING); |
1270 | } | 1270 | } |
1271 | strcpy(ifname, *argv); | 1271 | strcpy(ifname, *argv); |
@@ -1304,7 +1304,7 @@ int gunzip_main(int argc, char **argv) | |||
1304 | 1304 | ||
1305 | /* And get to work */ | 1305 | /* And get to work */ |
1306 | if (strlen(ifname) > MAX_PATH_LEN - 4) { | 1306 | if (strlen(ifname) > MAX_PATH_LEN - 4) { |
1307 | errorMsg(name_too_long); | 1307 | error_msg(name_too_long); |
1308 | exit(WARNING); | 1308 | exit(WARNING); |
1309 | } | 1309 | } |
1310 | strcpy(ofname, ifname); | 1310 | strcpy(ofname, ifname); |
diff --git a/archival/gzip.c b/archival/gzip.c index d8c22a924..49c429b3a 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -114,7 +114,7 @@ extern int method; /* compression method */ | |||
114 | # define DECLARE(type, array, size) type * array | 114 | # define DECLARE(type, array, size) type * array |
115 | # define ALLOC(type, array, size) { \ | 115 | # define ALLOC(type, array, size) { \ |
116 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ | 116 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ |
117 | if (array == NULL) errorMsg(memory_exhausted); \ | 117 | if (array == NULL) error_msg(memory_exhausted); \ |
118 | } | 118 | } |
119 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} | 119 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} |
120 | #else | 120 | #else |
@@ -251,7 +251,7 @@ extern int save_orig_name; /* set if original name must be saved */ | |||
251 | 251 | ||
252 | /* Diagnostic functions */ | 252 | /* Diagnostic functions */ |
253 | #ifdef DEBUG | 253 | #ifdef DEBUG |
254 | # define Assert(cond,msg) {if(!(cond)) errorMsg(msg);} | 254 | # define Assert(cond,msg) {if(!(cond)) error_msg(msg);} |
255 | # define Trace(x) fprintf x | 255 | # define Trace(x) fprintf x |
256 | # define Tracev(x) {if (verbose) fprintf x ;} | 256 | # define Tracev(x) {if (verbose) fprintf x ;} |
257 | # define Tracevv(x) {if (verbose>1) fprintf x ;} | 257 | # define Tracevv(x) {if (verbose>1) fprintf x ;} |
@@ -1381,7 +1381,7 @@ int length; | |||
1381 | (char *) window + start, length) != EQUAL) { | 1381 | (char *) window + start, length) != EQUAL) { |
1382 | fprintf(stderr, | 1382 | fprintf(stderr, |
1383 | " start %d, match %d, length %d\n", start, match, length); | 1383 | " start %d, match %d, length %d\n", start, match, length); |
1384 | errorMsg("invalid match\n"); | 1384 | error_msg("invalid match\n"); |
1385 | } | 1385 | } |
1386 | if (verbose > 1) { | 1386 | if (verbose > 1) { |
1387 | fprintf(stderr, "\\[%d,%d]", start - match, length); | 1387 | fprintf(stderr, "\\[%d,%d]", start - match, length); |
@@ -1819,9 +1819,9 @@ int gzip_main(int argc, char **argv) | |||
1819 | } | 1819 | } |
1820 | 1820 | ||
1821 | if (isatty(fileno(stdin)) && fromstdin==1 && force==0) | 1821 | if (isatty(fileno(stdin)) && fromstdin==1 && force==0) |
1822 | fatalError( "data not read from terminal. Use -f to force it.\n"); | 1822 | error_msg_and_die( "data not read from terminal. Use -f to force it.\n"); |
1823 | if (isatty(fileno(stdout)) && tostdout==1 && force==0) | 1823 | if (isatty(fileno(stdout)) && tostdout==1 && force==0) |
1824 | fatalError( "data not written to terminal. Use -f to force it.\n"); | 1824 | error_msg_and_die( "data not written to terminal. Use -f to force it.\n"); |
1825 | 1825 | ||
1826 | foreground = signal(SIGINT, SIG_IGN) != SIG_IGN; | 1826 | foreground = signal(SIGINT, SIG_IGN) != SIG_IGN; |
1827 | if (foreground) { | 1827 | if (foreground) { |
@@ -2900,7 +2900,7 @@ int eof; /* true if this is the last block for a file */ | |||
2900 | #endif | 2900 | #endif |
2901 | /* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */ | 2901 | /* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */ |
2902 | if (buf == (char *) 0) | 2902 | if (buf == (char *) 0) |
2903 | errorMsg("block vanished\n"); | 2903 | error_msg("block vanished\n"); |
2904 | 2904 | ||
2905 | copy_block(buf, (unsigned) stored_len, 0); /* without header */ | 2905 | copy_block(buf, (unsigned) stored_len, 0); /* without header */ |
2906 | compressed_len = stored_len << 3; | 2906 | compressed_len = stored_len << 3; |
@@ -3083,7 +3083,7 @@ local void set_file_type() | |||
3083 | bin_freq += dyn_ltree[n++].Freq; | 3083 | bin_freq += dyn_ltree[n++].Freq; |
3084 | *file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII; | 3084 | *file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII; |
3085 | if (*file_type == BINARY && translate_eol) { | 3085 | if (*file_type == BINARY && translate_eol) { |
3086 | errorMsg("-l used on binary file\n"); | 3086 | error_msg("-l used on binary file\n"); |
3087 | } | 3087 | } |
3088 | } | 3088 | } |
3089 | 3089 | ||
@@ -3239,13 +3239,13 @@ char *env; /* name of environment variable */ | |||
3239 | nargv = (char **) calloc(*argcp + 1, sizeof(char *)); | 3239 | nargv = (char **) calloc(*argcp + 1, sizeof(char *)); |
3240 | 3240 | ||
3241 | if (nargv == NULL) | 3241 | if (nargv == NULL) |
3242 | errorMsg(memory_exhausted); | 3242 | error_msg(memory_exhausted); |
3243 | oargv = *argvp; | 3243 | oargv = *argvp; |
3244 | *argvp = nargv; | 3244 | *argvp = nargv; |
3245 | 3245 | ||
3246 | /* Copy the program name first */ | 3246 | /* Copy the program name first */ |
3247 | if (oargc-- < 0) | 3247 | if (oargc-- < 0) |
3248 | errorMsg("argc<=0\n"); | 3248 | error_msg("argc<=0\n"); |
3249 | *(nargv++) = *(oargv++); | 3249 | *(nargv++) = *(oargv++); |
3250 | 3250 | ||
3251 | /* Then copy the environment args */ | 3251 | /* Then copy the environment args */ |
diff --git a/archival/tar.c b/archival/tar.c index 906fd7eda..cc7ba3b80 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -193,10 +193,10 @@ extern int tar_main(int argc, char **argv) | |||
193 | break; | 193 | break; |
194 | case 'f': | 194 | case 'f': |
195 | if (*tarName != '-') | 195 | if (*tarName != '-') |
196 | fatalError( "Only one 'f' option allowed\n"); | 196 | error_msg_and_die( "Only one 'f' option allowed\n"); |
197 | tarName = *(++argv); | 197 | tarName = *(++argv); |
198 | if (tarName == NULL) | 198 | if (tarName == NULL) |
199 | fatalError( "Option requires an argument: No file specified\n"); | 199 | error_msg_and_die( "Option requires an argument: No file specified\n"); |
200 | stopIt=TRUE; | 200 | stopIt=TRUE; |
201 | break; | 201 | break; |
202 | #if defined BB_FEATURE_TAR_EXCLUDE | 202 | #if defined BB_FEATURE_TAR_EXCLUDE |
@@ -205,7 +205,7 @@ extern int tar_main(int argc, char **argv) | |||
205 | excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2)); | 205 | excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2)); |
206 | excludeList[excludeListSize] = *(++argv); | 206 | excludeList[excludeListSize] = *(++argv); |
207 | if (excludeList[excludeListSize] == NULL) | 207 | if (excludeList[excludeListSize] == NULL) |
208 | fatalError( "Option requires an argument: No file specified\n"); | 208 | error_msg_and_die( "Option requires an argument: No file specified\n"); |
209 | /* Remove leading "/"s */ | 209 | /* Remove leading "/"s */ |
210 | if (*excludeList[excludeListSize] =='/') | 210 | if (*excludeList[excludeListSize] =='/') |
211 | excludeList[excludeListSize] = (excludeList[excludeListSize])+1; | 211 | excludeList[excludeListSize] = (excludeList[excludeListSize])+1; |
@@ -216,13 +216,13 @@ extern int tar_main(int argc, char **argv) | |||
216 | } | 216 | } |
217 | case 'X': | 217 | case 'X': |
218 | if (*excludeFileName != '-') | 218 | if (*excludeFileName != '-') |
219 | fatalError("Only one 'X' option allowed\n"); | 219 | error_msg_and_die("Only one 'X' option allowed\n"); |
220 | excludeFileName = *(++argv); | 220 | excludeFileName = *(++argv); |
221 | if (excludeFileName == NULL) | 221 | if (excludeFileName == NULL) |
222 | fatalError("Option requires an argument: No file specified\n"); | 222 | error_msg_and_die("Option requires an argument: No file specified\n"); |
223 | fileList = fopen (excludeFileName, "rt"); | 223 | fileList = fopen (excludeFileName, "rt"); |
224 | if (! fileList) | 224 | if (! fileList) |
225 | fatalError("Exclude file: file not found\n"); | 225 | error_msg_and_die("Exclude file: file not found\n"); |
226 | while (!feof(fileList)) { | 226 | while (!feof(fileList)) { |
227 | fscanf(fileList, "%s", file); | 227 | fscanf(fileList, "%s", file); |
228 | excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2)); | 228 | excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2)); |
@@ -253,7 +253,7 @@ extern int tar_main(int argc, char **argv) | |||
253 | */ | 253 | */ |
254 | if (createFlag == TRUE) { | 254 | if (createFlag == TRUE) { |
255 | #ifndef BB_FEATURE_TAR_CREATE | 255 | #ifndef BB_FEATURE_TAR_CREATE |
256 | fatalError( "This version of tar was not compiled with tar creation support.\n"); | 256 | error_msg_and_die( "This version of tar was not compiled with tar creation support.\n"); |
257 | #else | 257 | #else |
258 | status = writeTarFile(tarName, verboseFlag, argv, excludeList); | 258 | status = writeTarFile(tarName, verboseFlag, argv, excludeList); |
259 | #endif | 259 | #endif |
@@ -271,7 +271,7 @@ extern int tar_main(int argc, char **argv) | |||
271 | return EXIT_FAILURE; | 271 | return EXIT_FAILURE; |
272 | 272 | ||
273 | flagError: | 273 | flagError: |
274 | fatalError( "Exactly one of 'c', 'x' or 't' must be specified\n"); | 274 | error_msg_and_die( "Exactly one of 'c', 'x' or 't' must be specified\n"); |
275 | } | 275 | } |
276 | 276 | ||
277 | static void | 277 | static void |
@@ -301,10 +301,10 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
301 | if (extractFlag==TRUE && tostdoutFlag==FALSE) { | 301 | if (extractFlag==TRUE && tostdoutFlag==FALSE) { |
302 | /* Create the path to the file, just in case it isn't there... | 302 | /* Create the path to the file, just in case it isn't there... |
303 | * This should not screw up path permissions or anything. */ | 303 | * This should not screw up path permissions or anything. */ |
304 | createPath(header->name, 0777); | 304 | create_path(header->name, 0777); |
305 | if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY, | 305 | if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY, |
306 | header->mode & ~S_IFMT)) < 0) { | 306 | header->mode & ~S_IFMT)) < 0) { |
307 | errorMsg(io_error, header->name, strerror(errno)); | 307 | error_msg(io_error, header->name, strerror(errno)); |
308 | return( FALSE); | 308 | return( FALSE); |
309 | } | 309 | } |
310 | } | 310 | } |
@@ -322,9 +322,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
322 | readSize = size; | 322 | readSize = size; |
323 | writeSize = size; | 323 | writeSize = size; |
324 | } | 324 | } |
325 | if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) { | 325 | if ( (readSize = full_read(header->tarFd, buffer, readSize)) <= 0 ) { |
326 | /* Tarball seems to have a problem */ | 326 | /* Tarball seems to have a problem */ |
327 | errorMsg("Unexpected EOF in archive\n"); | 327 | error_msg("Unexpected EOF in archive\n"); |
328 | return( FALSE); | 328 | return( FALSE); |
329 | } | 329 | } |
330 | if ( readSize < writeSize ) | 330 | if ( readSize < writeSize ) |
@@ -333,9 +333,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
333 | /* Write out the file, if we are supposed to be doing that */ | 333 | /* Write out the file, if we are supposed to be doing that */ |
334 | if (extractFlag==TRUE) { | 334 | if (extractFlag==TRUE) { |
335 | 335 | ||
336 | if ((actualWriteSz=fullWrite(outFd, buffer, writeSize)) != writeSize ) { | 336 | if ((actualWriteSz=full_write(outFd, buffer, writeSize)) != writeSize ) { |
337 | /* Output file seems to have a problem */ | 337 | /* Output file seems to have a problem */ |
338 | errorMsg(io_error, header->name, strerror(errno)); | 338 | error_msg(io_error, header->name, strerror(errno)); |
339 | return( FALSE); | 339 | return( FALSE); |
340 | } | 340 | } |
341 | } else { | 341 | } else { |
@@ -361,13 +361,13 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
361 | if (extractFlag==FALSE || tostdoutFlag==TRUE) | 361 | if (extractFlag==FALSE || tostdoutFlag==TRUE) |
362 | return( TRUE); | 362 | return( TRUE); |
363 | 363 | ||
364 | if (createPath(header->name, header->mode) != TRUE) { | 364 | if (create_path(header->name, header->mode) != TRUE) { |
365 | errorMsg("%s: Cannot mkdir: %s\n", | 365 | error_msg("%s: Cannot mkdir: %s\n", |
366 | header->name, strerror(errno)); | 366 | header->name, strerror(errno)); |
367 | return( FALSE); | 367 | return( FALSE); |
368 | } | 368 | } |
369 | /* make the final component, just in case it was | 369 | /* make the final component, just in case it was |
370 | * omitted by createPath() (which will skip the | 370 | * omitted by create_path() (which will skip the |
371 | * directory if it doesn't have a terminating '/') */ | 371 | * directory if it doesn't have a terminating '/') */ |
372 | if (mkdir(header->name, header->mode) == 0) { | 372 | if (mkdir(header->name, header->mode) == 0) { |
373 | fixUpPermissions(header); | 373 | fixUpPermissions(header); |
@@ -382,7 +382,7 @@ tarExtractHardLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
382 | return( TRUE); | 382 | return( TRUE); |
383 | 383 | ||
384 | if (link(header->linkname, header->name) < 0) { | 384 | if (link(header->linkname, header->name) < 0) { |
385 | errorMsg("%s: Cannot create hard link to '%s': %s\n", | 385 | error_msg("%s: Cannot create hard link to '%s': %s\n", |
386 | header->name, header->linkname, strerror(errno)); | 386 | header->name, header->linkname, strerror(errno)); |
387 | return( FALSE); | 387 | return( FALSE); |
388 | } | 388 | } |
@@ -400,7 +400,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
400 | 400 | ||
401 | #ifdef S_ISLNK | 401 | #ifdef S_ISLNK |
402 | if (symlink(header->linkname, header->name) < 0) { | 402 | if (symlink(header->linkname, header->name) < 0) { |
403 | errorMsg("%s: Cannot create symlink to '%s': %s\n", | 403 | error_msg("%s: Cannot create symlink to '%s': %s\n", |
404 | header->name, header->linkname, strerror(errno)); | 404 | header->name, header->linkname, strerror(errno)); |
405 | return( FALSE); | 405 | return( FALSE); |
406 | } | 406 | } |
@@ -415,7 +415,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
415 | /* Do not change permissions or date on symlink, | 415 | /* Do not change permissions or date on symlink, |
416 | * since it changes the pointed to file instead. duh. */ | 416 | * since it changes the pointed to file instead. duh. */ |
417 | #else | 417 | #else |
418 | errorMsg("%s: Cannot create symlink to '%s': %s\n", | 418 | error_msg("%s: Cannot create symlink to '%s': %s\n", |
419 | header->name, header->linkname, | 419 | header->name, header->linkname, |
420 | "symlinks not supported"); | 420 | "symlinks not supported"); |
421 | #endif | 421 | #endif |
@@ -430,13 +430,13 @@ tarExtractSpecial(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
430 | 430 | ||
431 | if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) { | 431 | if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) { |
432 | if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) { | 432 | if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) { |
433 | errorMsg("%s: Cannot mknod: %s\n", | 433 | error_msg("%s: Cannot mknod: %s\n", |
434 | header->name, strerror(errno)); | 434 | header->name, strerror(errno)); |
435 | return( FALSE); | 435 | return( FALSE); |
436 | } | 436 | } |
437 | } else if (S_ISFIFO(header->mode)) { | 437 | } else if (S_ISFIFO(header->mode)) { |
438 | if (mkfifo(header->name, header->mode) < 0) { | 438 | if (mkfifo(header->name, header->mode) < 0) { |
439 | errorMsg("%s: Cannot mkfifo: %s\n", | 439 | error_msg("%s: Cannot mkfifo: %s\n", |
440 | header->name, strerror(errno)); | 440 | header->name, strerror(errno)); |
441 | return( FALSE); | 441 | return( FALSE); |
442 | } | 442 | } |
@@ -455,9 +455,9 @@ static long getOctal(const char *cp, int size) | |||
455 | long val = 0; | 455 | long val = 0; |
456 | 456 | ||
457 | for(;(size > 0) && (*cp == ' '); cp++, size--); | 457 | for(;(size > 0) && (*cp == ' '); cp++, size--); |
458 | if ((size == 0) || !isOctal(*cp)) | 458 | if ((size == 0) || !is_octal(*cp)) |
459 | return -1; | 459 | return -1; |
460 | for(; (size > 0) && isOctal(*cp); size--) { | 460 | for(; (size > 0) && is_octal(*cp); size--) { |
461 | val = val * 8 + *cp++ - '0'; | 461 | val = val * 8 + *cp++ - '0'; |
462 | } | 462 | } |
463 | for (;(size > 0) && (*cp == ' '); cp++, size--); | 463 | for (;(size > 0) && (*cp == ' '); cp++, size--); |
@@ -484,7 +484,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header) | |||
484 | ++*(header->name); | 484 | ++*(header->name); |
485 | 485 | ||
486 | if (alreadyWarned == FALSE) { | 486 | if (alreadyWarned == FALSE) { |
487 | errorMsg("Removing leading '/' from member names\n"); | 487 | error_msg("Removing leading '/' from member names\n"); |
488 | alreadyWarned = TRUE; | 488 | alreadyWarned = TRUE; |
489 | } | 489 | } |
490 | } | 490 | } |
@@ -538,7 +538,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
538 | else | 538 | else |
539 | tarFd = open(tarName, O_RDONLY); | 539 | tarFd = open(tarName, O_RDONLY); |
540 | if (tarFd < 0) { | 540 | if (tarFd < 0) { |
541 | errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno)); | 541 | error_msg( "Error opening '%s': %s\n", tarName, strerror(errno)); |
542 | return ( FALSE); | 542 | return ( FALSE); |
543 | } | 543 | } |
544 | 544 | ||
@@ -547,7 +547,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
547 | umask(0); | 547 | umask(0); |
548 | 548 | ||
549 | /* Read the tar file, and iterate over it one file at a time */ | 549 | /* Read the tar file, and iterate over it one file at a time */ |
550 | while ( (status = fullRead(tarFd, (char*)&rawHeader, TAR_BLOCK_SIZE)) == TAR_BLOCK_SIZE ) { | 550 | while ( (status = full_read(tarFd, (char*)&rawHeader, TAR_BLOCK_SIZE)) == TAR_BLOCK_SIZE ) { |
551 | 551 | ||
552 | /* Try to read the header */ | 552 | /* Try to read the header */ |
553 | if ( readTarHeader(&rawHeader, &header) == FALSE ) { | 553 | if ( readTarHeader(&rawHeader, &header) == FALSE ) { |
@@ -555,7 +555,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
555 | goto endgame; | 555 | goto endgame; |
556 | } else { | 556 | } else { |
557 | errorFlag=TRUE; | 557 | errorFlag=TRUE; |
558 | errorMsg("Bad tar header, skipping\n"); | 558 | error_msg("Bad tar header, skipping\n"); |
559 | continue; | 559 | continue; |
560 | } | 560 | } |
561 | } | 561 | } |
@@ -572,7 +572,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
572 | } | 572 | } |
573 | if ( skipNextHeaderFlag == TRUE ) { | 573 | if ( skipNextHeaderFlag == TRUE ) { |
574 | skipNextHeaderFlag=FALSE; | 574 | skipNextHeaderFlag=FALSE; |
575 | errorMsg(name_longer_than_foo, NAME_SIZE); | 575 | error_msg(name_longer_than_foo, NAME_SIZE); |
576 | if (tarExtractRegularFile(&header, FALSE, FALSE) == FALSE) | 576 | if (tarExtractRegularFile(&header, FALSE, FALSE) == FALSE) |
577 | errorFlag = TRUE; | 577 | errorFlag = TRUE; |
578 | continue; | 578 | continue; |
@@ -638,7 +638,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
638 | char buf[35]; | 638 | char buf[35]; |
639 | struct tm *tm = localtime (&(header.mtime)); | 639 | struct tm *tm = localtime (&(header.mtime)); |
640 | 640 | ||
641 | len=printf("%s ", modeString(header.mode)); | 641 | len=printf("%s ", mode_string(header.mode)); |
642 | memset(buf, 0, 8*sizeof(char)); | 642 | memset(buf, 0, 8*sizeof(char)); |
643 | my_getpwuid(buf, header.uid); | 643 | my_getpwuid(buf, header.uid); |
644 | if (! *buf) | 644 | if (! *buf) |
@@ -731,7 +731,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
731 | break; | 731 | break; |
732 | #endif | 732 | #endif |
733 | default: | 733 | default: |
734 | errorMsg("Unknown file type '%c' in tar file\n", header.type); | 734 | error_msg("Unknown file type '%c' in tar file\n", header.type); |
735 | close( tarFd); | 735 | close( tarFd); |
736 | return( FALSE); | 736 | return( FALSE); |
737 | } | 737 | } |
@@ -739,11 +739,11 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
739 | close(tarFd); | 739 | close(tarFd); |
740 | if (status > 0) { | 740 | if (status > 0) { |
741 | /* Bummer - we read a partial header */ | 741 | /* Bummer - we read a partial header */ |
742 | errorMsg( "Error reading '%s': %s\n", tarName, strerror(errno)); | 742 | error_msg( "Error reading '%s': %s\n", tarName, strerror(errno)); |
743 | return ( FALSE); | 743 | return ( FALSE); |
744 | } | 744 | } |
745 | else if (errorFlag==TRUE) { | 745 | else if (errorFlag==TRUE) { |
746 | errorMsg( "Error exit delayed from previous errors\n"); | 746 | error_msg( "Error exit delayed from previous errors\n"); |
747 | return( FALSE); | 747 | return( FALSE); |
748 | } else | 748 | } else |
749 | return( status); | 749 | return( status); |
@@ -753,13 +753,13 @@ endgame: | |||
753 | close( tarFd); | 753 | close( tarFd); |
754 | if (extractList != NULL) { | 754 | if (extractList != NULL) { |
755 | for (; *extractList != NULL; extractList++) { | 755 | for (; *extractList != NULL; extractList++) { |
756 | errorMsg("%s: Not found in archive\n", *extractList); | 756 | error_msg("%s: Not found in archive\n", *extractList); |
757 | errorFlag = TRUE; | 757 | errorFlag = TRUE; |
758 | } | 758 | } |
759 | } | 759 | } |
760 | if ( *(header.name) == '\0' ) { | 760 | if ( *(header.name) == '\0' ) { |
761 | if (errorFlag==TRUE) | 761 | if (errorFlag==TRUE) |
762 | errorMsg( "Error exit delayed from previous errors\n"); | 762 | error_msg( "Error exit delayed from previous errors\n"); |
763 | else | 763 | else |
764 | return( TRUE); | 764 | return( TRUE); |
765 | } | 765 | } |
@@ -903,7 +903,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
903 | if (*fileName=='/') { | 903 | if (*fileName=='/') { |
904 | static int alreadyWarned=FALSE; | 904 | static int alreadyWarned=FALSE; |
905 | if (alreadyWarned==FALSE) { | 905 | if (alreadyWarned==FALSE) { |
906 | errorMsg("Removing leading '/' from member names\n"); | 906 | error_msg("Removing leading '/' from member names\n"); |
907 | alreadyWarned=TRUE; | 907 | alreadyWarned=TRUE; |
908 | } | 908 | } |
909 | strncpy(header.name, fileName+1, sizeof(header.name)); | 909 | strncpy(header.name, fileName+1, sizeof(header.name)); |
@@ -956,7 +956,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
956 | header.typeflag = SYMTYPE; | 956 | header.typeflag = SYMTYPE; |
957 | link_size = readlink(fileName, buffer, sizeof(buffer) - 1); | 957 | link_size = readlink(fileName, buffer, sizeof(buffer) - 1); |
958 | if ( link_size < 0) { | 958 | if ( link_size < 0) { |
959 | errorMsg("Error reading symlink '%s': %s\n", header.name, strerror(errno)); | 959 | error_msg("Error reading symlink '%s': %s\n", header.name, strerror(errno)); |
960 | return ( FALSE); | 960 | return ( FALSE); |
961 | } | 961 | } |
962 | buffer[link_size] = '\0'; | 962 | buffer[link_size] = '\0'; |
@@ -978,7 +978,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
978 | header.typeflag = REGTYPE; | 978 | header.typeflag = REGTYPE; |
979 | putOctal(header.size, sizeof(header.size), statbuf->st_size); | 979 | putOctal(header.size, sizeof(header.size), statbuf->st_size); |
980 | } else { | 980 | } else { |
981 | errorMsg("%s: Unknown file type\n", fileName); | 981 | error_msg("%s: Unknown file type\n", fileName); |
982 | return ( FALSE); | 982 | return ( FALSE); |
983 | } | 983 | } |
984 | 984 | ||
@@ -994,8 +994,8 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
994 | putOctal(header.chksum, 7, chksum); | 994 | putOctal(header.chksum, 7, chksum); |
995 | 995 | ||
996 | /* Now write the header out to disk */ | 996 | /* Now write the header out to disk */ |
997 | if ((size=fullWrite(tbInfo->tarFd, (char*)&header, sizeof(struct TarHeader))) < 0) { | 997 | if ((size=full_write(tbInfo->tarFd, (char*)&header, sizeof(struct TarHeader))) < 0) { |
998 | errorMsg(io_error, fileName, strerror(errno)); | 998 | error_msg(io_error, fileName, strerror(errno)); |
999 | return ( FALSE); | 999 | return ( FALSE); |
1000 | } | 1000 | } |
1001 | /* Pad the header up to the tar block size */ | 1001 | /* Pad the header up to the tar block size */ |
@@ -1036,7 +1036,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
1036 | 1036 | ||
1037 | /* It is against the rules to archive a socket */ | 1037 | /* It is against the rules to archive a socket */ |
1038 | if (S_ISSOCK(statbuf->st_mode)) { | 1038 | if (S_ISSOCK(statbuf->st_mode)) { |
1039 | errorMsg("%s: socket ignored\n", fileName); | 1039 | error_msg("%s: socket ignored\n", fileName); |
1040 | return( TRUE); | 1040 | return( TRUE); |
1041 | } | 1041 | } |
1042 | 1042 | ||
@@ -1045,12 +1045,12 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
1045 | * the new tarball */ | 1045 | * the new tarball */ |
1046 | if (tbInfo->statBuf.st_dev == statbuf->st_dev && | 1046 | if (tbInfo->statBuf.st_dev == statbuf->st_dev && |
1047 | tbInfo->statBuf.st_ino == statbuf->st_ino) { | 1047 | tbInfo->statBuf.st_ino == statbuf->st_ino) { |
1048 | errorMsg("%s: file is the archive; skipping\n", fileName); | 1048 | error_msg("%s: file is the archive; skipping\n", fileName); |
1049 | return( TRUE); | 1049 | return( TRUE); |
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | if (strlen(fileName) >= NAME_SIZE) { | 1052 | if (strlen(fileName) >= NAME_SIZE) { |
1053 | errorMsg(name_longer_than_foo, NAME_SIZE); | 1053 | error_msg(name_longer_than_foo, NAME_SIZE); |
1054 | return ( TRUE); | 1054 | return ( TRUE); |
1055 | } | 1055 | } |
1056 | 1056 | ||
@@ -1067,21 +1067,21 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
1067 | 1067 | ||
1068 | /* open the file we want to archive, and make sure all is well */ | 1068 | /* open the file we want to archive, and make sure all is well */ |
1069 | if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { | 1069 | if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { |
1070 | errorMsg("%s: Cannot open: %s\n", fileName, strerror(errno)); | 1070 | error_msg("%s: Cannot open: %s\n", fileName, strerror(errno)); |
1071 | return( FALSE); | 1071 | return( FALSE); |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | /* write the file to the archive */ | 1074 | /* write the file to the archive */ |
1075 | while ( (size = fullRead(inputFileFd, buffer, sizeof(buffer))) > 0 ) { | 1075 | while ( (size = full_read(inputFileFd, buffer, sizeof(buffer))) > 0 ) { |
1076 | if (fullWrite(tbInfo->tarFd, buffer, size) != size ) { | 1076 | if (full_write(tbInfo->tarFd, buffer, size) != size ) { |
1077 | /* Output file seems to have a problem */ | 1077 | /* Output file seems to have a problem */ |
1078 | errorMsg(io_error, fileName, strerror(errno)); | 1078 | error_msg(io_error, fileName, strerror(errno)); |
1079 | return( FALSE); | 1079 | return( FALSE); |
1080 | } | 1080 | } |
1081 | readSize+=size; | 1081 | readSize+=size; |
1082 | } | 1082 | } |
1083 | if (size == -1) { | 1083 | if (size == -1) { |
1084 | errorMsg(io_error, fileName, strerror(errno)); | 1084 | error_msg(io_error, fileName, strerror(errno)); |
1085 | return( FALSE); | 1085 | return( FALSE); |
1086 | } | 1086 | } |
1087 | /* Pad the file up to the tar block size */ | 1087 | /* Pad the file up to the tar block size */ |
@@ -1106,7 +1106,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1106 | 1106 | ||
1107 | /* Make sure there is at least one file to tar up. */ | 1107 | /* Make sure there is at least one file to tar up. */ |
1108 | if (*argv == NULL) | 1108 | if (*argv == NULL) |
1109 | fatalError("Cowardly refusing to create an empty archive\n"); | 1109 | error_msg_and_die("Cowardly refusing to create an empty archive\n"); |
1110 | 1110 | ||
1111 | /* Open the tar file for writing. */ | 1111 | /* Open the tar file for writing. */ |
1112 | if (!strcmp(tarName, "-")) | 1112 | if (!strcmp(tarName, "-")) |
@@ -1114,7 +1114,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1114 | else | 1114 | else |
1115 | tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644); | 1115 | tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644); |
1116 | if (tbInfo.tarFd < 0) { | 1116 | if (tbInfo.tarFd < 0) { |
1117 | errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno)); | 1117 | error_msg( "Error opening '%s': %s\n", tarName, strerror(errno)); |
1118 | freeHardLinkInfo(&tbInfo.hlInfoHead); | 1118 | freeHardLinkInfo(&tbInfo.hlInfoHead); |
1119 | return ( FALSE); | 1119 | return ( FALSE); |
1120 | } | 1120 | } |
@@ -1122,7 +1122,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1122 | /* Store the stat info for the tarball's file, so | 1122 | /* Store the stat info for the tarball's file, so |
1123 | * can avoid including the tarball into itself.... */ | 1123 | * can avoid including the tarball into itself.... */ |
1124 | if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0) | 1124 | if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0) |
1125 | fatalError(io_error, tarName, strerror(errno)); | 1125 | error_msg_and_die(io_error, tarName, strerror(errno)); |
1126 | 1126 | ||
1127 | /* Set the umask for this process so it doesn't | 1127 | /* Set the umask for this process so it doesn't |
1128 | * screw up permission setting for us later. */ | 1128 | * screw up permission setting for us later. */ |
@@ -1130,7 +1130,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1130 | 1130 | ||
1131 | /* Read the directory/files and iterate over them one at a time */ | 1131 | /* Read the directory/files and iterate over them one at a time */ |
1132 | while (*argv != NULL) { | 1132 | while (*argv != NULL) { |
1133 | if (recursiveAction(*argv++, TRUE, FALSE, FALSE, | 1133 | if (recursive_action(*argv++, TRUE, FALSE, FALSE, |
1134 | writeFileToTarball, writeFileToTarball, | 1134 | writeFileToTarball, writeFileToTarball, |
1135 | (void*) &tbInfo) == FALSE) { | 1135 | (void*) &tbInfo) == FALSE) { |
1136 | errorFlag = TRUE; | 1136 | errorFlag = TRUE; |
@@ -1149,7 +1149,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1149 | /* Hang up the tools, close up shop, head home */ | 1149 | /* Hang up the tools, close up shop, head home */ |
1150 | close(tarFd); | 1150 | close(tarFd); |
1151 | if (errorFlag == TRUE) { | 1151 | if (errorFlag == TRUE) { |
1152 | errorMsg("Error exit delayed from previous errors\n"); | 1152 | error_msg("Error exit delayed from previous errors\n"); |
1153 | freeHardLinkInfo(&tbInfo.hlInfoHead); | 1153 | freeHardLinkInfo(&tbInfo.hlInfoHead); |
1154 | return(FALSE); | 1154 | return(FALSE); |
1155 | } | 1155 | } |
@@ -54,7 +54,7 @@ static char *busybox_fullpath() | |||
54 | if (len != -1) { | 54 | if (len != -1) { |
55 | path[len] = 0; | 55 | path[len] = 0; |
56 | } else { | 56 | } else { |
57 | errorMsg("%s: %s\n", proc, strerror(errno)); | 57 | error_msg("%s: %s\n", proc, strerror(errno)); |
58 | return NULL; | 58 | return NULL; |
59 | } | 59 | } |
60 | return strdup(path); | 60 | return strdup(path); |
@@ -78,7 +78,7 @@ static void install_links(const char *busybox, int use_symbolic_links) | |||
78 | rc = Link(busybox, command); | 78 | rc = Link(busybox, command); |
79 | 79 | ||
80 | if (rc) { | 80 | if (rc) { |
81 | errorMsg("%s: %s\n", command, strerror(errno)); | 81 | error_msg("%s: %s\n", command, strerror(errno)); |
82 | } | 82 | } |
83 | } | 83 | } |
84 | } | 84 | } |
@@ -55,8 +55,8 @@ | |||
55 | #define BUF_SIZE 8192 | 55 | #define BUF_SIZE 8192 |
56 | #define EXPAND_ALLOC 1024 | 56 | #define EXPAND_ALLOC 1024 |
57 | 57 | ||
58 | static inline int isDecimal(ch) { return ((ch >= '0') && (ch <= '9')); } | 58 | static inline int is_decimal(ch) { return ((ch >= '0') && (ch <= '9')); } |
59 | static inline int isOctal(ch) { return ((ch >= '0') && (ch <= '7')); } | 59 | static inline int is_octal(ch) { return ((ch >= '0') && (ch <= '7')); } |
60 | 60 | ||
61 | /* Macros for min/max. */ | 61 | /* Macros for min/max. */ |
62 | #ifndef MIN | 62 | #ifndef MIN |
@@ -119,14 +119,14 @@ extern const char *applet_name; | |||
119 | extern int applet_name_compare(const void *x, const void *y); | 119 | extern int applet_name_compare(const void *x, const void *y); |
120 | 120 | ||
121 | extern void usage(const char *usage) __attribute__ ((noreturn)); | 121 | extern void usage(const char *usage) __attribute__ ((noreturn)); |
122 | extern void errorMsg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 122 | extern void error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); |
123 | extern void fatalError(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 123 | extern void error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); |
124 | extern void perrorMsg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 124 | extern void perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); |
125 | extern void fatalPerror(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 125 | extern void perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); |
126 | 126 | ||
127 | const char *modeString(int mode); | 127 | const char *mode_string(int mode); |
128 | const char *timeString(time_t timeVal); | 128 | const char *time_string(time_t timeVal); |
129 | int isDirectory(const char *name, const int followLinks, struct stat *statBuf); | 129 | int is_directory(const char *name, const int followLinks, struct stat *statBuf); |
130 | int isDevice(const char *name); | 130 | int isDevice(const char *name); |
131 | 131 | ||
132 | typedef struct ino_dev_hash_bucket_struct { | 132 | typedef struct ino_dev_hash_bucket_struct { |
@@ -139,7 +139,7 @@ int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name); | |||
139 | void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name); | 139 | void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name); |
140 | void reset_ino_dev_hashtable(void); | 140 | void reset_ino_dev_hashtable(void); |
141 | 141 | ||
142 | int copyFile(const char *srcName, const char *destName, | 142 | int copy_file(const char *srcName, const char *destName, |
143 | int setModes, int followLinks, int forceFlag); | 143 | int setModes, int followLinks, int forceFlag); |
144 | int copy_file_chunk(int srcFd, int dstFd, size_t remaining); | 144 | int copy_file_chunk(int srcFd, int dstFd, size_t remaining); |
145 | char *buildName(const char *dirName, const char *fileName); | 145 | char *buildName(const char *dirName, const char *fileName); |
@@ -147,20 +147,20 @@ int makeString(int argc, const char **argv, char *buf, int bufLen); | |||
147 | char *getChunk(int size); | 147 | char *getChunk(int size); |
148 | char *chunkstrdup(const char *str); | 148 | char *chunkstrdup(const char *str); |
149 | void freeChunks(void); | 149 | void freeChunks(void); |
150 | int fullWrite(int fd, const char *buf, int len); | 150 | int full_write(int fd, const char *buf, int len); |
151 | int fullRead(int fd, char *buf, int len); | 151 | int full_read(int fd, char *buf, int len); |
152 | int recursiveAction(const char *fileName, int recurse, int followLinks, int depthFirst, | 152 | int recursive_action(const char *fileName, int recurse, int followLinks, int depthFirst, |
153 | int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData), | 153 | int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData), |
154 | int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData), | 154 | int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData), |
155 | void* userData); | 155 | void* userData); |
156 | 156 | ||
157 | extern int createPath (const char *name, int mode); | 157 | extern int create_path (const char *name, int mode); |
158 | extern int parse_mode( const char* s, mode_t* theMode); | 158 | extern int parse_mode( const char* s, mode_t* theMode); |
159 | 159 | ||
160 | extern int get_kernel_revision(void); | 160 | extern int get_kernel_revision(void); |
161 | 161 | ||
162 | extern int get_console_fd(char* tty_name); | 162 | extern int get_console_fd(char* tty_name); |
163 | extern struct mntent *findMountPoint(const char *name, const char *table); | 163 | extern struct mntent *find_mount_point(const char *name, const char *table); |
164 | extern void write_mtab(char* blockDevice, char* directory, | 164 | extern void write_mtab(char* blockDevice, char* directory, |
165 | char* filesystemType, long flags, char* string_flags); | 165 | char* filesystemType, long flags, char* string_flags); |
166 | extern void erase_mtab(const char * name); | 166 | extern void erase_mtab(const char * name); |
@@ -169,8 +169,8 @@ extern char *mtab_first(void **iter); | |||
169 | extern char *mtab_next(void **iter); | 169 | extern char *mtab_next(void **iter); |
170 | extern char *mtab_getinfo(const char *match, const char which); | 170 | extern char *mtab_getinfo(const char *match, const char which); |
171 | extern int check_wildcard_match(const char* text, const char* pattern); | 171 | extern int check_wildcard_match(const char* text, const char* pattern); |
172 | extern long getNum (const char *cp); | 172 | extern long atoi_w_units (const char *cp); |
173 | extern pid_t* findPidByName( char* pidName); | 173 | extern pid_t* find_pid_by_name( char* pidName); |
174 | extern int find_real_root_device_name(char* name); | 174 | extern int find_real_root_device_name(char* name); |
175 | extern char *get_line_from_file(FILE *file); | 175 | extern char *get_line_from_file(FILE *file); |
176 | extern void print_file(FILE *file); | 176 | extern void print_file(FILE *file); |
diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c index e8ccb8156..530c45658 100644 --- a/chmod_chown_chgrp.c +++ b/chmod_chown_chgrp.c | |||
@@ -64,7 +64,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk) | |||
64 | case CHMOD_APP: | 64 | case CHMOD_APP: |
65 | /* Parse the specified modes */ | 65 | /* Parse the specified modes */ |
66 | if (parse_mode(theMode, &(statbuf->st_mode)) == FALSE) { | 66 | if (parse_mode(theMode, &(statbuf->st_mode)) == FALSE) { |
67 | fatalError( "unknown mode: %s\n", theMode); | 67 | error_msg_and_die( "unknown mode: %s\n", theMode); |
68 | } | 68 | } |
69 | if (chmod(fileName, statbuf->st_mode) == 0) | 69 | if (chmod(fileName, statbuf->st_mode) == 0) |
70 | return (TRUE); | 70 | return (TRUE); |
@@ -111,7 +111,7 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |||
111 | } | 111 | } |
112 | 112 | ||
113 | if (argc == 0 || *argv == NULL) { | 113 | if (argc == 0 || *argv == NULL) { |
114 | errorMsg(too_few_args); | 114 | error_msg(too_few_args); |
115 | } | 115 | } |
116 | 116 | ||
117 | if (whichApp == CHMOD_APP) { | 117 | if (whichApp == CHMOD_APP) { |
@@ -149,24 +149,24 @@ int chmod_chown_chgrp_main(int argc, char **argv) | |||
149 | if (*argv == p) | 149 | if (*argv == p) |
150 | uid = my_getpwnam(*argv); | 150 | uid = my_getpwnam(*argv); |
151 | if (uid == -1) { | 151 | if (uid == -1) { |
152 | fatalError( "unknown user name: %s\n", *argv); | 152 | error_msg_and_die( "unknown user name: %s\n", *argv); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | } | 155 | } |
156 | 156 | ||
157 | /* Ok, ready to do the deed now */ | 157 | /* Ok, ready to do the deed now */ |
158 | if (argc < 1) { | 158 | if (argc < 1) { |
159 | fatalError(too_few_args); | 159 | error_msg_and_die(too_few_args); |
160 | } | 160 | } |
161 | while (argc-- > 1) { | 161 | while (argc-- > 1) { |
162 | if (recursiveAction (*(++argv), recursiveFlag, FALSE, FALSE, | 162 | if (recursive_action (*(++argv), recursiveFlag, FALSE, FALSE, |
163 | fileAction, fileAction, NULL) == FALSE) | 163 | fileAction, fileAction, NULL) == FALSE) |
164 | return EXIT_FAILURE; | 164 | return EXIT_FAILURE; |
165 | } | 165 | } |
166 | return EXIT_SUCCESS; | 166 | return EXIT_SUCCESS; |
167 | 167 | ||
168 | bad_group: | 168 | bad_group: |
169 | fatalError( "unknown group name: %s\n", groupName); | 169 | error_msg_and_die( "unknown group name: %s\n", groupName); |
170 | } | 170 | } |
171 | 171 | ||
172 | /* | 172 | /* |
@@ -38,7 +38,7 @@ int chroot_main(int argc, char **argv) | |||
38 | argv++; | 38 | argv++; |
39 | 39 | ||
40 | if (chroot(*argv) || (chdir("/"))) { | 40 | if (chroot(*argv) || (chdir("/"))) { |
41 | fatalError("cannot change root directory to %s: %s\n", *argv, strerror(errno)); | 41 | error_msg_and_die("cannot change root directory to %s: %s\n", *argv, strerror(errno)); |
42 | } | 42 | } |
43 | 43 | ||
44 | argc--; | 44 | argc--; |
@@ -57,7 +57,7 @@ int chroot_main(int argc, char **argv) | |||
57 | return EXIT_SUCCESS; | 57 | return EXIT_SUCCESS; |
58 | #endif | 58 | #endif |
59 | } | 59 | } |
60 | fatalError("cannot execute %s: %s\n", prog, strerror(errno)); | 60 | error_msg_and_die("cannot execute %s: %s\n", prog, strerror(errno)); |
61 | 61 | ||
62 | } | 62 | } |
63 | 63 | ||
@@ -106,7 +106,7 @@ cmdedit_setwidth(int w) | |||
106 | cmdedit_termw = w; | 106 | cmdedit_termw = w; |
107 | cmdedit_scroll = w / 3; | 107 | cmdedit_scroll = w / 3; |
108 | } else { | 108 | } else { |
109 | errorMsg("\n*** Error: minimum screen width is 21\n"); | 109 | error_msg("\n*** Error: minimum screen width is 21\n"); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index 4600c0d05..ebdce7b24 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c | |||
@@ -35,12 +35,12 @@ printf("erik: B\n"); | |||
35 | for (i = 1; i < argc; i++) { | 35 | for (i = 1; i < argc; i++) { |
36 | num = atoi(argv[i]); | 36 | num = atoi(argv[i]); |
37 | if (num == 0) | 37 | if (num == 0) |
38 | errorMsg("0: illegal VT number\n"); | 38 | error_msg("0: illegal VT number\n"); |
39 | else if (num == 1) | 39 | else if (num == 1) |
40 | errorMsg("VT 1 cannot be deallocated\n"); | 40 | error_msg("VT 1 cannot be deallocated\n"); |
41 | else if (ioctl(fd, VT_DISALLOCATE, num)) { | 41 | else if (ioctl(fd, VT_DISALLOCATE, num)) { |
42 | perror("VT_DISALLOCATE"); | 42 | perror("VT_DISALLOCATE"); |
43 | fatalError("could not deallocate console %d\n", num); | 43 | error_msg_and_die("could not deallocate console %d\n", num); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | printf("erik: C\n"); | 46 | printf("erik: C\n"); |
diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c index 77689fc84..3ff5ef691 100644 --- a/console-tools/dumpkmap.c +++ b/console-tools/dumpkmap.c | |||
@@ -50,7 +50,7 @@ int dumpkmap_main(int argc, char **argv) | |||
50 | 50 | ||
51 | fd = open("/dev/tty0", O_RDWR); | 51 | fd = open("/dev/tty0", O_RDWR); |
52 | if (fd < 0) { | 52 | if (fd < 0) { |
53 | errorMsg("Error opening /dev/tty0: %s\n", strerror(errno)); | 53 | error_msg("Error opening /dev/tty0: %s\n", strerror(errno)); |
54 | return EXIT_FAILURE; | 54 | return EXIT_FAILURE; |
55 | } | 55 | } |
56 | 56 | ||
@@ -78,7 +78,7 @@ int dumpkmap_main(int argc, char **argv) | |||
78 | ke.kb_table = i; | 78 | ke.kb_table = i; |
79 | if (ioctl(fd, KDGKBENT, &ke) < 0) { | 79 | if (ioctl(fd, KDGKBENT, &ke) < 0) { |
80 | 80 | ||
81 | errorMsg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); | 81 | error_msg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); |
82 | } | 82 | } |
83 | else { | 83 | else { |
84 | write(1,(void*)&ke.kb_value,2); | 84 | write(1,(void*)&ke.kb_value,2); |
diff --git a/console-tools/loadacm.c b/console-tools/loadacm.c index 156210890..a69664031 100644 --- a/console-tools/loadacm.c +++ b/console-tools/loadacm.c | |||
@@ -39,12 +39,12 @@ int loadacm_main(int argc, char **argv) | |||
39 | 39 | ||
40 | fd = open("/dev/tty", O_RDWR); | 40 | fd = open("/dev/tty", O_RDWR); |
41 | if (fd < 0) { | 41 | if (fd < 0) { |
42 | errorMsg("Error opening /dev/tty1: %s\n", strerror(errno)); | 42 | error_msg("Error opening /dev/tty1: %s\n", strerror(errno)); |
43 | return EXIT_FAILURE; | 43 | return EXIT_FAILURE; |
44 | } | 44 | } |
45 | 45 | ||
46 | if (screen_map_load(fd, stdin)) { | 46 | if (screen_map_load(fd, stdin)) { |
47 | errorMsg("Error loading acm: %s\n", strerror(errno)); | 47 | error_msg("Error loading acm: %s\n", strerror(errno)); |
48 | return EXIT_FAILURE; | 48 | return EXIT_FAILURE; |
49 | } | 49 | } |
50 | 50 | ||
@@ -72,7 +72,7 @@ int screen_map_load(int fd, FILE * fp) | |||
72 | if (parse_failed) { | 72 | if (parse_failed) { |
73 | if (-1 == fseek(fp, 0, SEEK_SET)) { | 73 | if (-1 == fseek(fp, 0, SEEK_SET)) { |
74 | if (errno == ESPIPE) | 74 | if (errno == ESPIPE) |
75 | errorMsg("16bit screen-map MUST be a regular file.\n"), | 75 | error_msg("16bit screen-map MUST be a regular file.\n"), |
76 | exit(1); | 76 | exit(1); |
77 | else | 77 | else |
78 | perror("fseek failed reading binary 16bit screen-map"), | 78 | perror("fseek failed reading binary 16bit screen-map"), |
@@ -83,7 +83,7 @@ int screen_map_load(int fd, FILE * fp) | |||
83 | perror("Cannot read [new] map from file"), exit(1); | 83 | perror("Cannot read [new] map from file"), exit(1); |
84 | #if 0 | 84 | #if 0 |
85 | else | 85 | else |
86 | errorMsg("Input screen-map is binary.\n"); | 86 | error_msg("Input screen-map is binary.\n"); |
87 | #endif | 87 | #endif |
88 | } | 88 | } |
89 | 89 | ||
@@ -100,7 +100,7 @@ int screen_map_load(int fd, FILE * fp) | |||
100 | /* rewind... */ | 100 | /* rewind... */ |
101 | if (-1 == fseek(fp, 0, SEEK_SET)) { | 101 | if (-1 == fseek(fp, 0, SEEK_SET)) { |
102 | if (errno == ESPIPE) | 102 | if (errno == ESPIPE) |
103 | errorMsg("Assuming 8bit screen-map - MUST be a regular file.\n"), | 103 | error_msg("Assuming 8bit screen-map - MUST be a regular file.\n"), |
104 | exit(1); | 104 | exit(1); |
105 | else | 105 | else |
106 | perror("fseek failed assuming 8bit screen-map"), exit(1); | 106 | perror("fseek failed assuming 8bit screen-map"), exit(1); |
@@ -113,7 +113,7 @@ int screen_map_load(int fd, FILE * fp) | |||
113 | if (-1 == fseek(fp, 0, SEEK_SET)) { | 113 | if (-1 == fseek(fp, 0, SEEK_SET)) { |
114 | if (errno == ESPIPE) | 114 | if (errno == ESPIPE) |
115 | /* should not - it succedeed above */ | 115 | /* should not - it succedeed above */ |
116 | errorMsg("fseek() returned ESPIPE !\n"), | 116 | error_msg("fseek() returned ESPIPE !\n"), |
117 | exit(1); | 117 | exit(1); |
118 | else | 118 | else |
119 | perror("fseek for binary 8bit screen-map"), exit(1); | 119 | perror("fseek for binary 8bit screen-map"), exit(1); |
@@ -123,7 +123,7 @@ int screen_map_load(int fd, FILE * fp) | |||
123 | perror("Cannot read [old] map from file"), exit(1); | 123 | perror("Cannot read [old] map from file"), exit(1); |
124 | #if 0 | 124 | #if 0 |
125 | else | 125 | else |
126 | errorMsg("Input screen-map is binary.\n"); | 126 | error_msg("Input screen-map is binary.\n"); |
127 | #endif | 127 | #endif |
128 | } | 128 | } |
129 | 129 | ||
@@ -132,7 +132,7 @@ int screen_map_load(int fd, FILE * fp) | |||
132 | else | 132 | else |
133 | return 0; | 133 | return 0; |
134 | } | 134 | } |
135 | errorMsg("Error parsing symbolic map\n"); | 135 | error_msg("Error parsing symbolic map\n"); |
136 | return(1); | 136 | return(1); |
137 | } | 137 | } |
138 | 138 | ||
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index f69f52fd8..13a196fb0 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c | |||
@@ -48,7 +48,7 @@ extern int loadfont_main(int argc, char **argv) | |||
48 | 48 | ||
49 | fd = open("/dev/tty0", O_RDWR); | 49 | fd = open("/dev/tty0", O_RDWR); |
50 | if (fd < 0) | 50 | if (fd < 0) |
51 | fatalPerror("Error opening /dev/tty0"); | 51 | perror_msg_and_die("Error opening /dev/tty0"); |
52 | loadnewfont(fd); | 52 | loadnewfont(fd); |
53 | 53 | ||
54 | return EXIT_SUCCESS; | 54 | return EXIT_SUCCESS; |
@@ -62,7 +62,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize) | |||
62 | memset(buf, 0, sizeof(buf)); | 62 | memset(buf, 0, sizeof(buf)); |
63 | 63 | ||
64 | if (unit < 1 || unit > 32) | 64 | if (unit < 1 || unit > 32) |
65 | fatalError("Bad character size %d\n", unit); | 65 | error_msg_and_die("Bad character size %d\n", unit); |
66 | 66 | ||
67 | for (i = 0; i < fontsize; i++) | 67 | for (i = 0; i < fontsize; i++) |
68 | memcpy(buf + (32 * i), inbuf + (unit * i), unit); | 68 | memcpy(buf + (32 * i), inbuf + (unit * i), unit); |
@@ -77,11 +77,11 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize) | |||
77 | 77 | ||
78 | if (ioctl(fd, PIO_FONTX, &cfd) == 0) | 78 | if (ioctl(fd, PIO_FONTX, &cfd) == 0) |
79 | return; /* success */ | 79 | return; /* success */ |
80 | perrorMsg("PIO_FONTX ioctl error (trying PIO_FONT)"); | 80 | perror_msg("PIO_FONTX ioctl error (trying PIO_FONT)"); |
81 | } | 81 | } |
82 | #endif | 82 | #endif |
83 | if (ioctl(fd, PIO_FONT, buf)) | 83 | if (ioctl(fd, PIO_FONT, buf)) |
84 | fatalPerror("PIO_FONT ioctl error"); | 84 | perror_msg_and_die("PIO_FONT ioctl error"); |
85 | } | 85 | } |
86 | 86 | ||
87 | static void | 87 | static void |
@@ -119,11 +119,11 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize) | |||
119 | if (ioctl(fd, PIO_UNIMAPCLR, &advice)) { | 119 | if (ioctl(fd, PIO_UNIMAPCLR, &advice)) { |
120 | #ifdef ENOIOCTLCMD | 120 | #ifdef ENOIOCTLCMD |
121 | if (errno == ENOIOCTLCMD) { | 121 | if (errno == ENOIOCTLCMD) { |
122 | errorMsg("It seems this kernel is older than 1.1.92\n"); | 122 | error_msg("It seems this kernel is older than 1.1.92\n"); |
123 | fatalError("No Unicode mapping table loaded.\n"); | 123 | error_msg_and_die("No Unicode mapping table loaded.\n"); |
124 | } else | 124 | } else |
125 | #endif | 125 | #endif |
126 | fatalPerror("PIO_UNIMAPCLR"); | 126 | perror_msg_and_die("PIO_UNIMAPCLR"); |
127 | } | 127 | } |
128 | ud.entry_ct = ct; | 128 | ud.entry_ct = ct; |
129 | ud.entries = up; | 129 | ud.entries = up; |
@@ -133,7 +133,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize) | |||
133 | /* change advice parameters */ | 133 | /* change advice parameters */ |
134 | } | 134 | } |
135 | #endif | 135 | #endif |
136 | fatalPerror("PIO_UNIMAP"); | 136 | perror_msg_and_die("PIO_UNIMAP"); |
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
@@ -150,13 +150,13 @@ static void loadnewfont(int fd) | |||
150 | */ | 150 | */ |
151 | inputlth = fread(inbuf, 1, sizeof(inbuf), stdin); | 151 | inputlth = fread(inbuf, 1, sizeof(inbuf), stdin); |
152 | if (ferror(stdin)) | 152 | if (ferror(stdin)) |
153 | fatalPerror("Error reading input font"); | 153 | perror_msg_and_die("Error reading input font"); |
154 | /* use malloc/realloc in case of giant files; | 154 | /* use malloc/realloc in case of giant files; |
155 | maybe these do not occur: 16kB for the font, | 155 | maybe these do not occur: 16kB for the font, |
156 | and 16kB for the map leaves 32 unicode values | 156 | and 16kB for the map leaves 32 unicode values |
157 | for each font position */ | 157 | for each font position */ |
158 | if (!feof(stdin)) | 158 | if (!feof(stdin)) |
159 | fatalPerror("Font too large"); | 159 | perror_msg_and_die("Font too large"); |
160 | 160 | ||
161 | /* test for psf first */ | 161 | /* test for psf first */ |
162 | { | 162 | { |
@@ -174,11 +174,11 @@ static void loadnewfont(int fd) | |||
174 | goto no_psf; | 174 | goto no_psf; |
175 | 175 | ||
176 | if (psfhdr.mode > PSF_MAXMODE) | 176 | if (psfhdr.mode > PSF_MAXMODE) |
177 | fatalError("Unsupported psf file mode\n"); | 177 | error_msg_and_die("Unsupported psf file mode\n"); |
178 | fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256); | 178 | fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256); |
179 | #if !defined( PIO_FONTX ) || defined( __sparc__ ) | 179 | #if !defined( PIO_FONTX ) || defined( __sparc__ ) |
180 | if (fontsize != 256) | 180 | if (fontsize != 256) |
181 | fatalError("Only fontsize 256 supported\n"); | 181 | error_msg_and_die("Only fontsize 256 supported\n"); |
182 | #endif | 182 | #endif |
183 | hastable = (psfhdr.mode & PSF_MODEHASTAB); | 183 | hastable = (psfhdr.mode & PSF_MODEHASTAB); |
184 | unit = psfhdr.charsize; | 184 | unit = psfhdr.charsize; |
@@ -186,7 +186,7 @@ static void loadnewfont(int fd) | |||
186 | 186 | ||
187 | head = head0 + fontsize * unit; | 187 | head = head0 + fontsize * unit; |
188 | if (head > inputlth || (!hastable && head != inputlth)) | 188 | if (head > inputlth || (!hastable && head != inputlth)) |
189 | fatalError("Input file: bad length\n"); | 189 | error_msg_and_die("Input file: bad length\n"); |
190 | do_loadfont(fd, inbuf + head0, unit, fontsize); | 190 | do_loadfont(fd, inbuf + head0, unit, fontsize); |
191 | if (hastable) | 191 | if (hastable) |
192 | do_loadtable(fd, inbuf + head, inputlth - head, fontsize); | 192 | do_loadtable(fd, inbuf + head, inputlth - head, fontsize); |
@@ -201,7 +201,7 @@ static void loadnewfont(int fd) | |||
201 | } else { | 201 | } else { |
202 | /* bare font */ | 202 | /* bare font */ |
203 | if (inputlth & 0377) | 203 | if (inputlth & 0377) |
204 | fatalError("Bad input file size\n"); | 204 | error_msg_and_die("Bad input file size\n"); |
205 | offset = 0; | 205 | offset = 0; |
206 | unit = inputlth / 256; | 206 | unit = inputlth / 256; |
207 | } | 207 | } |
diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c index 7dfa670f4..fc2439864 100644 --- a/console-tools/loadkmap.c +++ b/console-tools/loadkmap.c | |||
@@ -52,14 +52,14 @@ int loadkmap_main(int argc, char **argv) | |||
52 | 52 | ||
53 | fd = open("/dev/tty0", O_RDWR); | 53 | fd = open("/dev/tty0", O_RDWR); |
54 | if (fd < 0) | 54 | if (fd < 0) |
55 | fatalPerror("Error opening /dev/tty0"); | 55 | perror_msg_and_die("Error opening /dev/tty0"); |
56 | 56 | ||
57 | read(0, buff, 7); | 57 | read(0, buff, 7); |
58 | if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7)) | 58 | if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7)) |
59 | fatalError("This is not a valid binary keymap.\n"); | 59 | error_msg_and_die("This is not a valid binary keymap.\n"); |
60 | 60 | ||
61 | if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) | 61 | if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) |
62 | fatalPerror("Error reading keymap flags"); | 62 | perror_msg_and_die("Error reading keymap flags"); |
63 | 63 | ||
64 | ibuff = (u_short *) xmalloc(ibuffsz); | 64 | ibuff = (u_short *) xmalloc(ibuffsz); |
65 | 65 | ||
@@ -68,7 +68,7 @@ int loadkmap_main(int argc, char **argv) | |||
68 | pos = 0; | 68 | pos = 0; |
69 | while (pos < ibuffsz) { | 69 | while (pos < ibuffsz) { |
70 | if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) < 0) | 70 | if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) < 0) |
71 | fatalPerror("Error reading keymap"); | 71 | perror_msg_and_die("Error reading keymap"); |
72 | pos += readsz; | 72 | pos += readsz; |
73 | } | 73 | } |
74 | for (j = 0; j < NR_KEYS; j++) { | 74 | for (j = 0; j < NR_KEYS; j++) { |
diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c index 6a31e042a..7db398d77 100644 --- a/console-tools/setkeycodes.c +++ b/console-tools/setkeycodes.c | |||
@@ -52,18 +52,18 @@ setkeycodes_main(int argc, char** argv) | |||
52 | a.keycode = atoi(argv[2]); | 52 | a.keycode = atoi(argv[2]); |
53 | a.scancode = sc = strtol(argv[1], &ep, 16); | 53 | a.scancode = sc = strtol(argv[1], &ep, 16); |
54 | if (*ep) { | 54 | if (*ep) { |
55 | fatalError("error reading SCANCODE: '%s'\n", argv[1]); | 55 | error_msg_and_die("error reading SCANCODE: '%s'\n", argv[1]); |
56 | } | 56 | } |
57 | if (a.scancode > 127) { | 57 | if (a.scancode > 127) { |
58 | a.scancode -= 0xe000; | 58 | a.scancode -= 0xe000; |
59 | a.scancode += 128; | 59 | a.scancode += 128; |
60 | } | 60 | } |
61 | if (a.scancode > 255 || a.keycode > 127) { | 61 | if (a.scancode > 255 || a.keycode > 127) { |
62 | fatalError("SCANCODE or KEYCODE outside bounds\n"); | 62 | error_msg_and_die("SCANCODE or KEYCODE outside bounds\n"); |
63 | } | 63 | } |
64 | if (ioctl(fd,KDSETKEYCODE,&a)) { | 64 | if (ioctl(fd,KDSETKEYCODE,&a)) { |
65 | perror("KDSETKEYCODE"); | 65 | perror("KDSETKEYCODE"); |
66 | fatalError("failed to set SCANCODE %x to KEYCODE %d\n", sc, a.keycode); | 66 | error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d\n", sc, a.keycode); |
67 | } | 67 | } |
68 | argc -= 2; | 68 | argc -= 2; |
69 | argv += 2; | 69 | argv += 2; |
diff --git a/coreutils/chroot.c b/coreutils/chroot.c index f279af18d..34daf7f25 100644 --- a/coreutils/chroot.c +++ b/coreutils/chroot.c | |||
@@ -38,7 +38,7 @@ int chroot_main(int argc, char **argv) | |||
38 | argv++; | 38 | argv++; |
39 | 39 | ||
40 | if (chroot(*argv) || (chdir("/"))) { | 40 | if (chroot(*argv) || (chdir("/"))) { |
41 | fatalError("cannot change root directory to %s: %s\n", *argv, strerror(errno)); | 41 | error_msg_and_die("cannot change root directory to %s: %s\n", *argv, strerror(errno)); |
42 | } | 42 | } |
43 | 43 | ||
44 | argc--; | 44 | argc--; |
@@ -57,7 +57,7 @@ int chroot_main(int argc, char **argv) | |||
57 | return EXIT_SUCCESS; | 57 | return EXIT_SUCCESS; |
58 | #endif | 58 | #endif |
59 | } | 59 | } |
60 | fatalError("cannot execute %s: %s\n", prog, strerror(errno)); | 60 | error_msg_and_die("cannot execute %s: %s\n", prog, strerror(errno)); |
61 | 61 | ||
62 | } | 62 | } |
63 | 63 | ||
diff --git a/coreutils/cut.c b/coreutils/cut.c index b281fa234..6e0fe83fc 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
@@ -54,12 +54,12 @@ static void decompose_list(const char *list) | |||
54 | /* the list must contain only digits and no more than one minus sign */ | 54 | /* the list must contain only digits and no more than one minus sign */ |
55 | for (ptr = (char *)list; *ptr; ptr++) { | 55 | for (ptr = (char *)list; *ptr; ptr++) { |
56 | if (!isdigit(*ptr) && *ptr != '-') { | 56 | if (!isdigit(*ptr) && *ptr != '-') { |
57 | fatalError("invalid byte or field list\n"); | 57 | error_msg_and_die("invalid byte or field list\n"); |
58 | } | 58 | } |
59 | if (*ptr == '-') { | 59 | if (*ptr == '-') { |
60 | nminus++; | 60 | nminus++; |
61 | if (nminus > 1) { | 61 | if (nminus > 1) { |
62 | fatalError("invalid byte or field list\n"); | 62 | error_msg_and_die("invalid byte or field list\n"); |
63 | } | 63 | } |
64 | } | 64 | } |
65 | } | 65 | } |
@@ -68,7 +68,7 @@ static void decompose_list(const char *list) | |||
68 | if (nminus == 0) { | 68 | if (nminus == 0) { |
69 | startpos = strtol(list, &ptr, 10); | 69 | startpos = strtol(list, &ptr, 10); |
70 | if (startpos == 0) { | 70 | if (startpos == 0) { |
71 | fatalError("missing list of fields\n"); | 71 | error_msg_and_die("missing list of fields\n"); |
72 | } | 72 | } |
73 | endpos = startpos; | 73 | endpos = startpos; |
74 | } | 74 | } |
@@ -188,14 +188,14 @@ extern int cut_main(int argc, char **argv) | |||
188 | case 'f': | 188 | case 'f': |
189 | /* make sure they didn't ask for two types of lists */ | 189 | /* make sure they didn't ask for two types of lists */ |
190 | if (part != 0) { | 190 | if (part != 0) { |
191 | fatalError("only one type of list may be specified"); | 191 | error_msg_and_die("only one type of list may be specified"); |
192 | } | 192 | } |
193 | part = (char)opt; | 193 | part = (char)opt; |
194 | decompose_list(optarg); | 194 | decompose_list(optarg); |
195 | break; | 195 | break; |
196 | case 'd': | 196 | case 'd': |
197 | if (strlen(optarg) > 1) { | 197 | if (strlen(optarg) > 1) { |
198 | fatalError("the delimiter must be a single character\n"); | 198 | error_msg_and_die("the delimiter must be a single character\n"); |
199 | } | 199 | } |
200 | delim = optarg[0]; | 200 | delim = optarg[0]; |
201 | break; | 201 | break; |
@@ -209,16 +209,16 @@ extern int cut_main(int argc, char **argv) | |||
209 | } | 209 | } |
210 | 210 | ||
211 | if (part == 0) { | 211 | if (part == 0) { |
212 | fatalError("you must specify a list of bytes, characters, or fields\n"); | 212 | error_msg_and_die("you must specify a list of bytes, characters, or fields\n"); |
213 | } | 213 | } |
214 | 214 | ||
215 | if (supress_non_delimited_lines && part != 'f') { | 215 | if (supress_non_delimited_lines && part != 'f') { |
216 | fatalError("suppressing non-delimited lines makes sense | 216 | error_msg_and_die("suppressing non-delimited lines makes sense |
217 | only when operating on fields\n"); | 217 | only when operating on fields\n"); |
218 | } | 218 | } |
219 | 219 | ||
220 | if (delim != '\t' && part != 'f') { | 220 | if (delim != '\t' && part != 'f') { |
221 | fatalError("a delimiter may be specified only when operating on fields\n"); | 221 | error_msg_and_die("a delimiter may be specified only when operating on fields\n"); |
222 | } | 222 | } |
223 | 223 | ||
224 | /* argv[(optind)..(argc-1)] should be names of file to process. If no | 224 | /* argv[(optind)..(argc-1)] should be names of file to process. If no |
@@ -233,7 +233,7 @@ extern int cut_main(int argc, char **argv) | |||
233 | for (i = optind; i < argc; i++) { | 233 | for (i = optind; i < argc; i++) { |
234 | file = fopen(argv[i], "r"); | 234 | file = fopen(argv[i], "r"); |
235 | if (file == NULL) { | 235 | if (file == NULL) { |
236 | errorMsg("%s: %s\n", argv[i], strerror(errno)); | 236 | error_msg("%s: %s\n", argv[i], strerror(errno)); |
237 | } else { | 237 | } else { |
238 | cut_file(file); | 238 | cut_file(file); |
239 | fclose(file); | 239 | fclose(file); |
diff --git a/coreutils/date.c b/coreutils/date.c index 2e69bde4a..73fc70511 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -56,7 +56,7 @@ struct tm *date_conv_time(struct tm *tm_time, const char *t_string) | |||
56 | &(tm_time->tm_min), &(tm_time->tm_year)); | 56 | &(tm_time->tm_min), &(tm_time->tm_year)); |
57 | 57 | ||
58 | if (nr < 4 || nr > 5) { | 58 | if (nr < 4 || nr > 5) { |
59 | fatalError(invalid_date, t_string); | 59 | error_msg_and_die(invalid_date, t_string); |
60 | } | 60 | } |
61 | 61 | ||
62 | /* correct for century - minor Y2K problem here? */ | 62 | /* correct for century - minor Y2K problem here? */ |
@@ -121,7 +121,7 @@ struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string) | |||
121 | t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */ | 121 | t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */ |
122 | 122 | ||
123 | } else { | 123 | } else { |
124 | fatalError(invalid_date, t_string); | 124 | error_msg_and_die(invalid_date, t_string); |
125 | } | 125 | } |
126 | *tm_time = t; | 126 | *tm_time = t; |
127 | return (tm_time); | 127 | return (tm_time); |
@@ -156,7 +156,7 @@ int date_main(int argc, char **argv) | |||
156 | case 'u': | 156 | case 'u': |
157 | utc = 1; | 157 | utc = 1; |
158 | if (putenv("TZ=UTC0") != 0) | 158 | if (putenv("TZ=UTC0") != 0) |
159 | fatalError(memory_exhausted); | 159 | error_msg_and_die(memory_exhausted); |
160 | break; | 160 | break; |
161 | case 'd': | 161 | case 'd': |
162 | use_arg = 1; | 162 | use_arg = 1; |
@@ -176,7 +176,7 @@ int date_main(int argc, char **argv) | |||
176 | } | 176 | } |
177 | #if 0 | 177 | #if 0 |
178 | else { | 178 | else { |
179 | errorMsg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt); | 179 | error_msg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt); |
180 | usage(date_usage); | 180 | usage(date_usage); |
181 | } | 181 | } |
182 | #endif | 182 | #endif |
@@ -205,16 +205,16 @@ int date_main(int argc, char **argv) | |||
205 | /* Correct any day of week and day of year etc fields */ | 205 | /* Correct any day of week and day of year etc fields */ |
206 | tm = mktime(&tm_time); | 206 | tm = mktime(&tm_time); |
207 | if (tm < 0) | 207 | if (tm < 0) |
208 | fatalError(invalid_date, date_str); | 208 | error_msg_and_die(invalid_date, date_str); |
209 | if ( utc ) { | 209 | if ( utc ) { |
210 | if (putenv("TZ=UTC0") != 0) | 210 | if (putenv("TZ=UTC0") != 0) |
211 | fatalError(memory_exhausted); | 211 | error_msg_and_die(memory_exhausted); |
212 | } | 212 | } |
213 | 213 | ||
214 | /* if setting time, set it */ | 214 | /* if setting time, set it */ |
215 | if (set_time) { | 215 | if (set_time) { |
216 | if (stime(&tm) < 0) { | 216 | if (stime(&tm) < 0) { |
217 | perrorMsg("cannot set date"); | 217 | perror_msg("cannot set date"); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | } | 220 | } |
diff --git a/coreutils/dd.c b/coreutils/dd.c index 044f167c3..626b54898 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -71,28 +71,28 @@ extern int dd_main(int argc, char **argv) | |||
71 | else if (outFile == NULL && (strncmp(*argv, "of", 2) == 0)) | 71 | else if (outFile == NULL && (strncmp(*argv, "of", 2) == 0)) |
72 | outFile = ((strchr(*argv, '=')) + 1); | 72 | outFile = ((strchr(*argv, '=')) + 1); |
73 | else if (strncmp("count", *argv, 5) == 0) { | 73 | else if (strncmp("count", *argv, 5) == 0) { |
74 | count = getNum((strchr(*argv, '=')) + 1); | 74 | count = atoi_w_units((strchr(*argv, '=')) + 1); |
75 | if (count < 0) { | 75 | if (count < 0) { |
76 | errorMsg("Bad count value %s\n", *argv); | 76 | error_msg("Bad count value %s\n", *argv); |
77 | goto usage; | 77 | goto usage; |
78 | } | 78 | } |
79 | } else if (strncmp(*argv, "bs", 2) == 0) { | 79 | } else if (strncmp(*argv, "bs", 2) == 0) { |
80 | blockSize = getNum((strchr(*argv, '=')) + 1); | 80 | blockSize = atoi_w_units((strchr(*argv, '=')) + 1); |
81 | if (blockSize <= 0) { | 81 | if (blockSize <= 0) { |
82 | errorMsg("Bad block size value %s\n", *argv); | 82 | error_msg("Bad block size value %s\n", *argv); |
83 | goto usage; | 83 | goto usage; |
84 | } | 84 | } |
85 | } else if (strncmp(*argv, "skip", 4) == 0) { | 85 | } else if (strncmp(*argv, "skip", 4) == 0) { |
86 | skipBlocks = getNum((strchr(*argv, '=')) + 1); | 86 | skipBlocks = atoi_w_units((strchr(*argv, '=')) + 1); |
87 | if (skipBlocks <= 0) { | 87 | if (skipBlocks <= 0) { |
88 | errorMsg("Bad skip value %s\n", *argv); | 88 | error_msg("Bad skip value %s\n", *argv); |
89 | goto usage; | 89 | goto usage; |
90 | } | 90 | } |
91 | 91 | ||
92 | } else if (strncmp(*argv, "seek", 4) == 0) { | 92 | } else if (strncmp(*argv, "seek", 4) == 0) { |
93 | seekBlocks = getNum((strchr(*argv, '=')) + 1); | 93 | seekBlocks = atoi_w_units((strchr(*argv, '=')) + 1); |
94 | if (seekBlocks <= 0) { | 94 | if (seekBlocks <= 0) { |
95 | errorMsg("Bad seek value %s\n", *argv); | 95 | error_msg("Bad seek value %s\n", *argv); |
96 | goto usage; | 96 | goto usage; |
97 | } | 97 | } |
98 | } else if (strncmp(*argv, "conv", 4) == 0) { | 98 | } else if (strncmp(*argv, "conv", 4) == 0) { |
@@ -119,7 +119,7 @@ extern int dd_main(int argc, char **argv) | |||
119 | * here anyways... */ | 119 | * here anyways... */ |
120 | 120 | ||
121 | /* free(buf); */ | 121 | /* free(buf); */ |
122 | fatalPerror("%s", inFile); | 122 | perror_msg_and_die("%s", inFile); |
123 | } | 123 | } |
124 | 124 | ||
125 | if (outFile == NULL) | 125 | if (outFile == NULL) |
@@ -134,7 +134,7 @@ extern int dd_main(int argc, char **argv) | |||
134 | 134 | ||
135 | /* close(inFd); | 135 | /* close(inFd); |
136 | free(buf); */ | 136 | free(buf); */ |
137 | fatalPerror("%s", outFile); | 137 | perror_msg_and_die("%s", outFile); |
138 | } | 138 | } |
139 | 139 | ||
140 | lseek(inFd, (off_t) (skipBlocks * blockSize), SEEK_SET); | 140 | lseek(inFd, (off_t) (skipBlocks * blockSize), SEEK_SET); |
@@ -146,13 +146,13 @@ extern int dd_main(int argc, char **argv) | |||
146 | ibs=BUFSIZ; | 146 | ibs=BUFSIZ; |
147 | 147 | ||
148 | while (totalSize > outTotal) { | 148 | while (totalSize > outTotal) { |
149 | inCc = fullRead(inFd, buf, ibs); | 149 | inCc = full_read(inFd, buf, ibs); |
150 | inTotal += inCc; | 150 | inTotal += inCc; |
151 | if ( (sync==TRUE) && (inCc>0) ) | 151 | if ( (sync==TRUE) && (inCc>0) ) |
152 | while (inCc<ibs) | 152 | while (inCc<ibs) |
153 | buf[inCc++]='\0'; | 153 | buf[inCc++]='\0'; |
154 | 154 | ||
155 | if ((outCc = fullWrite(outFd, buf, inCc)) < 1){ | 155 | if ((outCc = full_write(outFd, buf, inCc)) < 1){ |
156 | if (outCc < 0 ){ | 156 | if (outCc < 0 ){ |
157 | perror("Error during write"); | 157 | perror("Error during write"); |
158 | } | 158 | } |
diff --git a/coreutils/df.c b/coreutils/df.c index 969a5b982..dc4849049 100644 --- a/coreutils/df.c +++ b/coreutils/df.c | |||
@@ -36,7 +36,7 @@ static int df(char *device, const char *mountPoint) | |||
36 | long blocks_percent_used; | 36 | long blocks_percent_used; |
37 | 37 | ||
38 | if (statfs(mountPoint, &s) != 0) { | 38 | if (statfs(mountPoint, &s) != 0) { |
39 | perrorMsg("%s", mountPoint); | 39 | perror_msg("%s", mountPoint); |
40 | return FALSE; | 40 | return FALSE; |
41 | } | 41 | } |
42 | 42 | ||
@@ -75,8 +75,8 @@ extern int df_main(int argc, char **argv) | |||
75 | usage(df_usage); | 75 | usage(df_usage); |
76 | } | 76 | } |
77 | while (argc > 1) { | 77 | while (argc > 1) { |
78 | if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) { | 78 | if ((mountEntry = find_mount_point(argv[1], mtab_file)) == 0) { |
79 | errorMsg("%s: can't find mount point.\n", argv[1]); | 79 | error_msg("%s: can't find mount point.\n", argv[1]); |
80 | status = EXIT_FAILURE; | 80 | status = EXIT_FAILURE; |
81 | } else if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir)) | 81 | } else if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir)) |
82 | status = EXIT_FAILURE; | 82 | status = EXIT_FAILURE; |
@@ -89,7 +89,7 @@ extern int df_main(int argc, char **argv) | |||
89 | 89 | ||
90 | mountTable = setmntent(mtab_file, "r"); | 90 | mountTable = setmntent(mtab_file, "r"); |
91 | if (mountTable == 0) { | 91 | if (mountTable == 0) { |
92 | perrorMsg("%s", mtab_file); | 92 | perror_msg("%s", mtab_file); |
93 | return EXIT_FAILURE; | 93 | return EXIT_FAILURE; |
94 | } | 94 | } |
95 | 95 | ||
diff --git a/coreutils/du.c b/coreutils/du.c index 313a910ad..fa76465e7 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -97,7 +97,7 @@ static long du(char *filename) | |||
97 | } | 97 | } |
98 | 98 | ||
99 | if (len + strlen(name) + 1 > BUFSIZ) { | 99 | if (len + strlen(name) + 1 > BUFSIZ) { |
100 | errorMsg(name_too_long); | 100 | error_msg(name_too_long); |
101 | du_depth--; | 101 | du_depth--; |
102 | return 0; | 102 | return 0; |
103 | } | 103 | } |
@@ -156,7 +156,7 @@ int du_main(int argc, char **argv) | |||
156 | for (i=optind; i < argc; i++) { | 156 | for (i=optind; i < argc; i++) { |
157 | if ((sum = du(argv[i])) == 0) | 157 | if ((sum = du(argv[i])) == 0) |
158 | status = EXIT_FAILURE; | 158 | status = EXIT_FAILURE; |
159 | if (sum && isDirectory(argv[i], FALSE, NULL)) { | 159 | if (sum && is_directory(argv[i], FALSE, NULL)) { |
160 | print_normal(sum, argv[i]); | 160 | print_normal(sum, argv[i]); |
161 | } | 161 | } |
162 | reset_ino_dev_hashtable(); | 162 | reset_ino_dev_hashtable(); |
@@ -166,7 +166,7 @@ int du_main(int argc, char **argv) | |||
166 | return status; | 166 | return status; |
167 | } | 167 | } |
168 | 168 | ||
169 | /* $Id: du.c,v 1.28 2000/12/06 15:56:31 kraai Exp $ */ | 169 | /* $Id: du.c,v 1.29 2000/12/07 19:56:48 markw Exp $ */ |
170 | /* | 170 | /* |
171 | Local Variables: | 171 | Local Variables: |
172 | c-file-style: "linux" | 172 | c-file-style: "linux" |
diff --git a/coreutils/expr.c b/coreutils/expr.c index 670352eb6..eed2637f2 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c | |||
@@ -74,14 +74,14 @@ int expr_main (int argc, char **argv) | |||
74 | VALUE *v; | 74 | VALUE *v; |
75 | 75 | ||
76 | if (argc == 1) { | 76 | if (argc == 1) { |
77 | fatalError("too few arguments\n"); | 77 | error_msg_and_die("too few arguments\n"); |
78 | } | 78 | } |
79 | 79 | ||
80 | args = argv + 1; | 80 | args = argv + 1; |
81 | 81 | ||
82 | v = eval (); | 82 | v = eval (); |
83 | if (*args) | 83 | if (*args) |
84 | fatalError ("syntax error\n"); | 84 | error_msg_and_die ("syntax error\n"); |
85 | 85 | ||
86 | if (v->type == integer) | 86 | if (v->type == integer) |
87 | printf ("%d\n", v->u.i); | 87 | printf ("%d\n", v->u.i); |
@@ -216,7 +216,7 @@ static \ | |||
216 | int name (l, r) VALUE *l; VALUE *r; \ | 216 | int name (l, r) VALUE *l; VALUE *r; \ |
217 | { \ | 217 | { \ |
218 | if (!toarith (l) || !toarith (r)) \ | 218 | if (!toarith (l) || !toarith (r)) \ |
219 | fatalError ("non-numeric argument\n"); \ | 219 | error_msg_and_die ("non-numeric argument\n"); \ |
220 | return l->u.i op r->u.i; \ | 220 | return l->u.i op r->u.i; \ |
221 | } | 221 | } |
222 | 222 | ||
@@ -224,9 +224,9 @@ int name (l, r) VALUE *l; VALUE *r; \ | |||
224 | int name (l, r) VALUE *l; VALUE *r; \ | 224 | int name (l, r) VALUE *l; VALUE *r; \ |
225 | { \ | 225 | { \ |
226 | if (!toarith (l) || !toarith (r)) \ | 226 | if (!toarith (l) || !toarith (r)) \ |
227 | fatalError ( "non-numeric argument\n"); \ | 227 | error_msg_and_die ( "non-numeric argument\n"); \ |
228 | if (r->u.i == 0) \ | 228 | if (r->u.i == 0) \ |
229 | fatalError ( "division by zero\n"); \ | 229 | error_msg_and_die ( "division by zero\n"); \ |
230 | return l->u.i op r->u.i; \ | 230 | return l->u.i op r->u.i; \ |
231 | } | 231 | } |
232 | 232 | ||
@@ -270,7 +270,7 @@ of a basic regular expression is not portable; it is being ignored", | |||
270 | re_syntax_options = RE_SYNTAX_POSIX_BASIC; | 270 | re_syntax_options = RE_SYNTAX_POSIX_BASIC; |
271 | errmsg = re_compile_pattern (pv->u.s, len, &re_buffer); | 271 | errmsg = re_compile_pattern (pv->u.s, len, &re_buffer); |
272 | if (errmsg) { | 272 | if (errmsg) { |
273 | fatalError("%s\n", errmsg); | 273 | error_msg_and_die("%s\n", errmsg); |
274 | } | 274 | } |
275 | 275 | ||
276 | len = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs); | 276 | len = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs); |
@@ -301,19 +301,19 @@ static VALUE *eval7 (void) | |||
301 | VALUE *v; | 301 | VALUE *v; |
302 | 302 | ||
303 | if (!*args) | 303 | if (!*args) |
304 | fatalError ( "syntax error\n"); | 304 | error_msg_and_die ( "syntax error\n"); |
305 | 305 | ||
306 | if (nextarg ("(")) { | 306 | if (nextarg ("(")) { |
307 | args++; | 307 | args++; |
308 | v = eval (); | 308 | v = eval (); |
309 | if (!nextarg (")")) | 309 | if (!nextarg (")")) |
310 | fatalError ( "syntax error\n"); | 310 | error_msg_and_die ( "syntax error\n"); |
311 | args++; | 311 | args++; |
312 | return v; | 312 | return v; |
313 | } | 313 | } |
314 | 314 | ||
315 | if (nextarg (")")) | 315 | if (nextarg (")")) |
316 | fatalError ( "syntax error\n"); | 316 | error_msg_and_die ( "syntax error\n"); |
317 | 317 | ||
318 | return str_value (*args++); | 318 | return str_value (*args++); |
319 | } | 319 | } |
@@ -327,7 +327,7 @@ static VALUE *eval6 (void) | |||
327 | if (nextarg ("quote")) { | 327 | if (nextarg ("quote")) { |
328 | args++; | 328 | args++; |
329 | if (!*args) | 329 | if (!*args) |
330 | fatalError ( "syntax error\n"); | 330 | error_msg_and_die ( "syntax error\n"); |
331 | return str_value (*args++); | 331 | return str_value (*args++); |
332 | } | 332 | } |
333 | else if (nextarg ("length")) { | 333 | else if (nextarg ("length")) { |
diff --git a/coreutils/head.c b/coreutils/head.c index 92b43bae2..f3aef1b9b 100644 --- a/coreutils/head.c +++ b/coreutils/head.c | |||
@@ -80,7 +80,7 @@ int head_main(int argc, char **argv) | |||
80 | } | 80 | } |
81 | head(len, fp); | 81 | head(len, fp); |
82 | if (errno) { | 82 | if (errno) { |
83 | errorMsg("%s: %s\n", argv[optind], strerror(errno)); | 83 | error_msg("%s: %s\n", argv[optind], strerror(errno)); |
84 | status = EXIT_FAILURE; | 84 | status = EXIT_FAILURE; |
85 | errno = 0; | 85 | errno = 0; |
86 | } | 86 | } |
diff --git a/coreutils/id.c b/coreutils/id.c index fdfc33cdc..86667f516 100644 --- a/coreutils/id.c +++ b/coreutils/id.c | |||
@@ -78,7 +78,7 @@ extern int id_main(int argc, char **argv) | |||
78 | pwnam=my_getpwnam(user); | 78 | pwnam=my_getpwnam(user); |
79 | grnam=my_getgrnam(group); | 79 | grnam=my_getgrnam(group); |
80 | if (gid == -1 || pwnam==-1 || grnam==-1) { | 80 | if (gid == -1 || pwnam==-1 || grnam==-1) { |
81 | fatalError("%s: No such user\n", user); | 81 | error_msg_and_die("%s: No such user\n", user); |
82 | } | 82 | } |
83 | if (no_group) | 83 | if (no_group) |
84 | printf("%ld\n", pwnam); | 84 | printf("%ld\n", pwnam); |
diff --git a/coreutils/ln.c b/coreutils/ln.c index e81dbafae..ead5322fa 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -55,9 +55,9 @@ static int fs_link(const char *link_DestName, const char *link_SrcName, const in | |||
55 | strcpy(srcName, link_SrcName); | 55 | strcpy(srcName, link_SrcName); |
56 | 56 | ||
57 | if (flag&LN_NODEREFERENCE) | 57 | if (flag&LN_NODEREFERENCE) |
58 | srcIsDir = isDirectory(srcName, TRUE, NULL); | 58 | srcIsDir = is_directory(srcName, TRUE, NULL); |
59 | else | 59 | else |
60 | srcIsDir = isDirectory(srcName, FALSE, NULL); | 60 | srcIsDir = is_directory(srcName, FALSE, NULL); |
61 | 61 | ||
62 | if ((srcIsDir==TRUE)&&((flag&LN_NODEREFERENCE)==0)) { | 62 | if ((srcIsDir==TRUE)&&((flag&LN_NODEREFERENCE)==0)) { |
63 | strcat(srcName, "/"); | 63 | strcat(srcName, "/"); |
diff --git a/coreutils/logname.c b/coreutils/logname.c index 89c409f00..1fc518bfc 100644 --- a/coreutils/logname.c +++ b/coreutils/logname.c | |||
@@ -35,5 +35,5 @@ extern int logname_main(int argc, char **argv) | |||
35 | puts(user); | 35 | puts(user); |
36 | return EXIT_SUCCESS; | 36 | return EXIT_SUCCESS; |
37 | } | 37 | } |
38 | fatalError("no login name\n"); | 38 | error_msg_and_die("no login name\n"); |
39 | } | 39 | } |
diff --git a/coreutils/ls.c b/coreutils/ls.c index 225132ba4..94c73b377 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -181,7 +181,7 @@ static int my_stat(struct dnode *cur) | |||
181 | #ifdef BB_FEATURE_LS_FOLLOWLINKS | 181 | #ifdef BB_FEATURE_LS_FOLLOWLINKS |
182 | if (follow_links == TRUE) { | 182 | if (follow_links == TRUE) { |
183 | if (stat(cur->fullname, &cur->dstat)) { | 183 | if (stat(cur->fullname, &cur->dstat)) { |
184 | errorMsg("%s: %s\n", cur->fullname, strerror(errno)); | 184 | error_msg("%s: %s\n", cur->fullname, strerror(errno)); |
185 | status = EXIT_FAILURE; | 185 | status = EXIT_FAILURE; |
186 | free(cur->fullname); | 186 | free(cur->fullname); |
187 | free(cur); | 187 | free(cur); |
@@ -190,7 +190,7 @@ static int my_stat(struct dnode *cur) | |||
190 | } else | 190 | } else |
191 | #endif | 191 | #endif |
192 | if (lstat(cur->fullname, &cur->dstat)) { | 192 | if (lstat(cur->fullname, &cur->dstat)) { |
193 | errorMsg("%s: %s\n", cur->fullname, strerror(errno)); | 193 | error_msg("%s: %s\n", cur->fullname, strerror(errno)); |
194 | status = EXIT_FAILURE; | 194 | status = EXIT_FAILURE; |
195 | free(cur->fullname); | 195 | free(cur->fullname); |
196 | free(cur); | 196 | free(cur); |
@@ -511,7 +511,7 @@ struct dnode **list_dir(char *path) | |||
511 | nfiles= 0; | 511 | nfiles= 0; |
512 | dir = opendir(path); | 512 | dir = opendir(path); |
513 | if (dir == NULL) { | 513 | if (dir == NULL) { |
514 | errorMsg("%s: %s\n", path, strerror(errno)); | 514 | error_msg("%s: %s\n", path, strerror(errno)); |
515 | status = EXIT_FAILURE; | 515 | status = EXIT_FAILURE; |
516 | return(NULL); /* could not open the dir */ | 516 | return(NULL); /* could not open the dir */ |
517 | } | 517 | } |
@@ -591,7 +591,7 @@ int list_single(struct dnode *dn) | |||
591 | column += 5; | 591 | column += 5; |
592 | break; | 592 | break; |
593 | case LIST_MODEBITS: | 593 | case LIST_MODEBITS: |
594 | fprintf(stdout, "%10s", (char *)modeString(dn->dstat.st_mode)); | 594 | fprintf(stdout, "%10s", (char *)mode_string(dn->dstat.st_mode)); |
595 | column += 10; | 595 | column += 10; |
596 | break; | 596 | break; |
597 | case LIST_NLINKS: | 597 | case LIST_NLINKS: |
diff --git a/coreutils/md5sum.c b/coreutils/md5sum.c index 84e037a61..57fac7450 100644 --- a/coreutils/md5sum.c +++ b/coreutils/md5sum.c | |||
@@ -651,13 +651,13 @@ static int md5_file(const char *filename, | |||
651 | } else { | 651 | } else { |
652 | fp = fopen(filename, OPENOPTS(binary)); | 652 | fp = fopen(filename, OPENOPTS(binary)); |
653 | if (fp == NULL) { | 653 | if (fp == NULL) { |
654 | errorMsg("%s: %s\n", filename, strerror(errno)); | 654 | error_msg("%s: %s\n", filename, strerror(errno)); |
655 | return FALSE; | 655 | return FALSE; |
656 | } | 656 | } |
657 | } | 657 | } |
658 | 658 | ||
659 | if (md5_stream(fp, md5_result)) { | 659 | if (md5_stream(fp, md5_result)) { |
660 | errorMsg("%s: %s\n", filename, strerror(errno)); | 660 | error_msg("%s: %s\n", filename, strerror(errno)); |
661 | 661 | ||
662 | if (fp != stdin) | 662 | if (fp != stdin) |
663 | fclose(fp); | 663 | fclose(fp); |
@@ -665,7 +665,7 @@ static int md5_file(const char *filename, | |||
665 | } | 665 | } |
666 | 666 | ||
667 | if (fp != stdin && fclose(fp) == EOF) { | 667 | if (fp != stdin && fclose(fp) == EOF) { |
668 | errorMsg("%s: %s\n", filename, strerror(errno)); | 668 | error_msg("%s: %s\n", filename, strerror(errno)); |
669 | return FALSE; | 669 | return FALSE; |
670 | } | 670 | } |
671 | 671 | ||
@@ -689,7 +689,7 @@ static int md5_check(const char *checkfile_name) | |||
689 | } else { | 689 | } else { |
690 | checkfile_stream = fopen(checkfile_name, "r"); | 690 | checkfile_stream = fopen(checkfile_name, "r"); |
691 | if (checkfile_stream == NULL) { | 691 | if (checkfile_stream == NULL) { |
692 | errorMsg("%s: %s\n", checkfile_name, strerror(errno)); | 692 | error_msg("%s: %s\n", checkfile_name, strerror(errno)); |
693 | return FALSE; | 693 | return FALSE; |
694 | } | 694 | } |
695 | } | 695 | } |
@@ -722,7 +722,7 @@ static int md5_check(const char *checkfile_name) | |||
722 | if (split_3(line, line_length, &md5num, &binary, &filename) | 722 | if (split_3(line, line_length, &md5num, &binary, &filename) |
723 | || !hex_digits(md5num)) { | 723 | || !hex_digits(md5num)) { |
724 | if (warn) { | 724 | if (warn) { |
725 | errorMsg("%s: %lu: improperly formatted MD5 checksum line\n", | 725 | error_msg("%s: %lu: improperly formatted MD5 checksum line\n", |
726 | checkfile_name, (unsigned long) line_number); | 726 | checkfile_name, (unsigned long) line_number); |
727 | } | 727 | } |
728 | } else { | 728 | } else { |
@@ -770,18 +770,18 @@ static int md5_check(const char *checkfile_name) | |||
770 | free(line); | 770 | free(line); |
771 | 771 | ||
772 | if (ferror(checkfile_stream)) { | 772 | if (ferror(checkfile_stream)) { |
773 | errorMsg("%s: read error\n", checkfile_name); /* */ | 773 | error_msg("%s: read error\n", checkfile_name); /* */ |
774 | return FALSE; | 774 | return FALSE; |
775 | } | 775 | } |
776 | 776 | ||
777 | if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) { | 777 | if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) { |
778 | errorMsg("md5sum: %s: %s\n", checkfile_name, strerror(errno)); | 778 | error_msg("md5sum: %s: %s\n", checkfile_name, strerror(errno)); |
779 | return FALSE; | 779 | return FALSE; |
780 | } | 780 | } |
781 | 781 | ||
782 | if (n_properly_formated_lines == 0) { | 782 | if (n_properly_formated_lines == 0) { |
783 | /* Warn if no tests are found. */ | 783 | /* Warn if no tests are found. */ |
784 | errorMsg("%s: no properly formatted MD5 checksum lines found\n", | 784 | error_msg("%s: no properly formatted MD5 checksum lines found\n", |
785 | checkfile_name); | 785 | checkfile_name); |
786 | return FALSE; | 786 | return FALSE; |
787 | } else { | 787 | } else { |
@@ -790,13 +790,13 @@ static int md5_check(const char *checkfile_name) | |||
790 | - n_open_or_read_failures); | 790 | - n_open_or_read_failures); |
791 | 791 | ||
792 | if (n_open_or_read_failures > 0) { | 792 | if (n_open_or_read_failures > 0) { |
793 | errorMsg("WARNING: %d of %d listed files could not be read\n", | 793 | error_msg("WARNING: %d of %d listed files could not be read\n", |
794 | n_open_or_read_failures, n_properly_formated_lines); | 794 | n_open_or_read_failures, n_properly_formated_lines); |
795 | return FALSE; | 795 | return FALSE; |
796 | } | 796 | } |
797 | 797 | ||
798 | if (n_mismatched_checksums > 0) { | 798 | if (n_mismatched_checksums > 0) { |
799 | errorMsg("WARNING: %d of %d computed checksums did NOT match\n", | 799 | error_msg("WARNING: %d of %d computed checksums did NOT match\n", |
800 | n_mismatched_checksums, n_computed_checkums); | 800 | n_mismatched_checksums, n_computed_checkums); |
801 | return FALSE; | 801 | return FALSE; |
802 | } | 802 | } |
@@ -861,22 +861,22 @@ int md5sum_main(int argc, | |||
861 | } | 861 | } |
862 | 862 | ||
863 | if (file_type_specified && do_check) { | 863 | if (file_type_specified && do_check) { |
864 | errorMsg("the -b and -t options are meaningless when verifying checksums\n"); | 864 | error_msg("the -b and -t options are meaningless when verifying checksums\n"); |
865 | return EXIT_FAILURE; | 865 | return EXIT_FAILURE; |
866 | } | 866 | } |
867 | 867 | ||
868 | if (n_strings > 0 && do_check) { | 868 | if (n_strings > 0 && do_check) { |
869 | errorMsg("the -g and -c options are mutually exclusive\n"); | 869 | error_msg("the -g and -c options are mutually exclusive\n"); |
870 | return EXIT_FAILURE; | 870 | return EXIT_FAILURE; |
871 | } | 871 | } |
872 | 872 | ||
873 | if (status_only && !do_check) { | 873 | if (status_only && !do_check) { |
874 | errorMsg("the -s option is meaningful only when verifying checksums\n"); | 874 | error_msg("the -s option is meaningful only when verifying checksums\n"); |
875 | return EXIT_FAILURE; | 875 | return EXIT_FAILURE; |
876 | } | 876 | } |
877 | 877 | ||
878 | if (warn && !do_check) { | 878 | if (warn && !do_check) { |
879 | errorMsg("the -w option is meaningful only when verifying checksums\n"); | 879 | error_msg("the -w option is meaningful only when verifying checksums\n"); |
880 | return EXIT_FAILURE; | 880 | return EXIT_FAILURE; |
881 | } | 881 | } |
882 | 882 | ||
@@ -884,7 +884,7 @@ int md5sum_main(int argc, | |||
884 | size_t i; | 884 | size_t i; |
885 | 885 | ||
886 | if (optind < argc) { | 886 | if (optind < argc) { |
887 | errorMsg("no files may be specified when using -g\n"); | 887 | error_msg("no files may be specified when using -g\n"); |
888 | return EXIT_FAILURE; | 888 | return EXIT_FAILURE; |
889 | } | 889 | } |
890 | for (i = 0; i < n_strings; ++i) { | 890 | for (i = 0; i < n_strings; ++i) { |
@@ -898,7 +898,7 @@ int md5sum_main(int argc, | |||
898 | } | 898 | } |
899 | } else if (do_check) { | 899 | } else if (do_check) { |
900 | if (optind + 1 < argc) { | 900 | if (optind + 1 < argc) { |
901 | errorMsg("only one argument may be specified when using -c\n"); | 901 | error_msg("only one argument may be specified when using -c\n"); |
902 | } | 902 | } |
903 | 903 | ||
904 | err = md5_check ((optind == argc) ? "-" : argv[optind]); | 904 | err = md5_check ((optind == argc) ? "-" : argv[optind]); |
@@ -951,12 +951,12 @@ int md5sum_main(int argc, | |||
951 | } | 951 | } |
952 | 952 | ||
953 | if (fclose (stdout) == EOF) { | 953 | if (fclose (stdout) == EOF) { |
954 | errorMsg("write error\n"); | 954 | error_msg("write error\n"); |
955 | return EXIT_FAILURE; | 955 | return EXIT_FAILURE; |
956 | } | 956 | } |
957 | 957 | ||
958 | if (have_read_stdin && fclose (stdin) == EOF) { | 958 | if (have_read_stdin && fclose (stdin) == EOF) { |
959 | errorMsg("standard input\n"); | 959 | error_msg("standard input\n"); |
960 | return EXIT_FAILURE; | 960 | return EXIT_FAILURE; |
961 | } | 961 | } |
962 | 962 | ||
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index c950847dc..92357a665 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c | |||
@@ -50,7 +50,7 @@ extern int mkdir_main(int argc, char **argv) | |||
50 | /* Find the specified modes */ | 50 | /* Find the specified modes */ |
51 | mode = 0; | 51 | mode = 0; |
52 | if (parse_mode(*(++argv), &mode) == FALSE) { | 52 | if (parse_mode(*(++argv), &mode) == FALSE) { |
53 | errorMsg("Unknown mode: %s\n", *argv); | 53 | error_msg("Unknown mode: %s\n", *argv); |
54 | return EXIT_FAILURE; | 54 | return EXIT_FAILURE; |
55 | } | 55 | } |
56 | /* Set the umask for this process so it doesn't | 56 | /* Set the umask for this process so it doesn't |
@@ -79,18 +79,18 @@ extern int mkdir_main(int argc, char **argv) | |||
79 | char buf[BUFSIZ + 1]; | 79 | char buf[BUFSIZ + 1]; |
80 | 80 | ||
81 | if (strlen(*argv) > BUFSIZ - 1) { | 81 | if (strlen(*argv) > BUFSIZ - 1) { |
82 | errorMsg(name_too_long); | 82 | error_msg(name_too_long); |
83 | return EXIT_FAILURE; | 83 | return EXIT_FAILURE; |
84 | } | 84 | } |
85 | strcpy(buf, *argv); | 85 | strcpy(buf, *argv); |
86 | status = stat(buf, &statBuf); | 86 | status = stat(buf, &statBuf); |
87 | if (parentFlag == FALSE && status != -1 && errno != ENOENT) { | 87 | if (parentFlag == FALSE && status != -1 && errno != ENOENT) { |
88 | errorMsg("%s: File exists\n", buf); | 88 | error_msg("%s: File exists\n", buf); |
89 | return EXIT_FAILURE; | 89 | return EXIT_FAILURE; |
90 | } | 90 | } |
91 | if (parentFlag == TRUE) { | 91 | if (parentFlag == TRUE) { |
92 | strcat(buf, "/"); | 92 | strcat(buf, "/"); |
93 | createPath(buf, mode); | 93 | create_path(buf, mode); |
94 | } else { | 94 | } else { |
95 | if (mkdir(buf, mode) != 0 && parentFlag == FALSE) { | 95 | if (mkdir(buf, mode) != 0 && parentFlag == FALSE) { |
96 | perror(buf); | 96 | perror(buf); |
diff --git a/coreutils/mknod.c b/coreutils/mknod.c index 21b2689cc..022ab8571 100644 --- a/coreutils/mknod.c +++ b/coreutils/mknod.c | |||
@@ -84,7 +84,7 @@ int mknod_main(int argc, char **argv) | |||
84 | mode |= perm; | 84 | mode |= perm; |
85 | 85 | ||
86 | if (mknod(argv[0], mode, dev) != 0) | 86 | if (mknod(argv[0], mode, dev) != 0) |
87 | fatalError("%s: %s\n", argv[0], strerror(errno)); | 87 | error_msg_and_die("%s: %s\n", argv[0], strerror(errno)); |
88 | return EXIT_SUCCESS; | 88 | return EXIT_SUCCESS; |
89 | } | 89 | } |
90 | 90 | ||
diff --git a/coreutils/pwd.c b/coreutils/pwd.c index 54129b175..71731944c 100644 --- a/coreutils/pwd.c +++ b/coreutils/pwd.c | |||
@@ -31,7 +31,7 @@ extern int pwd_main(int argc, char **argv) | |||
31 | char buf[BUFSIZ + 1]; | 31 | char buf[BUFSIZ + 1]; |
32 | 32 | ||
33 | if (getcwd(buf, sizeof(buf)) == NULL) | 33 | if (getcwd(buf, sizeof(buf)) == NULL) |
34 | fatalError("%s\n", strerror(errno)); | 34 | error_msg_and_die("%s\n", strerror(errno)); |
35 | 35 | ||
36 | printf("%s\n", buf); | 36 | printf("%s\n", buf); |
37 | return EXIT_SUCCESS; | 37 | return EXIT_SUCCESS; |
diff --git a/coreutils/rm.c b/coreutils/rm.c index 566335158..a9501ec7f 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c | |||
@@ -37,7 +37,7 @@ static const char *srcName; | |||
37 | static int fileAction(const char *fileName, struct stat *statbuf, void* junk) | 37 | static int fileAction(const char *fileName, struct stat *statbuf, void* junk) |
38 | { | 38 | { |
39 | if (unlink(fileName) < 0) { | 39 | if (unlink(fileName) < 0) { |
40 | perrorMsg("%s", fileName); | 40 | perror_msg("%s", fileName); |
41 | return (FALSE); | 41 | return (FALSE); |
42 | } | 42 | } |
43 | return (TRUE); | 43 | return (TRUE); |
@@ -47,11 +47,11 @@ static int dirAction(const char *fileName, struct stat *statbuf, void* junk) | |||
47 | { | 47 | { |
48 | if (recursiveFlag == FALSE) { | 48 | if (recursiveFlag == FALSE) { |
49 | errno = EISDIR; | 49 | errno = EISDIR; |
50 | perrorMsg("%s", fileName); | 50 | perror_msg("%s", fileName); |
51 | return (FALSE); | 51 | return (FALSE); |
52 | } | 52 | } |
53 | if (rmdir(fileName) < 0) { | 53 | if (rmdir(fileName) < 0) { |
54 | perrorMsg("%s", fileName); | 54 | perror_msg("%s", fileName); |
55 | return (FALSE); | 55 | return (FALSE); |
56 | } | 56 | } |
57 | return (TRUE); | 57 | return (TRUE); |
@@ -101,7 +101,7 @@ extern int rm_main(int argc, char **argv) | |||
101 | && errno == ENOENT) { | 101 | && errno == ENOENT) { |
102 | /* do not reports errors for non-existent files if -f, just skip them */ | 102 | /* do not reports errors for non-existent files if -f, just skip them */ |
103 | } else { | 103 | } else { |
104 | if (recursiveAction(srcName, recursiveFlag, FALSE, | 104 | if (recursive_action(srcName, recursiveFlag, FALSE, |
105 | TRUE, fileAction, dirAction, NULL) == FALSE) { | 105 | TRUE, fileAction, dirAction, NULL) == FALSE) { |
106 | status = EXIT_FAILURE; | 106 | status = EXIT_FAILURE; |
107 | } | 107 | } |
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index dfe53b215..f9f82bba4 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c | |||
@@ -35,7 +35,7 @@ extern int rmdir_main(int argc, char **argv) | |||
35 | 35 | ||
36 | while (--argc > 0) { | 36 | while (--argc > 0) { |
37 | if (rmdir(*(++argv)) == -1) { | 37 | if (rmdir(*(++argv)) == -1) { |
38 | perrorMsg("%s", *argv); | 38 | perror_msg("%s", *argv); |
39 | status = EXIT_FAILURE; | 39 | status = EXIT_FAILURE; |
40 | } | 40 | } |
41 | } | 41 | } |
diff --git a/coreutils/sort.c b/coreutils/sort.c index d6c3e9a5b..b0bf6e494 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -247,7 +247,7 @@ int sort_main(int argc, char **argv) | |||
247 | break; | 247 | break; |
248 | #endif | 248 | #endif |
249 | default: | 249 | default: |
250 | errorMsg("invalid option -- %c\n", opt); | 250 | error_msg("invalid option -- %c\n", opt); |
251 | usage(sort_usage); | 251 | usage(sort_usage); |
252 | } | 252 | } |
253 | } else { | 253 | } else { |
@@ -286,4 +286,4 @@ int sort_main(int argc, char **argv) | |||
286 | return(0); | 286 | return(0); |
287 | } | 287 | } |
288 | 288 | ||
289 | /* $Id: sort.c,v 1.23 2000/09/28 17:49:59 beppu Exp $ */ | 289 | /* $Id: sort.c,v 1.24 2000/12/07 19:56:48 markw Exp $ */ |
diff --git a/coreutils/tail.c b/coreutils/tail.c index a9da95462..308bb3085 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
@@ -225,7 +225,7 @@ int tail_main(int argc, char **argv) | |||
225 | usage(tail_usage); | 225 | usage(tail_usage); |
226 | break; | 226 | break; |
227 | default: | 227 | default: |
228 | errorMsg("\nUnknown arg: %c.\n\n",optopt); | 228 | error_msg("\nUnknown arg: %c.\n\n",optopt); |
229 | usage(tail_usage); | 229 | usage(tail_usage); |
230 | } | 230 | } |
231 | } | 231 | } |
@@ -263,7 +263,7 @@ int tail_main(int argc, char **argv) | |||
263 | else | 263 | else |
264 | fd[test] = open(files[test], O_RDONLY); | 264 | fd[test] = open(files[test], O_RDONLY); |
265 | if (fd[test] == -1) | 265 | if (fd[test] == -1) |
266 | fatalError("Unable to open file %s.\n", files[test]); | 266 | error_msg_and_die("Unable to open file %s.\n", files[test]); |
267 | tail_stream(fd[test]); | 267 | tail_stream(fd[test]); |
268 | 268 | ||
269 | bs=BUFSIZ; | 269 | bs=BUFSIZ; |
diff --git a/coreutils/tee.c b/coreutils/tee.c index 621801336..347684a28 100644 --- a/coreutils/tee.c +++ b/coreutils/tee.c | |||
@@ -47,7 +47,7 @@ tee_main(int argc, char **argv) | |||
47 | while (optind < argc) { | 47 | while (optind < argc) { |
48 | if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) { | 48 | if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) { |
49 | nfiles--; | 49 | nfiles--; |
50 | errorMsg("%s: %s\n", argv[optind-1], strerror(errno)); | 50 | error_msg("%s: %s\n", argv[optind-1], strerror(errno)); |
51 | status = 1; | 51 | status = 1; |
52 | } | 52 | } |
53 | } | 53 | } |
diff --git a/coreutils/test.c b/coreutils/test.c index acd6947d9..d1a0b6025 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -184,7 +184,7 @@ test_main(int argc, char** argv) | |||
184 | 184 | ||
185 | if (strcmp(applet_name, "[") == 0) { | 185 | if (strcmp(applet_name, "[") == 0) { |
186 | if (strcmp(argv[--argc], "]")) | 186 | if (strcmp(argv[--argc], "]")) |
187 | fatalError("missing ]\n"); | 187 | error_msg_and_die("missing ]\n"); |
188 | argv[argc] = NULL; | 188 | argv[argc] = NULL; |
189 | } | 189 | } |
190 | /* Implement special cases from POSIX.2, section 4.62.4 */ | 190 | /* Implement special cases from POSIX.2, section 4.62.4 */ |
@@ -233,9 +233,9 @@ syntax(op, msg) | |||
233 | char *msg; | 233 | char *msg; |
234 | { | 234 | { |
235 | if (op && *op) | 235 | if (op && *op) |
236 | fatalError("%s: %s\n", op, msg); | 236 | error_msg_and_die("%s: %s\n", op, msg); |
237 | else | 237 | else |
238 | fatalError("%s\n", msg); | 238 | error_msg_and_die("%s\n", msg); |
239 | } | 239 | } |
240 | 240 | ||
241 | static int | 241 | static int |
@@ -470,13 +470,13 @@ getn(s) | |||
470 | r = strtol(s, &p, 10); | 470 | r = strtol(s, &p, 10); |
471 | 471 | ||
472 | if (errno != 0) | 472 | if (errno != 0) |
473 | fatalError("%s: out of range\n", s); | 473 | error_msg_and_die("%s: out of range\n", s); |
474 | 474 | ||
475 | while (isspace(*p)) | 475 | while (isspace(*p)) |
476 | p++; | 476 | p++; |
477 | 477 | ||
478 | if (*p) | 478 | if (*p) |
479 | fatalError("%s: bad number\n", s); | 479 | error_msg_and_die("%s: bad number\n", s); |
480 | 480 | ||
481 | return (int) r; | 481 | return (int) r; |
482 | } | 482 | } |
diff --git a/coreutils/touch.c b/coreutils/touch.c index 5537fb63b..59800b2a0 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c | |||
@@ -58,12 +58,12 @@ extern int touch_main(int argc, char **argv) | |||
58 | if (create == FALSE && errno == ENOENT) | 58 | if (create == FALSE && errno == ENOENT) |
59 | return EXIT_SUCCESS; | 59 | return EXIT_SUCCESS; |
60 | else { | 60 | else { |
61 | fatalError("%s", strerror(errno)); | 61 | error_msg_and_die("%s", strerror(errno)); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | close(fd); | 64 | close(fd); |
65 | if (utime(*argv, NULL)) { | 65 | if (utime(*argv, NULL)) { |
66 | fatalError("%s", strerror(errno)); | 66 | error_msg_and_die("%s", strerror(errno)); |
67 | } | 67 | } |
68 | argc--; | 68 | argc--; |
69 | argv++; | 69 | argv++; |
diff --git a/coreutils/tr.c b/coreutils/tr.c index 3e34e68fa..fd547b87d 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c | |||
@@ -173,7 +173,7 @@ extern int tr_main(int argc, char **argv) | |||
173 | input_length = complement(input, input_length); | 173 | input_length = complement(input, input_length); |
174 | if (argv[index] != NULL) { | 174 | if (argv[index] != NULL) { |
175 | if (*argv[index] == '\0') | 175 | if (*argv[index] == '\0') |
176 | fatalError("STRING2 cannot be empty\n"); | 176 | error_msg_and_die("STRING2 cannot be empty\n"); |
177 | output_length = expand(argv[index], output); | 177 | output_length = expand(argv[index], output); |
178 | map(input, input_length, output, output_length); | 178 | map(input, input_length, output, output_length); |
179 | } | 179 | } |
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index 825fdb562..ff4a9d9e6 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
@@ -43,7 +43,7 @@ static int read_stduu (const char *inname) | |||
43 | char *p; | 43 | char *p; |
44 | 44 | ||
45 | if (fgets (buf, sizeof(buf), stdin) == NULL) { | 45 | if (fgets (buf, sizeof(buf), stdin) == NULL) { |
46 | errorMsg("%s: Short file\n", inname); | 46 | error_msg("%s: Short file\n", inname); |
47 | return FALSE; | 47 | return FALSE; |
48 | } | 48 | } |
49 | p = buf; | 49 | p = buf; |
@@ -78,7 +78,7 @@ static int read_stduu (const char *inname) | |||
78 | 78 | ||
79 | if (fgets (buf, sizeof(buf), stdin) == NULL | 79 | if (fgets (buf, sizeof(buf), stdin) == NULL |
80 | || strcmp (buf, "end\n")) { | 80 | || strcmp (buf, "end\n")) { |
81 | errorMsg("%s: No `end' line\n", inname); | 81 | error_msg("%s: No `end' line\n", inname); |
82 | return FALSE; | 82 | return FALSE; |
83 | } | 83 | } |
84 | 84 | ||
@@ -128,7 +128,7 @@ static int read_base64 (const char *inname) | |||
128 | unsigned char *p; | 128 | unsigned char *p; |
129 | 129 | ||
130 | if (fgets (buf, sizeof(buf), stdin) == NULL) { | 130 | if (fgets (buf, sizeof(buf), stdin) == NULL) { |
131 | errorMsg("%s: Short file\n", inname); | 131 | error_msg("%s: Short file\n", inname); |
132 | return FALSE; | 132 | return FALSE; |
133 | } | 133 | } |
134 | p = buf; | 134 | p = buf; |
@@ -136,7 +136,7 @@ static int read_base64 (const char *inname) | |||
136 | if (memcmp (buf, "====", 4) == 0) | 136 | if (memcmp (buf, "====", 4) == 0) |
137 | break; | 137 | break; |
138 | if (last_data != 0) { | 138 | if (last_data != 0) { |
139 | errorMsg("%s: data following `=' padding character\n", inname); | 139 | error_msg("%s: data following `=' padding character\n", inname); |
140 | return FALSE; | 140 | return FALSE; |
141 | } | 141 | } |
142 | 142 | ||
@@ -158,14 +158,14 @@ static int read_base64 (const char *inname) | |||
158 | 158 | ||
159 | while ((b64_tab[*p] & '\100') != 0) | 159 | while ((b64_tab[*p] & '\100') != 0) |
160 | if (*p == '\n' || *p++ == '=') { | 160 | if (*p == '\n' || *p++ == '=') { |
161 | errorMsg("%s: illegal line\n", inname); | 161 | error_msg("%s: illegal line\n", inname); |
162 | return FALSE; | 162 | return FALSE; |
163 | } | 163 | } |
164 | c2 = b64_tab[*p++]; | 164 | c2 = b64_tab[*p++]; |
165 | 165 | ||
166 | while (b64_tab[*p] == '\177') | 166 | while (b64_tab[*p] == '\177') |
167 | if (*p++ == '\n') { | 167 | if (*p++ == '\n') { |
168 | errorMsg("%s: illegal line\n", inname); | 168 | error_msg("%s: illegal line\n", inname); |
169 | return FALSE; | 169 | return FALSE; |
170 | } | 170 | } |
171 | if (*p == '=') { | 171 | if (*p == '=') { |
@@ -177,7 +177,7 @@ static int read_base64 (const char *inname) | |||
177 | 177 | ||
178 | while (b64_tab[*p] == '\177') | 178 | while (b64_tab[*p] == '\177') |
179 | if (*p++ == '\n') { | 179 | if (*p++ == '\n') { |
180 | errorMsg("%s: illegal line\n", inname); | 180 | error_msg("%s: illegal line\n", inname); |
181 | return FALSE; | 181 | return FALSE; |
182 | } | 182 | } |
183 | putchar (c1 << 2 | c2 >> 4); | 183 | putchar (c1 << 2 | c2 >> 4); |
@@ -209,7 +209,7 @@ static int decode (const char *inname, | |||
209 | 209 | ||
210 | while (1) { | 210 | while (1) { |
211 | if (fgets (buf, sizeof (buf), stdin) == NULL) { | 211 | if (fgets (buf, sizeof (buf), stdin) == NULL) { |
212 | errorMsg("%s: No `begin' line\n", inname); | 212 | error_msg("%s: No `begin' line\n", inname); |
213 | return FALSE; | 213 | return FALSE; |
214 | } | 214 | } |
215 | 215 | ||
@@ -234,13 +234,13 @@ static int decode (const char *inname, | |||
234 | while (*p != '/') | 234 | while (*p != '/') |
235 | ++p; | 235 | ++p; |
236 | if (*p == '\0') { | 236 | if (*p == '\0') { |
237 | errorMsg("%s: Illegal ~user\n", inname); | 237 | error_msg("%s: Illegal ~user\n", inname); |
238 | return FALSE; | 238 | return FALSE; |
239 | } | 239 | } |
240 | *p++ = '\0'; | 240 | *p++ = '\0'; |
241 | pw = getpwnam (buf + 1); | 241 | pw = getpwnam (buf + 1); |
242 | if (pw == NULL) { | 242 | if (pw == NULL) { |
243 | errorMsg("%s: No user `%s'\n", inname, buf + 1); | 243 | error_msg("%s: No user `%s'\n", inname, buf + 1); |
244 | return FALSE; | 244 | return FALSE; |
245 | } | 245 | } |
246 | n = strlen (pw->pw_dir); | 246 | n = strlen (pw->pw_dir); |
@@ -257,7 +257,7 @@ static int decode (const char *inname, | |||
257 | && (freopen (outname, "w", stdout) == NULL | 257 | && (freopen (outname, "w", stdout) == NULL |
258 | || chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)) | 258 | || chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)) |
259 | )) { | 259 | )) { |
260 | errorMsg("%s: %s %s\n", outname, inname, strerror(errno)); /* */ | 260 | error_msg("%s: %s %s\n", outname, inname, strerror(errno)); /* */ |
261 | return FALSE; | 261 | return FALSE; |
262 | } | 262 | } |
263 | 263 | ||
@@ -302,7 +302,7 @@ int uudecode_main (int argc, | |||
302 | if (decode (argv[optind], outname) != 0) | 302 | if (decode (argv[optind], outname) != 0) |
303 | exit_status = FALSE; | 303 | exit_status = FALSE; |
304 | } else { | 304 | } else { |
305 | errorMsg("%s: %s\n", argv[optind], strerror(errno)); | 305 | error_msg("%s: %s\n", argv[optind], strerror(errno)); |
306 | exit_status = EXIT_FAILURE; | 306 | exit_status = EXIT_FAILURE; |
307 | } | 307 | } |
308 | optind++; | 308 | optind++; |
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index 8d15adbf6..41e659075 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c | |||
@@ -142,7 +142,7 @@ static void encode() | |||
142 | } | 142 | } |
143 | 143 | ||
144 | if (ferror (stdin)) | 144 | if (ferror (stdin)) |
145 | errorMsg("Read error\n"); | 145 | error_msg("Read error\n"); |
146 | 146 | ||
147 | if (trans_ptr == uu_std) { | 147 | if (trans_ptr == uu_std) { |
148 | putchar (ENC ('\0')); | 148 | putchar (ENC ('\0')); |
@@ -178,7 +178,7 @@ int uuencode_main (int argc, | |||
178 | case 2: | 178 | case 2: |
179 | /* Optional first argument is input file. */ | 179 | /* Optional first argument is input file. */ |
180 | if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) { | 180 | if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) { |
181 | errorMsg("%s: %s\n", argv[optind], strerror(errno)); | 181 | error_msg("%s: %s\n", argv[optind], strerror(errno)); |
182 | return EXIT_FAILURE; | 182 | return EXIT_FAILURE; |
183 | } | 183 | } |
184 | mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); | 184 | mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); |
@@ -199,7 +199,7 @@ int uuencode_main (int argc, | |||
199 | encode(); | 199 | encode(); |
200 | printf(trans_ptr == uu_std ? "end\n" : "====\n"); | 200 | printf(trans_ptr == uu_std ? "end\n" : "====\n"); |
201 | if (ferror (stdout)) { | 201 | if (ferror (stdout)) { |
202 | errorMsg("Write error\n"); | 202 | error_msg("Write error\n"); |
203 | return EXIT_FAILURE; | 203 | return EXIT_FAILURE; |
204 | } | 204 | } |
205 | return EXIT_SUCCESS; | 205 | return EXIT_SUCCESS; |
diff --git a/coreutils/whoami.c b/coreutils/whoami.c index 44fbc950b..6a5dd2c04 100644 --- a/coreutils/whoami.c +++ b/coreutils/whoami.c | |||
@@ -37,5 +37,5 @@ extern int whoami_main(int argc, char **argv) | |||
37 | puts(user); | 37 | puts(user); |
38 | return EXIT_SUCCESS; | 38 | return EXIT_SUCCESS; |
39 | } | 39 | } |
40 | fatalError("cannot find username for UID %u\n", (unsigned) uid); | 40 | error_msg_and_die("cannot find username for UID %u\n", (unsigned) uid); |
41 | } | 41 | } |
@@ -75,7 +75,7 @@ static void name_too_long__exit (void) __attribute__((noreturn)); | |||
75 | static | 75 | static |
76 | void name_too_long__exit (void) | 76 | void name_too_long__exit (void) |
77 | { | 77 | { |
78 | fatalError(name_too_long); | 78 | error_msg_and_die(name_too_long); |
79 | } | 79 | } |
80 | 80 | ||
81 | static void | 81 | static void |
@@ -109,14 +109,14 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk) | |||
109 | 109 | ||
110 | if (srcDirFlag == TRUE) { | 110 | if (srcDirFlag == TRUE) { |
111 | if (recursiveFlag == FALSE) { | 111 | if (recursiveFlag == FALSE) { |
112 | errorMsg(omitting_directory, baseSrcName); | 112 | error_msg(omitting_directory, baseSrcName); |
113 | return TRUE; | 113 | return TRUE; |
114 | } | 114 | } |
115 | srcBasename = (strstr(fileName, baseSrcName) | 115 | srcBasename = (strstr(fileName, baseSrcName) |
116 | + strlen(baseSrcName)); | 116 | + strlen(baseSrcName)); |
117 | 117 | ||
118 | if (destLen + strlen(srcBasename) > BUFSIZ) { | 118 | if (destLen + strlen(srcBasename) > BUFSIZ) { |
119 | errorMsg(name_too_long); | 119 | error_msg(name_too_long); |
120 | return FALSE; | 120 | return FALSE; |
121 | } | 121 | } |
122 | strcat(destName, srcBasename); | 122 | strcat(destName, srcBasename); |
@@ -130,7 +130,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk) | |||
130 | if (mv_Action_first_time && (dz_i == is_mv)) { | 130 | if (mv_Action_first_time && (dz_i == is_mv)) { |
131 | mv_Action_first_time = errno = 0; | 131 | mv_Action_first_time = errno = 0; |
132 | if (rename(fileName, destName) < 0 && errno != EXDEV) { | 132 | if (rename(fileName, destName) < 0 && errno != EXDEV) { |
133 | errorMsg("rename(%s, %s): %s\n", fileName, destName, | 133 | error_msg("rename(%s, %s): %s\n", fileName, destName, |
134 | strerror(errno)); | 134 | strerror(errno)); |
135 | goto do_copyFile; /* Try anyway... */ | 135 | goto do_copyFile; /* Try anyway... */ |
136 | } | 136 | } |
@@ -143,7 +143,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk) | |||
143 | if (preserveFlag == TRUE && statbuf->st_nlink > 1) { | 143 | if (preserveFlag == TRUE && statbuf->st_nlink > 1) { |
144 | if (is_in_ino_dev_hashtable(statbuf, &name)) { | 144 | if (is_in_ino_dev_hashtable(statbuf, &name)) { |
145 | if (link(name, destName) < 0) { | 145 | if (link(name, destName) < 0) { |
146 | errorMsg("link(%s, %s): %s\n", name, destName, strerror(errno)); | 146 | error_msg("link(%s, %s): %s\n", name, destName, strerror(errno)); |
147 | return FALSE; | 147 | return FALSE; |
148 | } | 148 | } |
149 | return TRUE; | 149 | return TRUE; |
@@ -152,7 +152,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk) | |||
152 | add_to_ino_dev_hashtable(statbuf, destName); | 152 | add_to_ino_dev_hashtable(statbuf, destName); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | return copyFile(fileName, destName, preserveFlag, followLinks, forceFlag); | 155 | return copy_file(fileName, destName, preserveFlag, followLinks, forceFlag); |
156 | } | 156 | } |
157 | 157 | ||
158 | static int | 158 | static int |
@@ -162,11 +162,11 @@ rm_Action(const char *fileName, struct stat *statbuf, void* junk) | |||
162 | 162 | ||
163 | if (S_ISDIR(statbuf->st_mode)) { | 163 | if (S_ISDIR(statbuf->st_mode)) { |
164 | if (rmdir(fileName) < 0) { | 164 | if (rmdir(fileName) < 0) { |
165 | errorMsg("rmdir(%s): %s\n", fileName, strerror(errno)); | 165 | error_msg("rmdir(%s): %s\n", fileName, strerror(errno)); |
166 | status = FALSE; | 166 | status = FALSE; |
167 | } | 167 | } |
168 | } else if (unlink(fileName) < 0) { | 168 | } else if (unlink(fileName) < 0) { |
169 | errorMsg("unlink(%s): %s\n", fileName, strerror(errno)); | 169 | error_msg("unlink(%s): %s\n", fileName, strerror(errno)); |
170 | status = FALSE; | 170 | status = FALSE; |
171 | } | 171 | } |
172 | return status; | 172 | return status; |
@@ -224,7 +224,7 @@ extern int cp_mv_main(int argc, char **argv) | |||
224 | 224 | ||
225 | 225 | ||
226 | if (strlen(argv[argc - 1]) > BUFSIZ) { | 226 | if (strlen(argv[argc - 1]) > BUFSIZ) { |
227 | errorMsg(name_too_long); | 227 | error_msg(name_too_long); |
228 | goto exit_false; | 228 | goto exit_false; |
229 | } | 229 | } |
230 | strcpy(baseDestName, argv[argc - 1]); | 230 | strcpy(baseDestName, argv[argc - 1]); |
@@ -232,9 +232,9 @@ extern int cp_mv_main(int argc, char **argv) | |||
232 | if (baseDestLen == 0) | 232 | if (baseDestLen == 0) |
233 | goto exit_false; | 233 | goto exit_false; |
234 | 234 | ||
235 | destDirFlag = isDirectory(baseDestName, TRUE, &destStatBuf); | 235 | destDirFlag = is_directory(baseDestName, TRUE, &destStatBuf); |
236 | if (argc - optind > 2 && destDirFlag == FALSE) { | 236 | if (argc - optind > 2 && destDirFlag == FALSE) { |
237 | errorMsg(not_a_directory, baseDestName); | 237 | error_msg(not_a_directory, baseDestName); |
238 | goto exit_false; | 238 | goto exit_false; |
239 | } | 239 | } |
240 | 240 | ||
@@ -250,7 +250,7 @@ extern int cp_mv_main(int argc, char **argv) | |||
250 | 250 | ||
251 | if (srcLen == 0) continue; /* "" */ | 251 | if (srcLen == 0) continue; /* "" */ |
252 | 252 | ||
253 | srcDirFlag = isDirectory(baseSrcName, followLinks, &srcStatBuf); | 253 | srcDirFlag = is_directory(baseSrcName, followLinks, &srcStatBuf); |
254 | 254 | ||
255 | if ((flags_memo = (recursiveFlag == TRUE && | 255 | if ((flags_memo = (recursiveFlag == TRUE && |
256 | srcDirFlag == TRUE && destDirFlag == TRUE))) { | 256 | srcDirFlag == TRUE && destDirFlag == TRUE))) { |
@@ -260,26 +260,26 @@ extern int cp_mv_main(int argc, char **argv) | |||
260 | char *pushd, *d, *p; | 260 | char *pushd, *d, *p; |
261 | 261 | ||
262 | if ((pushd = getcwd(NULL, BUFSIZ + 1)) == NULL) { | 262 | if ((pushd = getcwd(NULL, BUFSIZ + 1)) == NULL) { |
263 | errorMsg("getcwd(): %s\n", strerror(errno)); | 263 | error_msg("getcwd(): %s\n", strerror(errno)); |
264 | continue; | 264 | continue; |
265 | } | 265 | } |
266 | if (chdir(baseDestName) < 0) { | 266 | if (chdir(baseDestName) < 0) { |
267 | errorMsg("chdir(%s): %s\n", baseSrcName, strerror(errno)); | 267 | error_msg("chdir(%s): %s\n", baseSrcName, strerror(errno)); |
268 | continue; | 268 | continue; |
269 | } | 269 | } |
270 | if ((d = getcwd(NULL, BUFSIZ + 1)) == NULL) { | 270 | if ((d = getcwd(NULL, BUFSIZ + 1)) == NULL) { |
271 | errorMsg("getcwd(): %s\n", strerror(errno)); | 271 | error_msg("getcwd(): %s\n", strerror(errno)); |
272 | continue; | 272 | continue; |
273 | } | 273 | } |
274 | while (!state && *d != '\0') { | 274 | while (!state && *d != '\0') { |
275 | if (stat(d, &sb) < 0) { /* stat not lstat - always dereference targets */ | 275 | if (stat(d, &sb) < 0) { /* stat not lstat - always dereference targets */ |
276 | errorMsg("stat(%s): %s\n", d, strerror(errno)); | 276 | error_msg("stat(%s): %s\n", d, strerror(errno)); |
277 | state = -1; | 277 | state = -1; |
278 | continue; | 278 | continue; |
279 | } | 279 | } |
280 | if ((sb.st_ino == srcStatBuf.st_ino) && | 280 | if ((sb.st_ino == srcStatBuf.st_ino) && |
281 | (sb.st_dev == srcStatBuf.st_dev)) { | 281 | (sb.st_dev == srcStatBuf.st_dev)) { |
282 | errorMsg("Cannot %s `%s' into a subdirectory of itself, " | 282 | error_msg("Cannot %s `%s' into a subdirectory of itself, " |
283 | "`%s/%s'\n", applet_name, baseSrcName, | 283 | "`%s/%s'\n", applet_name, baseSrcName, |
284 | baseDestName, baseSrcName); | 284 | baseDestName, baseSrcName); |
285 | state = -1; | 285 | state = -1; |
@@ -290,7 +290,7 @@ extern int cp_mv_main(int argc, char **argv) | |||
290 | } | 290 | } |
291 | } | 291 | } |
292 | if (chdir(pushd) < 0) { | 292 | if (chdir(pushd) < 0) { |
293 | errorMsg("chdir(%s): %s\n", pushd, strerror(errno)); | 293 | error_msg("chdir(%s): %s\n", pushd, strerror(errno)); |
294 | free(pushd); | 294 | free(pushd); |
295 | free(d); | 295 | free(d); |
296 | continue; | 296 | continue; |
@@ -305,11 +305,11 @@ extern int cp_mv_main(int argc, char **argv) | |||
305 | status = setjmp(catch); | 305 | status = setjmp(catch); |
306 | if (status == 0) { | 306 | if (status == 0) { |
307 | mv_Action_first_time = 1; | 307 | mv_Action_first_time = 1; |
308 | if (recursiveAction(baseSrcName, | 308 | if (recursive_action(baseSrcName, |
309 | recursiveFlag, followLinks, FALSE, | 309 | recursiveFlag, followLinks, FALSE, |
310 | cp_mv_Action, cp_mv_Action, NULL) == FALSE) goto exit_false; | 310 | cp_mv_Action, cp_mv_Action, NULL) == FALSE) goto exit_false; |
311 | if (dz_i == is_mv && | 311 | if (dz_i == is_mv && |
312 | recursiveAction(baseSrcName, | 312 | recursive_action(baseSrcName, |
313 | recursiveFlag, followLinks, TRUE, | 313 | recursiveFlag, followLinks, TRUE, |
314 | rm_Action, rm_Action, NULL) == FALSE) goto exit_false; | 314 | rm_Action, rm_Action, NULL) == FALSE) goto exit_false; |
315 | } | 315 | } |
@@ -54,12 +54,12 @@ static void decompose_list(const char *list) | |||
54 | /* the list must contain only digits and no more than one minus sign */ | 54 | /* the list must contain only digits and no more than one minus sign */ |
55 | for (ptr = (char *)list; *ptr; ptr++) { | 55 | for (ptr = (char *)list; *ptr; ptr++) { |
56 | if (!isdigit(*ptr) && *ptr != '-') { | 56 | if (!isdigit(*ptr) && *ptr != '-') { |
57 | fatalError("invalid byte or field list\n"); | 57 | error_msg_and_die("invalid byte or field list\n"); |
58 | } | 58 | } |
59 | if (*ptr == '-') { | 59 | if (*ptr == '-') { |
60 | nminus++; | 60 | nminus++; |
61 | if (nminus > 1) { | 61 | if (nminus > 1) { |
62 | fatalError("invalid byte or field list\n"); | 62 | error_msg_and_die("invalid byte or field list\n"); |
63 | } | 63 | } |
64 | } | 64 | } |
65 | } | 65 | } |
@@ -68,7 +68,7 @@ static void decompose_list(const char *list) | |||
68 | if (nminus == 0) { | 68 | if (nminus == 0) { |
69 | startpos = strtol(list, &ptr, 10); | 69 | startpos = strtol(list, &ptr, 10); |
70 | if (startpos == 0) { | 70 | if (startpos == 0) { |
71 | fatalError("missing list of fields\n"); | 71 | error_msg_and_die("missing list of fields\n"); |
72 | } | 72 | } |
73 | endpos = startpos; | 73 | endpos = startpos; |
74 | } | 74 | } |
@@ -188,14 +188,14 @@ extern int cut_main(int argc, char **argv) | |||
188 | case 'f': | 188 | case 'f': |
189 | /* make sure they didn't ask for two types of lists */ | 189 | /* make sure they didn't ask for two types of lists */ |
190 | if (part != 0) { | 190 | if (part != 0) { |
191 | fatalError("only one type of list may be specified"); | 191 | error_msg_and_die("only one type of list may be specified"); |
192 | } | 192 | } |
193 | part = (char)opt; | 193 | part = (char)opt; |
194 | decompose_list(optarg); | 194 | decompose_list(optarg); |
195 | break; | 195 | break; |
196 | case 'd': | 196 | case 'd': |
197 | if (strlen(optarg) > 1) { | 197 | if (strlen(optarg) > 1) { |
198 | fatalError("the delimiter must be a single character\n"); | 198 | error_msg_and_die("the delimiter must be a single character\n"); |
199 | } | 199 | } |
200 | delim = optarg[0]; | 200 | delim = optarg[0]; |
201 | break; | 201 | break; |
@@ -209,16 +209,16 @@ extern int cut_main(int argc, char **argv) | |||
209 | } | 209 | } |
210 | 210 | ||
211 | if (part == 0) { | 211 | if (part == 0) { |
212 | fatalError("you must specify a list of bytes, characters, or fields\n"); | 212 | error_msg_and_die("you must specify a list of bytes, characters, or fields\n"); |
213 | } | 213 | } |
214 | 214 | ||
215 | if (supress_non_delimited_lines && part != 'f') { | 215 | if (supress_non_delimited_lines && part != 'f') { |
216 | fatalError("suppressing non-delimited lines makes sense | 216 | error_msg_and_die("suppressing non-delimited lines makes sense |
217 | only when operating on fields\n"); | 217 | only when operating on fields\n"); |
218 | } | 218 | } |
219 | 219 | ||
220 | if (delim != '\t' && part != 'f') { | 220 | if (delim != '\t' && part != 'f') { |
221 | fatalError("a delimiter may be specified only when operating on fields\n"); | 221 | error_msg_and_die("a delimiter may be specified only when operating on fields\n"); |
222 | } | 222 | } |
223 | 223 | ||
224 | /* argv[(optind)..(argc-1)] should be names of file to process. If no | 224 | /* argv[(optind)..(argc-1)] should be names of file to process. If no |
@@ -233,7 +233,7 @@ extern int cut_main(int argc, char **argv) | |||
233 | for (i = optind; i < argc; i++) { | 233 | for (i = optind; i < argc; i++) { |
234 | file = fopen(argv[i], "r"); | 234 | file = fopen(argv[i], "r"); |
235 | if (file == NULL) { | 235 | if (file == NULL) { |
236 | errorMsg("%s: %s\n", argv[i], strerror(errno)); | 236 | error_msg("%s: %s\n", argv[i], strerror(errno)); |
237 | } else { | 237 | } else { |
238 | cut_file(file); | 238 | cut_file(file); |
239 | fclose(file); | 239 | fclose(file); |
@@ -56,7 +56,7 @@ struct tm *date_conv_time(struct tm *tm_time, const char *t_string) | |||
56 | &(tm_time->tm_min), &(tm_time->tm_year)); | 56 | &(tm_time->tm_min), &(tm_time->tm_year)); |
57 | 57 | ||
58 | if (nr < 4 || nr > 5) { | 58 | if (nr < 4 || nr > 5) { |
59 | fatalError(invalid_date, t_string); | 59 | error_msg_and_die(invalid_date, t_string); |
60 | } | 60 | } |
61 | 61 | ||
62 | /* correct for century - minor Y2K problem here? */ | 62 | /* correct for century - minor Y2K problem here? */ |
@@ -121,7 +121,7 @@ struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string) | |||
121 | t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */ | 121 | t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */ |
122 | 122 | ||
123 | } else { | 123 | } else { |
124 | fatalError(invalid_date, t_string); | 124 | error_msg_and_die(invalid_date, t_string); |
125 | } | 125 | } |
126 | *tm_time = t; | 126 | *tm_time = t; |
127 | return (tm_time); | 127 | return (tm_time); |
@@ -156,7 +156,7 @@ int date_main(int argc, char **argv) | |||
156 | case 'u': | 156 | case 'u': |
157 | utc = 1; | 157 | utc = 1; |
158 | if (putenv("TZ=UTC0") != 0) | 158 | if (putenv("TZ=UTC0") != 0) |
159 | fatalError(memory_exhausted); | 159 | error_msg_and_die(memory_exhausted); |
160 | break; | 160 | break; |
161 | case 'd': | 161 | case 'd': |
162 | use_arg = 1; | 162 | use_arg = 1; |
@@ -176,7 +176,7 @@ int date_main(int argc, char **argv) | |||
176 | } | 176 | } |
177 | #if 0 | 177 | #if 0 |
178 | else { | 178 | else { |
179 | errorMsg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt); | 179 | error_msg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt); |
180 | usage(date_usage); | 180 | usage(date_usage); |
181 | } | 181 | } |
182 | #endif | 182 | #endif |
@@ -205,16 +205,16 @@ int date_main(int argc, char **argv) | |||
205 | /* Correct any day of week and day of year etc fields */ | 205 | /* Correct any day of week and day of year etc fields */ |
206 | tm = mktime(&tm_time); | 206 | tm = mktime(&tm_time); |
207 | if (tm < 0) | 207 | if (tm < 0) |
208 | fatalError(invalid_date, date_str); | 208 | error_msg_and_die(invalid_date, date_str); |
209 | if ( utc ) { | 209 | if ( utc ) { |
210 | if (putenv("TZ=UTC0") != 0) | 210 | if (putenv("TZ=UTC0") != 0) |
211 | fatalError(memory_exhausted); | 211 | error_msg_and_die(memory_exhausted); |
212 | } | 212 | } |
213 | 213 | ||
214 | /* if setting time, set it */ | 214 | /* if setting time, set it */ |
215 | if (set_time) { | 215 | if (set_time) { |
216 | if (stime(&tm) < 0) { | 216 | if (stime(&tm) < 0) { |
217 | perrorMsg("cannot set date"); | 217 | perror_msg("cannot set date"); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | } | 220 | } |
@@ -14,14 +14,14 @@ static unsigned int pointer; | |||
14 | static void push(double a) | 14 | static void push(double a) |
15 | { | 15 | { |
16 | if (pointer >= (sizeof(stack) / sizeof(*stack))) | 16 | if (pointer >= (sizeof(stack) / sizeof(*stack))) |
17 | fatalError("stack overflow\n"); | 17 | error_msg_and_die("stack overflow\n"); |
18 | stack[pointer++] = a; | 18 | stack[pointer++] = a; |
19 | } | 19 | } |
20 | 20 | ||
21 | static double pop() | 21 | static double pop() |
22 | { | 22 | { |
23 | if (pointer == 0) | 23 | if (pointer == 0) |
24 | fatalError("stack underflow\n"); | 24 | error_msg_and_die("stack underflow\n"); |
25 | return stack[--pointer]; | 25 | return stack[--pointer]; |
26 | } | 26 | } |
27 | 27 | ||
@@ -120,7 +120,7 @@ static void stack_machine(const char *argument) | |||
120 | } | 120 | } |
121 | o++; | 121 | o++; |
122 | } | 122 | } |
123 | fatalError("%s: syntax error.\n", argument); | 123 | error_msg_and_die("%s: syntax error.\n", argument); |
124 | } | 124 | } |
125 | 125 | ||
126 | /* return pointer to next token in buffer and set *buffer to one char | 126 | /* return pointer to next token in buffer and set *buffer to one char |
@@ -71,28 +71,28 @@ extern int dd_main(int argc, char **argv) | |||
71 | else if (outFile == NULL && (strncmp(*argv, "of", 2) == 0)) | 71 | else if (outFile == NULL && (strncmp(*argv, "of", 2) == 0)) |
72 | outFile = ((strchr(*argv, '=')) + 1); | 72 | outFile = ((strchr(*argv, '=')) + 1); |
73 | else if (strncmp("count", *argv, 5) == 0) { | 73 | else if (strncmp("count", *argv, 5) == 0) { |
74 | count = getNum((strchr(*argv, '=')) + 1); | 74 | count = atoi_w_units((strchr(*argv, '=')) + 1); |
75 | if (count < 0) { | 75 | if (count < 0) { |
76 | errorMsg("Bad count value %s\n", *argv); | 76 | error_msg("Bad count value %s\n", *argv); |
77 | goto usage; | 77 | goto usage; |
78 | } | 78 | } |
79 | } else if (strncmp(*argv, "bs", 2) == 0) { | 79 | } else if (strncmp(*argv, "bs", 2) == 0) { |
80 | blockSize = getNum((strchr(*argv, '=')) + 1); | 80 | blockSize = atoi_w_units((strchr(*argv, '=')) + 1); |
81 | if (blockSize <= 0) { | 81 | if (blockSize <= 0) { |
82 | errorMsg("Bad block size value %s\n", *argv); | 82 | error_msg("Bad block size value %s\n", *argv); |
83 | goto usage; | 83 | goto usage; |
84 | } | 84 | } |
85 | } else if (strncmp(*argv, "skip", 4) == 0) { | 85 | } else if (strncmp(*argv, "skip", 4) == 0) { |
86 | skipBlocks = getNum((strchr(*argv, '=')) + 1); | 86 | skipBlocks = atoi_w_units((strchr(*argv, '=')) + 1); |
87 | if (skipBlocks <= 0) { | 87 | if (skipBlocks <= 0) { |
88 | errorMsg("Bad skip value %s\n", *argv); | 88 | error_msg("Bad skip value %s\n", *argv); |
89 | goto usage; | 89 | goto usage; |
90 | } | 90 | } |
91 | 91 | ||
92 | } else if (strncmp(*argv, "seek", 4) == 0) { | 92 | } else if (strncmp(*argv, "seek", 4) == 0) { |
93 | seekBlocks = getNum((strchr(*argv, '=')) + 1); | 93 | seekBlocks = atoi_w_units((strchr(*argv, '=')) + 1); |
94 | if (seekBlocks <= 0) { | 94 | if (seekBlocks <= 0) { |
95 | errorMsg("Bad seek value %s\n", *argv); | 95 | error_msg("Bad seek value %s\n", *argv); |
96 | goto usage; | 96 | goto usage; |
97 | } | 97 | } |
98 | } else if (strncmp(*argv, "conv", 4) == 0) { | 98 | } else if (strncmp(*argv, "conv", 4) == 0) { |
@@ -119,7 +119,7 @@ extern int dd_main(int argc, char **argv) | |||
119 | * here anyways... */ | 119 | * here anyways... */ |
120 | 120 | ||
121 | /* free(buf); */ | 121 | /* free(buf); */ |
122 | fatalPerror("%s", inFile); | 122 | perror_msg_and_die("%s", inFile); |
123 | } | 123 | } |
124 | 124 | ||
125 | if (outFile == NULL) | 125 | if (outFile == NULL) |
@@ -134,7 +134,7 @@ extern int dd_main(int argc, char **argv) | |||
134 | 134 | ||
135 | /* close(inFd); | 135 | /* close(inFd); |
136 | free(buf); */ | 136 | free(buf); */ |
137 | fatalPerror("%s", outFile); | 137 | perror_msg_and_die("%s", outFile); |
138 | } | 138 | } |
139 | 139 | ||
140 | lseek(inFd, (off_t) (skipBlocks * blockSize), SEEK_SET); | 140 | lseek(inFd, (off_t) (skipBlocks * blockSize), SEEK_SET); |
@@ -146,13 +146,13 @@ extern int dd_main(int argc, char **argv) | |||
146 | ibs=BUFSIZ; | 146 | ibs=BUFSIZ; |
147 | 147 | ||
148 | while (totalSize > outTotal) { | 148 | while (totalSize > outTotal) { |
149 | inCc = fullRead(inFd, buf, ibs); | 149 | inCc = full_read(inFd, buf, ibs); |
150 | inTotal += inCc; | 150 | inTotal += inCc; |
151 | if ( (sync==TRUE) && (inCc>0) ) | 151 | if ( (sync==TRUE) && (inCc>0) ) |
152 | while (inCc<ibs) | 152 | while (inCc<ibs) |
153 | buf[inCc++]='\0'; | 153 | buf[inCc++]='\0'; |
154 | 154 | ||
155 | if ((outCc = fullWrite(outFd, buf, inCc)) < 1){ | 155 | if ((outCc = full_write(outFd, buf, inCc)) < 1){ |
156 | if (outCc < 0 ){ | 156 | if (outCc < 0 ){ |
157 | perror("Error during write"); | 157 | perror("Error during write"); |
158 | } | 158 | } |
diff --git a/deallocvt.c b/deallocvt.c index 4600c0d05..ebdce7b24 100644 --- a/deallocvt.c +++ b/deallocvt.c | |||
@@ -35,12 +35,12 @@ printf("erik: B\n"); | |||
35 | for (i = 1; i < argc; i++) { | 35 | for (i = 1; i < argc; i++) { |
36 | num = atoi(argv[i]); | 36 | num = atoi(argv[i]); |
37 | if (num == 0) | 37 | if (num == 0) |
38 | errorMsg("0: illegal VT number\n"); | 38 | error_msg("0: illegal VT number\n"); |
39 | else if (num == 1) | 39 | else if (num == 1) |
40 | errorMsg("VT 1 cannot be deallocated\n"); | 40 | error_msg("VT 1 cannot be deallocated\n"); |
41 | else if (ioctl(fd, VT_DISALLOCATE, num)) { | 41 | else if (ioctl(fd, VT_DISALLOCATE, num)) { |
42 | perror("VT_DISALLOCATE"); | 42 | perror("VT_DISALLOCATE"); |
43 | fatalError("could not deallocate console %d\n", num); | 43 | error_msg_and_die("could not deallocate console %d\n", num); |
44 | } | 44 | } |
45 | } | 45 | } |
46 | printf("erik: C\n"); | 46 | printf("erik: C\n"); |
@@ -36,7 +36,7 @@ static int df(char *device, const char *mountPoint) | |||
36 | long blocks_percent_used; | 36 | long blocks_percent_used; |
37 | 37 | ||
38 | if (statfs(mountPoint, &s) != 0) { | 38 | if (statfs(mountPoint, &s) != 0) { |
39 | perrorMsg("%s", mountPoint); | 39 | perror_msg("%s", mountPoint); |
40 | return FALSE; | 40 | return FALSE; |
41 | } | 41 | } |
42 | 42 | ||
@@ -75,8 +75,8 @@ extern int df_main(int argc, char **argv) | |||
75 | usage(df_usage); | 75 | usage(df_usage); |
76 | } | 76 | } |
77 | while (argc > 1) { | 77 | while (argc > 1) { |
78 | if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) { | 78 | if ((mountEntry = find_mount_point(argv[1], mtab_file)) == 0) { |
79 | errorMsg("%s: can't find mount point.\n", argv[1]); | 79 | error_msg("%s: can't find mount point.\n", argv[1]); |
80 | status = EXIT_FAILURE; | 80 | status = EXIT_FAILURE; |
81 | } else if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir)) | 81 | } else if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir)) |
82 | status = EXIT_FAILURE; | 82 | status = EXIT_FAILURE; |
@@ -89,7 +89,7 @@ extern int df_main(int argc, char **argv) | |||
89 | 89 | ||
90 | mountTable = setmntent(mtab_file, "r"); | 90 | mountTable = setmntent(mtab_file, "r"); |
91 | if (mountTable == 0) { | 91 | if (mountTable == 0) { |
92 | perrorMsg("%s", mtab_file); | 92 | perror_msg("%s", mtab_file); |
93 | return EXIT_FAILURE; | 93 | return EXIT_FAILURE; |
94 | } | 94 | } |
95 | 95 | ||
@@ -97,7 +97,7 @@ static long du(char *filename) | |||
97 | } | 97 | } |
98 | 98 | ||
99 | if (len + strlen(name) + 1 > BUFSIZ) { | 99 | if (len + strlen(name) + 1 > BUFSIZ) { |
100 | errorMsg(name_too_long); | 100 | error_msg(name_too_long); |
101 | du_depth--; | 101 | du_depth--; |
102 | return 0; | 102 | return 0; |
103 | } | 103 | } |
@@ -156,7 +156,7 @@ int du_main(int argc, char **argv) | |||
156 | for (i=optind; i < argc; i++) { | 156 | for (i=optind; i < argc; i++) { |
157 | if ((sum = du(argv[i])) == 0) | 157 | if ((sum = du(argv[i])) == 0) |
158 | status = EXIT_FAILURE; | 158 | status = EXIT_FAILURE; |
159 | if (sum && isDirectory(argv[i], FALSE, NULL)) { | 159 | if (sum && is_directory(argv[i], FALSE, NULL)) { |
160 | print_normal(sum, argv[i]); | 160 | print_normal(sum, argv[i]); |
161 | } | 161 | } |
162 | reset_ino_dev_hashtable(); | 162 | reset_ino_dev_hashtable(); |
@@ -166,7 +166,7 @@ int du_main(int argc, char **argv) | |||
166 | return status; | 166 | return status; |
167 | } | 167 | } |
168 | 168 | ||
169 | /* $Id: du.c,v 1.28 2000/12/06 15:56:31 kraai Exp $ */ | 169 | /* $Id: du.c,v 1.29 2000/12/07 19:56:48 markw Exp $ */ |
170 | /* | 170 | /* |
171 | Local Variables: | 171 | Local Variables: |
172 | c-file-style: "linux" | 172 | c-file-style: "linux" |
diff --git a/dumpkmap.c b/dumpkmap.c index 77689fc84..3ff5ef691 100644 --- a/dumpkmap.c +++ b/dumpkmap.c | |||
@@ -50,7 +50,7 @@ int dumpkmap_main(int argc, char **argv) | |||
50 | 50 | ||
51 | fd = open("/dev/tty0", O_RDWR); | 51 | fd = open("/dev/tty0", O_RDWR); |
52 | if (fd < 0) { | 52 | if (fd < 0) { |
53 | errorMsg("Error opening /dev/tty0: %s\n", strerror(errno)); | 53 | error_msg("Error opening /dev/tty0: %s\n", strerror(errno)); |
54 | return EXIT_FAILURE; | 54 | return EXIT_FAILURE; |
55 | } | 55 | } |
56 | 56 | ||
@@ -78,7 +78,7 @@ int dumpkmap_main(int argc, char **argv) | |||
78 | ke.kb_table = i; | 78 | ke.kb_table = i; |
79 | if (ioctl(fd, KDGKBENT, &ke) < 0) { | 79 | if (ioctl(fd, KDGKBENT, &ke) < 0) { |
80 | 80 | ||
81 | errorMsg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); | 81 | error_msg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); |
82 | } | 82 | } |
83 | else { | 83 | else { |
84 | write(1,(void*)&ke.kb_value,2); | 84 | write(1,(void*)&ke.kb_value,2); |
@@ -35,7 +35,7 @@ extern int dutmp_main(int argc, char **argv) | |||
35 | } else { | 35 | } else { |
36 | file = open(argv[1], O_RDONLY); | 36 | file = open(argv[1], O_RDONLY); |
37 | if (file < 0) { | 37 | if (file < 0) { |
38 | fatalError(io_error, argv[1], strerror(errno)); | 38 | error_msg_and_die(io_error, argv[1], strerror(errno)); |
39 | } | 39 | } |
40 | } | 40 | } |
41 | 41 | ||
diff --git a/editors/sed.c b/editors/sed.c index f26e6e304..812f62145 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -215,14 +215,14 @@ static int get_address(const char *str, int *line, regex_t **regex) | |||
215 | else if (my_str[idx] == '/') { | 215 | else if (my_str[idx] == '/') { |
216 | idx = index_of_next_unescaped_slash(my_str, ++idx); | 216 | idx = index_of_next_unescaped_slash(my_str, ++idx); |
217 | if (idx == -1) | 217 | if (idx == -1) |
218 | fatalError("unterminated match expression\n"); | 218 | error_msg_and_die("unterminated match expression\n"); |
219 | my_str[idx] = '\0'; | 219 | my_str[idx] = '\0'; |
220 | *regex = (regex_t *)xmalloc(sizeof(regex_t)); | 220 | *regex = (regex_t *)xmalloc(sizeof(regex_t)); |
221 | xregcomp(*regex, my_str+1, 0); | 221 | xregcomp(*regex, my_str+1, 0); |
222 | idx++; /* so it points to the next character after the last '/' */ | 222 | idx++; /* so it points to the next character after the last '/' */ |
223 | } | 223 | } |
224 | else { | 224 | else { |
225 | errorMsg("get_address: no address found in string\n" | 225 | error_msg("get_address: no address found in string\n" |
226 | "\t(you probably didn't check the string you passed me)\n"); | 226 | "\t(you probably didn't check the string you passed me)\n"); |
227 | idx = -1; | 227 | idx = -1; |
228 | } | 228 | } |
@@ -258,13 +258,13 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr) | |||
258 | 258 | ||
259 | /* verify that the 's' is followed by a 'slash' */ | 259 | /* verify that the 's' is followed by a 'slash' */ |
260 | if (substr[++idx] != '/') | 260 | if (substr[++idx] != '/') |
261 | fatalError("bad format in substitution expression\n"); | 261 | error_msg_and_die("bad format in substitution expression\n"); |
262 | 262 | ||
263 | /* save the match string */ | 263 | /* save the match string */ |
264 | oldidx = idx+1; | 264 | oldidx = idx+1; |
265 | idx = index_of_next_unescaped_slash(substr, ++idx); | 265 | idx = index_of_next_unescaped_slash(substr, ++idx); |
266 | if (idx == -1) | 266 | if (idx == -1) |
267 | fatalError("bad format in substitution expression\n"); | 267 | error_msg_and_die("bad format in substitution expression\n"); |
268 | match = strdup_substr(substr, oldidx, idx); | 268 | match = strdup_substr(substr, oldidx, idx); |
269 | 269 | ||
270 | /* determine the number of back references in the match string */ | 270 | /* determine the number of back references in the match string */ |
@@ -283,7 +283,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr) | |||
283 | oldidx = idx+1; | 283 | oldidx = idx+1; |
284 | idx = index_of_next_unescaped_slash(substr, ++idx); | 284 | idx = index_of_next_unescaped_slash(substr, ++idx); |
285 | if (idx == -1) | 285 | if (idx == -1) |
286 | fatalError("bad format in substitution expression\n"); | 286 | error_msg_and_die("bad format in substitution expression\n"); |
287 | sed_cmd->replace = strdup_substr(substr, oldidx, idx); | 287 | sed_cmd->replace = strdup_substr(substr, oldidx, idx); |
288 | 288 | ||
289 | /* process the flags */ | 289 | /* process the flags */ |
@@ -303,7 +303,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr) | |||
303 | if (strchr("; \t\v\n\r", substr[idx])) | 303 | if (strchr("; \t\v\n\r", substr[idx])) |
304 | goto out; | 304 | goto out; |
305 | /* else */ | 305 | /* else */ |
306 | fatalError("bad option in substitution expression\n"); | 306 | error_msg_and_die("bad option in substitution expression\n"); |
307 | } | 307 | } |
308 | } | 308 | } |
309 | 309 | ||
@@ -345,7 +345,7 @@ static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr) | |||
345 | */ | 345 | */ |
346 | 346 | ||
347 | if (editstr[1] != '\\' && (editstr[2] != '\n' || editstr[2] != '\r')) | 347 | if (editstr[1] != '\\' && (editstr[2] != '\n' || editstr[2] != '\r')) |
348 | fatalError("bad format in edit expression\n"); | 348 | error_msg_and_die("bad format in edit expression\n"); |
349 | 349 | ||
350 | /* store the edit line text */ | 350 | /* store the edit line text */ |
351 | /* make editline big enough to accomodate the extra '\n' we will tack on | 351 | /* make editline big enough to accomodate the extra '\n' we will tack on |
@@ -409,9 +409,9 @@ static char *parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) | |||
409 | 409 | ||
410 | /* last part (mandatory) will be a command */ | 410 | /* last part (mandatory) will be a command */ |
411 | if (cmdstr[idx] == '\0') | 411 | if (cmdstr[idx] == '\0') |
412 | fatalError("missing command\n"); | 412 | error_msg_and_die("missing command\n"); |
413 | if (!strchr("pdsaic", cmdstr[idx])) /* <-- XXX add new commands here */ | 413 | if (!strchr("pdsaic", cmdstr[idx])) /* <-- XXX add new commands here */ |
414 | fatalError("invalid command\n"); | 414 | error_msg_and_die("invalid command\n"); |
415 | sed_cmd->cmd = cmdstr[idx]; | 415 | sed_cmd->cmd = cmdstr[idx]; |
416 | 416 | ||
417 | /* special-case handling for (s)ubstitution */ | 417 | /* special-case handling for (s)ubstitution */ |
@@ -421,7 +421,7 @@ static char *parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) | |||
421 | /* special-case handling for (a)ppend, (i)nsert, and (c)hange */ | 421 | /* special-case handling for (a)ppend, (i)nsert, and (c)hange */ |
422 | else if (strchr("aic", cmdstr[idx])) { | 422 | else if (strchr("aic", cmdstr[idx])) { |
423 | if (sed_cmd->end_line || sed_cmd->end_match) | 423 | if (sed_cmd->end_line || sed_cmd->end_match) |
424 | fatalError("only a beginning address can be specified for edit commands\n"); | 424 | error_msg_and_die("only a beginning address can be specified for edit commands\n"); |
425 | idx += parse_edit_cmd(sed_cmd, &cmdstr[idx]); | 425 | idx += parse_edit_cmd(sed_cmd, &cmdstr[idx]); |
426 | } | 426 | } |
427 | /* if it was a single-letter command (such as 'p' or 'd') we need to | 427 | /* if it was a single-letter command (such as 'p' or 'd') we need to |
@@ -757,7 +757,7 @@ extern int sed_main(int argc, char **argv) | |||
757 | for (i = optind; i < argc; i++) { | 757 | for (i = optind; i < argc; i++) { |
758 | file = fopen(argv[i], "r"); | 758 | file = fopen(argv[i], "r"); |
759 | if (file == NULL) { | 759 | if (file == NULL) { |
760 | errorMsg("%s: %s\n", argv[i], strerror(errno)); | 760 | error_msg("%s: %s\n", argv[i], strerror(errno)); |
761 | } else { | 761 | } else { |
762 | process_file(file); | 762 | process_file(file); |
763 | fclose(file); | 763 | fclose(file); |
@@ -74,14 +74,14 @@ int expr_main (int argc, char **argv) | |||
74 | VALUE *v; | 74 | VALUE *v; |
75 | 75 | ||
76 | if (argc == 1) { | 76 | if (argc == 1) { |
77 | fatalError("too few arguments\n"); | 77 | error_msg_and_die("too few arguments\n"); |
78 | } | 78 | } |
79 | 79 | ||
80 | args = argv + 1; | 80 | args = argv + 1; |
81 | 81 | ||
82 | v = eval (); | 82 | v = eval (); |
83 | if (*args) | 83 | if (*args) |
84 | fatalError ("syntax error\n"); | 84 | error_msg_and_die ("syntax error\n"); |
85 | 85 | ||
86 | if (v->type == integer) | 86 | if (v->type == integer) |
87 | printf ("%d\n", v->u.i); | 87 | printf ("%d\n", v->u.i); |
@@ -216,7 +216,7 @@ static \ | |||
216 | int name (l, r) VALUE *l; VALUE *r; \ | 216 | int name (l, r) VALUE *l; VALUE *r; \ |
217 | { \ | 217 | { \ |
218 | if (!toarith (l) || !toarith (r)) \ | 218 | if (!toarith (l) || !toarith (r)) \ |
219 | fatalError ("non-numeric argument\n"); \ | 219 | error_msg_and_die ("non-numeric argument\n"); \ |
220 | return l->u.i op r->u.i; \ | 220 | return l->u.i op r->u.i; \ |
221 | } | 221 | } |
222 | 222 | ||
@@ -224,9 +224,9 @@ int name (l, r) VALUE *l; VALUE *r; \ | |||
224 | int name (l, r) VALUE *l; VALUE *r; \ | 224 | int name (l, r) VALUE *l; VALUE *r; \ |
225 | { \ | 225 | { \ |
226 | if (!toarith (l) || !toarith (r)) \ | 226 | if (!toarith (l) || !toarith (r)) \ |
227 | fatalError ( "non-numeric argument\n"); \ | 227 | error_msg_and_die ( "non-numeric argument\n"); \ |
228 | if (r->u.i == 0) \ | 228 | if (r->u.i == 0) \ |
229 | fatalError ( "division by zero\n"); \ | 229 | error_msg_and_die ( "division by zero\n"); \ |
230 | return l->u.i op r->u.i; \ | 230 | return l->u.i op r->u.i; \ |
231 | } | 231 | } |
232 | 232 | ||
@@ -270,7 +270,7 @@ of a basic regular expression is not portable; it is being ignored", | |||
270 | re_syntax_options = RE_SYNTAX_POSIX_BASIC; | 270 | re_syntax_options = RE_SYNTAX_POSIX_BASIC; |
271 | errmsg = re_compile_pattern (pv->u.s, len, &re_buffer); | 271 | errmsg = re_compile_pattern (pv->u.s, len, &re_buffer); |
272 | if (errmsg) { | 272 | if (errmsg) { |
273 | fatalError("%s\n", errmsg); | 273 | error_msg_and_die("%s\n", errmsg); |
274 | } | 274 | } |
275 | 275 | ||
276 | len = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs); | 276 | len = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs); |
@@ -301,19 +301,19 @@ static VALUE *eval7 (void) | |||
301 | VALUE *v; | 301 | VALUE *v; |
302 | 302 | ||
303 | if (!*args) | 303 | if (!*args) |
304 | fatalError ( "syntax error\n"); | 304 | error_msg_and_die ( "syntax error\n"); |
305 | 305 | ||
306 | if (nextarg ("(")) { | 306 | if (nextarg ("(")) { |
307 | args++; | 307 | args++; |
308 | v = eval (); | 308 | v = eval (); |
309 | if (!nextarg (")")) | 309 | if (!nextarg (")")) |
310 | fatalError ( "syntax error\n"); | 310 | error_msg_and_die ( "syntax error\n"); |
311 | args++; | 311 | args++; |
312 | return v; | 312 | return v; |
313 | } | 313 | } |
314 | 314 | ||
315 | if (nextarg (")")) | 315 | if (nextarg (")")) |
316 | fatalError ( "syntax error\n"); | 316 | error_msg_and_die ( "syntax error\n"); |
317 | 317 | ||
318 | return str_value (*args++); | 318 | return str_value (*args++); |
319 | } | 319 | } |
@@ -327,7 +327,7 @@ static VALUE *eval6 (void) | |||
327 | if (nextarg ("quote")) { | 327 | if (nextarg ("quote")) { |
328 | args++; | 328 | args++; |
329 | if (!*args) | 329 | if (!*args) |
330 | fatalError ( "syntax error\n"); | 330 | error_msg_and_die ( "syntax error\n"); |
331 | return str_value (*args++); | 331 | return str_value (*args++); |
332 | } | 332 | } |
333 | else if (nextarg ("length")) { | 333 | else if (nextarg ("length")) { |
@@ -283,7 +283,7 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn, | |||
283 | } | 283 | } |
284 | } | 284 | } |
285 | #else | 285 | #else |
286 | errorMsg( "mode reading not compiled in\n"); | 286 | error_msg( "mode reading not compiled in\n"); |
287 | #endif | 287 | #endif |
288 | return 0; | 288 | return 0; |
289 | } | 289 | } |
@@ -433,7 +433,7 @@ extern int fbset_main(int argc, char **argv) | |||
433 | PERROR("fbset(ioctl)"); | 433 | PERROR("fbset(ioctl)"); |
434 | if (g_options & OPT_READMODE) { | 434 | if (g_options & OPT_READMODE) { |
435 | if (!readmode(&var, modefile, mode)) { | 435 | if (!readmode(&var, modefile, mode)) { |
436 | errorMsg("Unknown video mode `%s'\n", mode); | 436 | error_msg("Unknown video mode `%s'\n", mode); |
437 | return EXIT_FAILURE; | 437 | return EXIT_FAILURE; |
438 | } | 438 | } |
439 | } | 439 | } |
@@ -98,7 +98,7 @@ int find_main(int argc, char **argv) | |||
98 | break; | 98 | break; |
99 | } | 99 | } |
100 | 100 | ||
101 | if (recursiveAction(directory, TRUE, FALSE, FALSE, | 101 | if (recursive_action(directory, TRUE, FALSE, FALSE, |
102 | fileAction, fileAction, NULL) == FALSE) { | 102 | fileAction, fileAction, NULL) == FALSE) { |
103 | return EXIT_FAILURE; | 103 | return EXIT_FAILURE; |
104 | } | 104 | } |
diff --git a/findutils/find.c b/findutils/find.c index a86b07e73..c82b509b6 100644 --- a/findutils/find.c +++ b/findutils/find.c | |||
@@ -98,7 +98,7 @@ int find_main(int argc, char **argv) | |||
98 | break; | 98 | break; |
99 | } | 99 | } |
100 | 100 | ||
101 | if (recursiveAction(directory, TRUE, FALSE, FALSE, | 101 | if (recursive_action(directory, TRUE, FALSE, FALSE, |
102 | fileAction, fileAction, NULL) == FALSE) { | 102 | fileAction, fileAction, NULL) == FALSE) { |
103 | return EXIT_FAILURE; | 103 | return EXIT_FAILURE; |
104 | } | 104 | } |
diff --git a/findutils/grep.c b/findutils/grep.c index c0193bce3..9014443b1 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -169,7 +169,7 @@ extern int grep_main(int argc, char **argv) | |||
169 | file = fopen(cur_file, "r"); | 169 | file = fopen(cur_file, "r"); |
170 | if (file == NULL) { | 170 | if (file == NULL) { |
171 | if (!suppress_err_msgs) | 171 | if (!suppress_err_msgs) |
172 | errorMsg("%s: %s\n", cur_file, strerror(errno)); | 172 | error_msg("%s: %s\n", cur_file, strerror(errno)); |
173 | } | 173 | } |
174 | else { | 174 | else { |
175 | grep_file(file); | 175 | grep_file(file); |
diff --git a/freeramdisk.c b/freeramdisk.c index 567151455..a568cc67c 100644 --- a/freeramdisk.c +++ b/freeramdisk.c | |||
@@ -43,10 +43,10 @@ freeramdisk_main(int argc, char **argv) | |||
43 | } | 43 | } |
44 | 44 | ||
45 | if ((f = open(argv[1], O_RDWR)) == -1) { | 45 | if ((f = open(argv[1], O_RDWR)) == -1) { |
46 | fatalError( "cannot open %s: %s\n", argv[1], strerror(errno)); | 46 | error_msg_and_die( "cannot open %s: %s\n", argv[1], strerror(errno)); |
47 | } | 47 | } |
48 | if (ioctl(f, BLKFLSBUF) < 0) { | 48 | if (ioctl(f, BLKFLSBUF) < 0) { |
49 | fatalError( "failed ioctl on %s: %s\n", argv[1], strerror(errno)); | 49 | error_msg_and_die( "failed ioctl on %s: %s\n", argv[1], strerror(errno)); |
50 | } | 50 | } |
51 | /* Don't bother closing. Exit does | 51 | /* Don't bother closing. Exit does |
52 | * that, so we can save a few bytes */ | 52 | * that, so we can save a few bytes */ |
diff --git a/fsck_minix.c b/fsck_minix.c index ef65e3073..9ebabe9e5 100644 --- a/fsck_minix.c +++ b/fsck_minix.c | |||
@@ -296,7 +296,7 @@ static void show_usage(void) | |||
296 | 296 | ||
297 | static void die(const char *str) | 297 | static void die(const char *str) |
298 | { | 298 | { |
299 | errorMsg("%s\n", str); | 299 | error_msg("%s\n", str); |
300 | leave(8); | 300 | leave(8); |
301 | } | 301 | } |
302 | 302 | ||
@@ -37,7 +37,7 @@ | |||
37 | * <misiek@misiek.eu.org>) | 37 | * <misiek@misiek.eu.org>) |
38 | * Ported to Busybox - Alfred M. Szmidt <ams@trillian.itslinux.org> | 38 | * Ported to Busybox - Alfred M. Szmidt <ams@trillian.itslinux.org> |
39 | * Removed --version/-V and --help/-h in | 39 | * Removed --version/-V and --help/-h in |
40 | * Removed prase_error(), using errorMsg() from Busybox instead | 40 | * Removed prase_error(), using error_msg() from Busybox instead |
41 | * Replaced our_malloc with xmalloc and our_realloc with xrealloc | 41 | * Replaced our_malloc with xmalloc and our_realloc with xrealloc |
42 | * | 42 | * |
43 | */ | 43 | */ |
@@ -258,7 +258,7 @@ void add_long_options(char *options) | |||
258 | arg_opt=required_argument; | 258 | arg_opt=required_argument; |
259 | } | 259 | } |
260 | if (strlen(tokptr) == 0) | 260 | if (strlen(tokptr) == 0) |
261 | errorMsg("empty long option after -l or --long argument\n"); | 261 | error_msg("empty long option after -l or --long argument\n"); |
262 | } | 262 | } |
263 | add_longopt(tokptr,arg_opt); | 263 | add_longopt(tokptr,arg_opt); |
264 | } | 264 | } |
@@ -277,7 +277,7 @@ void set_shell(const char *new_shell) | |||
277 | else if (!strcmp(new_shell,"csh")) | 277 | else if (!strcmp(new_shell,"csh")) |
278 | shell=TCSH; | 278 | shell=TCSH; |
279 | else | 279 | else |
280 | errorMsg("unknown shell after -s or --shell argument\n"); | 280 | error_msg("unknown shell after -s or --shell argument\n"); |
281 | } | 281 | } |
282 | 282 | ||
283 | 283 | ||
@@ -326,7 +326,7 @@ int getopt_main(int argc, char *argv[]) | |||
326 | printf(" --\n"); | 326 | printf(" --\n"); |
327 | exit(0); | 327 | exit(0); |
328 | } else | 328 | } else |
329 | fatalError("missing optstring argument\n"); | 329 | error_msg_and_die("missing optstring argument\n"); |
330 | } | 330 | } |
331 | 331 | ||
332 | if (argv[1][0] != '-' || compatible) { | 332 | if (argv[1][0] != '-' || compatible) { |
@@ -377,7 +377,7 @@ int getopt_main(int argc, char *argv[]) | |||
377 | 377 | ||
378 | if (!optstr) { | 378 | if (!optstr) { |
379 | if (optind >= argc) | 379 | if (optind >= argc) |
380 | fatalError("missing optstring argument\n"); | 380 | error_msg_and_die("missing optstring argument\n"); |
381 | else { | 381 | else { |
382 | optstr=xmalloc(strlen(argv[optind])+1); | 382 | optstr=xmalloc(strlen(argv[optind])+1); |
383 | strcpy(optstr,argv[optind]); | 383 | strcpy(optstr,argv[optind]); |
@@ -169,7 +169,7 @@ extern int grep_main(int argc, char **argv) | |||
169 | file = fopen(cur_file, "r"); | 169 | file = fopen(cur_file, "r"); |
170 | if (file == NULL) { | 170 | if (file == NULL) { |
171 | if (!suppress_err_msgs) | 171 | if (!suppress_err_msgs) |
172 | errorMsg("%s: %s\n", cur_file, strerror(errno)); | 172 | error_msg("%s: %s\n", cur_file, strerror(errno)); |
173 | } | 173 | } |
174 | else { | 174 | else { |
175 | grep_file(file); | 175 | grep_file(file); |
@@ -113,7 +113,7 @@ static char *license_msg[] = { | |||
113 | 113 | ||
114 | /* Diagnostic functions */ | 114 | /* Diagnostic functions */ |
115 | #ifdef DEBUG | 115 | #ifdef DEBUG |
116 | # define Assert(cond,msg) {if(!(cond)) errorMsg(msg);} | 116 | # define Assert(cond,msg) {if(!(cond)) error_msg(msg);} |
117 | # define Trace(x) fprintf x | 117 | # define Trace(x) fprintf x |
118 | # define Tracev(x) {if (verbose) fprintf x ;} | 118 | # define Tracev(x) {if (verbose) fprintf x ;} |
119 | # define Tracevv(x) {if (verbose>1) fprintf x ;} | 119 | # define Tracevv(x) {if (verbose>1) fprintf x ;} |
@@ -297,7 +297,7 @@ int in; /* input file descriptor */ | |||
297 | 297 | ||
298 | method = (int) get_byte(); | 298 | method = (int) get_byte(); |
299 | if (method != DEFLATED) { | 299 | if (method != DEFLATED) { |
300 | errorMsg("unknown method %d -- get newer version of gzip\n", method); | 300 | error_msg("unknown method %d -- get newer version of gzip\n", method); |
301 | exit_code = ERROR; | 301 | exit_code = ERROR; |
302 | return -1; | 302 | return -1; |
303 | } | 303 | } |
@@ -1114,13 +1114,13 @@ int in, out; /* input and output file descriptors */ | |||
1114 | int res = inflate(); | 1114 | int res = inflate(); |
1115 | 1115 | ||
1116 | if (res == 3) { | 1116 | if (res == 3) { |
1117 | errorMsg(memory_exhausted); | 1117 | error_msg(memory_exhausted); |
1118 | } else if (res != 0) { | 1118 | } else if (res != 0) { |
1119 | errorMsg("invalid compressed data--format violated\n"); | 1119 | error_msg("invalid compressed data--format violated\n"); |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | } else { | 1122 | } else { |
1123 | errorMsg("internal error, invalid method\n"); | 1123 | error_msg("internal error, invalid method\n"); |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | /* Get the crc and original length */ | 1126 | /* Get the crc and original length */ |
@@ -1149,10 +1149,10 @@ int in, out; /* input and output file descriptors */ | |||
1149 | 1149 | ||
1150 | /* Validate decompression */ | 1150 | /* Validate decompression */ |
1151 | if (orig_crc != updcrc(outbuf, 0)) { | 1151 | if (orig_crc != updcrc(outbuf, 0)) { |
1152 | errorMsg("invalid compressed data--crc error\n"); | 1152 | error_msg("invalid compressed data--crc error\n"); |
1153 | } | 1153 | } |
1154 | if (orig_len != (ulg) bytes_out) { | 1154 | if (orig_len != (ulg) bytes_out) { |
1155 | errorMsg("invalid compressed data--length error\n"); | 1155 | error_msg("invalid compressed data--length error\n"); |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | /* Check if there are more entries in a pkzip file */ | 1158 | /* Check if there are more entries in a pkzip file */ |
@@ -1225,9 +1225,9 @@ int gunzip_main(int argc, char **argv) | |||
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | if (isatty(fileno(stdin)) && fromstdin==1 && force==0) | 1227 | if (isatty(fileno(stdin)) && fromstdin==1 && force==0) |
1228 | fatalError( "data not read from terminal. Use -f to force it.\n"); | 1228 | error_msg_and_die( "data not read from terminal. Use -f to force it.\n"); |
1229 | if (isatty(fileno(stdout)) && tostdout==1 && force==0) | 1229 | if (isatty(fileno(stdout)) && tostdout==1 && force==0) |
1230 | fatalError( "data not written to terminal. Use -f to force it.\n"); | 1230 | error_msg_and_die( "data not written to terminal. Use -f to force it.\n"); |
1231 | 1231 | ||
1232 | 1232 | ||
1233 | foreground = signal(SIGINT, SIG_IGN) != SIG_IGN; | 1233 | foreground = signal(SIGINT, SIG_IGN) != SIG_IGN; |
@@ -1265,7 +1265,7 @@ int gunzip_main(int argc, char **argv) | |||
1265 | if (argc <= 0) | 1265 | if (argc <= 0) |
1266 | usage(gunzip_usage); | 1266 | usage(gunzip_usage); |
1267 | if (strlen(*argv) > MAX_PATH_LEN) { | 1267 | if (strlen(*argv) > MAX_PATH_LEN) { |
1268 | errorMsg(name_too_long); | 1268 | error_msg(name_too_long); |
1269 | exit(WARNING); | 1269 | exit(WARNING); |
1270 | } | 1270 | } |
1271 | strcpy(ifname, *argv); | 1271 | strcpy(ifname, *argv); |
@@ -1304,7 +1304,7 @@ int gunzip_main(int argc, char **argv) | |||
1304 | 1304 | ||
1305 | /* And get to work */ | 1305 | /* And get to work */ |
1306 | if (strlen(ifname) > MAX_PATH_LEN - 4) { | 1306 | if (strlen(ifname) > MAX_PATH_LEN - 4) { |
1307 | errorMsg(name_too_long); | 1307 | error_msg(name_too_long); |
1308 | exit(WARNING); | 1308 | exit(WARNING); |
1309 | } | 1309 | } |
1310 | strcpy(ofname, ifname); | 1310 | strcpy(ofname, ifname); |
@@ -114,7 +114,7 @@ extern int method; /* compression method */ | |||
114 | # define DECLARE(type, array, size) type * array | 114 | # define DECLARE(type, array, size) type * array |
115 | # define ALLOC(type, array, size) { \ | 115 | # define ALLOC(type, array, size) { \ |
116 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ | 116 | array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ |
117 | if (array == NULL) errorMsg(memory_exhausted); \ | 117 | if (array == NULL) error_msg(memory_exhausted); \ |
118 | } | 118 | } |
119 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} | 119 | # define FREE(array) {if (array != NULL) free(array), array=NULL;} |
120 | #else | 120 | #else |
@@ -251,7 +251,7 @@ extern int save_orig_name; /* set if original name must be saved */ | |||
251 | 251 | ||
252 | /* Diagnostic functions */ | 252 | /* Diagnostic functions */ |
253 | #ifdef DEBUG | 253 | #ifdef DEBUG |
254 | # define Assert(cond,msg) {if(!(cond)) errorMsg(msg);} | 254 | # define Assert(cond,msg) {if(!(cond)) error_msg(msg);} |
255 | # define Trace(x) fprintf x | 255 | # define Trace(x) fprintf x |
256 | # define Tracev(x) {if (verbose) fprintf x ;} | 256 | # define Tracev(x) {if (verbose) fprintf x ;} |
257 | # define Tracevv(x) {if (verbose>1) fprintf x ;} | 257 | # define Tracevv(x) {if (verbose>1) fprintf x ;} |
@@ -1381,7 +1381,7 @@ int length; | |||
1381 | (char *) window + start, length) != EQUAL) { | 1381 | (char *) window + start, length) != EQUAL) { |
1382 | fprintf(stderr, | 1382 | fprintf(stderr, |
1383 | " start %d, match %d, length %d\n", start, match, length); | 1383 | " start %d, match %d, length %d\n", start, match, length); |
1384 | errorMsg("invalid match\n"); | 1384 | error_msg("invalid match\n"); |
1385 | } | 1385 | } |
1386 | if (verbose > 1) { | 1386 | if (verbose > 1) { |
1387 | fprintf(stderr, "\\[%d,%d]", start - match, length); | 1387 | fprintf(stderr, "\\[%d,%d]", start - match, length); |
@@ -1819,9 +1819,9 @@ int gzip_main(int argc, char **argv) | |||
1819 | } | 1819 | } |
1820 | 1820 | ||
1821 | if (isatty(fileno(stdin)) && fromstdin==1 && force==0) | 1821 | if (isatty(fileno(stdin)) && fromstdin==1 && force==0) |
1822 | fatalError( "data not read from terminal. Use -f to force it.\n"); | 1822 | error_msg_and_die( "data not read from terminal. Use -f to force it.\n"); |
1823 | if (isatty(fileno(stdout)) && tostdout==1 && force==0) | 1823 | if (isatty(fileno(stdout)) && tostdout==1 && force==0) |
1824 | fatalError( "data not written to terminal. Use -f to force it.\n"); | 1824 | error_msg_and_die( "data not written to terminal. Use -f to force it.\n"); |
1825 | 1825 | ||
1826 | foreground = signal(SIGINT, SIG_IGN) != SIG_IGN; | 1826 | foreground = signal(SIGINT, SIG_IGN) != SIG_IGN; |
1827 | if (foreground) { | 1827 | if (foreground) { |
@@ -2900,7 +2900,7 @@ int eof; /* true if this is the last block for a file */ | |||
2900 | #endif | 2900 | #endif |
2901 | /* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */ | 2901 | /* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */ |
2902 | if (buf == (char *) 0) | 2902 | if (buf == (char *) 0) |
2903 | errorMsg("block vanished\n"); | 2903 | error_msg("block vanished\n"); |
2904 | 2904 | ||
2905 | copy_block(buf, (unsigned) stored_len, 0); /* without header */ | 2905 | copy_block(buf, (unsigned) stored_len, 0); /* without header */ |
2906 | compressed_len = stored_len << 3; | 2906 | compressed_len = stored_len << 3; |
@@ -3083,7 +3083,7 @@ local void set_file_type() | |||
3083 | bin_freq += dyn_ltree[n++].Freq; | 3083 | bin_freq += dyn_ltree[n++].Freq; |
3084 | *file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII; | 3084 | *file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII; |
3085 | if (*file_type == BINARY && translate_eol) { | 3085 | if (*file_type == BINARY && translate_eol) { |
3086 | errorMsg("-l used on binary file\n"); | 3086 | error_msg("-l used on binary file\n"); |
3087 | } | 3087 | } |
3088 | } | 3088 | } |
3089 | 3089 | ||
@@ -3239,13 +3239,13 @@ char *env; /* name of environment variable */ | |||
3239 | nargv = (char **) calloc(*argcp + 1, sizeof(char *)); | 3239 | nargv = (char **) calloc(*argcp + 1, sizeof(char *)); |
3240 | 3240 | ||
3241 | if (nargv == NULL) | 3241 | if (nargv == NULL) |
3242 | errorMsg(memory_exhausted); | 3242 | error_msg(memory_exhausted); |
3243 | oargv = *argvp; | 3243 | oargv = *argvp; |
3244 | *argvp = nargv; | 3244 | *argvp = nargv; |
3245 | 3245 | ||
3246 | /* Copy the program name first */ | 3246 | /* Copy the program name first */ |
3247 | if (oargc-- < 0) | 3247 | if (oargc-- < 0) |
3248 | errorMsg("argc<=0\n"); | 3248 | error_msg("argc<=0\n"); |
3249 | *(nargv++) = *(oargv++); | 3249 | *(nargv++) = *(oargv++); |
3250 | 3250 | ||
3251 | /* Then copy the environment args */ | 3251 | /* Then copy the environment args */ |
@@ -28,7 +28,7 @@ extern int halt_main(int argc, char **argv) | |||
28 | { | 28 | { |
29 | #ifdef BB_FEATURE_LINUXRC | 29 | #ifdef BB_FEATURE_LINUXRC |
30 | /* don't assume init's pid == 1 */ | 30 | /* don't assume init's pid == 1 */ |
31 | return(kill(*(findPidByName("init")), SIGUSR1)); | 31 | return(kill(*(find_pid_by_name("init")), SIGUSR1)); |
32 | #else | 32 | #else |
33 | return(kill(1, SIGUSR1)); | 33 | return(kill(1, SIGUSR1)); |
34 | #endif | 34 | #endif |
@@ -80,7 +80,7 @@ int head_main(int argc, char **argv) | |||
80 | } | 80 | } |
81 | head(len, fp); | 81 | head(len, fp); |
82 | if (errno) { | 82 | if (errno) { |
83 | errorMsg("%s: %s\n", argv[optind], strerror(errno)); | 83 | error_msg("%s: %s\n", argv[optind], strerror(errno)); |
84 | status = EXIT_FAILURE; | 84 | status = EXIT_FAILURE; |
85 | errno = 0; | 85 | errno = 0; |
86 | } | 86 | } |
diff --git a/hostname.c b/hostname.c index 44d529c83..13e52c41d 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.15 2000/10/12 22:30:31 andersen Exp $ | 3 | * $Id: hostname.c,v 1.16 2000/12/07 19:56:48 markw 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> |
@@ -40,7 +40,7 @@ void do_sethostname(char *s, int isfile) | |||
40 | if (!isfile) { | 40 | if (!isfile) { |
41 | if (sethostname(s, strlen(s)) < 0) { | 41 | if (sethostname(s, strlen(s)) < 0) { |
42 | if (errno == EPERM) | 42 | if (errno == EPERM) |
43 | errorMsg("you must be root to change the hostname\n"); | 43 | error_msg("you must be root to change the hostname\n"); |
44 | else | 44 | else |
45 | perror("sethostname"); | 45 | perror("sethostname"); |
46 | exit(1); | 46 | exit(1); |
@@ -78,7 +78,7 @@ extern int id_main(int argc, char **argv) | |||
78 | pwnam=my_getpwnam(user); | 78 | pwnam=my_getpwnam(user); |
79 | grnam=my_getgrnam(group); | 79 | grnam=my_getgrnam(group); |
80 | if (gid == -1 || pwnam==-1 || grnam==-1) { | 80 | if (gid == -1 || pwnam==-1 || grnam==-1) { |
81 | fatalError("%s: No such user\n", user); | 81 | error_msg_and_die("%s: No such user\n", user); |
82 | } | 82 | } |
83 | if (no_group) | 83 | if (no_group) |
84 | printf("%ld\n", pwnam); | 84 | printf("%ld\n", pwnam); |
diff --git a/include/busybox.h b/include/busybox.h index 63f39590f..41421ae56 100644 --- a/include/busybox.h +++ b/include/busybox.h | |||
@@ -55,8 +55,8 @@ | |||
55 | #define BUF_SIZE 8192 | 55 | #define BUF_SIZE 8192 |
56 | #define EXPAND_ALLOC 1024 | 56 | #define EXPAND_ALLOC 1024 |
57 | 57 | ||
58 | static inline int isDecimal(ch) { return ((ch >= '0') && (ch <= '9')); } | 58 | static inline int is_decimal(ch) { return ((ch >= '0') && (ch <= '9')); } |
59 | static inline int isOctal(ch) { return ((ch >= '0') && (ch <= '7')); } | 59 | static inline int is_octal(ch) { return ((ch >= '0') && (ch <= '7')); } |
60 | 60 | ||
61 | /* Macros for min/max. */ | 61 | /* Macros for min/max. */ |
62 | #ifndef MIN | 62 | #ifndef MIN |
@@ -119,14 +119,14 @@ extern const char *applet_name; | |||
119 | extern int applet_name_compare(const void *x, const void *y); | 119 | extern int applet_name_compare(const void *x, const void *y); |
120 | 120 | ||
121 | extern void usage(const char *usage) __attribute__ ((noreturn)); | 121 | extern void usage(const char *usage) __attribute__ ((noreturn)); |
122 | extern void errorMsg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 122 | extern void error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); |
123 | extern void fatalError(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 123 | extern void error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); |
124 | extern void perrorMsg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 124 | extern void perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); |
125 | extern void fatalPerror(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 125 | extern void perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); |
126 | 126 | ||
127 | const char *modeString(int mode); | 127 | const char *mode_string(int mode); |
128 | const char *timeString(time_t timeVal); | 128 | const char *time_string(time_t timeVal); |
129 | int isDirectory(const char *name, const int followLinks, struct stat *statBuf); | 129 | int is_directory(const char *name, const int followLinks, struct stat *statBuf); |
130 | int isDevice(const char *name); | 130 | int isDevice(const char *name); |
131 | 131 | ||
132 | typedef struct ino_dev_hash_bucket_struct { | 132 | typedef struct ino_dev_hash_bucket_struct { |
@@ -139,7 +139,7 @@ int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name); | |||
139 | void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name); | 139 | void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name); |
140 | void reset_ino_dev_hashtable(void); | 140 | void reset_ino_dev_hashtable(void); |
141 | 141 | ||
142 | int copyFile(const char *srcName, const char *destName, | 142 | int copy_file(const char *srcName, const char *destName, |
143 | int setModes, int followLinks, int forceFlag); | 143 | int setModes, int followLinks, int forceFlag); |
144 | int copy_file_chunk(int srcFd, int dstFd, size_t remaining); | 144 | int copy_file_chunk(int srcFd, int dstFd, size_t remaining); |
145 | char *buildName(const char *dirName, const char *fileName); | 145 | char *buildName(const char *dirName, const char *fileName); |
@@ -147,20 +147,20 @@ int makeString(int argc, const char **argv, char *buf, int bufLen); | |||
147 | char *getChunk(int size); | 147 | char *getChunk(int size); |
148 | char *chunkstrdup(const char *str); | 148 | char *chunkstrdup(const char *str); |
149 | void freeChunks(void); | 149 | void freeChunks(void); |
150 | int fullWrite(int fd, const char *buf, int len); | 150 | int full_write(int fd, const char *buf, int len); |
151 | int fullRead(int fd, char *buf, int len); | 151 | int full_read(int fd, char *buf, int len); |
152 | int recursiveAction(const char *fileName, int recurse, int followLinks, int depthFirst, | 152 | int recursive_action(const char *fileName, int recurse, int followLinks, int depthFirst, |
153 | int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData), | 153 | int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData), |
154 | int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData), | 154 | int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData), |
155 | void* userData); | 155 | void* userData); |
156 | 156 | ||
157 | extern int createPath (const char *name, int mode); | 157 | extern int create_path (const char *name, int mode); |
158 | extern int parse_mode( const char* s, mode_t* theMode); | 158 | extern int parse_mode( const char* s, mode_t* theMode); |
159 | 159 | ||
160 | extern int get_kernel_revision(void); | 160 | extern int get_kernel_revision(void); |
161 | 161 | ||
162 | extern int get_console_fd(char* tty_name); | 162 | extern int get_console_fd(char* tty_name); |
163 | extern struct mntent *findMountPoint(const char *name, const char *table); | 163 | extern struct mntent *find_mount_point(const char *name, const char *table); |
164 | extern void write_mtab(char* blockDevice, char* directory, | 164 | extern void write_mtab(char* blockDevice, char* directory, |
165 | char* filesystemType, long flags, char* string_flags); | 165 | char* filesystemType, long flags, char* string_flags); |
166 | extern void erase_mtab(const char * name); | 166 | extern void erase_mtab(const char * name); |
@@ -169,8 +169,8 @@ extern char *mtab_first(void **iter); | |||
169 | extern char *mtab_next(void **iter); | 169 | extern char *mtab_next(void **iter); |
170 | extern char *mtab_getinfo(const char *match, const char which); | 170 | extern char *mtab_getinfo(const char *match, const char which); |
171 | extern int check_wildcard_match(const char* text, const char* pattern); | 171 | extern int check_wildcard_match(const char* text, const char* pattern); |
172 | extern long getNum (const char *cp); | 172 | extern long atoi_w_units (const char *cp); |
173 | extern pid_t* findPidByName( char* pidName); | 173 | extern pid_t* find_pid_by_name( char* pidName); |
174 | extern int find_real_root_device_name(char* name); | 174 | extern int find_real_root_device_name(char* name); |
175 | extern char *get_line_from_file(FILE *file); | 175 | extern char *get_line_from_file(FILE *file); |
176 | extern void print_file(FILE *file); | 176 | extern void print_file(FILE *file); |
@@ -296,7 +296,7 @@ static int check_free_memory() | |||
296 | unsigned int result, u, s=10; | 296 | unsigned int result, u, s=10; |
297 | 297 | ||
298 | if (sysinfo(&info) != 0) { | 298 | if (sysinfo(&info) != 0) { |
299 | perrorMsg("Error checking free memory: "); | 299 | perror_msg("Error checking free memory: "); |
300 | return -1; | 300 | return -1; |
301 | } | 301 | } |
302 | 302 | ||
diff --git a/init/halt.c b/init/halt.c index c3e2523c0..e875d04f0 100644 --- a/init/halt.c +++ b/init/halt.c | |||
@@ -28,7 +28,7 @@ extern int halt_main(int argc, char **argv) | |||
28 | { | 28 | { |
29 | #ifdef BB_FEATURE_LINUXRC | 29 | #ifdef BB_FEATURE_LINUXRC |
30 | /* don't assume init's pid == 1 */ | 30 | /* don't assume init's pid == 1 */ |
31 | return(kill(*(findPidByName("init")), SIGUSR1)); | 31 | return(kill(*(find_pid_by_name("init")), SIGUSR1)); |
32 | #else | 32 | #else |
33 | return(kill(1, SIGUSR1)); | 33 | return(kill(1, SIGUSR1)); |
34 | #endif | 34 | #endif |
diff --git a/init/init.c b/init/init.c index c4440894c..e5b1a3931 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -296,7 +296,7 @@ static int check_free_memory() | |||
296 | unsigned int result, u, s=10; | 296 | unsigned int result, u, s=10; |
297 | 297 | ||
298 | if (sysinfo(&info) != 0) { | 298 | if (sysinfo(&info) != 0) { |
299 | perrorMsg("Error checking free memory: "); | 299 | perror_msg("Error checking free memory: "); |
300 | return -1; | 300 | return -1; |
301 | } | 301 | } |
302 | 302 | ||
diff --git a/init/poweroff.c b/init/poweroff.c index 3101a20dc..007099d4d 100644 --- a/init/poweroff.c +++ b/init/poweroff.c | |||
@@ -28,7 +28,7 @@ extern int poweroff_main(int argc, char **argv) | |||
28 | { | 28 | { |
29 | #ifdef BB_FEATURE_LINUXRC | 29 | #ifdef BB_FEATURE_LINUXRC |
30 | /* don't assume init's pid == 1 */ | 30 | /* don't assume init's pid == 1 */ |
31 | return(kill(*(findPidByName("init")), SIGUSR2)); | 31 | return(kill(*(find_pid_by_name("init")), SIGUSR2)); |
32 | #else | 32 | #else |
33 | return(kill(1, SIGUSR2)); | 33 | return(kill(1, SIGUSR2)); |
34 | #endif | 34 | #endif |
diff --git a/init/reboot.c b/init/reboot.c index 354286d47..3e5f2382c 100644 --- a/init/reboot.c +++ b/init/reboot.c | |||
@@ -28,7 +28,7 @@ extern int reboot_main(int argc, char **argv) | |||
28 | { | 28 | { |
29 | #ifdef BB_FEATURE_LINUXRC | 29 | #ifdef BB_FEATURE_LINUXRC |
30 | /* don't assume init's pid == 1 */ | 30 | /* don't assume init's pid == 1 */ |
31 | return(kill(*(findPidByName("init")), SIGINT)); | 31 | return(kill(*(find_pid_by_name("init")), SIGINT)); |
32 | #else | 32 | #else |
33 | return(kill(1, SIGINT)); | 33 | return(kill(1, SIGINT)); |
34 | #endif | 34 | #endif |
@@ -78,7 +78,7 @@ | |||
78 | #ifndef MODUTILS_MODULE_H | 78 | #ifndef MODUTILS_MODULE_H |
79 | #define MODUTILS_MODULE_H 1 | 79 | #define MODUTILS_MODULE_H 1 |
80 | 80 | ||
81 | #ident "$Id: insmod.c,v 1.30 2000/12/06 18:18:26 andersen Exp $" | 81 | #ident "$Id: insmod.c,v 1.31 2000/12/07 19:56:48 markw Exp $" |
82 | 82 | ||
83 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 83 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
84 | We do not use the kernel headers directly because we do not wish | 84 | We do not use the kernel headers directly because we do not wish |
@@ -284,7 +284,7 @@ int delete_module(const char *); | |||
284 | #ifndef MODUTILS_OBJ_H | 284 | #ifndef MODUTILS_OBJ_H |
285 | #define MODUTILS_OBJ_H 1 | 285 | #define MODUTILS_OBJ_H 1 |
286 | 286 | ||
287 | #ident "$Id: insmod.c,v 1.30 2000/12/06 18:18:26 andersen Exp $" | 287 | #ident "$Id: insmod.c,v 1.31 2000/12/07 19:56:48 markw Exp $" |
288 | 288 | ||
289 | /* The relocatable object is manipulated using elfin types. */ | 289 | /* The relocatable object is manipulated using elfin types. */ |
290 | 290 | ||
@@ -1157,7 +1157,7 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name, | |||
1157 | /* Don't report an error if the symbol is coming from | 1157 | /* Don't report an error if the symbol is coming from |
1158 | the kernel or some external module. */ | 1158 | the kernel or some external module. */ |
1159 | if (secidx <= SHN_HIRESERVE) | 1159 | if (secidx <= SHN_HIRESERVE) |
1160 | errorMsg("%s multiply defined\n", name); | 1160 | error_msg("%s multiply defined\n", name); |
1161 | return sym; | 1161 | return sym; |
1162 | } | 1162 | } |
1163 | } | 1163 | } |
@@ -1420,7 +1420,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1420 | 1420 | ||
1421 | /* Also check that the parameter was not resolved from the kernel. */ | 1421 | /* Also check that the parameter was not resolved from the kernel. */ |
1422 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { | 1422 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { |
1423 | errorMsg("symbol for parameter %s not found\n", p); | 1423 | error_msg("symbol for parameter %s not found\n", p); |
1424 | return 0; | 1424 | return 0; |
1425 | } | 1425 | } |
1426 | 1426 | ||
@@ -1433,7 +1433,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1433 | str = alloca(strlen(q)); | 1433 | str = alloca(strlen(q)); |
1434 | for (r = str, q++; *q != '"'; ++q, ++r) { | 1434 | for (r = str, q++; *q != '"'; ++q, ++r) { |
1435 | if (*q == '\0') { | 1435 | if (*q == '\0') { |
1436 | errorMsg("improperly terminated string argument for %s\n", p); | 1436 | error_msg("improperly terminated string argument for %s\n", p); |
1437 | return 0; | 1437 | return 0; |
1438 | } else if (*q == '\\') | 1438 | } else if (*q == '\\') |
1439 | switch (*++q) { | 1439 | switch (*++q) { |
@@ -1562,7 +1562,7 @@ static int old_get_kernel_symbols(const char *m_name) | |||
1562 | 1562 | ||
1563 | nks = get_kernel_syms(NULL); | 1563 | nks = get_kernel_syms(NULL); |
1564 | if (nks < 0) { | 1564 | if (nks < 0) { |
1565 | errorMsg("get_kernel_syms: %s: %s\n", m_name, strerror(errno)); | 1565 | error_msg("get_kernel_syms: %s: %s\n", m_name, strerror(errno)); |
1566 | return 0; | 1566 | return 0; |
1567 | } | 1567 | } |
1568 | 1568 | ||
@@ -1743,7 +1743,7 @@ old_init_module(const char *m_name, struct obj_file *f, | |||
1743 | m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN | 1743 | m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN |
1744 | : 0), &routines, symtab); | 1744 | : 0), &routines, symtab); |
1745 | if (ret) | 1745 | if (ret) |
1746 | errorMsg("init_module: %s: %s\n", m_name, strerror(errno)); | 1746 | error_msg("init_module: %s: %s\n", m_name, strerror(errno)); |
1747 | 1747 | ||
1748 | free(image); | 1748 | free(image); |
1749 | free(symtab); | 1749 | free(symtab); |
@@ -1786,7 +1786,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1786 | p = get_modinfo_value(f, key); | 1786 | p = get_modinfo_value(f, key); |
1787 | key += 5; | 1787 | key += 5; |
1788 | if (p == NULL) { | 1788 | if (p == NULL) { |
1789 | errorMsg("invalid parameter %s\n", key); | 1789 | error_msg("invalid parameter %s\n", key); |
1790 | return 0; | 1790 | return 0; |
1791 | } | 1791 | } |
1792 | 1792 | ||
@@ -1794,7 +1794,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1794 | 1794 | ||
1795 | /* Also check that the parameter was not resolved from the kernel. */ | 1795 | /* Also check that the parameter was not resolved from the kernel. */ |
1796 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { | 1796 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { |
1797 | errorMsg("symbol for parameter %s not found\n", key); | 1797 | error_msg("symbol for parameter %s not found\n", key); |
1798 | return 0; | 1798 | return 0; |
1799 | } | 1799 | } |
1800 | 1800 | ||
@@ -1822,7 +1822,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1822 | str = alloca(strlen(q)); | 1822 | str = alloca(strlen(q)); |
1823 | for (r = str, q++; *q != '"'; ++q, ++r) { | 1823 | for (r = str, q++; *q != '"'; ++q, ++r) { |
1824 | if (*q == '\0') { | 1824 | if (*q == '\0') { |
1825 | errorMsg("improperly terminated string argument for %s\n", | 1825 | error_msg("improperly terminated string argument for %s\n", |
1826 | key); | 1826 | key); |
1827 | return 0; | 1827 | return 0; |
1828 | } else if (*q == '\\') | 1828 | } else if (*q == '\\') |
@@ -1916,7 +1916,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1916 | /* Get the size of each member */ | 1916 | /* Get the size of each member */ |
1917 | /* Probably we should do that outside the loop ? */ | 1917 | /* Probably we should do that outside the loop ? */ |
1918 | if (!isdigit(*(p + 1))) { | 1918 | if (!isdigit(*(p + 1))) { |
1919 | errorMsg("parameter type 'c' for %s must be followed by" | 1919 | error_msg("parameter type 'c' for %s must be followed by" |
1920 | " the maximum size\n", key); | 1920 | " the maximum size\n", key); |
1921 | return 0; | 1921 | return 0; |
1922 | } | 1922 | } |
@@ -1924,7 +1924,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1924 | 1924 | ||
1925 | /* Check length */ | 1925 | /* Check length */ |
1926 | if (strlen(str) >= charssize) { | 1926 | if (strlen(str) >= charssize) { |
1927 | errorMsg("string too long for %s (max %ld)\n", key, | 1927 | error_msg("string too long for %s (max %ld)\n", key, |
1928 | charssize - 1); | 1928 | charssize - 1); |
1929 | return 0; | 1929 | return 0; |
1930 | } | 1930 | } |
@@ -1953,7 +1953,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1953 | break; | 1953 | break; |
1954 | 1954 | ||
1955 | default: | 1955 | default: |
1956 | errorMsg("unknown parameter type '%c' for %s\n", *p, key); | 1956 | error_msg("unknown parameter type '%c' for %s\n", *p, key); |
1957 | return 0; | 1957 | return 0; |
1958 | } | 1958 | } |
1959 | } | 1959 | } |
@@ -1972,21 +1972,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1972 | 1972 | ||
1973 | case ',': | 1973 | case ',': |
1974 | if (++n > max) { | 1974 | if (++n > max) { |
1975 | errorMsg("too many values for %s (max %d)\n", key, max); | 1975 | error_msg("too many values for %s (max %d)\n", key, max); |
1976 | return 0; | 1976 | return 0; |
1977 | } | 1977 | } |
1978 | ++q; | 1978 | ++q; |
1979 | break; | 1979 | break; |
1980 | 1980 | ||
1981 | default: | 1981 | default: |
1982 | errorMsg("invalid argument syntax for %s\n", key); | 1982 | error_msg("invalid argument syntax for %s\n", key); |
1983 | return 0; | 1983 | return 0; |
1984 | } | 1984 | } |
1985 | } | 1985 | } |
1986 | 1986 | ||
1987 | end_of_arg: | 1987 | end_of_arg: |
1988 | if (n < min) { | 1988 | if (n < min) { |
1989 | errorMsg("too few values for %s (min %d)\n", key, min); | 1989 | error_msg("too few values for %s (min %d)\n", key, min); |
1990 | return 0; | 1990 | return 0; |
1991 | } | 1991 | } |
1992 | 1992 | ||
@@ -2055,7 +2055,7 @@ static int new_get_kernel_symbols(void) | |||
2055 | module_names = xrealloc(module_names, bufsize = ret); | 2055 | module_names = xrealloc(module_names, bufsize = ret); |
2056 | goto retry_modules_load; | 2056 | goto retry_modules_load; |
2057 | } | 2057 | } |
2058 | errorMsg("QM_MODULES: %s\n", strerror(errno)); | 2058 | error_msg("QM_MODULES: %s\n", strerror(errno)); |
2059 | return 0; | 2059 | return 0; |
2060 | } | 2060 | } |
2061 | 2061 | ||
@@ -2074,7 +2074,7 @@ static int new_get_kernel_symbols(void) | |||
2074 | /* The module was removed out from underneath us. */ | 2074 | /* The module was removed out from underneath us. */ |
2075 | continue; | 2075 | continue; |
2076 | } | 2076 | } |
2077 | errorMsg("query_module: QM_INFO: %s: %s\n", mn, strerror(errno)); | 2077 | error_msg("query_module: QM_INFO: %s: %s\n", mn, strerror(errno)); |
2078 | return 0; | 2078 | return 0; |
2079 | } | 2079 | } |
2080 | 2080 | ||
@@ -2089,7 +2089,7 @@ static int new_get_kernel_symbols(void) | |||
2089 | /* The module was removed out from underneath us. */ | 2089 | /* The module was removed out from underneath us. */ |
2090 | continue; | 2090 | continue; |
2091 | default: | 2091 | default: |
2092 | errorMsg("query_module: QM_SYMBOLS: %s: %s\n", mn, strerror(errno)); | 2092 | error_msg("query_module: QM_SYMBOLS: %s: %s\n", mn, strerror(errno)); |
2093 | return 0; | 2093 | return 0; |
2094 | } | 2094 | } |
2095 | } | 2095 | } |
@@ -2114,7 +2114,7 @@ static int new_get_kernel_symbols(void) | |||
2114 | syms = xrealloc(syms, bufsize = ret); | 2114 | syms = xrealloc(syms, bufsize = ret); |
2115 | goto retry_kern_sym_load; | 2115 | goto retry_kern_sym_load; |
2116 | } | 2116 | } |
2117 | errorMsg("kernel: QM_SYMBOLS: %s\n", strerror(errno)); | 2117 | error_msg("kernel: QM_SYMBOLS: %s\n", strerror(errno)); |
2118 | return 0; | 2118 | return 0; |
2119 | } | 2119 | } |
2120 | nksyms = nsyms = ret; | 2120 | nksyms = nsyms = ret; |
@@ -2295,7 +2295,7 @@ new_init_module(const char *m_name, struct obj_file *f, | |||
2295 | 2295 | ||
2296 | ret = new_sys_init_module(m_name, (struct new_module *) image); | 2296 | ret = new_sys_init_module(m_name, (struct new_module *) image); |
2297 | if (ret) | 2297 | if (ret) |
2298 | errorMsg("init_module: %s: %s\n", m_name, strerror(errno)); | 2298 | error_msg("init_module: %s: %s\n", m_name, strerror(errno)); |
2299 | 2299 | ||
2300 | free(image); | 2300 | free(image); |
2301 | 2301 | ||
@@ -2372,7 +2372,7 @@ int obj_check_undefineds(struct obj_file *f) | |||
2372 | sym->secidx = SHN_ABS; | 2372 | sym->secidx = SHN_ABS; |
2373 | sym->value = 0; | 2373 | sym->value = 0; |
2374 | } else { | 2374 | } else { |
2375 | errorMsg("unresolved symbol %s\n", sym->name); | 2375 | error_msg("unresolved symbol %s\n", sym->name); |
2376 | ret = 0; | 2376 | ret = 0; |
2377 | } | 2377 | } |
2378 | } | 2378 | } |
@@ -2599,11 +2599,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base) | |||
2599 | errmsg = "Unhandled relocation"; | 2599 | errmsg = "Unhandled relocation"; |
2600 | bad_reloc: | 2600 | bad_reloc: |
2601 | if (extsym) { | 2601 | if (extsym) { |
2602 | errorMsg("%s of type %ld for %s\n", errmsg, | 2602 | error_msg("%s of type %ld for %s\n", errmsg, |
2603 | (long) ELFW(R_TYPE) (rel->r_info), | 2603 | (long) ELFW(R_TYPE) (rel->r_info), |
2604 | strtab + extsym->st_name); | 2604 | strtab + extsym->st_name); |
2605 | } else { | 2605 | } else { |
2606 | errorMsg("%s of type %ld\n", errmsg, | 2606 | error_msg("%s of type %ld\n", errmsg, |
2607 | (long) ELFW(R_TYPE) (rel->r_info)); | 2607 | (long) ELFW(R_TYPE) (rel->r_info)); |
2608 | } | 2608 | } |
2609 | ret = 0; | 2609 | ret = 0; |
@@ -2680,7 +2680,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2680 | 2680 | ||
2681 | fseek(fp, 0, SEEK_SET); | 2681 | fseek(fp, 0, SEEK_SET); |
2682 | if (fread(&f->header, sizeof(f->header), 1, fp) != 1) { | 2682 | if (fread(&f->header, sizeof(f->header), 1, fp) != 1) { |
2683 | errorMsg("error reading ELF header: %s\n", strerror(errno)); | 2683 | error_msg("error reading ELF header: %s\n", strerror(errno)); |
2684 | return NULL; | 2684 | return NULL; |
2685 | } | 2685 | } |
2686 | 2686 | ||
@@ -2688,25 +2688,25 @@ struct obj_file *obj_load(FILE * fp) | |||
2688 | || f->header.e_ident[EI_MAG1] != ELFMAG1 | 2688 | || f->header.e_ident[EI_MAG1] != ELFMAG1 |
2689 | || f->header.e_ident[EI_MAG2] != ELFMAG2 | 2689 | || f->header.e_ident[EI_MAG2] != ELFMAG2 |
2690 | || f->header.e_ident[EI_MAG3] != ELFMAG3) { | 2690 | || f->header.e_ident[EI_MAG3] != ELFMAG3) { |
2691 | errorMsg("not an ELF file\n"); | 2691 | error_msg("not an ELF file\n"); |
2692 | return NULL; | 2692 | return NULL; |
2693 | } | 2693 | } |
2694 | if (f->header.e_ident[EI_CLASS] != ELFCLASSM | 2694 | if (f->header.e_ident[EI_CLASS] != ELFCLASSM |
2695 | || f->header.e_ident[EI_DATA] != ELFDATAM | 2695 | || f->header.e_ident[EI_DATA] != ELFDATAM |
2696 | || f->header.e_ident[EI_VERSION] != EV_CURRENT | 2696 | || f->header.e_ident[EI_VERSION] != EV_CURRENT |
2697 | || !MATCH_MACHINE(f->header.e_machine)) { | 2697 | || !MATCH_MACHINE(f->header.e_machine)) { |
2698 | errorMsg("ELF file not for this architecture\n"); | 2698 | error_msg("ELF file not for this architecture\n"); |
2699 | return NULL; | 2699 | return NULL; |
2700 | } | 2700 | } |
2701 | if (f->header.e_type != ET_REL) { | 2701 | if (f->header.e_type != ET_REL) { |
2702 | errorMsg("ELF file not a relocatable object\n"); | 2702 | error_msg("ELF file not a relocatable object\n"); |
2703 | return NULL; | 2703 | return NULL; |
2704 | } | 2704 | } |
2705 | 2705 | ||
2706 | /* Read the section headers. */ | 2706 | /* Read the section headers. */ |
2707 | 2707 | ||
2708 | if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { | 2708 | if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { |
2709 | errorMsg("section header size mismatch: %lu != %lu\n", | 2709 | error_msg("section header size mismatch: %lu != %lu\n", |
2710 | (unsigned long) f->header.e_shentsize, | 2710 | (unsigned long) f->header.e_shentsize, |
2711 | (unsigned long) sizeof(ElfW(Shdr))); | 2711 | (unsigned long) sizeof(ElfW(Shdr))); |
2712 | return NULL; | 2712 | return NULL; |
@@ -2719,7 +2719,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2719 | section_headers = alloca(sizeof(ElfW(Shdr)) * shnum); | 2719 | section_headers = alloca(sizeof(ElfW(Shdr)) * shnum); |
2720 | fseek(fp, f->header.e_shoff, SEEK_SET); | 2720 | fseek(fp, f->header.e_shoff, SEEK_SET); |
2721 | if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) { | 2721 | if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) { |
2722 | errorMsg("error reading ELF section headers: %s\n", strerror(errno)); | 2722 | error_msg("error reading ELF section headers: %s\n", strerror(errno)); |
2723 | return NULL; | 2723 | return NULL; |
2724 | } | 2724 | } |
2725 | 2725 | ||
@@ -2749,7 +2749,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2749 | sec->contents = xmalloc(sec->header.sh_size); | 2749 | sec->contents = xmalloc(sec->header.sh_size); |
2750 | fseek(fp, sec->header.sh_offset, SEEK_SET); | 2750 | fseek(fp, sec->header.sh_offset, SEEK_SET); |
2751 | if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) { | 2751 | if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) { |
2752 | errorMsg("error reading ELF section data: %s\n", strerror(errno)); | 2752 | error_msg("error reading ELF section data: %s\n", strerror(errno)); |
2753 | return NULL; | 2753 | return NULL; |
2754 | } | 2754 | } |
2755 | } else { | 2755 | } else { |
@@ -2759,11 +2759,11 @@ struct obj_file *obj_load(FILE * fp) | |||
2759 | 2759 | ||
2760 | #if SHT_RELM == SHT_REL | 2760 | #if SHT_RELM == SHT_REL |
2761 | case SHT_RELA: | 2761 | case SHT_RELA: |
2762 | errorMsg("RELA relocations not supported on this architecture\n"); | 2762 | error_msg("RELA relocations not supported on this architecture\n"); |
2763 | return NULL; | 2763 | return NULL; |
2764 | #else | 2764 | #else |
2765 | case SHT_REL: | 2765 | case SHT_REL: |
2766 | errorMsg("REL relocations not supported on this architecture\n"); | 2766 | error_msg("REL relocations not supported on this architecture\n"); |
2767 | return NULL; | 2767 | return NULL; |
2768 | #endif | 2768 | #endif |
2769 | 2769 | ||
@@ -2776,7 +2776,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2776 | break; | 2776 | break; |
2777 | } | 2777 | } |
2778 | 2778 | ||
2779 | errorMsg("can't handle sections of type %ld\n", | 2779 | error_msg("can't handle sections of type %ld\n", |
2780 | (long) sec->header.sh_type); | 2780 | (long) sec->header.sh_type); |
2781 | return NULL; | 2781 | return NULL; |
2782 | } | 2782 | } |
@@ -2805,7 +2805,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2805 | ElfW(Sym) * sym; | 2805 | ElfW(Sym) * sym; |
2806 | 2806 | ||
2807 | if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { | 2807 | if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { |
2808 | errorMsg("symbol size mismatch: %lu != %lu\n", | 2808 | error_msg("symbol size mismatch: %lu != %lu\n", |
2809 | (unsigned long) sec->header.sh_entsize, | 2809 | (unsigned long) sec->header.sh_entsize, |
2810 | (unsigned long) sizeof(ElfW(Sym))); | 2810 | (unsigned long) sizeof(ElfW(Sym))); |
2811 | return NULL; | 2811 | return NULL; |
@@ -2837,7 +2837,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2837 | 2837 | ||
2838 | case SHT_RELM: | 2838 | case SHT_RELM: |
2839 | if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { | 2839 | if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { |
2840 | errorMsg("relocation entry size mismatch: %lu != %lu\n", | 2840 | error_msg("relocation entry size mismatch: %lu != %lu\n", |
2841 | (unsigned long) sec->header.sh_entsize, | 2841 | (unsigned long) sec->header.sh_entsize, |
2842 | (unsigned long) sizeof(ElfW(RelM))); | 2842 | (unsigned long) sizeof(ElfW(RelM))); |
2843 | return NULL; | 2843 | return NULL; |
@@ -2937,17 +2937,17 @@ extern int insmod_main( int argc, char **argv) | |||
2937 | /* Get a filedesc for the module */ | 2937 | /* Get a filedesc for the module */ |
2938 | if ((fp = fopen(*argv, "r")) == NULL) { | 2938 | if ((fp = fopen(*argv, "r")) == NULL) { |
2939 | /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */ | 2939 | /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */ |
2940 | if (recursiveAction(_PATH_MODULES, TRUE, FALSE, FALSE, | 2940 | if (recursive_action(_PATH_MODULES, TRUE, FALSE, FALSE, |
2941 | findNamedModule, 0, m_fullName) == FALSE) | 2941 | findNamedModule, 0, m_fullName) == FALSE) |
2942 | { | 2942 | { |
2943 | if (m_filename[0] == '\0' | 2943 | if (m_filename[0] == '\0' |
2944 | || ((fp = fopen(m_filename, "r")) == NULL)) | 2944 | || ((fp = fopen(m_filename, "r")) == NULL)) |
2945 | { | 2945 | { |
2946 | errorMsg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); | 2946 | error_msg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); |
2947 | return EXIT_FAILURE; | 2947 | return EXIT_FAILURE; |
2948 | } | 2948 | } |
2949 | } else | 2949 | } else |
2950 | fatalError("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); | 2950 | error_msg_and_die("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); |
2951 | } else | 2951 | } else |
2952 | memcpy(m_filename, *argv, strlen(*argv)); | 2952 | memcpy(m_filename, *argv, strlen(*argv)); |
2953 | 2953 | ||
@@ -2971,7 +2971,7 @@ extern int insmod_main( int argc, char **argv) | |||
2971 | } else { | 2971 | } else { |
2972 | m_version = old_get_module_version(f, m_strversion); | 2972 | m_version = old_get_module_version(f, m_strversion); |
2973 | if (m_version == -1) { | 2973 | if (m_version == -1) { |
2974 | errorMsg("couldn't find the kernel version the module was " | 2974 | error_msg("couldn't find the kernel version the module was " |
2975 | "compiled for\n"); | 2975 | "compiled for\n"); |
2976 | goto out; | 2976 | goto out; |
2977 | } | 2977 | } |
@@ -2979,12 +2979,12 @@ extern int insmod_main( int argc, char **argv) | |||
2979 | 2979 | ||
2980 | if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) { | 2980 | if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) { |
2981 | if (flag_force_load) { | 2981 | if (flag_force_load) { |
2982 | errorMsg("Warning: kernel-module version mismatch\n" | 2982 | error_msg("Warning: kernel-module version mismatch\n" |
2983 | "\t%s was compiled for kernel version %s\n" | 2983 | "\t%s was compiled for kernel version %s\n" |
2984 | "\twhile this kernel is version %s\n", | 2984 | "\twhile this kernel is version %s\n", |
2985 | m_filename, m_strversion, k_strversion); | 2985 | m_filename, m_strversion, k_strversion); |
2986 | } else { | 2986 | } else { |
2987 | errorMsg("kernel-module version mismatch\n" | 2987 | error_msg("kernel-module version mismatch\n" |
2988 | "\t%s was compiled for kernel version %s\n" | 2988 | "\t%s was compiled for kernel version %s\n" |
2989 | "\twhile this kernel is version %s.\n", | 2989 | "\twhile this kernel is version %s.\n", |
2990 | m_filename, m_strversion, k_strversion); | 2990 | m_filename, m_strversion, k_strversion); |
@@ -3002,7 +3002,7 @@ extern int insmod_main( int argc, char **argv) | |||
3002 | goto out; | 3002 | goto out; |
3003 | k_crcs = new_is_kernel_checksummed(); | 3003 | k_crcs = new_is_kernel_checksummed(); |
3004 | #else | 3004 | #else |
3005 | errorMsg("Not configured to support new kernels\n"); | 3005 | error_msg("Not configured to support new kernels\n"); |
3006 | goto out; | 3006 | goto out; |
3007 | #endif | 3007 | #endif |
3008 | } else { | 3008 | } else { |
@@ -3011,7 +3011,7 @@ extern int insmod_main( int argc, char **argv) | |||
3011 | goto out; | 3011 | goto out; |
3012 | k_crcs = old_is_kernel_checksummed(); | 3012 | k_crcs = old_is_kernel_checksummed(); |
3013 | #else | 3013 | #else |
3014 | errorMsg("Not configured to support old kernels\n"); | 3014 | error_msg("Not configured to support old kernels\n"); |
3015 | goto out; | 3015 | goto out; |
3016 | #endif | 3016 | #endif |
3017 | } | 3017 | } |
@@ -3068,14 +3068,14 @@ extern int insmod_main( int argc, char **argv) | |||
3068 | case 0: | 3068 | case 0: |
3069 | break; | 3069 | break; |
3070 | case EEXIST: | 3070 | case EEXIST: |
3071 | errorMsg("A module named %s already exists\n", m_name); | 3071 | error_msg("A module named %s already exists\n", m_name); |
3072 | goto out; | 3072 | goto out; |
3073 | case ENOMEM: | 3073 | case ENOMEM: |
3074 | errorMsg("Can't allocate kernel memory for module; needed %lu bytes\n", | 3074 | error_msg("Can't allocate kernel memory for module; needed %lu bytes\n", |
3075 | m_size); | 3075 | m_size); |
3076 | goto out; | 3076 | goto out; |
3077 | default: | 3077 | default: |
3078 | errorMsg("create_module: %s: %s\n", m_name, strerror(errno)); | 3078 | error_msg("create_module: %s: %s\n", m_name, strerror(errno)); |
3079 | goto out; | 3079 | goto out; |
3080 | } | 3080 | } |
3081 | 3081 | ||
@@ -204,10 +204,10 @@ extern int kill_main(int argc, char **argv) | |||
204 | int pid; | 204 | int pid; |
205 | 205 | ||
206 | if (!isdigit(**argv)) | 206 | if (!isdigit(**argv)) |
207 | fatalError( "Bad PID: %s\n", strerror(errno)); | 207 | error_msg_and_die( "Bad PID: %s\n", strerror(errno)); |
208 | pid = strtol(*argv, NULL, 0); | 208 | pid = strtol(*argv, NULL, 0); |
209 | if (kill(pid, sig) != 0) | 209 | if (kill(pid, sig) != 0) |
210 | fatalError( "Could not kill pid '%d': %s\n", pid, strerror(errno)); | 210 | error_msg_and_die( "Could not kill pid '%d': %s\n", pid, strerror(errno)); |
211 | argv++; | 211 | argv++; |
212 | } | 212 | } |
213 | } | 213 | } |
@@ -219,20 +219,20 @@ extern int kill_main(int argc, char **argv) | |||
219 | while (--argc >= 0) { | 219 | while (--argc >= 0) { |
220 | pid_t* pidList; | 220 | pid_t* pidList; |
221 | 221 | ||
222 | pidList = findPidByName( *argv); | 222 | pidList = find_pid_by_name( *argv); |
223 | if (!pidList) { | 223 | if (!pidList) { |
224 | all_found = FALSE; | 224 | all_found = FALSE; |
225 | errorMsg( "%s: no process killed\n", *argv); | 225 | error_msg( "%s: no process killed\n", *argv); |
226 | } | 226 | } |
227 | 227 | ||
228 | for(; pidList && *pidList!=0; pidList++) { | 228 | for(; pidList && *pidList!=0; pidList++) { |
229 | if (*pidList==myPid) | 229 | if (*pidList==myPid) |
230 | continue; | 230 | continue; |
231 | if (kill(*pidList, sig) != 0) | 231 | if (kill(*pidList, sig) != 0) |
232 | fatalError( "Could not kill pid '%d': %s\n", *pidList, strerror(errno)); | 232 | error_msg_and_die( "Could not kill pid '%d': %s\n", *pidList, strerror(errno)); |
233 | } | 233 | } |
234 | /* Note that we don't bother to free the memory | 234 | /* Note that we don't bother to free the memory |
235 | * allocated in findPidByName(). It will be freed | 235 | * allocated in find_pid_by_name(). It will be freed |
236 | * upon exit, so we can save a byte or two */ | 236 | * upon exit, so we can save a byte or two */ |
237 | argv++; | 237 | argv++; |
238 | } | 238 | } |
@@ -245,5 +245,5 @@ extern int kill_main(int argc, char **argv) | |||
245 | 245 | ||
246 | 246 | ||
247 | end: | 247 | end: |
248 | fatalError( "bad signal name: %s\n", *argv); | 248 | error_msg_and_die( "bad signal name: %s\n", *argv); |
249 | } | 249 | } |
@@ -250,7 +250,7 @@ static int builtin_exec(struct job *cmd, struct jobSet *junk) | |||
250 | { | 250 | { |
251 | cmd->progs[0].argv++; | 251 | cmd->progs[0].argv++; |
252 | execvp(cmd->progs[0].argv[0], cmd->progs[0].argv); | 252 | execvp(cmd->progs[0].argv[0], cmd->progs[0].argv); |
253 | fatalError("Exec to %s failed: %s\n", cmd->progs[0].argv[0], | 253 | error_msg_and_die("Exec to %s failed: %s\n", cmd->progs[0].argv[0], |
254 | strerror(errno)); | 254 | strerror(errno)); |
255 | } | 255 | } |
256 | return EXIT_SUCCESS; | 256 | return EXIT_SUCCESS; |
@@ -273,12 +273,12 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) | |||
273 | 273 | ||
274 | if (!jobList->head) { | 274 | if (!jobList->head) { |
275 | if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { | 275 | if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { |
276 | errorMsg("%s: exactly one argument is expected\n", | 276 | error_msg("%s: exactly one argument is expected\n", |
277 | cmd->progs[0].argv[0]); | 277 | cmd->progs[0].argv[0]); |
278 | return EXIT_FAILURE; | 278 | return EXIT_FAILURE; |
279 | } | 279 | } |
280 | if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { | 280 | if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { |
281 | errorMsg("%s: bad argument '%s'\n", | 281 | error_msg("%s: bad argument '%s'\n", |
282 | cmd->progs[0].argv[0], cmd->progs[0].argv[1]); | 282 | cmd->progs[0].argv[0], cmd->progs[0].argv[1]); |
283 | return EXIT_FAILURE; | 283 | return EXIT_FAILURE; |
284 | for (job = jobList->head; job; job = job->next) { | 284 | for (job = jobList->head; job; job = job->next) { |
@@ -292,7 +292,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) | |||
292 | } | 292 | } |
293 | 293 | ||
294 | if (!job) { | 294 | if (!job) { |
295 | errorMsg("%s: unknown job %d\n", | 295 | error_msg("%s: unknown job %d\n", |
296 | cmd->progs[0].argv[0], jobNum); | 296 | cmd->progs[0].argv[0], jobNum); |
297 | return EXIT_FAILURE; | 297 | return EXIT_FAILURE; |
298 | } | 298 | } |
@@ -444,7 +444,7 @@ static int builtin_then(struct job *cmd, struct jobSet *junk) | |||
444 | char* charptr1=cmd->text+5; /* skip over the leading 'then ' */ | 444 | char* charptr1=cmd->text+5; /* skip over the leading 'then ' */ |
445 | 445 | ||
446 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { | 446 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { |
447 | errorMsg("unexpected token `then'\n"); | 447 | error_msg("unexpected token `then'\n"); |
448 | return EXIT_FAILURE; | 448 | return EXIT_FAILURE; |
449 | } | 449 | } |
450 | /* If the if result was FALSE, skip the 'then' stuff */ | 450 | /* If the if result was FALSE, skip the 'then' stuff */ |
@@ -471,7 +471,7 @@ static int builtin_else(struct job *cmd, struct jobSet *junk) | |||
471 | char* charptr1=cmd->text+5; /* skip over the leading 'else ' */ | 471 | char* charptr1=cmd->text+5; /* skip over the leading 'else ' */ |
472 | 472 | ||
473 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { | 473 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { |
474 | errorMsg("unexpected token `else'\n"); | 474 | error_msg("unexpected token `else'\n"); |
475 | return EXIT_FAILURE; | 475 | return EXIT_FAILURE; |
476 | } | 476 | } |
477 | /* If the if result was TRUE, skip the 'else' stuff */ | 477 | /* If the if result was TRUE, skip the 'else' stuff */ |
@@ -495,7 +495,7 @@ static int builtin_else(struct job *cmd, struct jobSet *junk) | |||
495 | static int builtin_fi(struct job *cmd, struct jobSet *junk) | 495 | static int builtin_fi(struct job *cmd, struct jobSet *junk) |
496 | { | 496 | { |
497 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { | 497 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { |
498 | errorMsg("unexpected token `fi'\n"); | 498 | error_msg("unexpected token `fi'\n"); |
499 | return EXIT_FAILURE; | 499 | return EXIT_FAILURE; |
500 | } | 500 | } |
501 | /* Clear out the if and then context bits */ | 501 | /* Clear out the if and then context bits */ |
@@ -646,7 +646,7 @@ static int setupRedirections(struct childProgram *prog) | |||
646 | if (openfd < 0) { | 646 | if (openfd < 0) { |
647 | /* this could get lost if stderr has been redirected, but | 647 | /* this could get lost if stderr has been redirected, but |
648 | bash and ash both lose it as well (though zsh doesn't!) */ | 648 | bash and ash both lose it as well (though zsh doesn't!) */ |
649 | errorMsg("error opening %s: %s\n", redir->filename, | 649 | error_msg("error opening %s: %s\n", redir->filename, |
650 | strerror(errno)); | 650 | strerror(errno)); |
651 | return 1; | 651 | return 1; |
652 | } | 652 | } |
@@ -820,7 +820,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr, | |||
820 | if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){ | 820 | if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){ |
821 | rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->globResult); | 821 | rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->globResult); |
822 | if (rc == GLOB_NOSPACE) { | 822 | if (rc == GLOB_NOSPACE) { |
823 | errorMsg("out of space during glob operation\n"); | 823 | error_msg("out of space during glob operation\n"); |
824 | return; | 824 | return; |
825 | } else if (rc == GLOB_NOMATCH || | 825 | } else if (rc == GLOB_NOMATCH || |
826 | (!rc && (prog->globResult.gl_pathc - i) == 1 && | 826 | (!rc && (prog->globResult.gl_pathc - i) == 1 && |
@@ -927,7 +927,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
927 | if (*src == '\\') { | 927 | if (*src == '\\') { |
928 | src++; | 928 | src++; |
929 | if (!*src) { | 929 | if (!*src) { |
930 | errorMsg("character expected after \\\n"); | 930 | error_msg("character expected after \\\n"); |
931 | freeJob(job); | 931 | freeJob(job); |
932 | return 1; | 932 | return 1; |
933 | } | 933 | } |
@@ -1009,7 +1009,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1009 | chptr++; | 1009 | chptr++; |
1010 | 1010 | ||
1011 | if (!*chptr) { | 1011 | if (!*chptr) { |
1012 | errorMsg("file name expected after %c\n", *src); | 1012 | error_msg("file name expected after %c\n", *src); |
1013 | freeJob(job); | 1013 | freeJob(job); |
1014 | job->numProgs=0; | 1014 | job->numProgs=0; |
1015 | return 1; | 1015 | return 1; |
@@ -1028,7 +1028,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1028 | if (*prog->argv[argc_l]) | 1028 | if (*prog->argv[argc_l]) |
1029 | argc_l++; | 1029 | argc_l++; |
1030 | if (!argc_l) { | 1030 | if (!argc_l) { |
1031 | errorMsg("empty command in pipe\n"); | 1031 | error_msg("empty command in pipe\n"); |
1032 | freeJob(job); | 1032 | freeJob(job); |
1033 | job->numProgs=0; | 1033 | job->numProgs=0; |
1034 | return 1; | 1034 | return 1; |
@@ -1055,7 +1055,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1055 | src++; | 1055 | src++; |
1056 | 1056 | ||
1057 | if (!*src) { | 1057 | if (!*src) { |
1058 | errorMsg("empty command in pipe\n"); | 1058 | error_msg("empty command in pipe\n"); |
1059 | freeJob(job); | 1059 | freeJob(job); |
1060 | job->numProgs=0; | 1060 | job->numProgs=0; |
1061 | return 1; | 1061 | return 1; |
@@ -1114,7 +1114,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1114 | * command line, making extra room as needed */ | 1114 | * command line, making extra room as needed */ |
1115 | --src; | 1115 | --src; |
1116 | charptr1 = xmalloc(BUFSIZ); | 1116 | charptr1 = xmalloc(BUFSIZ); |
1117 | while ( (size=fullRead(pipefd[0], charptr1, BUFSIZ-1)) >0) { | 1117 | while ( (size=full_read(pipefd[0], charptr1, BUFSIZ-1)) >0) { |
1118 | int newSize=src - *commandPtr + size + 1 + strlen(charptr2); | 1118 | int newSize=src - *commandPtr + size + 1 + strlen(charptr2); |
1119 | if (newSize > BUFSIZ) { | 1119 | if (newSize > BUFSIZ) { |
1120 | *commandPtr=xrealloc(*commandPtr, src - *commandPtr + | 1120 | *commandPtr=xrealloc(*commandPtr, src - *commandPtr + |
@@ -1145,7 +1145,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1145 | case '\\': | 1145 | case '\\': |
1146 | src++; | 1146 | src++; |
1147 | if (!*src) { | 1147 | if (!*src) { |
1148 | errorMsg("character expected after \\\n"); | 1148 | error_msg("character expected after \\\n"); |
1149 | freeJob(job); | 1149 | freeJob(job); |
1150 | return 1; | 1150 | return 1; |
1151 | } | 1151 | } |
@@ -1291,7 +1291,7 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||
1291 | #endif | 1291 | #endif |
1292 | 1292 | ||
1293 | execvp(newJob->progs[i].argv[0], newJob->progs[i].argv); | 1293 | execvp(newJob->progs[i].argv[0], newJob->progs[i].argv); |
1294 | fatalError("%s: %s\n", newJob->progs[i].argv[0], | 1294 | error_msg_and_die("%s: %s\n", newJob->progs[i].argv[0], |
1295 | strerror(errno)); | 1295 | strerror(errno)); |
1296 | } | 1296 | } |
1297 | if (outPipe[1]!=-1) { | 1297 | if (outPipe[1]!=-1) { |
@@ -1495,7 +1495,7 @@ int shell_main(int argc_l, char **argv_l) | |||
1495 | case 'c': | 1495 | case 'c': |
1496 | input = NULL; | 1496 | input = NULL; |
1497 | if (local_pending_command != 0) | 1497 | if (local_pending_command != 0) |
1498 | fatalError("multiple -c arguments\n"); | 1498 | error_msg_and_die("multiple -c arguments\n"); |
1499 | local_pending_command = xstrdup(argv[optind]); | 1499 | local_pending_command = xstrdup(argv[optind]); |
1500 | optind++; | 1500 | optind++; |
1501 | argv = argv+optind; | 1501 | argv = argv+optind; |
@@ -55,9 +55,9 @@ static int fs_link(const char *link_DestName, const char *link_SrcName, const in | |||
55 | strcpy(srcName, link_SrcName); | 55 | strcpy(srcName, link_SrcName); |
56 | 56 | ||
57 | if (flag&LN_NODEREFERENCE) | 57 | if (flag&LN_NODEREFERENCE) |
58 | srcIsDir = isDirectory(srcName, TRUE, NULL); | 58 | srcIsDir = is_directory(srcName, TRUE, NULL); |
59 | else | 59 | else |
60 | srcIsDir = isDirectory(srcName, FALSE, NULL); | 60 | srcIsDir = is_directory(srcName, FALSE, NULL); |
61 | 61 | ||
62 | if ((srcIsDir==TRUE)&&((flag&LN_NODEREFERENCE)==0)) { | 62 | if ((srcIsDir==TRUE)&&((flag&LN_NODEREFERENCE)==0)) { |
63 | strcat(srcName, "/"); | 63 | strcat(srcName, "/"); |
@@ -39,12 +39,12 @@ int loadacm_main(int argc, char **argv) | |||
39 | 39 | ||
40 | fd = open("/dev/tty", O_RDWR); | 40 | fd = open("/dev/tty", O_RDWR); |
41 | if (fd < 0) { | 41 | if (fd < 0) { |
42 | errorMsg("Error opening /dev/tty1: %s\n", strerror(errno)); | 42 | error_msg("Error opening /dev/tty1: %s\n", strerror(errno)); |
43 | return EXIT_FAILURE; | 43 | return EXIT_FAILURE; |
44 | } | 44 | } |
45 | 45 | ||
46 | if (screen_map_load(fd, stdin)) { | 46 | if (screen_map_load(fd, stdin)) { |
47 | errorMsg("Error loading acm: %s\n", strerror(errno)); | 47 | error_msg("Error loading acm: %s\n", strerror(errno)); |
48 | return EXIT_FAILURE; | 48 | return EXIT_FAILURE; |
49 | } | 49 | } |
50 | 50 | ||
@@ -72,7 +72,7 @@ int screen_map_load(int fd, FILE * fp) | |||
72 | if (parse_failed) { | 72 | if (parse_failed) { |
73 | if (-1 == fseek(fp, 0, SEEK_SET)) { | 73 | if (-1 == fseek(fp, 0, SEEK_SET)) { |
74 | if (errno == ESPIPE) | 74 | if (errno == ESPIPE) |
75 | errorMsg("16bit screen-map MUST be a regular file.\n"), | 75 | error_msg("16bit screen-map MUST be a regular file.\n"), |
76 | exit(1); | 76 | exit(1); |
77 | else | 77 | else |
78 | perror("fseek failed reading binary 16bit screen-map"), | 78 | perror("fseek failed reading binary 16bit screen-map"), |
@@ -83,7 +83,7 @@ int screen_map_load(int fd, FILE * fp) | |||
83 | perror("Cannot read [new] map from file"), exit(1); | 83 | perror("Cannot read [new] map from file"), exit(1); |
84 | #if 0 | 84 | #if 0 |
85 | else | 85 | else |
86 | errorMsg("Input screen-map is binary.\n"); | 86 | error_msg("Input screen-map is binary.\n"); |
87 | #endif | 87 | #endif |
88 | } | 88 | } |
89 | 89 | ||
@@ -100,7 +100,7 @@ int screen_map_load(int fd, FILE * fp) | |||
100 | /* rewind... */ | 100 | /* rewind... */ |
101 | if (-1 == fseek(fp, 0, SEEK_SET)) { | 101 | if (-1 == fseek(fp, 0, SEEK_SET)) { |
102 | if (errno == ESPIPE) | 102 | if (errno == ESPIPE) |
103 | errorMsg("Assuming 8bit screen-map - MUST be a regular file.\n"), | 103 | error_msg("Assuming 8bit screen-map - MUST be a regular file.\n"), |
104 | exit(1); | 104 | exit(1); |
105 | else | 105 | else |
106 | perror("fseek failed assuming 8bit screen-map"), exit(1); | 106 | perror("fseek failed assuming 8bit screen-map"), exit(1); |
@@ -113,7 +113,7 @@ int screen_map_load(int fd, FILE * fp) | |||
113 | if (-1 == fseek(fp, 0, SEEK_SET)) { | 113 | if (-1 == fseek(fp, 0, SEEK_SET)) { |
114 | if (errno == ESPIPE) | 114 | if (errno == ESPIPE) |
115 | /* should not - it succedeed above */ | 115 | /* should not - it succedeed above */ |
116 | errorMsg("fseek() returned ESPIPE !\n"), | 116 | error_msg("fseek() returned ESPIPE !\n"), |
117 | exit(1); | 117 | exit(1); |
118 | else | 118 | else |
119 | perror("fseek for binary 8bit screen-map"), exit(1); | 119 | perror("fseek for binary 8bit screen-map"), exit(1); |
@@ -123,7 +123,7 @@ int screen_map_load(int fd, FILE * fp) | |||
123 | perror("Cannot read [old] map from file"), exit(1); | 123 | perror("Cannot read [old] map from file"), exit(1); |
124 | #if 0 | 124 | #if 0 |
125 | else | 125 | else |
126 | errorMsg("Input screen-map is binary.\n"); | 126 | error_msg("Input screen-map is binary.\n"); |
127 | #endif | 127 | #endif |
128 | } | 128 | } |
129 | 129 | ||
@@ -132,7 +132,7 @@ int screen_map_load(int fd, FILE * fp) | |||
132 | else | 132 | else |
133 | return 0; | 133 | return 0; |
134 | } | 134 | } |
135 | errorMsg("Error parsing symbolic map\n"); | 135 | error_msg("Error parsing symbolic map\n"); |
136 | return(1); | 136 | return(1); |
137 | } | 137 | } |
138 | 138 | ||
diff --git a/loadfont.c b/loadfont.c index f69f52fd8..13a196fb0 100644 --- a/loadfont.c +++ b/loadfont.c | |||
@@ -48,7 +48,7 @@ extern int loadfont_main(int argc, char **argv) | |||
48 | 48 | ||
49 | fd = open("/dev/tty0", O_RDWR); | 49 | fd = open("/dev/tty0", O_RDWR); |
50 | if (fd < 0) | 50 | if (fd < 0) |
51 | fatalPerror("Error opening /dev/tty0"); | 51 | perror_msg_and_die("Error opening /dev/tty0"); |
52 | loadnewfont(fd); | 52 | loadnewfont(fd); |
53 | 53 | ||
54 | return EXIT_SUCCESS; | 54 | return EXIT_SUCCESS; |
@@ -62,7 +62,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize) | |||
62 | memset(buf, 0, sizeof(buf)); | 62 | memset(buf, 0, sizeof(buf)); |
63 | 63 | ||
64 | if (unit < 1 || unit > 32) | 64 | if (unit < 1 || unit > 32) |
65 | fatalError("Bad character size %d\n", unit); | 65 | error_msg_and_die("Bad character size %d\n", unit); |
66 | 66 | ||
67 | for (i = 0; i < fontsize; i++) | 67 | for (i = 0; i < fontsize; i++) |
68 | memcpy(buf + (32 * i), inbuf + (unit * i), unit); | 68 | memcpy(buf + (32 * i), inbuf + (unit * i), unit); |
@@ -77,11 +77,11 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize) | |||
77 | 77 | ||
78 | if (ioctl(fd, PIO_FONTX, &cfd) == 0) | 78 | if (ioctl(fd, PIO_FONTX, &cfd) == 0) |
79 | return; /* success */ | 79 | return; /* success */ |
80 | perrorMsg("PIO_FONTX ioctl error (trying PIO_FONT)"); | 80 | perror_msg("PIO_FONTX ioctl error (trying PIO_FONT)"); |
81 | } | 81 | } |
82 | #endif | 82 | #endif |
83 | if (ioctl(fd, PIO_FONT, buf)) | 83 | if (ioctl(fd, PIO_FONT, buf)) |
84 | fatalPerror("PIO_FONT ioctl error"); | 84 | perror_msg_and_die("PIO_FONT ioctl error"); |
85 | } | 85 | } |
86 | 86 | ||
87 | static void | 87 | static void |
@@ -119,11 +119,11 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize) | |||
119 | if (ioctl(fd, PIO_UNIMAPCLR, &advice)) { | 119 | if (ioctl(fd, PIO_UNIMAPCLR, &advice)) { |
120 | #ifdef ENOIOCTLCMD | 120 | #ifdef ENOIOCTLCMD |
121 | if (errno == ENOIOCTLCMD) { | 121 | if (errno == ENOIOCTLCMD) { |
122 | errorMsg("It seems this kernel is older than 1.1.92\n"); | 122 | error_msg("It seems this kernel is older than 1.1.92\n"); |
123 | fatalError("No Unicode mapping table loaded.\n"); | 123 | error_msg_and_die("No Unicode mapping table loaded.\n"); |
124 | } else | 124 | } else |
125 | #endif | 125 | #endif |
126 | fatalPerror("PIO_UNIMAPCLR"); | 126 | perror_msg_and_die("PIO_UNIMAPCLR"); |
127 | } | 127 | } |
128 | ud.entry_ct = ct; | 128 | ud.entry_ct = ct; |
129 | ud.entries = up; | 129 | ud.entries = up; |
@@ -133,7 +133,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize) | |||
133 | /* change advice parameters */ | 133 | /* change advice parameters */ |
134 | } | 134 | } |
135 | #endif | 135 | #endif |
136 | fatalPerror("PIO_UNIMAP"); | 136 | perror_msg_and_die("PIO_UNIMAP"); |
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
@@ -150,13 +150,13 @@ static void loadnewfont(int fd) | |||
150 | */ | 150 | */ |
151 | inputlth = fread(inbuf, 1, sizeof(inbuf), stdin); | 151 | inputlth = fread(inbuf, 1, sizeof(inbuf), stdin); |
152 | if (ferror(stdin)) | 152 | if (ferror(stdin)) |
153 | fatalPerror("Error reading input font"); | 153 | perror_msg_and_die("Error reading input font"); |
154 | /* use malloc/realloc in case of giant files; | 154 | /* use malloc/realloc in case of giant files; |
155 | maybe these do not occur: 16kB for the font, | 155 | maybe these do not occur: 16kB for the font, |
156 | and 16kB for the map leaves 32 unicode values | 156 | and 16kB for the map leaves 32 unicode values |
157 | for each font position */ | 157 | for each font position */ |
158 | if (!feof(stdin)) | 158 | if (!feof(stdin)) |
159 | fatalPerror("Font too large"); | 159 | perror_msg_and_die("Font too large"); |
160 | 160 | ||
161 | /* test for psf first */ | 161 | /* test for psf first */ |
162 | { | 162 | { |
@@ -174,11 +174,11 @@ static void loadnewfont(int fd) | |||
174 | goto no_psf; | 174 | goto no_psf; |
175 | 175 | ||
176 | if (psfhdr.mode > PSF_MAXMODE) | 176 | if (psfhdr.mode > PSF_MAXMODE) |
177 | fatalError("Unsupported psf file mode\n"); | 177 | error_msg_and_die("Unsupported psf file mode\n"); |
178 | fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256); | 178 | fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256); |
179 | #if !defined( PIO_FONTX ) || defined( __sparc__ ) | 179 | #if !defined( PIO_FONTX ) || defined( __sparc__ ) |
180 | if (fontsize != 256) | 180 | if (fontsize != 256) |
181 | fatalError("Only fontsize 256 supported\n"); | 181 | error_msg_and_die("Only fontsize 256 supported\n"); |
182 | #endif | 182 | #endif |
183 | hastable = (psfhdr.mode & PSF_MODEHASTAB); | 183 | hastable = (psfhdr.mode & PSF_MODEHASTAB); |
184 | unit = psfhdr.charsize; | 184 | unit = psfhdr.charsize; |
@@ -186,7 +186,7 @@ static void loadnewfont(int fd) | |||
186 | 186 | ||
187 | head = head0 + fontsize * unit; | 187 | head = head0 + fontsize * unit; |
188 | if (head > inputlth || (!hastable && head != inputlth)) | 188 | if (head > inputlth || (!hastable && head != inputlth)) |
189 | fatalError("Input file: bad length\n"); | 189 | error_msg_and_die("Input file: bad length\n"); |
190 | do_loadfont(fd, inbuf + head0, unit, fontsize); | 190 | do_loadfont(fd, inbuf + head0, unit, fontsize); |
191 | if (hastable) | 191 | if (hastable) |
192 | do_loadtable(fd, inbuf + head, inputlth - head, fontsize); | 192 | do_loadtable(fd, inbuf + head, inputlth - head, fontsize); |
@@ -201,7 +201,7 @@ static void loadnewfont(int fd) | |||
201 | } else { | 201 | } else { |
202 | /* bare font */ | 202 | /* bare font */ |
203 | if (inputlth & 0377) | 203 | if (inputlth & 0377) |
204 | fatalError("Bad input file size\n"); | 204 | error_msg_and_die("Bad input file size\n"); |
205 | offset = 0; | 205 | offset = 0; |
206 | unit = inputlth / 256; | 206 | unit = inputlth / 256; |
207 | } | 207 | } |
diff --git a/loadkmap.c b/loadkmap.c index 7dfa670f4..fc2439864 100644 --- a/loadkmap.c +++ b/loadkmap.c | |||
@@ -52,14 +52,14 @@ int loadkmap_main(int argc, char **argv) | |||
52 | 52 | ||
53 | fd = open("/dev/tty0", O_RDWR); | 53 | fd = open("/dev/tty0", O_RDWR); |
54 | if (fd < 0) | 54 | if (fd < 0) |
55 | fatalPerror("Error opening /dev/tty0"); | 55 | perror_msg_and_die("Error opening /dev/tty0"); |
56 | 56 | ||
57 | read(0, buff, 7); | 57 | read(0, buff, 7); |
58 | if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7)) | 58 | if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7)) |
59 | fatalError("This is not a valid binary keymap.\n"); | 59 | error_msg_and_die("This is not a valid binary keymap.\n"); |
60 | 60 | ||
61 | if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) | 61 | if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) |
62 | fatalPerror("Error reading keymap flags"); | 62 | perror_msg_and_die("Error reading keymap flags"); |
63 | 63 | ||
64 | ibuff = (u_short *) xmalloc(ibuffsz); | 64 | ibuff = (u_short *) xmalloc(ibuffsz); |
65 | 65 | ||
@@ -68,7 +68,7 @@ int loadkmap_main(int argc, char **argv) | |||
68 | pos = 0; | 68 | pos = 0; |
69 | while (pos < ibuffsz) { | 69 | while (pos < ibuffsz) { |
70 | if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) < 0) | 70 | if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) < 0) |
71 | fatalPerror("Error reading keymap"); | 71 | perror_msg_and_die("Error reading keymap"); |
72 | pos += readsz; | 72 | pos += readsz; |
73 | } | 73 | } |
74 | for (j = 0; j < NR_KEYS; j++) { | 74 | for (j = 0; j < NR_KEYS; j++) { |
@@ -85,14 +85,14 @@ static int pencode(char *s) | |||
85 | *s = '\0'; | 85 | *s = '\0'; |
86 | fac = decode(save, facilitynames); | 86 | fac = decode(save, facilitynames); |
87 | if (fac < 0) | 87 | if (fac < 0) |
88 | fatalError("unknown facility name: %s\n", save); | 88 | error_msg_and_die("unknown facility name: %s\n", save); |
89 | *s++ = '.'; | 89 | *s++ = '.'; |
90 | } else { | 90 | } else { |
91 | s = save; | 91 | s = save; |
92 | } | 92 | } |
93 | lev = decode(s, prioritynames); | 93 | lev = decode(s, prioritynames); |
94 | if (lev < 0) | 94 | if (lev < 0) |
95 | fatalError("unknown priority name: %s\n", save); | 95 | error_msg_and_die("unknown priority name: %s\n", save); |
96 | return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK)); | 96 | return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK)); |
97 | } | 97 | } |
98 | 98 | ||
@@ -152,7 +152,7 @@ extern int logger_main(int argc, char **argv) | |||
152 | if (argc >= 1) | 152 | if (argc >= 1) |
153 | message = *argv; | 153 | message = *argv; |
154 | else | 154 | else |
155 | fatalError("No message\n"); | 155 | error_msg_and_die("No message\n"); |
156 | } | 156 | } |
157 | 157 | ||
158 | openlog(name, option, (pri | LOG_FACMASK)); | 158 | openlog(name, option, (pri | LOG_FACMASK)); |
@@ -35,5 +35,5 @@ extern int logname_main(int argc, char **argv) | |||
35 | puts(user); | 35 | puts(user); |
36 | return EXIT_SUCCESS; | 36 | return EXIT_SUCCESS; |
37 | } | 37 | } |
38 | fatalError("no login name\n"); | 38 | error_msg_and_die("no login name\n"); |
39 | } | 39 | } |
@@ -181,7 +181,7 @@ static int my_stat(struct dnode *cur) | |||
181 | #ifdef BB_FEATURE_LS_FOLLOWLINKS | 181 | #ifdef BB_FEATURE_LS_FOLLOWLINKS |
182 | if (follow_links == TRUE) { | 182 | if (follow_links == TRUE) { |
183 | if (stat(cur->fullname, &cur->dstat)) { | 183 | if (stat(cur->fullname, &cur->dstat)) { |
184 | errorMsg("%s: %s\n", cur->fullname, strerror(errno)); | 184 | error_msg("%s: %s\n", cur->fullname, strerror(errno)); |
185 | status = EXIT_FAILURE; | 185 | status = EXIT_FAILURE; |
186 | free(cur->fullname); | 186 | free(cur->fullname); |
187 | free(cur); | 187 | free(cur); |
@@ -190,7 +190,7 @@ static int my_stat(struct dnode *cur) | |||
190 | } else | 190 | } else |
191 | #endif | 191 | #endif |
192 | if (lstat(cur->fullname, &cur->dstat)) { | 192 | if (lstat(cur->fullname, &cur->dstat)) { |
193 | errorMsg("%s: %s\n", cur->fullname, strerror(errno)); | 193 | error_msg("%s: %s\n", cur->fullname, strerror(errno)); |
194 | status = EXIT_FAILURE; | 194 | status = EXIT_FAILURE; |
195 | free(cur->fullname); | 195 | free(cur->fullname); |
196 | free(cur); | 196 | free(cur); |
@@ -511,7 +511,7 @@ struct dnode **list_dir(char *path) | |||
511 | nfiles= 0; | 511 | nfiles= 0; |
512 | dir = opendir(path); | 512 | dir = opendir(path); |
513 | if (dir == NULL) { | 513 | if (dir == NULL) { |
514 | errorMsg("%s: %s\n", path, strerror(errno)); | 514 | error_msg("%s: %s\n", path, strerror(errno)); |
515 | status = EXIT_FAILURE; | 515 | status = EXIT_FAILURE; |
516 | return(NULL); /* could not open the dir */ | 516 | return(NULL); /* could not open the dir */ |
517 | } | 517 | } |
@@ -591,7 +591,7 @@ int list_single(struct dnode *dn) | |||
591 | column += 5; | 591 | column += 5; |
592 | break; | 592 | break; |
593 | case LIST_MODEBITS: | 593 | case LIST_MODEBITS: |
594 | fprintf(stdout, "%10s", (char *)modeString(dn->dstat.st_mode)); | 594 | fprintf(stdout, "%10s", (char *)mode_string(dn->dstat.st_mode)); |
595 | column += 10; | 595 | column += 10; |
596 | break; | 596 | break; |
597 | case LIST_NLINKS: | 597 | case LIST_NLINKS: |
@@ -83,7 +83,7 @@ extern int lsmod_main(int argc, char **argv) | |||
83 | module_names = xmalloc(bufsize = 256); | 83 | module_names = xmalloc(bufsize = 256); |
84 | deps = xmalloc(bufsize); | 84 | deps = xmalloc(bufsize); |
85 | if (query_module(NULL, QM_MODULES, module_names, bufsize, &nmod)) { | 85 | if (query_module(NULL, QM_MODULES, module_names, bufsize, &nmod)) { |
86 | fatalError("QM_MODULES: %s\n", strerror(errno)); | 86 | error_msg_and_die("QM_MODULES: %s\n", strerror(errno)); |
87 | } | 87 | } |
88 | 88 | ||
89 | printf("Module Size Used by\n"); | 89 | printf("Module Size Used by\n"); |
@@ -94,7 +94,7 @@ extern int lsmod_main(int argc, char **argv) | |||
94 | continue; | 94 | continue; |
95 | } | 95 | } |
96 | /* else choke */ | 96 | /* else choke */ |
97 | fatalError("module %s: QM_INFO: %s\n", mn, strerror(errno)); | 97 | error_msg_and_die("module %s: QM_INFO: %s\n", mn, strerror(errno)); |
98 | } | 98 | } |
99 | while (query_module(mn, QM_REFS, deps, bufsize, &count)) { | 99 | while (query_module(mn, QM_REFS, deps, bufsize, &count)) { |
100 | if (errno == ENOENT) { | 100 | if (errno == ENOENT) { |
@@ -102,7 +102,7 @@ extern int lsmod_main(int argc, char **argv) | |||
102 | continue; | 102 | continue; |
103 | } | 103 | } |
104 | if (errno != ENOSPC) { | 104 | if (errno != ENOSPC) { |
105 | fatalError("module %s: QM_REFS: %s", mn, strerror(errno)); | 105 | error_msg_and_die("module %s: QM_REFS: %s", mn, strerror(errno)); |
106 | } | 106 | } |
107 | deps = xrealloc(deps, bufsize = count); | 107 | deps = xrealloc(deps, bufsize = count); |
108 | } | 108 | } |
@@ -153,7 +153,7 @@ extern int lsmod_main(int argc, char **argv) | |||
153 | close(fd); | 153 | close(fd); |
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
156 | fatalError("/proc/modules: %s\n", strerror(errno)); | 156 | error_msg_and_die("/proc/modules: %s\n", strerror(errno)); |
157 | return 1; | 157 | return 1; |
158 | } | 158 | } |
159 | 159 | ||
@@ -651,13 +651,13 @@ static int md5_file(const char *filename, | |||
651 | } else { | 651 | } else { |
652 | fp = fopen(filename, OPENOPTS(binary)); | 652 | fp = fopen(filename, OPENOPTS(binary)); |
653 | if (fp == NULL) { | 653 | if (fp == NULL) { |
654 | errorMsg("%s: %s\n", filename, strerror(errno)); | 654 | error_msg("%s: %s\n", filename, strerror(errno)); |
655 | return FALSE; | 655 | return FALSE; |
656 | } | 656 | } |
657 | } | 657 | } |
658 | 658 | ||
659 | if (md5_stream(fp, md5_result)) { | 659 | if (md5_stream(fp, md5_result)) { |
660 | errorMsg("%s: %s\n", filename, strerror(errno)); | 660 | error_msg("%s: %s\n", filename, strerror(errno)); |
661 | 661 | ||
662 | if (fp != stdin) | 662 | if (fp != stdin) |
663 | fclose(fp); | 663 | fclose(fp); |
@@ -665,7 +665,7 @@ static int md5_file(const char *filename, | |||
665 | } | 665 | } |
666 | 666 | ||
667 | if (fp != stdin && fclose(fp) == EOF) { | 667 | if (fp != stdin && fclose(fp) == EOF) { |
668 | errorMsg("%s: %s\n", filename, strerror(errno)); | 668 | error_msg("%s: %s\n", filename, strerror(errno)); |
669 | return FALSE; | 669 | return FALSE; |
670 | } | 670 | } |
671 | 671 | ||
@@ -689,7 +689,7 @@ static int md5_check(const char *checkfile_name) | |||
689 | } else { | 689 | } else { |
690 | checkfile_stream = fopen(checkfile_name, "r"); | 690 | checkfile_stream = fopen(checkfile_name, "r"); |
691 | if (checkfile_stream == NULL) { | 691 | if (checkfile_stream == NULL) { |
692 | errorMsg("%s: %s\n", checkfile_name, strerror(errno)); | 692 | error_msg("%s: %s\n", checkfile_name, strerror(errno)); |
693 | return FALSE; | 693 | return FALSE; |
694 | } | 694 | } |
695 | } | 695 | } |
@@ -722,7 +722,7 @@ static int md5_check(const char *checkfile_name) | |||
722 | if (split_3(line, line_length, &md5num, &binary, &filename) | 722 | if (split_3(line, line_length, &md5num, &binary, &filename) |
723 | || !hex_digits(md5num)) { | 723 | || !hex_digits(md5num)) { |
724 | if (warn) { | 724 | if (warn) { |
725 | errorMsg("%s: %lu: improperly formatted MD5 checksum line\n", | 725 | error_msg("%s: %lu: improperly formatted MD5 checksum line\n", |
726 | checkfile_name, (unsigned long) line_number); | 726 | checkfile_name, (unsigned long) line_number); |
727 | } | 727 | } |
728 | } else { | 728 | } else { |
@@ -770,18 +770,18 @@ static int md5_check(const char *checkfile_name) | |||
770 | free(line); | 770 | free(line); |
771 | 771 | ||
772 | if (ferror(checkfile_stream)) { | 772 | if (ferror(checkfile_stream)) { |
773 | errorMsg("%s: read error\n", checkfile_name); /* */ | 773 | error_msg("%s: read error\n", checkfile_name); /* */ |
774 | return FALSE; | 774 | return FALSE; |
775 | } | 775 | } |
776 | 776 | ||
777 | if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) { | 777 | if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) { |
778 | errorMsg("md5sum: %s: %s\n", checkfile_name, strerror(errno)); | 778 | error_msg("md5sum: %s: %s\n", checkfile_name, strerror(errno)); |
779 | return FALSE; | 779 | return FALSE; |
780 | } | 780 | } |
781 | 781 | ||
782 | if (n_properly_formated_lines == 0) { | 782 | if (n_properly_formated_lines == 0) { |
783 | /* Warn if no tests are found. */ | 783 | /* Warn if no tests are found. */ |
784 | errorMsg("%s: no properly formatted MD5 checksum lines found\n", | 784 | error_msg("%s: no properly formatted MD5 checksum lines found\n", |
785 | checkfile_name); | 785 | checkfile_name); |
786 | return FALSE; | 786 | return FALSE; |
787 | } else { | 787 | } else { |
@@ -790,13 +790,13 @@ static int md5_check(const char *checkfile_name) | |||
790 | - n_open_or_read_failures); | 790 | - n_open_or_read_failures); |
791 | 791 | ||
792 | if (n_open_or_read_failures > 0) { | 792 | if (n_open_or_read_failures > 0) { |
793 | errorMsg("WARNING: %d of %d listed files could not be read\n", | 793 | error_msg("WARNING: %d of %d listed files could not be read\n", |
794 | n_open_or_read_failures, n_properly_formated_lines); | 794 | n_open_or_read_failures, n_properly_formated_lines); |
795 | return FALSE; | 795 | return FALSE; |
796 | } | 796 | } |
797 | 797 | ||
798 | if (n_mismatched_checksums > 0) { | 798 | if (n_mismatched_checksums > 0) { |
799 | errorMsg("WARNING: %d of %d computed checksums did NOT match\n", | 799 | error_msg("WARNING: %d of %d computed checksums did NOT match\n", |
800 | n_mismatched_checksums, n_computed_checkums); | 800 | n_mismatched_checksums, n_computed_checkums); |
801 | return FALSE; | 801 | return FALSE; |
802 | } | 802 | } |
@@ -861,22 +861,22 @@ int md5sum_main(int argc, | |||
861 | } | 861 | } |
862 | 862 | ||
863 | if (file_type_specified && do_check) { | 863 | if (file_type_specified && do_check) { |
864 | errorMsg("the -b and -t options are meaningless when verifying checksums\n"); | 864 | error_msg("the -b and -t options are meaningless when verifying checksums\n"); |
865 | return EXIT_FAILURE; | 865 | return EXIT_FAILURE; |
866 | } | 866 | } |
867 | 867 | ||
868 | if (n_strings > 0 && do_check) { | 868 | if (n_strings > 0 && do_check) { |
869 | errorMsg("the -g and -c options are mutually exclusive\n"); | 869 | error_msg("the -g and -c options are mutually exclusive\n"); |
870 | return EXIT_FAILURE; | 870 | return EXIT_FAILURE; |
871 | } | 871 | } |
872 | 872 | ||
873 | if (status_only && !do_check) { | 873 | if (status_only && !do_check) { |
874 | errorMsg("the -s option is meaningful only when verifying checksums\n"); | 874 | error_msg("the -s option is meaningful only when verifying checksums\n"); |
875 | return EXIT_FAILURE; | 875 | return EXIT_FAILURE; |
876 | } | 876 | } |
877 | 877 | ||
878 | if (warn && !do_check) { | 878 | if (warn && !do_check) { |
879 | errorMsg("the -w option is meaningful only when verifying checksums\n"); | 879 | error_msg("the -w option is meaningful only when verifying checksums\n"); |
880 | return EXIT_FAILURE; | 880 | return EXIT_FAILURE; |
881 | } | 881 | } |
882 | 882 | ||
@@ -884,7 +884,7 @@ int md5sum_main(int argc, | |||
884 | size_t i; | 884 | size_t i; |
885 | 885 | ||
886 | if (optind < argc) { | 886 | if (optind < argc) { |
887 | errorMsg("no files may be specified when using -g\n"); | 887 | error_msg("no files may be specified when using -g\n"); |
888 | return EXIT_FAILURE; | 888 | return EXIT_FAILURE; |
889 | } | 889 | } |
890 | for (i = 0; i < n_strings; ++i) { | 890 | for (i = 0; i < n_strings; ++i) { |
@@ -898,7 +898,7 @@ int md5sum_main(int argc, | |||
898 | } | 898 | } |
899 | } else if (do_check) { | 899 | } else if (do_check) { |
900 | if (optind + 1 < argc) { | 900 | if (optind + 1 < argc) { |
901 | errorMsg("only one argument may be specified when using -c\n"); | 901 | error_msg("only one argument may be specified when using -c\n"); |
902 | } | 902 | } |
903 | 903 | ||
904 | err = md5_check ((optind == argc) ? "-" : argv[optind]); | 904 | err = md5_check ((optind == argc) ? "-" : argv[optind]); |
@@ -951,12 +951,12 @@ int md5sum_main(int argc, | |||
951 | } | 951 | } |
952 | 952 | ||
953 | if (fclose (stdout) == EOF) { | 953 | if (fclose (stdout) == EOF) { |
954 | errorMsg("write error\n"); | 954 | error_msg("write error\n"); |
955 | return EXIT_FAILURE; | 955 | return EXIT_FAILURE; |
956 | } | 956 | } |
957 | 957 | ||
958 | if (have_read_stdin && fclose (stdin) == EOF) { | 958 | if (have_read_stdin && fclose (stdin) == EOF) { |
959 | errorMsg("standard input\n"); | 959 | error_msg("standard input\n"); |
960 | return EXIT_FAILURE; | 960 | return EXIT_FAILURE; |
961 | } | 961 | } |
962 | 962 | ||
diff --git a/miscutils/dc.c b/miscutils/dc.c index 0f5f1fc77..d462100a2 100644 --- a/miscutils/dc.c +++ b/miscutils/dc.c | |||
@@ -14,14 +14,14 @@ static unsigned int pointer; | |||
14 | static void push(double a) | 14 | static void push(double a) |
15 | { | 15 | { |
16 | if (pointer >= (sizeof(stack) / sizeof(*stack))) | 16 | if (pointer >= (sizeof(stack) / sizeof(*stack))) |
17 | fatalError("stack overflow\n"); | 17 | error_msg_and_die("stack overflow\n"); |
18 | stack[pointer++] = a; | 18 | stack[pointer++] = a; |
19 | } | 19 | } |
20 | 20 | ||
21 | static double pop() | 21 | static double pop() |
22 | { | 22 | { |
23 | if (pointer == 0) | 23 | if (pointer == 0) |
24 | fatalError("stack underflow\n"); | 24 | error_msg_and_die("stack underflow\n"); |
25 | return stack[--pointer]; | 25 | return stack[--pointer]; |
26 | } | 26 | } |
27 | 27 | ||
@@ -120,7 +120,7 @@ static void stack_machine(const char *argument) | |||
120 | } | 120 | } |
121 | o++; | 121 | o++; |
122 | } | 122 | } |
123 | fatalError("%s: syntax error.\n", argument); | 123 | error_msg_and_die("%s: syntax error.\n", argument); |
124 | } | 124 | } |
125 | 125 | ||
126 | /* return pointer to next token in buffer and set *buffer to one char | 126 | /* return pointer to next token in buffer and set *buffer to one char |
diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c index 03d80d87d..efd15dfbf 100644 --- a/miscutils/dutmp.c +++ b/miscutils/dutmp.c | |||
@@ -35,7 +35,7 @@ extern int dutmp_main(int argc, char **argv) | |||
35 | } else { | 35 | } else { |
36 | file = open(argv[1], O_RDONLY); | 36 | file = open(argv[1], O_RDONLY); |
37 | if (file < 0) { | 37 | if (file < 0) { |
38 | fatalError(io_error, argv[1], strerror(errno)); | 38 | error_msg_and_die(io_error, argv[1], strerror(errno)); |
39 | } | 39 | } |
40 | } | 40 | } |
41 | 41 | ||
diff --git a/miscutils/mt.c b/miscutils/mt.c index 583674b18..2d35c7c22 100644 --- a/miscutils/mt.c +++ b/miscutils/mt.c | |||
@@ -75,7 +75,7 @@ extern int mt_main(int argc, char **argv) | |||
75 | } | 75 | } |
76 | 76 | ||
77 | if (code->name == 0) { | 77 | if (code->name == 0) { |
78 | errorMsg("unrecognized opcode %s.\n", argv[1]); | 78 | error_msg("unrecognized opcode %s.\n", argv[1]); |
79 | return EXIT_FAILURE; | 79 | return EXIT_FAILURE; |
80 | } | 80 | } |
81 | 81 | ||
diff --git a/miscutils/readlink.c b/miscutils/readlink.c index 5a798c0ea..bb40b0787 100644 --- a/miscutils/readlink.c +++ b/miscutils/readlink.c | |||
@@ -39,7 +39,7 @@ int readlink_main(int argc, char **argv) | |||
39 | buf = xrealloc(buf, bufsize); | 39 | buf = xrealloc(buf, bufsize); |
40 | size = readlink(argv[1], buf, bufsize); | 40 | size = readlink(argv[1], buf, bufsize); |
41 | if (size == -1) | 41 | if (size == -1) |
42 | fatalError("%s: %s\n", argv[1], strerror(errno)); | 42 | error_msg_and_die("%s: %s\n", argv[1], strerror(errno)); |
43 | } | 43 | } |
44 | 44 | ||
45 | buf[size] = '\0'; | 45 | buf[size] = '\0'; |
@@ -50,7 +50,7 @@ extern int mkdir_main(int argc, char **argv) | |||
50 | /* Find the specified modes */ | 50 | /* Find the specified modes */ |
51 | mode = 0; | 51 | mode = 0; |
52 | if (parse_mode(*(++argv), &mode) == FALSE) { | 52 | if (parse_mode(*(++argv), &mode) == FALSE) { |
53 | errorMsg("Unknown mode: %s\n", *argv); | 53 | error_msg("Unknown mode: %s\n", *argv); |
54 | return EXIT_FAILURE; | 54 | return EXIT_FAILURE; |
55 | } | 55 | } |
56 | /* Set the umask for this process so it doesn't | 56 | /* Set the umask for this process so it doesn't |
@@ -79,18 +79,18 @@ extern int mkdir_main(int argc, char **argv) | |||
79 | char buf[BUFSIZ + 1]; | 79 | char buf[BUFSIZ + 1]; |
80 | 80 | ||
81 | if (strlen(*argv) > BUFSIZ - 1) { | 81 | if (strlen(*argv) > BUFSIZ - 1) { |
82 | errorMsg(name_too_long); | 82 | error_msg(name_too_long); |
83 | return EXIT_FAILURE; | 83 | return EXIT_FAILURE; |
84 | } | 84 | } |
85 | strcpy(buf, *argv); | 85 | strcpy(buf, *argv); |
86 | status = stat(buf, &statBuf); | 86 | status = stat(buf, &statBuf); |
87 | if (parentFlag == FALSE && status != -1 && errno != ENOENT) { | 87 | if (parentFlag == FALSE && status != -1 && errno != ENOENT) { |
88 | errorMsg("%s: File exists\n", buf); | 88 | error_msg("%s: File exists\n", buf); |
89 | return EXIT_FAILURE; | 89 | return EXIT_FAILURE; |
90 | } | 90 | } |
91 | if (parentFlag == TRUE) { | 91 | if (parentFlag == TRUE) { |
92 | strcat(buf, "/"); | 92 | strcat(buf, "/"); |
93 | createPath(buf, mode); | 93 | create_path(buf, mode); |
94 | } else { | 94 | } else { |
95 | if (mkdir(buf, mode) != 0 && parentFlag == FALSE) { | 95 | if (mkdir(buf, mode) != 0 && parentFlag == FALSE) { |
96 | perror(buf); | 96 | perror(buf); |
diff --git a/mkfs_minix.c b/mkfs_minix.c index 15cf531f0..95815fd4d 100644 --- a/mkfs_minix.c +++ b/mkfs_minix.c | |||
@@ -262,7 +262,7 @@ static inline int bit(char * a,unsigned int i) | |||
262 | */ | 262 | */ |
263 | static volatile void die(char *str) | 263 | static volatile void die(char *str) |
264 | { | 264 | { |
265 | errorMsg("%s\n", str); | 265 | error_msg("%s\n", str); |
266 | exit(8); | 266 | exit(8); |
267 | } | 267 | } |
268 | 268 | ||
@@ -796,7 +796,7 @@ extern int mkfs_minix_main(int argc, char **argv) | |||
796 | #ifdef BB_FEATURE_MINIX2 | 796 | #ifdef BB_FEATURE_MINIX2 |
797 | version2 = 1; | 797 | version2 = 1; |
798 | #else | 798 | #else |
799 | errorMsg("%s: not compiled with minix v2 support\n", | 799 | error_msg("%s: not compiled with minix v2 support\n", |
800 | device_name); | 800 | device_name); |
801 | exit(-1); | 801 | exit(-1); |
802 | #endif | 802 | #endif |
@@ -84,7 +84,7 @@ int mknod_main(int argc, char **argv) | |||
84 | mode |= perm; | 84 | mode |= perm; |
85 | 85 | ||
86 | if (mknod(argv[0], mode, dev) != 0) | 86 | if (mknod(argv[0], mode, dev) != 0) |
87 | fatalError("%s: %s\n", argv[0], strerror(errno)); | 87 | error_msg_and_die("%s: %s\n", argv[0], strerror(errno)); |
88 | return EXIT_SUCCESS; | 88 | return EXIT_SUCCESS; |
89 | } | 89 | } |
90 | 90 | ||
@@ -87,7 +87,7 @@ static void init_signature_page() | |||
87 | 87 | ||
88 | #ifdef PAGE_SIZE | 88 | #ifdef PAGE_SIZE |
89 | if (pagesize != PAGE_SIZE) | 89 | if (pagesize != PAGE_SIZE) |
90 | errorMsg("Assuming pages of size %d\n", pagesize); | 90 | error_msg("Assuming pages of size %d\n", pagesize); |
91 | #endif | 91 | #endif |
92 | signature_page = (int *) xmalloc(pagesize); | 92 | signature_page = (int *) xmalloc(pagesize); |
93 | memset(signature_page, 0, pagesize); | 93 | memset(signature_page, 0, pagesize); |
@@ -175,7 +175,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr) | |||
175 | 175 | ||
176 | void die(const char *str) | 176 | void die(const char *str) |
177 | { | 177 | { |
178 | errorMsg("%s\n", str); | 178 | error_msg("%s\n", str); |
179 | exit(EXIT_FAILURE); | 179 | exit(EXIT_FAILURE); |
180 | } | 180 | } |
181 | 181 | ||
@@ -316,14 +316,14 @@ int mkswap_main(int argc, char **argv) | |||
316 | } | 316 | } |
317 | } | 317 | } |
318 | if (!device_name) { | 318 | if (!device_name) { |
319 | errorMsg("error: Nowhere to set up swap on?\n"); | 319 | error_msg("error: Nowhere to set up swap on?\n"); |
320 | usage(mkswap_usage); | 320 | usage(mkswap_usage); |
321 | } | 321 | } |
322 | sz = get_size(device_name); | 322 | sz = get_size(device_name); |
323 | if (!PAGES) { | 323 | if (!PAGES) { |
324 | PAGES = sz; | 324 | PAGES = sz; |
325 | } else if (PAGES > sz && !force) { | 325 | } else if (PAGES > sz && !force) { |
326 | errorMsg("error: size %ld is larger than device size %d\n", | 326 | error_msg("error: size %ld is larger than device size %d\n", |
327 | PAGES * (pagesize / 1024), sz * (pagesize / 1024)); | 327 | PAGES * (pagesize / 1024), sz * (pagesize / 1024)); |
328 | return EXIT_FAILURE; | 328 | return EXIT_FAILURE; |
329 | } | 329 | } |
@@ -339,11 +339,11 @@ int mkswap_main(int argc, char **argv) | |||
339 | version = 1; | 339 | version = 1; |
340 | } | 340 | } |
341 | if (version != 0 && version != 1) { | 341 | if (version != 0 && version != 1) { |
342 | errorMsg("error: unknown version %d\n", version); | 342 | error_msg("error: unknown version %d\n", version); |
343 | usage(mkswap_usage); | 343 | usage(mkswap_usage); |
344 | } | 344 | } |
345 | if (PAGES < 10) { | 345 | if (PAGES < 10) { |
346 | errorMsg("error: swap area needs to be at least %ldkB\n", | 346 | error_msg("error: swap area needs to be at least %ldkB\n", |
347 | (long) (10 * pagesize / 1024)); | 347 | (long) (10 * pagesize / 1024)); |
348 | usage(mkswap_usage); | 348 | usage(mkswap_usage); |
349 | } | 349 | } |
@@ -362,7 +362,7 @@ int mkswap_main(int argc, char **argv) | |||
362 | #endif | 362 | #endif |
363 | if (PAGES > maxpages) { | 363 | if (PAGES > maxpages) { |
364 | PAGES = maxpages; | 364 | PAGES = maxpages; |
365 | errorMsg("warning: truncating swap area to %ldkB\n", | 365 | error_msg("warning: truncating swap area to %ldkB\n", |
366 | PAGES * pagesize / 1024); | 366 | PAGES * pagesize / 1024); |
367 | } | 367 | } |
368 | 368 | ||
@@ -389,7 +389,7 @@ int mkswap_main(int argc, char **argv) | |||
389 | for (sum = 0; q >= (unsigned short *) buffer;) | 389 | for (sum = 0; q >= (unsigned short *) buffer;) |
390 | sum ^= *q--; | 390 | sum ^= *q--; |
391 | if (!sum) { | 391 | if (!sum) { |
392 | errorMsg("Device '%s' contains a valid Sun disklabel.\n" | 392 | error_msg("Device '%s' contains a valid Sun disklabel.\n" |
393 | "This probably means creating v0 swap would destroy your partition table\n" | 393 | "This probably means creating v0 swap would destroy your partition table\n" |
394 | "No swap created. If you really want to create swap v0 on that device, use\n" | 394 | "No swap created. If you really want to create swap v0 on that device, use\n" |
395 | "the -f option to force it.\n", device_name); | 395 | "the -f option to force it.\n", device_name); |
diff --git a/modutils/insmod.c b/modutils/insmod.c index 0963225fa..0b12c694d 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -78,7 +78,7 @@ | |||
78 | #ifndef MODUTILS_MODULE_H | 78 | #ifndef MODUTILS_MODULE_H |
79 | #define MODUTILS_MODULE_H 1 | 79 | #define MODUTILS_MODULE_H 1 |
80 | 80 | ||
81 | #ident "$Id: insmod.c,v 1.30 2000/12/06 18:18:26 andersen Exp $" | 81 | #ident "$Id: insmod.c,v 1.31 2000/12/07 19:56:48 markw Exp $" |
82 | 82 | ||
83 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 83 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
84 | We do not use the kernel headers directly because we do not wish | 84 | We do not use the kernel headers directly because we do not wish |
@@ -284,7 +284,7 @@ int delete_module(const char *); | |||
284 | #ifndef MODUTILS_OBJ_H | 284 | #ifndef MODUTILS_OBJ_H |
285 | #define MODUTILS_OBJ_H 1 | 285 | #define MODUTILS_OBJ_H 1 |
286 | 286 | ||
287 | #ident "$Id: insmod.c,v 1.30 2000/12/06 18:18:26 andersen Exp $" | 287 | #ident "$Id: insmod.c,v 1.31 2000/12/07 19:56:48 markw Exp $" |
288 | 288 | ||
289 | /* The relocatable object is manipulated using elfin types. */ | 289 | /* The relocatable object is manipulated using elfin types. */ |
290 | 290 | ||
@@ -1157,7 +1157,7 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name, | |||
1157 | /* Don't report an error if the symbol is coming from | 1157 | /* Don't report an error if the symbol is coming from |
1158 | the kernel or some external module. */ | 1158 | the kernel or some external module. */ |
1159 | if (secidx <= SHN_HIRESERVE) | 1159 | if (secidx <= SHN_HIRESERVE) |
1160 | errorMsg("%s multiply defined\n", name); | 1160 | error_msg("%s multiply defined\n", name); |
1161 | return sym; | 1161 | return sym; |
1162 | } | 1162 | } |
1163 | } | 1163 | } |
@@ -1420,7 +1420,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1420 | 1420 | ||
1421 | /* Also check that the parameter was not resolved from the kernel. */ | 1421 | /* Also check that the parameter was not resolved from the kernel. */ |
1422 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { | 1422 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { |
1423 | errorMsg("symbol for parameter %s not found\n", p); | 1423 | error_msg("symbol for parameter %s not found\n", p); |
1424 | return 0; | 1424 | return 0; |
1425 | } | 1425 | } |
1426 | 1426 | ||
@@ -1433,7 +1433,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1433 | str = alloca(strlen(q)); | 1433 | str = alloca(strlen(q)); |
1434 | for (r = str, q++; *q != '"'; ++q, ++r) { | 1434 | for (r = str, q++; *q != '"'; ++q, ++r) { |
1435 | if (*q == '\0') { | 1435 | if (*q == '\0') { |
1436 | errorMsg("improperly terminated string argument for %s\n", p); | 1436 | error_msg("improperly terminated string argument for %s\n", p); |
1437 | return 0; | 1437 | return 0; |
1438 | } else if (*q == '\\') | 1438 | } else if (*q == '\\') |
1439 | switch (*++q) { | 1439 | switch (*++q) { |
@@ -1562,7 +1562,7 @@ static int old_get_kernel_symbols(const char *m_name) | |||
1562 | 1562 | ||
1563 | nks = get_kernel_syms(NULL); | 1563 | nks = get_kernel_syms(NULL); |
1564 | if (nks < 0) { | 1564 | if (nks < 0) { |
1565 | errorMsg("get_kernel_syms: %s: %s\n", m_name, strerror(errno)); | 1565 | error_msg("get_kernel_syms: %s: %s\n", m_name, strerror(errno)); |
1566 | return 0; | 1566 | return 0; |
1567 | } | 1567 | } |
1568 | 1568 | ||
@@ -1743,7 +1743,7 @@ old_init_module(const char *m_name, struct obj_file *f, | |||
1743 | m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN | 1743 | m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN |
1744 | : 0), &routines, symtab); | 1744 | : 0), &routines, symtab); |
1745 | if (ret) | 1745 | if (ret) |
1746 | errorMsg("init_module: %s: %s\n", m_name, strerror(errno)); | 1746 | error_msg("init_module: %s: %s\n", m_name, strerror(errno)); |
1747 | 1747 | ||
1748 | free(image); | 1748 | free(image); |
1749 | free(symtab); | 1749 | free(symtab); |
@@ -1786,7 +1786,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1786 | p = get_modinfo_value(f, key); | 1786 | p = get_modinfo_value(f, key); |
1787 | key += 5; | 1787 | key += 5; |
1788 | if (p == NULL) { | 1788 | if (p == NULL) { |
1789 | errorMsg("invalid parameter %s\n", key); | 1789 | error_msg("invalid parameter %s\n", key); |
1790 | return 0; | 1790 | return 0; |
1791 | } | 1791 | } |
1792 | 1792 | ||
@@ -1794,7 +1794,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1794 | 1794 | ||
1795 | /* Also check that the parameter was not resolved from the kernel. */ | 1795 | /* Also check that the parameter was not resolved from the kernel. */ |
1796 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { | 1796 | if (sym == NULL || sym->secidx > SHN_HIRESERVE) { |
1797 | errorMsg("symbol for parameter %s not found\n", key); | 1797 | error_msg("symbol for parameter %s not found\n", key); |
1798 | return 0; | 1798 | return 0; |
1799 | } | 1799 | } |
1800 | 1800 | ||
@@ -1822,7 +1822,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1822 | str = alloca(strlen(q)); | 1822 | str = alloca(strlen(q)); |
1823 | for (r = str, q++; *q != '"'; ++q, ++r) { | 1823 | for (r = str, q++; *q != '"'; ++q, ++r) { |
1824 | if (*q == '\0') { | 1824 | if (*q == '\0') { |
1825 | errorMsg("improperly terminated string argument for %s\n", | 1825 | error_msg("improperly terminated string argument for %s\n", |
1826 | key); | 1826 | key); |
1827 | return 0; | 1827 | return 0; |
1828 | } else if (*q == '\\') | 1828 | } else if (*q == '\\') |
@@ -1916,7 +1916,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1916 | /* Get the size of each member */ | 1916 | /* Get the size of each member */ |
1917 | /* Probably we should do that outside the loop ? */ | 1917 | /* Probably we should do that outside the loop ? */ |
1918 | if (!isdigit(*(p + 1))) { | 1918 | if (!isdigit(*(p + 1))) { |
1919 | errorMsg("parameter type 'c' for %s must be followed by" | 1919 | error_msg("parameter type 'c' for %s must be followed by" |
1920 | " the maximum size\n", key); | 1920 | " the maximum size\n", key); |
1921 | return 0; | 1921 | return 0; |
1922 | } | 1922 | } |
@@ -1924,7 +1924,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1924 | 1924 | ||
1925 | /* Check length */ | 1925 | /* Check length */ |
1926 | if (strlen(str) >= charssize) { | 1926 | if (strlen(str) >= charssize) { |
1927 | errorMsg("string too long for %s (max %ld)\n", key, | 1927 | error_msg("string too long for %s (max %ld)\n", key, |
1928 | charssize - 1); | 1928 | charssize - 1); |
1929 | return 0; | 1929 | return 0; |
1930 | } | 1930 | } |
@@ -1953,7 +1953,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1953 | break; | 1953 | break; |
1954 | 1954 | ||
1955 | default: | 1955 | default: |
1956 | errorMsg("unknown parameter type '%c' for %s\n", *p, key); | 1956 | error_msg("unknown parameter type '%c' for %s\n", *p, key); |
1957 | return 0; | 1957 | return 0; |
1958 | } | 1958 | } |
1959 | } | 1959 | } |
@@ -1972,21 +1972,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) | |||
1972 | 1972 | ||
1973 | case ',': | 1973 | case ',': |
1974 | if (++n > max) { | 1974 | if (++n > max) { |
1975 | errorMsg("too many values for %s (max %d)\n", key, max); | 1975 | error_msg("too many values for %s (max %d)\n", key, max); |
1976 | return 0; | 1976 | return 0; |
1977 | } | 1977 | } |
1978 | ++q; | 1978 | ++q; |
1979 | break; | 1979 | break; |
1980 | 1980 | ||
1981 | default: | 1981 | default: |
1982 | errorMsg("invalid argument syntax for %s\n", key); | 1982 | error_msg("invalid argument syntax for %s\n", key); |
1983 | return 0; | 1983 | return 0; |
1984 | } | 1984 | } |
1985 | } | 1985 | } |
1986 | 1986 | ||
1987 | end_of_arg: | 1987 | end_of_arg: |
1988 | if (n < min) { | 1988 | if (n < min) { |
1989 | errorMsg("too few values for %s (min %d)\n", key, min); | 1989 | error_msg("too few values for %s (min %d)\n", key, min); |
1990 | return 0; | 1990 | return 0; |
1991 | } | 1991 | } |
1992 | 1992 | ||
@@ -2055,7 +2055,7 @@ static int new_get_kernel_symbols(void) | |||
2055 | module_names = xrealloc(module_names, bufsize = ret); | 2055 | module_names = xrealloc(module_names, bufsize = ret); |
2056 | goto retry_modules_load; | 2056 | goto retry_modules_load; |
2057 | } | 2057 | } |
2058 | errorMsg("QM_MODULES: %s\n", strerror(errno)); | 2058 | error_msg("QM_MODULES: %s\n", strerror(errno)); |
2059 | return 0; | 2059 | return 0; |
2060 | } | 2060 | } |
2061 | 2061 | ||
@@ -2074,7 +2074,7 @@ static int new_get_kernel_symbols(void) | |||
2074 | /* The module was removed out from underneath us. */ | 2074 | /* The module was removed out from underneath us. */ |
2075 | continue; | 2075 | continue; |
2076 | } | 2076 | } |
2077 | errorMsg("query_module: QM_INFO: %s: %s\n", mn, strerror(errno)); | 2077 | error_msg("query_module: QM_INFO: %s: %s\n", mn, strerror(errno)); |
2078 | return 0; | 2078 | return 0; |
2079 | } | 2079 | } |
2080 | 2080 | ||
@@ -2089,7 +2089,7 @@ static int new_get_kernel_symbols(void) | |||
2089 | /* The module was removed out from underneath us. */ | 2089 | /* The module was removed out from underneath us. */ |
2090 | continue; | 2090 | continue; |
2091 | default: | 2091 | default: |
2092 | errorMsg("query_module: QM_SYMBOLS: %s: %s\n", mn, strerror(errno)); | 2092 | error_msg("query_module: QM_SYMBOLS: %s: %s\n", mn, strerror(errno)); |
2093 | return 0; | 2093 | return 0; |
2094 | } | 2094 | } |
2095 | } | 2095 | } |
@@ -2114,7 +2114,7 @@ static int new_get_kernel_symbols(void) | |||
2114 | syms = xrealloc(syms, bufsize = ret); | 2114 | syms = xrealloc(syms, bufsize = ret); |
2115 | goto retry_kern_sym_load; | 2115 | goto retry_kern_sym_load; |
2116 | } | 2116 | } |
2117 | errorMsg("kernel: QM_SYMBOLS: %s\n", strerror(errno)); | 2117 | error_msg("kernel: QM_SYMBOLS: %s\n", strerror(errno)); |
2118 | return 0; | 2118 | return 0; |
2119 | } | 2119 | } |
2120 | nksyms = nsyms = ret; | 2120 | nksyms = nsyms = ret; |
@@ -2295,7 +2295,7 @@ new_init_module(const char *m_name, struct obj_file *f, | |||
2295 | 2295 | ||
2296 | ret = new_sys_init_module(m_name, (struct new_module *) image); | 2296 | ret = new_sys_init_module(m_name, (struct new_module *) image); |
2297 | if (ret) | 2297 | if (ret) |
2298 | errorMsg("init_module: %s: %s\n", m_name, strerror(errno)); | 2298 | error_msg("init_module: %s: %s\n", m_name, strerror(errno)); |
2299 | 2299 | ||
2300 | free(image); | 2300 | free(image); |
2301 | 2301 | ||
@@ -2372,7 +2372,7 @@ int obj_check_undefineds(struct obj_file *f) | |||
2372 | sym->secidx = SHN_ABS; | 2372 | sym->secidx = SHN_ABS; |
2373 | sym->value = 0; | 2373 | sym->value = 0; |
2374 | } else { | 2374 | } else { |
2375 | errorMsg("unresolved symbol %s\n", sym->name); | 2375 | error_msg("unresolved symbol %s\n", sym->name); |
2376 | ret = 0; | 2376 | ret = 0; |
2377 | } | 2377 | } |
2378 | } | 2378 | } |
@@ -2599,11 +2599,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base) | |||
2599 | errmsg = "Unhandled relocation"; | 2599 | errmsg = "Unhandled relocation"; |
2600 | bad_reloc: | 2600 | bad_reloc: |
2601 | if (extsym) { | 2601 | if (extsym) { |
2602 | errorMsg("%s of type %ld for %s\n", errmsg, | 2602 | error_msg("%s of type %ld for %s\n", errmsg, |
2603 | (long) ELFW(R_TYPE) (rel->r_info), | 2603 | (long) ELFW(R_TYPE) (rel->r_info), |
2604 | strtab + extsym->st_name); | 2604 | strtab + extsym->st_name); |
2605 | } else { | 2605 | } else { |
2606 | errorMsg("%s of type %ld\n", errmsg, | 2606 | error_msg("%s of type %ld\n", errmsg, |
2607 | (long) ELFW(R_TYPE) (rel->r_info)); | 2607 | (long) ELFW(R_TYPE) (rel->r_info)); |
2608 | } | 2608 | } |
2609 | ret = 0; | 2609 | ret = 0; |
@@ -2680,7 +2680,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2680 | 2680 | ||
2681 | fseek(fp, 0, SEEK_SET); | 2681 | fseek(fp, 0, SEEK_SET); |
2682 | if (fread(&f->header, sizeof(f->header), 1, fp) != 1) { | 2682 | if (fread(&f->header, sizeof(f->header), 1, fp) != 1) { |
2683 | errorMsg("error reading ELF header: %s\n", strerror(errno)); | 2683 | error_msg("error reading ELF header: %s\n", strerror(errno)); |
2684 | return NULL; | 2684 | return NULL; |
2685 | } | 2685 | } |
2686 | 2686 | ||
@@ -2688,25 +2688,25 @@ struct obj_file *obj_load(FILE * fp) | |||
2688 | || f->header.e_ident[EI_MAG1] != ELFMAG1 | 2688 | || f->header.e_ident[EI_MAG1] != ELFMAG1 |
2689 | || f->header.e_ident[EI_MAG2] != ELFMAG2 | 2689 | || f->header.e_ident[EI_MAG2] != ELFMAG2 |
2690 | || f->header.e_ident[EI_MAG3] != ELFMAG3) { | 2690 | || f->header.e_ident[EI_MAG3] != ELFMAG3) { |
2691 | errorMsg("not an ELF file\n"); | 2691 | error_msg("not an ELF file\n"); |
2692 | return NULL; | 2692 | return NULL; |
2693 | } | 2693 | } |
2694 | if (f->header.e_ident[EI_CLASS] != ELFCLASSM | 2694 | if (f->header.e_ident[EI_CLASS] != ELFCLASSM |
2695 | || f->header.e_ident[EI_DATA] != ELFDATAM | 2695 | || f->header.e_ident[EI_DATA] != ELFDATAM |
2696 | || f->header.e_ident[EI_VERSION] != EV_CURRENT | 2696 | || f->header.e_ident[EI_VERSION] != EV_CURRENT |
2697 | || !MATCH_MACHINE(f->header.e_machine)) { | 2697 | || !MATCH_MACHINE(f->header.e_machine)) { |
2698 | errorMsg("ELF file not for this architecture\n"); | 2698 | error_msg("ELF file not for this architecture\n"); |
2699 | return NULL; | 2699 | return NULL; |
2700 | } | 2700 | } |
2701 | if (f->header.e_type != ET_REL) { | 2701 | if (f->header.e_type != ET_REL) { |
2702 | errorMsg("ELF file not a relocatable object\n"); | 2702 | error_msg("ELF file not a relocatable object\n"); |
2703 | return NULL; | 2703 | return NULL; |
2704 | } | 2704 | } |
2705 | 2705 | ||
2706 | /* Read the section headers. */ | 2706 | /* Read the section headers. */ |
2707 | 2707 | ||
2708 | if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { | 2708 | if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { |
2709 | errorMsg("section header size mismatch: %lu != %lu\n", | 2709 | error_msg("section header size mismatch: %lu != %lu\n", |
2710 | (unsigned long) f->header.e_shentsize, | 2710 | (unsigned long) f->header.e_shentsize, |
2711 | (unsigned long) sizeof(ElfW(Shdr))); | 2711 | (unsigned long) sizeof(ElfW(Shdr))); |
2712 | return NULL; | 2712 | return NULL; |
@@ -2719,7 +2719,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2719 | section_headers = alloca(sizeof(ElfW(Shdr)) * shnum); | 2719 | section_headers = alloca(sizeof(ElfW(Shdr)) * shnum); |
2720 | fseek(fp, f->header.e_shoff, SEEK_SET); | 2720 | fseek(fp, f->header.e_shoff, SEEK_SET); |
2721 | if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) { | 2721 | if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) { |
2722 | errorMsg("error reading ELF section headers: %s\n", strerror(errno)); | 2722 | error_msg("error reading ELF section headers: %s\n", strerror(errno)); |
2723 | return NULL; | 2723 | return NULL; |
2724 | } | 2724 | } |
2725 | 2725 | ||
@@ -2749,7 +2749,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2749 | sec->contents = xmalloc(sec->header.sh_size); | 2749 | sec->contents = xmalloc(sec->header.sh_size); |
2750 | fseek(fp, sec->header.sh_offset, SEEK_SET); | 2750 | fseek(fp, sec->header.sh_offset, SEEK_SET); |
2751 | if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) { | 2751 | if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) { |
2752 | errorMsg("error reading ELF section data: %s\n", strerror(errno)); | 2752 | error_msg("error reading ELF section data: %s\n", strerror(errno)); |
2753 | return NULL; | 2753 | return NULL; |
2754 | } | 2754 | } |
2755 | } else { | 2755 | } else { |
@@ -2759,11 +2759,11 @@ struct obj_file *obj_load(FILE * fp) | |||
2759 | 2759 | ||
2760 | #if SHT_RELM == SHT_REL | 2760 | #if SHT_RELM == SHT_REL |
2761 | case SHT_RELA: | 2761 | case SHT_RELA: |
2762 | errorMsg("RELA relocations not supported on this architecture\n"); | 2762 | error_msg("RELA relocations not supported on this architecture\n"); |
2763 | return NULL; | 2763 | return NULL; |
2764 | #else | 2764 | #else |
2765 | case SHT_REL: | 2765 | case SHT_REL: |
2766 | errorMsg("REL relocations not supported on this architecture\n"); | 2766 | error_msg("REL relocations not supported on this architecture\n"); |
2767 | return NULL; | 2767 | return NULL; |
2768 | #endif | 2768 | #endif |
2769 | 2769 | ||
@@ -2776,7 +2776,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2776 | break; | 2776 | break; |
2777 | } | 2777 | } |
2778 | 2778 | ||
2779 | errorMsg("can't handle sections of type %ld\n", | 2779 | error_msg("can't handle sections of type %ld\n", |
2780 | (long) sec->header.sh_type); | 2780 | (long) sec->header.sh_type); |
2781 | return NULL; | 2781 | return NULL; |
2782 | } | 2782 | } |
@@ -2805,7 +2805,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2805 | ElfW(Sym) * sym; | 2805 | ElfW(Sym) * sym; |
2806 | 2806 | ||
2807 | if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { | 2807 | if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { |
2808 | errorMsg("symbol size mismatch: %lu != %lu\n", | 2808 | error_msg("symbol size mismatch: %lu != %lu\n", |
2809 | (unsigned long) sec->header.sh_entsize, | 2809 | (unsigned long) sec->header.sh_entsize, |
2810 | (unsigned long) sizeof(ElfW(Sym))); | 2810 | (unsigned long) sizeof(ElfW(Sym))); |
2811 | return NULL; | 2811 | return NULL; |
@@ -2837,7 +2837,7 @@ struct obj_file *obj_load(FILE * fp) | |||
2837 | 2837 | ||
2838 | case SHT_RELM: | 2838 | case SHT_RELM: |
2839 | if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { | 2839 | if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { |
2840 | errorMsg("relocation entry size mismatch: %lu != %lu\n", | 2840 | error_msg("relocation entry size mismatch: %lu != %lu\n", |
2841 | (unsigned long) sec->header.sh_entsize, | 2841 | (unsigned long) sec->header.sh_entsize, |
2842 | (unsigned long) sizeof(ElfW(RelM))); | 2842 | (unsigned long) sizeof(ElfW(RelM))); |
2843 | return NULL; | 2843 | return NULL; |
@@ -2937,17 +2937,17 @@ extern int insmod_main( int argc, char **argv) | |||
2937 | /* Get a filedesc for the module */ | 2937 | /* Get a filedesc for the module */ |
2938 | if ((fp = fopen(*argv, "r")) == NULL) { | 2938 | if ((fp = fopen(*argv, "r")) == NULL) { |
2939 | /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */ | 2939 | /* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */ |
2940 | if (recursiveAction(_PATH_MODULES, TRUE, FALSE, FALSE, | 2940 | if (recursive_action(_PATH_MODULES, TRUE, FALSE, FALSE, |
2941 | findNamedModule, 0, m_fullName) == FALSE) | 2941 | findNamedModule, 0, m_fullName) == FALSE) |
2942 | { | 2942 | { |
2943 | if (m_filename[0] == '\0' | 2943 | if (m_filename[0] == '\0' |
2944 | || ((fp = fopen(m_filename, "r")) == NULL)) | 2944 | || ((fp = fopen(m_filename, "r")) == NULL)) |
2945 | { | 2945 | { |
2946 | errorMsg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); | 2946 | error_msg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); |
2947 | return EXIT_FAILURE; | 2947 | return EXIT_FAILURE; |
2948 | } | 2948 | } |
2949 | } else | 2949 | } else |
2950 | fatalError("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); | 2950 | error_msg_and_die("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); |
2951 | } else | 2951 | } else |
2952 | memcpy(m_filename, *argv, strlen(*argv)); | 2952 | memcpy(m_filename, *argv, strlen(*argv)); |
2953 | 2953 | ||
@@ -2971,7 +2971,7 @@ extern int insmod_main( int argc, char **argv) | |||
2971 | } else { | 2971 | } else { |
2972 | m_version = old_get_module_version(f, m_strversion); | 2972 | m_version = old_get_module_version(f, m_strversion); |
2973 | if (m_version == -1) { | 2973 | if (m_version == -1) { |
2974 | errorMsg("couldn't find the kernel version the module was " | 2974 | error_msg("couldn't find the kernel version the module was " |
2975 | "compiled for\n"); | 2975 | "compiled for\n"); |
2976 | goto out; | 2976 | goto out; |
2977 | } | 2977 | } |
@@ -2979,12 +2979,12 @@ extern int insmod_main( int argc, char **argv) | |||
2979 | 2979 | ||
2980 | if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) { | 2980 | if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) { |
2981 | if (flag_force_load) { | 2981 | if (flag_force_load) { |
2982 | errorMsg("Warning: kernel-module version mismatch\n" | 2982 | error_msg("Warning: kernel-module version mismatch\n" |
2983 | "\t%s was compiled for kernel version %s\n" | 2983 | "\t%s was compiled for kernel version %s\n" |
2984 | "\twhile this kernel is version %s\n", | 2984 | "\twhile this kernel is version %s\n", |
2985 | m_filename, m_strversion, k_strversion); | 2985 | m_filename, m_strversion, k_strversion); |
2986 | } else { | 2986 | } else { |
2987 | errorMsg("kernel-module version mismatch\n" | 2987 | error_msg("kernel-module version mismatch\n" |
2988 | "\t%s was compiled for kernel version %s\n" | 2988 | "\t%s was compiled for kernel version %s\n" |
2989 | "\twhile this kernel is version %s.\n", | 2989 | "\twhile this kernel is version %s.\n", |
2990 | m_filename, m_strversion, k_strversion); | 2990 | m_filename, m_strversion, k_strversion); |
@@ -3002,7 +3002,7 @@ extern int insmod_main( int argc, char **argv) | |||
3002 | goto out; | 3002 | goto out; |
3003 | k_crcs = new_is_kernel_checksummed(); | 3003 | k_crcs = new_is_kernel_checksummed(); |
3004 | #else | 3004 | #else |
3005 | errorMsg("Not configured to support new kernels\n"); | 3005 | error_msg("Not configured to support new kernels\n"); |
3006 | goto out; | 3006 | goto out; |
3007 | #endif | 3007 | #endif |
3008 | } else { | 3008 | } else { |
@@ -3011,7 +3011,7 @@ extern int insmod_main( int argc, char **argv) | |||
3011 | goto out; | 3011 | goto out; |
3012 | k_crcs = old_is_kernel_checksummed(); | 3012 | k_crcs = old_is_kernel_checksummed(); |
3013 | #else | 3013 | #else |
3014 | errorMsg("Not configured to support old kernels\n"); | 3014 | error_msg("Not configured to support old kernels\n"); |
3015 | goto out; | 3015 | goto out; |
3016 | #endif | 3016 | #endif |
3017 | } | 3017 | } |
@@ -3068,14 +3068,14 @@ extern int insmod_main( int argc, char **argv) | |||
3068 | case 0: | 3068 | case 0: |
3069 | break; | 3069 | break; |
3070 | case EEXIST: | 3070 | case EEXIST: |
3071 | errorMsg("A module named %s already exists\n", m_name); | 3071 | error_msg("A module named %s already exists\n", m_name); |
3072 | goto out; | 3072 | goto out; |
3073 | case ENOMEM: | 3073 | case ENOMEM: |
3074 | errorMsg("Can't allocate kernel memory for module; needed %lu bytes\n", | 3074 | error_msg("Can't allocate kernel memory for module; needed %lu bytes\n", |
3075 | m_size); | 3075 | m_size); |
3076 | goto out; | 3076 | goto out; |
3077 | default: | 3077 | default: |
3078 | errorMsg("create_module: %s: %s\n", m_name, strerror(errno)); | 3078 | error_msg("create_module: %s: %s\n", m_name, strerror(errno)); |
3079 | goto out; | 3079 | goto out; |
3080 | } | 3080 | } |
3081 | 3081 | ||
diff --git a/modutils/lsmod.c b/modutils/lsmod.c index 6fe505bf6..f957d2d00 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c | |||
@@ -83,7 +83,7 @@ extern int lsmod_main(int argc, char **argv) | |||
83 | module_names = xmalloc(bufsize = 256); | 83 | module_names = xmalloc(bufsize = 256); |
84 | deps = xmalloc(bufsize); | 84 | deps = xmalloc(bufsize); |
85 | if (query_module(NULL, QM_MODULES, module_names, bufsize, &nmod)) { | 85 | if (query_module(NULL, QM_MODULES, module_names, bufsize, &nmod)) { |
86 | fatalError("QM_MODULES: %s\n", strerror(errno)); | 86 | error_msg_and_die("QM_MODULES: %s\n", strerror(errno)); |
87 | } | 87 | } |
88 | 88 | ||
89 | printf("Module Size Used by\n"); | 89 | printf("Module Size Used by\n"); |
@@ -94,7 +94,7 @@ extern int lsmod_main(int argc, char **argv) | |||
94 | continue; | 94 | continue; |
95 | } | 95 | } |
96 | /* else choke */ | 96 | /* else choke */ |
97 | fatalError("module %s: QM_INFO: %s\n", mn, strerror(errno)); | 97 | error_msg_and_die("module %s: QM_INFO: %s\n", mn, strerror(errno)); |
98 | } | 98 | } |
99 | while (query_module(mn, QM_REFS, deps, bufsize, &count)) { | 99 | while (query_module(mn, QM_REFS, deps, bufsize, &count)) { |
100 | if (errno == ENOENT) { | 100 | if (errno == ENOENT) { |
@@ -102,7 +102,7 @@ extern int lsmod_main(int argc, char **argv) | |||
102 | continue; | 102 | continue; |
103 | } | 103 | } |
104 | if (errno != ENOSPC) { | 104 | if (errno != ENOSPC) { |
105 | fatalError("module %s: QM_REFS: %s", mn, strerror(errno)); | 105 | error_msg_and_die("module %s: QM_REFS: %s", mn, strerror(errno)); |
106 | } | 106 | } |
107 | deps = xrealloc(deps, bufsize = count); | 107 | deps = xrealloc(deps, bufsize = count); |
108 | } | 108 | } |
@@ -153,7 +153,7 @@ extern int lsmod_main(int argc, char **argv) | |||
153 | close(fd); | 153 | close(fd); |
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
156 | fatalError("/proc/modules: %s\n", strerror(errno)); | 156 | error_msg_and_die("/proc/modules: %s\n", strerror(errno)); |
157 | return 1; | 157 | return 1; |
158 | } | 158 | } |
159 | 159 | ||
@@ -132,22 +132,22 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
132 | 132 | ||
133 | specialfile = find_unused_loop_device(); | 133 | specialfile = find_unused_loop_device(); |
134 | if (specialfile == NULL) { | 134 | if (specialfile == NULL) { |
135 | errorMsg("Could not find a spare loop device\n"); | 135 | error_msg("Could not find a spare loop device\n"); |
136 | return (FALSE); | 136 | return (FALSE); |
137 | } | 137 | } |
138 | if (set_loop(specialfile, lofile, 0, &loro)) { | 138 | if (set_loop(specialfile, lofile, 0, &loro)) { |
139 | errorMsg("Could not setup loop device\n"); | 139 | error_msg("Could not setup loop device\n"); |
140 | return (FALSE); | 140 | return (FALSE); |
141 | } | 141 | } |
142 | if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ | 142 | if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ |
143 | errorMsg("WARNING: loop device is read-only\n"); | 143 | error_msg("WARNING: loop device is read-only\n"); |
144 | flags &= ~MS_RDONLY; | 144 | flags &= ~MS_RDONLY; |
145 | } | 145 | } |
146 | } | 146 | } |
147 | #endif | 147 | #endif |
148 | status = mount(specialfile, dir, filesystemtype, flags, string_flags); | 148 | status = mount(specialfile, dir, filesystemtype, flags, string_flags); |
149 | if (errno == EROFS) { | 149 | if (errno == EROFS) { |
150 | errorMsg("%s is write-protected, mounting read-only\n", specialfile); | 150 | error_msg("%s is write-protected, mounting read-only\n", specialfile); |
151 | status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags); | 151 | status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags); |
152 | } | 152 | } |
153 | } | 153 | } |
@@ -173,7 +173,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | if (errno == EPERM) { | 175 | if (errno == EPERM) { |
176 | fatalError("permission denied. Are you root?\n"); | 176 | error_msg_and_die("permission denied. Are you root?\n"); |
177 | } | 177 | } |
178 | 178 | ||
179 | return (FALSE); | 179 | return (FALSE); |
@@ -273,18 +273,18 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
273 | /* open device */ | 273 | /* open device */ |
274 | fd = open(device, O_RDONLY); | 274 | fd = open(device, O_RDONLY); |
275 | if (fd < 0) | 275 | if (fd < 0) |
276 | fatalError("open failed for `%s': %s\n", device, strerror (errno)); | 276 | error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno)); |
277 | 277 | ||
278 | /* How many filesystems? We need to know to allocate enough space */ | 278 | /* How many filesystems? We need to know to allocate enough space */ |
279 | numfilesystems = ioctl (fd, DEVMTAB_COUNT_FILESYSTEMS); | 279 | numfilesystems = ioctl (fd, DEVMTAB_COUNT_FILESYSTEMS); |
280 | if (numfilesystems<0) | 280 | if (numfilesystems<0) |
281 | fatalError("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno)); | 281 | error_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno)); |
282 | fslist = (struct k_fstype *) xcalloc ( numfilesystems, sizeof(struct k_fstype)); | 282 | fslist = (struct k_fstype *) xcalloc ( numfilesystems, sizeof(struct k_fstype)); |
283 | 283 | ||
284 | /* Grab the list of available filesystems */ | 284 | /* Grab the list of available filesystems */ |
285 | status = ioctl (fd, DEVMTAB_GET_FILESYSTEMS, fslist); | 285 | status = ioctl (fd, DEVMTAB_GET_FILESYSTEMS, fslist); |
286 | if (status<0) | 286 | if (status<0) |
287 | fatalError("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno)); | 287 | error_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno)); |
288 | 288 | ||
289 | /* Walk the list trying to mount filesystems | 289 | /* Walk the list trying to mount filesystems |
290 | * that do not claim to be nodev filesystems */ | 290 | * that do not claim to be nodev filesystems */ |
@@ -309,7 +309,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
309 | 309 | ||
310 | if (status == FALSE) { | 310 | if (status == FALSE) { |
311 | if (whineOnErrors == TRUE) { | 311 | if (whineOnErrors == TRUE) { |
312 | errorMsg("Mounting %s on %s failed: %s\n", | 312 | error_msg("Mounting %s on %s failed: %s\n", |
313 | blockDevice, directory, strerror(errno)); | 313 | blockDevice, directory, strerror(errno)); |
314 | } | 314 | } |
315 | return (FALSE); | 315 | return (FALSE); |
@@ -342,18 +342,18 @@ extern int mount_main(int argc, char **argv) | |||
342 | /* open device */ | 342 | /* open device */ |
343 | fd = open(device, O_RDONLY); | 343 | fd = open(device, O_RDONLY); |
344 | if (fd < 0) | 344 | if (fd < 0) |
345 | fatalError("open failed for `%s': %s\n", device, strerror (errno)); | 345 | error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno)); |
346 | 346 | ||
347 | /* How many mounted filesystems? We need to know to | 347 | /* How many mounted filesystems? We need to know to |
348 | * allocate enough space for later... */ | 348 | * allocate enough space for later... */ |
349 | numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS); | 349 | numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS); |
350 | if (numfilesystems<0) | 350 | if (numfilesystems<0) |
351 | fatalError( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno)); | 351 | error_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno)); |
352 | mntentlist = (struct k_mntent *) xcalloc ( numfilesystems, sizeof(struct k_mntent)); | 352 | mntentlist = (struct k_mntent *) xcalloc ( numfilesystems, sizeof(struct k_mntent)); |
353 | 353 | ||
354 | /* Grab the list of mounted filesystems */ | 354 | /* Grab the list of mounted filesystems */ |
355 | if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0) | 355 | if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0) |
356 | fatalError( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno)); | 356 | error_msg_and_die( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno)); |
357 | 357 | ||
358 | for( i = 0 ; i < numfilesystems ; i++) { | 358 | for( i = 0 ; i < numfilesystems ; i++) { |
359 | fprintf( stdout, "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname, | 359 | fprintf( stdout, "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname, |
@@ -455,7 +455,7 @@ extern int mount_main(int argc, char **argv) | |||
455 | fstabmount = TRUE; | 455 | fstabmount = TRUE; |
456 | 456 | ||
457 | if (f == NULL) | 457 | if (f == NULL) |
458 | fatalError( "\nCannot read /etc/fstab: %s\n", strerror (errno)); | 458 | error_msg_and_die( "\nCannot read /etc/fstab: %s\n", strerror (errno)); |
459 | 459 | ||
460 | while ((m = getmntent(f)) != NULL) { | 460 | while ((m = getmntent(f)) != NULL) { |
461 | if (all == FALSE && directory == NULL && ( | 461 | if (all == FALSE && directory == NULL && ( |
@@ -488,7 +488,7 @@ singlemount: | |||
488 | rc = nfsmount (device, directory, &flags, | 488 | rc = nfsmount (device, directory, &flags, |
489 | &extra_opts, &string_flags, 1); | 489 | &extra_opts, &string_flags, 1); |
490 | if ( rc != 0) { | 490 | if ( rc != 0) { |
491 | fatalError("nfsmount failed: %s\n", strerror(errno)); | 491 | error_msg_and_die("nfsmount failed: %s\n", strerror(errno)); |
492 | rc = EXIT_FAILURE; | 492 | rc = EXIT_FAILURE; |
493 | } | 493 | } |
494 | } | 494 | } |
@@ -75,7 +75,7 @@ extern int mt_main(int argc, char **argv) | |||
75 | } | 75 | } |
76 | 76 | ||
77 | if (code->name == 0) { | 77 | if (code->name == 0) { |
78 | errorMsg("unrecognized opcode %s.\n", argv[1]); | 78 | error_msg("unrecognized opcode %s.\n", argv[1]); |
79 | return EXIT_FAILURE; | 79 | return EXIT_FAILURE; |
80 | } | 80 | } |
81 | 81 | ||
@@ -76,7 +76,7 @@ void write_mtab(char *blockDevice, char *directory, | |||
76 | 76 | ||
77 | #ifdef BB_FEATURE_USE_PROCFS | 77 | #ifdef BB_FEATURE_USE_PROCFS |
78 | if (filesystemType == 0) { | 78 | if (filesystemType == 0) { |
79 | struct mntent *p = findMountPoint(blockDevice, "/proc/mounts"); | 79 | struct mntent *p = find_mount_point(blockDevice, "/proc/mounts"); |
80 | 80 | ||
81 | if (p && p->mnt_type) | 81 | if (p && p->mnt_type) |
82 | filesystemType = p->mnt_type; | 82 | filesystemType = p->mnt_type; |
@@ -63,7 +63,7 @@ int nc_main(int argc, char **argv) | |||
63 | hostinfo = (struct hostent *) gethostbyname(*argv); | 63 | hostinfo = (struct hostent *) gethostbyname(*argv); |
64 | 64 | ||
65 | if (!hostinfo) { | 65 | if (!hostinfo) { |
66 | fatalError("cannot resolve %s\n", *argv); | 66 | error_msg_and_die("cannot resolve %s\n", *argv); |
67 | } | 67 | } |
68 | 68 | ||
69 | address.sin_family = AF_INET; | 69 | address.sin_family = AF_INET; |
diff --git a/networking/hostname.c b/networking/hostname.c index 44d529c83..13e52c41d 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.15 2000/10/12 22:30:31 andersen Exp $ | 3 | * $Id: hostname.c,v 1.16 2000/12/07 19:56:48 markw 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> |
@@ -40,7 +40,7 @@ void do_sethostname(char *s, int isfile) | |||
40 | if (!isfile) { | 40 | if (!isfile) { |
41 | if (sethostname(s, strlen(s)) < 0) { | 41 | if (sethostname(s, strlen(s)) < 0) { |
42 | if (errno == EPERM) | 42 | if (errno == EPERM) |
43 | errorMsg("you must be root to change the hostname\n"); | 43 | error_msg("you must be root to change the hostname\n"); |
44 | else | 44 | else |
45 | perror("sethostname"); | 45 | perror("sethostname"); |
46 | exit(1); | 46 | exit(1); |
diff --git a/networking/nc.c b/networking/nc.c index fcacb0c45..805bbd4d8 100644 --- a/networking/nc.c +++ b/networking/nc.c | |||
@@ -63,7 +63,7 @@ int nc_main(int argc, char **argv) | |||
63 | hostinfo = (struct hostent *) gethostbyname(*argv); | 63 | hostinfo = (struct hostent *) gethostbyname(*argv); |
64 | 64 | ||
65 | if (!hostinfo) { | 65 | if (!hostinfo) { |
66 | fatalError("cannot resolve %s\n", *argv); | 66 | error_msg_and_die("cannot resolve %s\n", *argv); |
67 | } | 67 | } |
68 | 68 | ||
69 | address.sin_family = AF_INET; | 69 | address.sin_family = AF_INET; |
diff --git a/networking/ping.c b/networking/ping.c index af109cf0a..ccc535b26 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.27 2000/12/01 02:55:13 kraai Exp $ | 3 | * $Id: ping.c,v 1.28 2000/12/07 19:56:48 markw 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> |
@@ -202,7 +202,7 @@ static void ping(const char *host) | |||
202 | 202 | ||
203 | pingaddr.sin_family = AF_INET; | 203 | pingaddr.sin_family = AF_INET; |
204 | if (!(h = gethostbyname(host))) { | 204 | if (!(h = gethostbyname(host))) { |
205 | errorMsg("unknown host %s\n", host); | 205 | error_msg("unknown host %s\n", host); |
206 | exit(1); | 206 | exit(1); |
207 | } | 207 | } |
208 | memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); | 208 | memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); |
@@ -219,7 +219,7 @@ static void ping(const char *host) | |||
219 | if (c < 0 || c != sizeof(packet)) { | 219 | if (c < 0 || c != sizeof(packet)) { |
220 | if (c < 0) | 220 | if (c < 0) |
221 | perror("ping: sendto"); | 221 | perror("ping: sendto"); |
222 | errorMsg("write incomplete\n"); | 222 | error_msg("write incomplete\n"); |
223 | exit(1); | 223 | exit(1); |
224 | } | 224 | } |
225 | 225 | ||
@@ -325,9 +325,9 @@ static void sendping(int junk) | |||
325 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); | 325 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); |
326 | 326 | ||
327 | if (i < 0) | 327 | if (i < 0) |
328 | fatalError("sendto: %s\n", strerror(errno)); | 328 | error_msg_and_die("sendto: %s\n", strerror(errno)); |
329 | else if ((size_t)i != sizeof(packet)) | 329 | else if ((size_t)i != sizeof(packet)) |
330 | fatalError("ping wrote %d chars; %d expected\n", i, | 330 | error_msg_and_die("ping wrote %d chars; %d expected\n", i, |
331 | (int)sizeof(packet)); | 331 | (int)sizeof(packet)); |
332 | 332 | ||
333 | signal(SIGALRM, sendping); | 333 | signal(SIGALRM, sendping); |
@@ -422,7 +422,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) | |||
422 | printf("\n"); | 422 | printf("\n"); |
423 | } else | 423 | } else |
424 | if (icmppkt->icmp_type != ICMP_ECHO) | 424 | if (icmppkt->icmp_type != ICMP_ECHO) |
425 | errorMsg("Warning: Got ICMP %d (%s)\n", | 425 | error_msg("Warning: Got ICMP %d (%s)\n", |
426 | icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); | 426 | icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); |
427 | } | 427 | } |
428 | 428 | ||
@@ -440,7 +440,7 @@ static void ping(const char *host) | |||
440 | if ((pingsock = socket(AF_INET, SOCK_RAW, | 440 | if ((pingsock = socket(AF_INET, SOCK_RAW, |
441 | (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */ | 441 | (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */ |
442 | if (errno == EPERM) { | 442 | if (errno == EPERM) { |
443 | errorMsg("permission denied. (are you root?)\n"); | 443 | error_msg("permission denied. (are you root?)\n"); |
444 | } else { | 444 | } else { |
445 | perror("ping: creating a raw socket"); | 445 | perror("ping: creating a raw socket"); |
446 | } | 446 | } |
@@ -454,12 +454,12 @@ static void ping(const char *host) | |||
454 | 454 | ||
455 | pingaddr.sin_family = AF_INET; | 455 | pingaddr.sin_family = AF_INET; |
456 | if (!(h = gethostbyname(host))) { | 456 | if (!(h = gethostbyname(host))) { |
457 | errorMsg("unknown host %s\n", host); | 457 | error_msg("unknown host %s\n", host); |
458 | exit(1); | 458 | exit(1); |
459 | } | 459 | } |
460 | 460 | ||
461 | if (h->h_addrtype != AF_INET) { | 461 | if (h->h_addrtype != AF_INET) { |
462 | errorMsg("unknown address type; only AF_INET is currently supported.\n"); | 462 | error_msg("unknown address type; only AF_INET is currently supported.\n"); |
463 | exit(1); | 463 | exit(1); |
464 | } | 464 | } |
465 | 465 | ||
diff --git a/networking/telnet.c b/networking/telnet.c index bfa964460..7a7bcfb9f 100644 --- a/networking/telnet.c +++ b/networking/telnet.c | |||
@@ -583,7 +583,7 @@ static int getport(char * p) | |||
583 | 583 | ||
584 | if ((unsigned)(port - 1 ) > 65534) | 584 | if ((unsigned)(port - 1 ) > 65534) |
585 | { | 585 | { |
586 | fatalError("%s: bad port number\n", p); | 586 | error_msg_and_die("%s: bad port number\n", p); |
587 | } | 587 | } |
588 | return port; | 588 | return port; |
589 | } | 589 | } |
@@ -595,7 +595,7 @@ static struct in_addr getserver(char * host) | |||
595 | struct hostent * he; | 595 | struct hostent * he; |
596 | if ((he = gethostbyname(host)) == NULL) | 596 | if ((he = gethostbyname(host)) == NULL) |
597 | { | 597 | { |
598 | fatalError("%s: Unknown host\n", host); | 598 | error_msg_and_die("%s: Unknown host\n", host); |
599 | } | 599 | } |
600 | memcpy(&addr, he->h_addr, sizeof addr); | 600 | memcpy(&addr, he->h_addr, sizeof addr); |
601 | 601 | ||
@@ -650,7 +650,7 @@ static int remote_connect(struct in_addr addr, int port) | |||
650 | 650 | ||
651 | if (connect(s, (struct sockaddr *)&s_addr, sizeof s_addr) < 0) | 651 | if (connect(s, (struct sockaddr *)&s_addr, sizeof s_addr) < 0) |
652 | { | 652 | { |
653 | fatalError("Unable to connect to remote host: %s\n", strerror(errno)); | 653 | error_msg_and_die("Unable to connect to remote host: %s\n", strerror(errno)); |
654 | } | 654 | } |
655 | return s; | 655 | return s; |
656 | } | 656 | } |
diff --git a/networking/wget.c b/networking/wget.c index b43bbad62..0ec4dff19 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -100,7 +100,7 @@ int wget_main(int argc, char **argv) | |||
100 | 100 | ||
101 | 101 | ||
102 | if (do_continue && !fname_out) | 102 | if (do_continue && !fname_out) |
103 | fatalError("cannot specify continue (-c) without a filename (-O)\n"); | 103 | error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n"); |
104 | /* | 104 | /* |
105 | * Parse url into components. | 105 | * Parse url into components. |
106 | */ | 106 | */ |
@@ -117,7 +117,7 @@ int wget_main(int argc, char **argv) | |||
117 | if (fname_out != (char *)1) { | 117 | if (fname_out != (char *)1) { |
118 | if ( (output=fopen(fname_out, (do_continue ? "a" : "w"))) | 118 | if ( (output=fopen(fname_out, (do_continue ? "a" : "w"))) |
119 | == NULL) | 119 | == NULL) |
120 | fatalPerror("fopen(%s)", fname_out); | 120 | perror_msg_and_die("fopen(%s)", fname_out); |
121 | } else { | 121 | } else { |
122 | output = stdout; | 122 | output = stdout; |
123 | } | 123 | } |
@@ -128,7 +128,7 @@ int wget_main(int argc, char **argv) | |||
128 | if (do_continue) { | 128 | if (do_continue) { |
129 | struct stat sbuf; | 129 | struct stat sbuf; |
130 | if (fstat(fileno(output), &sbuf) < 0) | 130 | if (fstat(fileno(output), &sbuf) < 0) |
131 | fatalError("fstat()"); | 131 | error_msg_and_die("fstat()"); |
132 | if (sbuf.st_size > 0) | 132 | if (sbuf.st_size > 0) |
133 | beg_range = sbuf.st_size; | 133 | beg_range = sbuf.st_size; |
134 | else | 134 | else |
@@ -147,7 +147,7 @@ int wget_main(int argc, char **argv) | |||
147 | * Retrieve HTTP response line and check for "200" status code. | 147 | * Retrieve HTTP response line and check for "200" status code. |
148 | */ | 148 | */ |
149 | if (fgets(buf, sizeof(buf), sfp) == NULL) | 149 | if (fgets(buf, sizeof(buf), sfp) == NULL) |
150 | fatalError("no response from server\n"); | 150 | error_msg_and_die("no response from server\n"); |
151 | for (s = buf ; *s != '\0' && !isspace(*s) ; ++s) | 151 | for (s = buf ; *s != '\0' && !isspace(*s) ; ++s) |
152 | ; | 152 | ; |
153 | for ( ; isspace(*s) ; ++s) | 153 | for ( ; isspace(*s) ; ++s) |
@@ -156,13 +156,13 @@ int wget_main(int argc, char **argv) | |||
156 | case 200: | 156 | case 200: |
157 | if (!do_continue) | 157 | if (!do_continue) |
158 | break; | 158 | break; |
159 | fatalError("server does not support ranges\n"); | 159 | error_msg_and_die("server does not support ranges\n"); |
160 | case 206: | 160 | case 206: |
161 | if (do_continue) | 161 | if (do_continue) |
162 | break; | 162 | break; |
163 | /*FALLTHRU*/ | 163 | /*FALLTHRU*/ |
164 | default: | 164 | default: |
165 | fatalError("server returned error: %s", buf); | 165 | error_msg_and_die("server returned error: %s", buf); |
166 | } | 166 | } |
167 | 167 | ||
168 | /* | 168 | /* |
@@ -175,7 +175,7 @@ int wget_main(int argc, char **argv) | |||
175 | continue; | 175 | continue; |
176 | } | 176 | } |
177 | if (strcmp(buf, "transfer-encoding") == 0) { | 177 | if (strcmp(buf, "transfer-encoding") == 0) { |
178 | fatalError("server wants to do %s transfer encoding\n", s); | 178 | error_msg_and_die("server wants to do %s transfer encoding\n", s); |
179 | continue; | 179 | continue; |
180 | } | 180 | } |
181 | } | 181 | } |
@@ -197,7 +197,7 @@ int wget_main(int argc, char **argv) | |||
197 | filesize -= n; | 197 | filesize -= n; |
198 | } | 198 | } |
199 | if (n == 0 && ferror(sfp)) | 199 | if (n == 0 && ferror(sfp)) |
200 | fatalPerror("network read error"); | 200 | perror_msg_and_die("network read error"); |
201 | 201 | ||
202 | exit(0); | 202 | exit(0); |
203 | } | 203 | } |
@@ -211,7 +211,7 @@ void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path) | |||
211 | *uri_port = 80; | 211 | *uri_port = 80; |
212 | 212 | ||
213 | if (strncmp(url, "http://", 7) != 0) | 213 | if (strncmp(url, "http://", 7) != 0) |
214 | fatalError("not an http url: %s\n", url); | 214 | error_msg_and_die("not an http url: %s\n", url); |
215 | 215 | ||
216 | /* pull the host portion to the front of the buffer */ | 216 | /* pull the host portion to the front of the buffer */ |
217 | for (s = url, h = url+7 ; *h != '/' && *h != 0; ++h) { | 217 | for (s = url, h = url+7 ; *h != '/' && *h != 0; ++h) { |
@@ -240,7 +240,7 @@ FILE *open_socket(char *host, int port) | |||
240 | memzero(&sin, sizeof(sin)); | 240 | memzero(&sin, sizeof(sin)); |
241 | sin.sin_family = AF_INET; | 241 | sin.sin_family = AF_INET; |
242 | if ((hp = (struct hostent *) gethostbyname(host)) == NULL) | 242 | if ((hp = (struct hostent *) gethostbyname(host)) == NULL) |
243 | fatalError("cannot resolve %s\n", host); | 243 | error_msg_and_die("cannot resolve %s\n", host); |
244 | memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length); | 244 | memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length); |
245 | sin.sin_port = htons(port); | 245 | sin.sin_port = htons(port); |
246 | 246 | ||
@@ -248,11 +248,11 @@ FILE *open_socket(char *host, int port) | |||
248 | * Get the server onto a stdio stream. | 248 | * Get the server onto a stdio stream. |
249 | */ | 249 | */ |
250 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) | 250 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) |
251 | fatalPerror("socket()"); | 251 | perror_msg_and_die("socket()"); |
252 | if (connect(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0) | 252 | if (connect(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0) |
253 | fatalPerror("connect(%s)", host); | 253 | perror_msg_and_die("connect(%s)", host); |
254 | if ((fp = fdopen(fd, "r+")) == NULL) | 254 | if ((fp = fdopen(fd, "r+")) == NULL) |
255 | fatalPerror("fdopen()"); | 255 | perror_msg_and_die("fdopen()"); |
256 | 256 | ||
257 | return fp; | 257 | return fp; |
258 | } | 258 | } |
@@ -281,7 +281,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc) | |||
281 | 281 | ||
282 | /* verify we are at the end of the header name */ | 282 | /* verify we are at the end of the header name */ |
283 | if (*s != ':') | 283 | if (*s != ':') |
284 | fatalError("bad header line: %s\n", buf); | 284 | error_msg_and_die("bad header line: %s\n", buf); |
285 | 285 | ||
286 | /* locate the start of the header value */ | 286 | /* locate the start of the header value */ |
287 | for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s) | 287 | for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s) |
@@ -475,7 +475,7 @@ progressmeter(int flag) | |||
475 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 475 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
476 | * SUCH DAMAGE. | 476 | * SUCH DAMAGE. |
477 | * | 477 | * |
478 | * $Id: wget.c,v 1.9 2000/12/07 03:55:35 tausq Exp $ | 478 | * $Id: wget.c,v 1.10 2000/12/07 19:56:48 markw Exp $ |
479 | */ | 479 | */ |
480 | 480 | ||
481 | 481 | ||
diff --git a/nfsmount.c b/nfsmount.c index f8735e52c..a8c0b0ea6 100644 --- a/nfsmount.c +++ b/nfsmount.c | |||
@@ -300,7 +300,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
300 | msock = fsock = -1; | 300 | msock = fsock = -1; |
301 | mclient = NULL; | 301 | mclient = NULL; |
302 | if (strlen(spec) >= sizeof(hostdir)) { | 302 | if (strlen(spec) >= sizeof(hostdir)) { |
303 | errorMsg("excessively long host:dir argument\n"); | 303 | error_msg("excessively long host:dir argument\n"); |
304 | goto fail; | 304 | goto fail; |
305 | } | 305 | } |
306 | strcpy(hostdir, spec); | 306 | strcpy(hostdir, spec); |
@@ -312,10 +312,10 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
312 | until they can be fully supported. (mack@sgi.com) */ | 312 | until they can be fully supported. (mack@sgi.com) */ |
313 | if ((s = strchr(hostdir, ','))) { | 313 | if ((s = strchr(hostdir, ','))) { |
314 | *s = '\0'; | 314 | *s = '\0'; |
315 | errorMsg("warning: multiple hostnames not supported\n"); | 315 | error_msg("warning: multiple hostnames not supported\n"); |
316 | } | 316 | } |
317 | } else { | 317 | } else { |
318 | errorMsg("directory to mount not in host:dir format\n"); | 318 | error_msg("directory to mount not in host:dir format\n"); |
319 | goto fail; | 319 | goto fail; |
320 | } | 320 | } |
321 | 321 | ||
@@ -325,11 +325,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
325 | #endif | 325 | #endif |
326 | { | 326 | { |
327 | if ((hp = gethostbyname(hostname)) == NULL) { | 327 | if ((hp = gethostbyname(hostname)) == NULL) { |
328 | errorMsg("can't get address for %s\n", hostname); | 328 | error_msg("can't get address for %s\n", hostname); |
329 | goto fail; | 329 | goto fail; |
330 | } else { | 330 | } else { |
331 | if (hp->h_length > sizeof(struct in_addr)) { | 331 | if (hp->h_length > sizeof(struct in_addr)) { |
332 | errorMsg("got bad hp->h_length\n"); | 332 | error_msg("got bad hp->h_length\n"); |
333 | hp->h_length = sizeof(struct in_addr); | 333 | hp->h_length = sizeof(struct in_addr); |
334 | } | 334 | } |
335 | memcpy(&server_addr.sin_addr, | 335 | memcpy(&server_addr.sin_addr, |
@@ -346,7 +346,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
346 | if (!old_opts) | 346 | if (!old_opts) |
347 | old_opts = ""; | 347 | old_opts = ""; |
348 | if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { | 348 | if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { |
349 | errorMsg("excessively long option argument\n"); | 349 | error_msg("excessively long option argument\n"); |
350 | goto fail; | 350 | goto fail; |
351 | } | 351 | } |
352 | sprintf(new_opts, "%s%saddr=%s", | 352 | sprintf(new_opts, "%s%saddr=%s", |
@@ -506,11 +506,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
506 | data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); | 506 | data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); |
507 | #endif | 507 | #endif |
508 | if (nfsvers > MAX_NFSPROT) { | 508 | if (nfsvers > MAX_NFSPROT) { |
509 | errorMsg("NFSv%d not supported!\n", nfsvers); | 509 | error_msg("NFSv%d not supported!\n", nfsvers); |
510 | return 0; | 510 | return 0; |
511 | } | 511 | } |
512 | if (mountvers > MAX_NFSPROT) { | 512 | if (mountvers > MAX_NFSPROT) { |
513 | errorMsg("NFSv%d not supported!\n", nfsvers); | 513 | error_msg("NFSv%d not supported!\n", nfsvers); |
514 | return 0; | 514 | return 0; |
515 | } | 515 | } |
516 | if (nfsvers && !mountvers) | 516 | if (nfsvers && !mountvers) |
@@ -570,11 +570,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
570 | mount_server_addr.sin_addr.s_addr = inet_addr(hostname); | 570 | mount_server_addr.sin_addr.s_addr = inet_addr(hostname); |
571 | } else { | 571 | } else { |
572 | if ((hp = gethostbyname(mounthost)) == NULL) { | 572 | if ((hp = gethostbyname(mounthost)) == NULL) { |
573 | errorMsg("can't get address for %s\n", hostname); | 573 | error_msg("can't get address for %s\n", hostname); |
574 | goto fail; | 574 | goto fail; |
575 | } else { | 575 | } else { |
576 | if (hp->h_length > sizeof(struct in_addr)) { | 576 | if (hp->h_length > sizeof(struct in_addr)) { |
577 | errorMsg("got bad hp->h_length?\n"); | 577 | error_msg("got bad hp->h_length?\n"); |
578 | hp->h_length = sizeof(struct in_addr); | 578 | hp->h_length = sizeof(struct in_addr); |
579 | } | 579 | } |
580 | mount_server_addr.sin_family = AF_INET; | 580 | mount_server_addr.sin_family = AF_INET; |
@@ -709,7 +709,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
709 | 709 | ||
710 | if (nfsvers == 2) { | 710 | if (nfsvers == 2) { |
711 | if (status.nfsv2.fhs_status != 0) { | 711 | if (status.nfsv2.fhs_status != 0) { |
712 | errorMsg("%s:%s failed, reason given by server: %s\n", | 712 | error_msg("%s:%s failed, reason given by server: %s\n", |
713 | hostname, dirname, | 713 | hostname, dirname, |
714 | nfs_strerror(status.nfsv2.fhs_status)); | 714 | nfs_strerror(status.nfsv2.fhs_status)); |
715 | goto fail; | 715 | goto fail; |
@@ -727,7 +727,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
727 | #if NFS_MOUNT_VERSION >= 4 | 727 | #if NFS_MOUNT_VERSION >= 4 |
728 | fhandle3 *fhandle; | 728 | fhandle3 *fhandle; |
729 | if (status.nfsv3.fhs_status != 0) { | 729 | if (status.nfsv3.fhs_status != 0) { |
730 | errorMsg("%s:%s failed, reason given by server: %s\n", | 730 | error_msg("%s:%s failed, reason given by server: %s\n", |
731 | hostname, dirname, | 731 | hostname, dirname, |
732 | nfs_strerror(status.nfsv3.fhs_status)); | 732 | nfs_strerror(status.nfsv3.fhs_status)); |
733 | goto fail; | 733 | 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.27 2000/12/01 02:55:13 kraai Exp $ | 3 | * $Id: ping.c,v 1.28 2000/12/07 19:56:48 markw 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> |
@@ -202,7 +202,7 @@ static void ping(const char *host) | |||
202 | 202 | ||
203 | pingaddr.sin_family = AF_INET; | 203 | pingaddr.sin_family = AF_INET; |
204 | if (!(h = gethostbyname(host))) { | 204 | if (!(h = gethostbyname(host))) { |
205 | errorMsg("unknown host %s\n", host); | 205 | error_msg("unknown host %s\n", host); |
206 | exit(1); | 206 | exit(1); |
207 | } | 207 | } |
208 | memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); | 208 | memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); |
@@ -219,7 +219,7 @@ static void ping(const char *host) | |||
219 | if (c < 0 || c != sizeof(packet)) { | 219 | if (c < 0 || c != sizeof(packet)) { |
220 | if (c < 0) | 220 | if (c < 0) |
221 | perror("ping: sendto"); | 221 | perror("ping: sendto"); |
222 | errorMsg("write incomplete\n"); | 222 | error_msg("write incomplete\n"); |
223 | exit(1); | 223 | exit(1); |
224 | } | 224 | } |
225 | 225 | ||
@@ -325,9 +325,9 @@ static void sendping(int junk) | |||
325 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); | 325 | (struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in)); |
326 | 326 | ||
327 | if (i < 0) | 327 | if (i < 0) |
328 | fatalError("sendto: %s\n", strerror(errno)); | 328 | error_msg_and_die("sendto: %s\n", strerror(errno)); |
329 | else if ((size_t)i != sizeof(packet)) | 329 | else if ((size_t)i != sizeof(packet)) |
330 | fatalError("ping wrote %d chars; %d expected\n", i, | 330 | error_msg_and_die("ping wrote %d chars; %d expected\n", i, |
331 | (int)sizeof(packet)); | 331 | (int)sizeof(packet)); |
332 | 332 | ||
333 | signal(SIGALRM, sendping); | 333 | signal(SIGALRM, sendping); |
@@ -422,7 +422,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) | |||
422 | printf("\n"); | 422 | printf("\n"); |
423 | } else | 423 | } else |
424 | if (icmppkt->icmp_type != ICMP_ECHO) | 424 | if (icmppkt->icmp_type != ICMP_ECHO) |
425 | errorMsg("Warning: Got ICMP %d (%s)\n", | 425 | error_msg("Warning: Got ICMP %d (%s)\n", |
426 | icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); | 426 | icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); |
427 | } | 427 | } |
428 | 428 | ||
@@ -440,7 +440,7 @@ static void ping(const char *host) | |||
440 | if ((pingsock = socket(AF_INET, SOCK_RAW, | 440 | if ((pingsock = socket(AF_INET, SOCK_RAW, |
441 | (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */ | 441 | (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */ |
442 | if (errno == EPERM) { | 442 | if (errno == EPERM) { |
443 | errorMsg("permission denied. (are you root?)\n"); | 443 | error_msg("permission denied. (are you root?)\n"); |
444 | } else { | 444 | } else { |
445 | perror("ping: creating a raw socket"); | 445 | perror("ping: creating a raw socket"); |
446 | } | 446 | } |
@@ -454,12 +454,12 @@ static void ping(const char *host) | |||
454 | 454 | ||
455 | pingaddr.sin_family = AF_INET; | 455 | pingaddr.sin_family = AF_INET; |
456 | if (!(h = gethostbyname(host))) { | 456 | if (!(h = gethostbyname(host))) { |
457 | errorMsg("unknown host %s\n", host); | 457 | error_msg("unknown host %s\n", host); |
458 | exit(1); | 458 | exit(1); |
459 | } | 459 | } |
460 | 460 | ||
461 | if (h->h_addrtype != AF_INET) { | 461 | if (h->h_addrtype != AF_INET) { |
462 | errorMsg("unknown address type; only AF_INET is currently supported.\n"); | 462 | error_msg("unknown address type; only AF_INET is currently supported.\n"); |
463 | exit(1); | 463 | exit(1); |
464 | } | 464 | } |
465 | 465 | ||
diff --git a/poweroff.c b/poweroff.c index 3101a20dc..007099d4d 100644 --- a/poweroff.c +++ b/poweroff.c | |||
@@ -28,7 +28,7 @@ extern int poweroff_main(int argc, char **argv) | |||
28 | { | 28 | { |
29 | #ifdef BB_FEATURE_LINUXRC | 29 | #ifdef BB_FEATURE_LINUXRC |
30 | /* don't assume init's pid == 1 */ | 30 | /* don't assume init's pid == 1 */ |
31 | return(kill(*(findPidByName("init")), SIGUSR2)); | 31 | return(kill(*(find_pid_by_name("init")), SIGUSR2)); |
32 | #else | 32 | #else |
33 | return(kill(1, SIGUSR2)); | 33 | return(kill(1, SIGUSR2)); |
34 | #endif | 34 | #endif |
diff --git a/procps/kill.c b/procps/kill.c index dd5ca49fa..caaa52a5b 100644 --- a/procps/kill.c +++ b/procps/kill.c | |||
@@ -204,10 +204,10 @@ extern int kill_main(int argc, char **argv) | |||
204 | int pid; | 204 | int pid; |
205 | 205 | ||
206 | if (!isdigit(**argv)) | 206 | if (!isdigit(**argv)) |
207 | fatalError( "Bad PID: %s\n", strerror(errno)); | 207 | error_msg_and_die( "Bad PID: %s\n", strerror(errno)); |
208 | pid = strtol(*argv, NULL, 0); | 208 | pid = strtol(*argv, NULL, 0); |
209 | if (kill(pid, sig) != 0) | 209 | if (kill(pid, sig) != 0) |
210 | fatalError( "Could not kill pid '%d': %s\n", pid, strerror(errno)); | 210 | error_msg_and_die( "Could not kill pid '%d': %s\n", pid, strerror(errno)); |
211 | argv++; | 211 | argv++; |
212 | } | 212 | } |
213 | } | 213 | } |
@@ -219,20 +219,20 @@ extern int kill_main(int argc, char **argv) | |||
219 | while (--argc >= 0) { | 219 | while (--argc >= 0) { |
220 | pid_t* pidList; | 220 | pid_t* pidList; |
221 | 221 | ||
222 | pidList = findPidByName( *argv); | 222 | pidList = find_pid_by_name( *argv); |
223 | if (!pidList) { | 223 | if (!pidList) { |
224 | all_found = FALSE; | 224 | all_found = FALSE; |
225 | errorMsg( "%s: no process killed\n", *argv); | 225 | error_msg( "%s: no process killed\n", *argv); |
226 | } | 226 | } |
227 | 227 | ||
228 | for(; pidList && *pidList!=0; pidList++) { | 228 | for(; pidList && *pidList!=0; pidList++) { |
229 | if (*pidList==myPid) | 229 | if (*pidList==myPid) |
230 | continue; | 230 | continue; |
231 | if (kill(*pidList, sig) != 0) | 231 | if (kill(*pidList, sig) != 0) |
232 | fatalError( "Could not kill pid '%d': %s\n", *pidList, strerror(errno)); | 232 | error_msg_and_die( "Could not kill pid '%d': %s\n", *pidList, strerror(errno)); |
233 | } | 233 | } |
234 | /* Note that we don't bother to free the memory | 234 | /* Note that we don't bother to free the memory |
235 | * allocated in findPidByName(). It will be freed | 235 | * allocated in find_pid_by_name(). It will be freed |
236 | * upon exit, so we can save a byte or two */ | 236 | * upon exit, so we can save a byte or two */ |
237 | argv++; | 237 | argv++; |
238 | } | 238 | } |
@@ -245,5 +245,5 @@ extern int kill_main(int argc, char **argv) | |||
245 | 245 | ||
246 | 246 | ||
247 | end: | 247 | end: |
248 | fatalError( "bad signal name: %s\n", *argv); | 248 | error_msg_and_die( "bad signal name: %s\n", *argv); |
249 | } | 249 | } |
diff --git a/procps/ps.c b/procps/ps.c index 4998e15b1..79910fe34 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 | errorMsg("Internal error!\n"); | 100 | error_msg("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 | errorMsg("Internal error!\n"); | 107 | error_msg("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 | errorMsg("Internal error!\n"); | 113 | error_msg("Internal error!\n"); |
114 | 114 | ||
115 | } | 115 | } |
116 | 116 | ||
@@ -135,7 +135,7 @@ extern int ps_main(int argc, char **argv) | |||
135 | 135 | ||
136 | dir = opendir("/proc"); | 136 | dir = opendir("/proc"); |
137 | if (!dir) | 137 | if (!dir) |
138 | fatalError("Can't open /proc\n"); | 138 | error_msg_and_die("Can't open /proc\n"); |
139 | 139 | ||
140 | #ifdef BB_FEATURE_AUTOWIDTH | 140 | #ifdef BB_FEATURE_AUTOWIDTH |
141 | ioctl(fileno(stdout), TIOCGWINSZ, &win); | 141 | ioctl(fileno(stdout), TIOCGWINSZ, &win); |
@@ -219,11 +219,11 @@ extern int ps_main(int argc, char **argv) | |||
219 | /* open device */ | 219 | /* open device */ |
220 | fd = open(device, O_RDONLY); | 220 | fd = open(device, O_RDONLY); |
221 | if (fd < 0) | 221 | if (fd < 0) |
222 | fatalError( "open failed for `%s': %s\n", device, strerror (errno)); | 222 | error_msg_and_die( "open failed for `%s': %s\n", device, strerror (errno)); |
223 | 223 | ||
224 | /* Find out how many processes there are */ | 224 | /* Find out how many processes there are */ |
225 | if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0) | 225 | if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0) |
226 | fatalError( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno)); | 226 | error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno)); |
227 | 227 | ||
228 | /* Allocate some memory -- grab a few extras just in case | 228 | /* Allocate some memory -- grab a few extras just in case |
229 | * some new processes start up while we wait. The kernel will | 229 | * some new processes start up while we wait. The kernel will |
@@ -234,7 +234,7 @@ extern int ps_main(int argc, char **argv) | |||
234 | 234 | ||
235 | /* Now grab the pid list */ | 235 | /* Now grab the pid list */ |
236 | if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0) | 236 | if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0) |
237 | fatalError("\nDEVPS_GET_PID_LIST: %s\n", strerror (errno)); | 237 | error_msg_and_die("\nDEVPS_GET_PID_LIST: %s\n", strerror (errno)); |
238 | 238 | ||
239 | #ifdef BB_FEATURE_AUTOWIDTH | 239 | #ifdef BB_FEATURE_AUTOWIDTH |
240 | ioctl(fileno(stdout), TIOCGWINSZ, &win); | 240 | ioctl(fileno(stdout), TIOCGWINSZ, &win); |
@@ -252,7 +252,7 @@ extern int ps_main(int argc, char **argv) | |||
252 | info.pid = pid_array[i]; | 252 | info.pid = pid_array[i]; |
253 | 253 | ||
254 | if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0) | 254 | if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0) |
255 | fatalError("\nDEVPS_GET_PID_INFO: %s\n", strerror (errno)); | 255 | error_msg_and_die("\nDEVPS_GET_PID_INFO: %s\n", strerror (errno)); |
256 | 256 | ||
257 | /* Make some adjustments as needed */ | 257 | /* Make some adjustments as needed */ |
258 | my_getpwuid(uidName, info.euid); | 258 | my_getpwuid(uidName, info.euid); |
@@ -282,7 +282,7 @@ extern int ps_main(int argc, char **argv) | |||
282 | 282 | ||
283 | /* close device */ | 283 | /* close device */ |
284 | if (close (fd) != 0) | 284 | if (close (fd) != 0) |
285 | fatalError("close failed for `%s': %s\n", device, strerror (errno)); | 285 | error_msg_and_die("close failed for `%s': %s\n", device, strerror (errno)); |
286 | 286 | ||
287 | exit (0); | 287 | exit (0); |
288 | } | 288 | } |
diff --git a/procps/renice.c b/procps/renice.c index c81f31c5c..8f0618126 100644 --- a/procps/renice.c +++ b/procps/renice.c | |||
@@ -44,7 +44,7 @@ extern int renice_main(int argc, char **argv) | |||
44 | if (setpriority(PRIO_PROCESS, ps, prio) == 0) { | 44 | if (setpriority(PRIO_PROCESS, ps, prio) == 0) { |
45 | printf("%d: old priority %d, new priority %d\n", ps, oldp, prio ); | 45 | printf("%d: old priority %d, new priority %d\n", ps, oldp, prio ); |
46 | } else { | 46 | } else { |
47 | perrorMsg("%d: setpriority", ps); | 47 | perror_msg("%d: setpriority", ps); |
48 | status = EXIT_FAILURE; | 48 | status = EXIT_FAILURE; |
49 | } | 49 | } |
50 | } | 50 | } |
@@ -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 | errorMsg("Internal error!\n"); | 100 | error_msg("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 | errorMsg("Internal error!\n"); | 107 | error_msg("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 | errorMsg("Internal error!\n"); | 113 | error_msg("Internal error!\n"); |
114 | 114 | ||
115 | } | 115 | } |
116 | 116 | ||
@@ -135,7 +135,7 @@ extern int ps_main(int argc, char **argv) | |||
135 | 135 | ||
136 | dir = opendir("/proc"); | 136 | dir = opendir("/proc"); |
137 | if (!dir) | 137 | if (!dir) |
138 | fatalError("Can't open /proc\n"); | 138 | error_msg_and_die("Can't open /proc\n"); |
139 | 139 | ||
140 | #ifdef BB_FEATURE_AUTOWIDTH | 140 | #ifdef BB_FEATURE_AUTOWIDTH |
141 | ioctl(fileno(stdout), TIOCGWINSZ, &win); | 141 | ioctl(fileno(stdout), TIOCGWINSZ, &win); |
@@ -219,11 +219,11 @@ extern int ps_main(int argc, char **argv) | |||
219 | /* open device */ | 219 | /* open device */ |
220 | fd = open(device, O_RDONLY); | 220 | fd = open(device, O_RDONLY); |
221 | if (fd < 0) | 221 | if (fd < 0) |
222 | fatalError( "open failed for `%s': %s\n", device, strerror (errno)); | 222 | error_msg_and_die( "open failed for `%s': %s\n", device, strerror (errno)); |
223 | 223 | ||
224 | /* Find out how many processes there are */ | 224 | /* Find out how many processes there are */ |
225 | if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0) | 225 | if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0) |
226 | fatalError( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno)); | 226 | error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno)); |
227 | 227 | ||
228 | /* Allocate some memory -- grab a few extras just in case | 228 | /* Allocate some memory -- grab a few extras just in case |
229 | * some new processes start up while we wait. The kernel will | 229 | * some new processes start up while we wait. The kernel will |
@@ -234,7 +234,7 @@ extern int ps_main(int argc, char **argv) | |||
234 | 234 | ||
235 | /* Now grab the pid list */ | 235 | /* Now grab the pid list */ |
236 | if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0) | 236 | if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0) |
237 | fatalError("\nDEVPS_GET_PID_LIST: %s\n", strerror (errno)); | 237 | error_msg_and_die("\nDEVPS_GET_PID_LIST: %s\n", strerror (errno)); |
238 | 238 | ||
239 | #ifdef BB_FEATURE_AUTOWIDTH | 239 | #ifdef BB_FEATURE_AUTOWIDTH |
240 | ioctl(fileno(stdout), TIOCGWINSZ, &win); | 240 | ioctl(fileno(stdout), TIOCGWINSZ, &win); |
@@ -252,7 +252,7 @@ extern int ps_main(int argc, char **argv) | |||
252 | info.pid = pid_array[i]; | 252 | info.pid = pid_array[i]; |
253 | 253 | ||
254 | if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0) | 254 | if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0) |
255 | fatalError("\nDEVPS_GET_PID_INFO: %s\n", strerror (errno)); | 255 | error_msg_and_die("\nDEVPS_GET_PID_INFO: %s\n", strerror (errno)); |
256 | 256 | ||
257 | /* Make some adjustments as needed */ | 257 | /* Make some adjustments as needed */ |
258 | my_getpwuid(uidName, info.euid); | 258 | my_getpwuid(uidName, info.euid); |
@@ -282,7 +282,7 @@ extern int ps_main(int argc, char **argv) | |||
282 | 282 | ||
283 | /* close device */ | 283 | /* close device */ |
284 | if (close (fd) != 0) | 284 | if (close (fd) != 0) |
285 | fatalError("close failed for `%s': %s\n", device, strerror (errno)); | 285 | error_msg_and_die("close failed for `%s': %s\n", device, strerror (errno)); |
286 | 286 | ||
287 | exit (0); | 287 | exit (0); |
288 | } | 288 | } |
@@ -31,7 +31,7 @@ extern int pwd_main(int argc, char **argv) | |||
31 | char buf[BUFSIZ + 1]; | 31 | char buf[BUFSIZ + 1]; |
32 | 32 | ||
33 | if (getcwd(buf, sizeof(buf)) == NULL) | 33 | if (getcwd(buf, sizeof(buf)) == NULL) |
34 | fatalError("%s\n", strerror(errno)); | 34 | error_msg_and_die("%s\n", strerror(errno)); |
35 | 35 | ||
36 | printf("%s\n", buf); | 36 | printf("%s\n", buf); |
37 | return EXIT_SUCCESS; | 37 | return EXIT_SUCCESS; |
@@ -47,15 +47,15 @@ time_t askremotedate(char *host) | |||
47 | int fd; | 47 | int fd; |
48 | 48 | ||
49 | if (!(h = gethostbyname(host))) { /* get the IP addr */ | 49 | if (!(h = gethostbyname(host))) { /* get the IP addr */ |
50 | errorMsg("%s: %s\n", host, strerror(errno)); | 50 | error_msg("%s: %s\n", host, strerror(errno)); |
51 | return(-1); | 51 | return(-1); |
52 | } | 52 | } |
53 | if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */ | 53 | if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */ |
54 | errorMsg("%s: %s\n", "time", strerror(errno)); | 54 | error_msg("%s: %s\n", "time", strerror(errno)); |
55 | return(-1); | 55 | return(-1); |
56 | } | 56 | } |
57 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { /* get net connection */ | 57 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { /* get net connection */ |
58 | errorMsg("%s: %s\n", "socket", strerror(errno)); | 58 | error_msg("%s: %s\n", "socket", strerror(errno)); |
59 | return(-1); | 59 | return(-1); |
60 | } | 60 | } |
61 | 61 | ||
@@ -64,13 +64,13 @@ time_t askremotedate(char *host) | |||
64 | sin.sin_family = AF_INET; | 64 | sin.sin_family = AF_INET; |
65 | 65 | ||
66 | if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { /* connect to time server */ | 66 | if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { /* connect to time server */ |
67 | errorMsg("%s: %s\n", host, strerror(errno)); | 67 | error_msg("%s: %s\n", host, strerror(errno)); |
68 | close(fd); | 68 | close(fd); |
69 | return(-1); | 69 | return(-1); |
70 | } | 70 | } |
71 | if (read(fd, (void *)&nett, 4) != 4) { /* read time from server */ | 71 | if (read(fd, (void *)&nett, 4) != 4) { /* read time from server */ |
72 | close(fd); | 72 | close(fd); |
73 | errorMsg("%s did not send the complete time\n", host); | 73 | error_msg("%s did not send the complete time\n", host); |
74 | } | 74 | } |
75 | close(fd); | 75 | close(fd); |
76 | 76 | ||
@@ -123,7 +123,7 @@ int rdate_main(int argc, char **argv) | |||
123 | } | 123 | } |
124 | if (setdate) { | 124 | if (setdate) { |
125 | if (stime(&time) < 0) | 125 | if (stime(&time) < 0) |
126 | fatalError("Could not set time of day: %s\n", strerror(errno)); | 126 | error_msg_and_die("Could not set time of day: %s\n", strerror(errno)); |
127 | } | 127 | } |
128 | if (printdate) { | 128 | if (printdate) { |
129 | fprintf(stdout, "%s", ctime(&time)); | 129 | fprintf(stdout, "%s", ctime(&time)); |
diff --git a/readlink.c b/readlink.c index 5a798c0ea..bb40b0787 100644 --- a/readlink.c +++ b/readlink.c | |||
@@ -39,7 +39,7 @@ int readlink_main(int argc, char **argv) | |||
39 | buf = xrealloc(buf, bufsize); | 39 | buf = xrealloc(buf, bufsize); |
40 | size = readlink(argv[1], buf, bufsize); | 40 | size = readlink(argv[1], buf, bufsize); |
41 | if (size == -1) | 41 | if (size == -1) |
42 | fatalError("%s: %s\n", argv[1], strerror(errno)); | 42 | error_msg_and_die("%s: %s\n", argv[1], strerror(errno)); |
43 | } | 43 | } |
44 | 44 | ||
45 | buf[size] = '\0'; | 45 | buf[size] = '\0'; |
@@ -28,7 +28,7 @@ extern int reboot_main(int argc, char **argv) | |||
28 | { | 28 | { |
29 | #ifdef BB_FEATURE_LINUXRC | 29 | #ifdef BB_FEATURE_LINUXRC |
30 | /* don't assume init's pid == 1 */ | 30 | /* don't assume init's pid == 1 */ |
31 | return(kill(*(findPidByName("init")), SIGINT)); | 31 | return(kill(*(find_pid_by_name("init")), SIGINT)); |
32 | #else | 32 | #else |
33 | return(kill(1, SIGINT)); | 33 | return(kill(1, SIGINT)); |
34 | #endif | 34 | #endif |
@@ -44,7 +44,7 @@ extern int renice_main(int argc, char **argv) | |||
44 | if (setpriority(PRIO_PROCESS, ps, prio) == 0) { | 44 | if (setpriority(PRIO_PROCESS, ps, prio) == 0) { |
45 | printf("%d: old priority %d, new priority %d\n", ps, oldp, prio ); | 45 | printf("%d: old priority %d, new priority %d\n", ps, oldp, prio ); |
46 | } else { | 46 | } else { |
47 | perrorMsg("%d: setpriority", ps); | 47 | perror_msg("%d: setpriority", ps); |
48 | status = EXIT_FAILURE; | 48 | status = EXIT_FAILURE; |
49 | } | 49 | } |
50 | } | 50 | } |
@@ -37,7 +37,7 @@ static const char *srcName; | |||
37 | static int fileAction(const char *fileName, struct stat *statbuf, void* junk) | 37 | static int fileAction(const char *fileName, struct stat *statbuf, void* junk) |
38 | { | 38 | { |
39 | if (unlink(fileName) < 0) { | 39 | if (unlink(fileName) < 0) { |
40 | perrorMsg("%s", fileName); | 40 | perror_msg("%s", fileName); |
41 | return (FALSE); | 41 | return (FALSE); |
42 | } | 42 | } |
43 | return (TRUE); | 43 | return (TRUE); |
@@ -47,11 +47,11 @@ static int dirAction(const char *fileName, struct stat *statbuf, void* junk) | |||
47 | { | 47 | { |
48 | if (recursiveFlag == FALSE) { | 48 | if (recursiveFlag == FALSE) { |
49 | errno = EISDIR; | 49 | errno = EISDIR; |
50 | perrorMsg("%s", fileName); | 50 | perror_msg("%s", fileName); |
51 | return (FALSE); | 51 | return (FALSE); |
52 | } | 52 | } |
53 | if (rmdir(fileName) < 0) { | 53 | if (rmdir(fileName) < 0) { |
54 | perrorMsg("%s", fileName); | 54 | perror_msg("%s", fileName); |
55 | return (FALSE); | 55 | return (FALSE); |
56 | } | 56 | } |
57 | return (TRUE); | 57 | return (TRUE); |
@@ -101,7 +101,7 @@ extern int rm_main(int argc, char **argv) | |||
101 | && errno == ENOENT) { | 101 | && errno == ENOENT) { |
102 | /* do not reports errors for non-existent files if -f, just skip them */ | 102 | /* do not reports errors for non-existent files if -f, just skip them */ |
103 | } else { | 103 | } else { |
104 | if (recursiveAction(srcName, recursiveFlag, FALSE, | 104 | if (recursive_action(srcName, recursiveFlag, FALSE, |
105 | TRUE, fileAction, dirAction, NULL) == FALSE) { | 105 | TRUE, fileAction, dirAction, NULL) == FALSE) { |
106 | status = EXIT_FAILURE; | 106 | status = EXIT_FAILURE; |
107 | } | 107 | } |
@@ -35,7 +35,7 @@ extern int rmdir_main(int argc, char **argv) | |||
35 | 35 | ||
36 | while (--argc > 0) { | 36 | while (--argc > 0) { |
37 | if (rmdir(*(++argv)) == -1) { | 37 | if (rmdir(*(++argv)) == -1) { |
38 | perrorMsg("%s", *argv); | 38 | perror_msg("%s", *argv); |
39 | status = EXIT_FAILURE; | 39 | status = EXIT_FAILURE; |
40 | } | 40 | } |
41 | } | 41 | } |
@@ -215,14 +215,14 @@ static int get_address(const char *str, int *line, regex_t **regex) | |||
215 | else if (my_str[idx] == '/') { | 215 | else if (my_str[idx] == '/') { |
216 | idx = index_of_next_unescaped_slash(my_str, ++idx); | 216 | idx = index_of_next_unescaped_slash(my_str, ++idx); |
217 | if (idx == -1) | 217 | if (idx == -1) |
218 | fatalError("unterminated match expression\n"); | 218 | error_msg_and_die("unterminated match expression\n"); |
219 | my_str[idx] = '\0'; | 219 | my_str[idx] = '\0'; |
220 | *regex = (regex_t *)xmalloc(sizeof(regex_t)); | 220 | *regex = (regex_t *)xmalloc(sizeof(regex_t)); |
221 | xregcomp(*regex, my_str+1, 0); | 221 | xregcomp(*regex, my_str+1, 0); |
222 | idx++; /* so it points to the next character after the last '/' */ | 222 | idx++; /* so it points to the next character after the last '/' */ |
223 | } | 223 | } |
224 | else { | 224 | else { |
225 | errorMsg("get_address: no address found in string\n" | 225 | error_msg("get_address: no address found in string\n" |
226 | "\t(you probably didn't check the string you passed me)\n"); | 226 | "\t(you probably didn't check the string you passed me)\n"); |
227 | idx = -1; | 227 | idx = -1; |
228 | } | 228 | } |
@@ -258,13 +258,13 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr) | |||
258 | 258 | ||
259 | /* verify that the 's' is followed by a 'slash' */ | 259 | /* verify that the 's' is followed by a 'slash' */ |
260 | if (substr[++idx] != '/') | 260 | if (substr[++idx] != '/') |
261 | fatalError("bad format in substitution expression\n"); | 261 | error_msg_and_die("bad format in substitution expression\n"); |
262 | 262 | ||
263 | /* save the match string */ | 263 | /* save the match string */ |
264 | oldidx = idx+1; | 264 | oldidx = idx+1; |
265 | idx = index_of_next_unescaped_slash(substr, ++idx); | 265 | idx = index_of_next_unescaped_slash(substr, ++idx); |
266 | if (idx == -1) | 266 | if (idx == -1) |
267 | fatalError("bad format in substitution expression\n"); | 267 | error_msg_and_die("bad format in substitution expression\n"); |
268 | match = strdup_substr(substr, oldidx, idx); | 268 | match = strdup_substr(substr, oldidx, idx); |
269 | 269 | ||
270 | /* determine the number of back references in the match string */ | 270 | /* determine the number of back references in the match string */ |
@@ -283,7 +283,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr) | |||
283 | oldidx = idx+1; | 283 | oldidx = idx+1; |
284 | idx = index_of_next_unescaped_slash(substr, ++idx); | 284 | idx = index_of_next_unescaped_slash(substr, ++idx); |
285 | if (idx == -1) | 285 | if (idx == -1) |
286 | fatalError("bad format in substitution expression\n"); | 286 | error_msg_and_die("bad format in substitution expression\n"); |
287 | sed_cmd->replace = strdup_substr(substr, oldidx, idx); | 287 | sed_cmd->replace = strdup_substr(substr, oldidx, idx); |
288 | 288 | ||
289 | /* process the flags */ | 289 | /* process the flags */ |
@@ -303,7 +303,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr) | |||
303 | if (strchr("; \t\v\n\r", substr[idx])) | 303 | if (strchr("; \t\v\n\r", substr[idx])) |
304 | goto out; | 304 | goto out; |
305 | /* else */ | 305 | /* else */ |
306 | fatalError("bad option in substitution expression\n"); | 306 | error_msg_and_die("bad option in substitution expression\n"); |
307 | } | 307 | } |
308 | } | 308 | } |
309 | 309 | ||
@@ -345,7 +345,7 @@ static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr) | |||
345 | */ | 345 | */ |
346 | 346 | ||
347 | if (editstr[1] != '\\' && (editstr[2] != '\n' || editstr[2] != '\r')) | 347 | if (editstr[1] != '\\' && (editstr[2] != '\n' || editstr[2] != '\r')) |
348 | fatalError("bad format in edit expression\n"); | 348 | error_msg_and_die("bad format in edit expression\n"); |
349 | 349 | ||
350 | /* store the edit line text */ | 350 | /* store the edit line text */ |
351 | /* make editline big enough to accomodate the extra '\n' we will tack on | 351 | /* make editline big enough to accomodate the extra '\n' we will tack on |
@@ -409,9 +409,9 @@ static char *parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) | |||
409 | 409 | ||
410 | /* last part (mandatory) will be a command */ | 410 | /* last part (mandatory) will be a command */ |
411 | if (cmdstr[idx] == '\0') | 411 | if (cmdstr[idx] == '\0') |
412 | fatalError("missing command\n"); | 412 | error_msg_and_die("missing command\n"); |
413 | if (!strchr("pdsaic", cmdstr[idx])) /* <-- XXX add new commands here */ | 413 | if (!strchr("pdsaic", cmdstr[idx])) /* <-- XXX add new commands here */ |
414 | fatalError("invalid command\n"); | 414 | error_msg_and_die("invalid command\n"); |
415 | sed_cmd->cmd = cmdstr[idx]; | 415 | sed_cmd->cmd = cmdstr[idx]; |
416 | 416 | ||
417 | /* special-case handling for (s)ubstitution */ | 417 | /* special-case handling for (s)ubstitution */ |
@@ -421,7 +421,7 @@ static char *parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) | |||
421 | /* special-case handling for (a)ppend, (i)nsert, and (c)hange */ | 421 | /* special-case handling for (a)ppend, (i)nsert, and (c)hange */ |
422 | else if (strchr("aic", cmdstr[idx])) { | 422 | else if (strchr("aic", cmdstr[idx])) { |
423 | if (sed_cmd->end_line || sed_cmd->end_match) | 423 | if (sed_cmd->end_line || sed_cmd->end_match) |
424 | fatalError("only a beginning address can be specified for edit commands\n"); | 424 | error_msg_and_die("only a beginning address can be specified for edit commands\n"); |
425 | idx += parse_edit_cmd(sed_cmd, &cmdstr[idx]); | 425 | idx += parse_edit_cmd(sed_cmd, &cmdstr[idx]); |
426 | } | 426 | } |
427 | /* if it was a single-letter command (such as 'p' or 'd') we need to | 427 | /* if it was a single-letter command (such as 'p' or 'd') we need to |
@@ -757,7 +757,7 @@ extern int sed_main(int argc, char **argv) | |||
757 | for (i = optind; i < argc; i++) { | 757 | for (i = optind; i < argc; i++) { |
758 | file = fopen(argv[i], "r"); | 758 | file = fopen(argv[i], "r"); |
759 | if (file == NULL) { | 759 | if (file == NULL) { |
760 | errorMsg("%s: %s\n", argv[i], strerror(errno)); | 760 | error_msg("%s: %s\n", argv[i], strerror(errno)); |
761 | } else { | 761 | } else { |
762 | process_file(file); | 762 | process_file(file); |
763 | fclose(file); | 763 | fclose(file); |
diff --git a/setkeycodes.c b/setkeycodes.c index 6a31e042a..7db398d77 100644 --- a/setkeycodes.c +++ b/setkeycodes.c | |||
@@ -52,18 +52,18 @@ setkeycodes_main(int argc, char** argv) | |||
52 | a.keycode = atoi(argv[2]); | 52 | a.keycode = atoi(argv[2]); |
53 | a.scancode = sc = strtol(argv[1], &ep, 16); | 53 | a.scancode = sc = strtol(argv[1], &ep, 16); |
54 | if (*ep) { | 54 | if (*ep) { |
55 | fatalError("error reading SCANCODE: '%s'\n", argv[1]); | 55 | error_msg_and_die("error reading SCANCODE: '%s'\n", argv[1]); |
56 | } | 56 | } |
57 | if (a.scancode > 127) { | 57 | if (a.scancode > 127) { |
58 | a.scancode -= 0xe000; | 58 | a.scancode -= 0xe000; |
59 | a.scancode += 128; | 59 | a.scancode += 128; |
60 | } | 60 | } |
61 | if (a.scancode > 255 || a.keycode > 127) { | 61 | if (a.scancode > 255 || a.keycode > 127) { |
62 | fatalError("SCANCODE or KEYCODE outside bounds\n"); | 62 | error_msg_and_die("SCANCODE or KEYCODE outside bounds\n"); |
63 | } | 63 | } |
64 | if (ioctl(fd,KDSETKEYCODE,&a)) { | 64 | if (ioctl(fd,KDSETKEYCODE,&a)) { |
65 | perror("KDSETKEYCODE"); | 65 | perror("KDSETKEYCODE"); |
66 | fatalError("failed to set SCANCODE %x to KEYCODE %d\n", sc, a.keycode); | 66 | error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d\n", sc, a.keycode); |
67 | } | 67 | } |
68 | argc -= 2; | 68 | argc -= 2; |
69 | argv += 2; | 69 | argv += 2; |
@@ -250,7 +250,7 @@ static int builtin_exec(struct job *cmd, struct jobSet *junk) | |||
250 | { | 250 | { |
251 | cmd->progs[0].argv++; | 251 | cmd->progs[0].argv++; |
252 | execvp(cmd->progs[0].argv[0], cmd->progs[0].argv); | 252 | execvp(cmd->progs[0].argv[0], cmd->progs[0].argv); |
253 | fatalError("Exec to %s failed: %s\n", cmd->progs[0].argv[0], | 253 | error_msg_and_die("Exec to %s failed: %s\n", cmd->progs[0].argv[0], |
254 | strerror(errno)); | 254 | strerror(errno)); |
255 | } | 255 | } |
256 | return EXIT_SUCCESS; | 256 | return EXIT_SUCCESS; |
@@ -273,12 +273,12 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) | |||
273 | 273 | ||
274 | if (!jobList->head) { | 274 | if (!jobList->head) { |
275 | if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { | 275 | if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { |
276 | errorMsg("%s: exactly one argument is expected\n", | 276 | error_msg("%s: exactly one argument is expected\n", |
277 | cmd->progs[0].argv[0]); | 277 | cmd->progs[0].argv[0]); |
278 | return EXIT_FAILURE; | 278 | return EXIT_FAILURE; |
279 | } | 279 | } |
280 | if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { | 280 | if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { |
281 | errorMsg("%s: bad argument '%s'\n", | 281 | error_msg("%s: bad argument '%s'\n", |
282 | cmd->progs[0].argv[0], cmd->progs[0].argv[1]); | 282 | cmd->progs[0].argv[0], cmd->progs[0].argv[1]); |
283 | return EXIT_FAILURE; | 283 | return EXIT_FAILURE; |
284 | for (job = jobList->head; job; job = job->next) { | 284 | for (job = jobList->head; job; job = job->next) { |
@@ -292,7 +292,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) | |||
292 | } | 292 | } |
293 | 293 | ||
294 | if (!job) { | 294 | if (!job) { |
295 | errorMsg("%s: unknown job %d\n", | 295 | error_msg("%s: unknown job %d\n", |
296 | cmd->progs[0].argv[0], jobNum); | 296 | cmd->progs[0].argv[0], jobNum); |
297 | return EXIT_FAILURE; | 297 | return EXIT_FAILURE; |
298 | } | 298 | } |
@@ -444,7 +444,7 @@ static int builtin_then(struct job *cmd, struct jobSet *junk) | |||
444 | char* charptr1=cmd->text+5; /* skip over the leading 'then ' */ | 444 | char* charptr1=cmd->text+5; /* skip over the leading 'then ' */ |
445 | 445 | ||
446 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { | 446 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { |
447 | errorMsg("unexpected token `then'\n"); | 447 | error_msg("unexpected token `then'\n"); |
448 | return EXIT_FAILURE; | 448 | return EXIT_FAILURE; |
449 | } | 449 | } |
450 | /* If the if result was FALSE, skip the 'then' stuff */ | 450 | /* If the if result was FALSE, skip the 'then' stuff */ |
@@ -471,7 +471,7 @@ static int builtin_else(struct job *cmd, struct jobSet *junk) | |||
471 | char* charptr1=cmd->text+5; /* skip over the leading 'else ' */ | 471 | char* charptr1=cmd->text+5; /* skip over the leading 'else ' */ |
472 | 472 | ||
473 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { | 473 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { |
474 | errorMsg("unexpected token `else'\n"); | 474 | error_msg("unexpected token `else'\n"); |
475 | return EXIT_FAILURE; | 475 | return EXIT_FAILURE; |
476 | } | 476 | } |
477 | /* If the if result was TRUE, skip the 'else' stuff */ | 477 | /* If the if result was TRUE, skip the 'else' stuff */ |
@@ -495,7 +495,7 @@ static int builtin_else(struct job *cmd, struct jobSet *junk) | |||
495 | static int builtin_fi(struct job *cmd, struct jobSet *junk) | 495 | static int builtin_fi(struct job *cmd, struct jobSet *junk) |
496 | { | 496 | { |
497 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { | 497 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { |
498 | errorMsg("unexpected token `fi'\n"); | 498 | error_msg("unexpected token `fi'\n"); |
499 | return EXIT_FAILURE; | 499 | return EXIT_FAILURE; |
500 | } | 500 | } |
501 | /* Clear out the if and then context bits */ | 501 | /* Clear out the if and then context bits */ |
@@ -646,7 +646,7 @@ static int setupRedirections(struct childProgram *prog) | |||
646 | if (openfd < 0) { | 646 | if (openfd < 0) { |
647 | /* this could get lost if stderr has been redirected, but | 647 | /* this could get lost if stderr has been redirected, but |
648 | bash and ash both lose it as well (though zsh doesn't!) */ | 648 | bash and ash both lose it as well (though zsh doesn't!) */ |
649 | errorMsg("error opening %s: %s\n", redir->filename, | 649 | error_msg("error opening %s: %s\n", redir->filename, |
650 | strerror(errno)); | 650 | strerror(errno)); |
651 | return 1; | 651 | return 1; |
652 | } | 652 | } |
@@ -820,7 +820,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr, | |||
820 | if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){ | 820 | if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){ |
821 | rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->globResult); | 821 | rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->globResult); |
822 | if (rc == GLOB_NOSPACE) { | 822 | if (rc == GLOB_NOSPACE) { |
823 | errorMsg("out of space during glob operation\n"); | 823 | error_msg("out of space during glob operation\n"); |
824 | return; | 824 | return; |
825 | } else if (rc == GLOB_NOMATCH || | 825 | } else if (rc == GLOB_NOMATCH || |
826 | (!rc && (prog->globResult.gl_pathc - i) == 1 && | 826 | (!rc && (prog->globResult.gl_pathc - i) == 1 && |
@@ -927,7 +927,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
927 | if (*src == '\\') { | 927 | if (*src == '\\') { |
928 | src++; | 928 | src++; |
929 | if (!*src) { | 929 | if (!*src) { |
930 | errorMsg("character expected after \\\n"); | 930 | error_msg("character expected after \\\n"); |
931 | freeJob(job); | 931 | freeJob(job); |
932 | return 1; | 932 | return 1; |
933 | } | 933 | } |
@@ -1009,7 +1009,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1009 | chptr++; | 1009 | chptr++; |
1010 | 1010 | ||
1011 | if (!*chptr) { | 1011 | if (!*chptr) { |
1012 | errorMsg("file name expected after %c\n", *src); | 1012 | error_msg("file name expected after %c\n", *src); |
1013 | freeJob(job); | 1013 | freeJob(job); |
1014 | job->numProgs=0; | 1014 | job->numProgs=0; |
1015 | return 1; | 1015 | return 1; |
@@ -1028,7 +1028,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1028 | if (*prog->argv[argc_l]) | 1028 | if (*prog->argv[argc_l]) |
1029 | argc_l++; | 1029 | argc_l++; |
1030 | if (!argc_l) { | 1030 | if (!argc_l) { |
1031 | errorMsg("empty command in pipe\n"); | 1031 | error_msg("empty command in pipe\n"); |
1032 | freeJob(job); | 1032 | freeJob(job); |
1033 | job->numProgs=0; | 1033 | job->numProgs=0; |
1034 | return 1; | 1034 | return 1; |
@@ -1055,7 +1055,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1055 | src++; | 1055 | src++; |
1056 | 1056 | ||
1057 | if (!*src) { | 1057 | if (!*src) { |
1058 | errorMsg("empty command in pipe\n"); | 1058 | error_msg("empty command in pipe\n"); |
1059 | freeJob(job); | 1059 | freeJob(job); |
1060 | job->numProgs=0; | 1060 | job->numProgs=0; |
1061 | return 1; | 1061 | return 1; |
@@ -1114,7 +1114,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1114 | * command line, making extra room as needed */ | 1114 | * command line, making extra room as needed */ |
1115 | --src; | 1115 | --src; |
1116 | charptr1 = xmalloc(BUFSIZ); | 1116 | charptr1 = xmalloc(BUFSIZ); |
1117 | while ( (size=fullRead(pipefd[0], charptr1, BUFSIZ-1)) >0) { | 1117 | while ( (size=full_read(pipefd[0], charptr1, BUFSIZ-1)) >0) { |
1118 | int newSize=src - *commandPtr + size + 1 + strlen(charptr2); | 1118 | int newSize=src - *commandPtr + size + 1 + strlen(charptr2); |
1119 | if (newSize > BUFSIZ) { | 1119 | if (newSize > BUFSIZ) { |
1120 | *commandPtr=xrealloc(*commandPtr, src - *commandPtr + | 1120 | *commandPtr=xrealloc(*commandPtr, src - *commandPtr + |
@@ -1145,7 +1145,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1145 | case '\\': | 1145 | case '\\': |
1146 | src++; | 1146 | src++; |
1147 | if (!*src) { | 1147 | if (!*src) { |
1148 | errorMsg("character expected after \\\n"); | 1148 | error_msg("character expected after \\\n"); |
1149 | freeJob(job); | 1149 | freeJob(job); |
1150 | return 1; | 1150 | return 1; |
1151 | } | 1151 | } |
@@ -1291,7 +1291,7 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||
1291 | #endif | 1291 | #endif |
1292 | 1292 | ||
1293 | execvp(newJob->progs[i].argv[0], newJob->progs[i].argv); | 1293 | execvp(newJob->progs[i].argv[0], newJob->progs[i].argv); |
1294 | fatalError("%s: %s\n", newJob->progs[i].argv[0], | 1294 | error_msg_and_die("%s: %s\n", newJob->progs[i].argv[0], |
1295 | strerror(errno)); | 1295 | strerror(errno)); |
1296 | } | 1296 | } |
1297 | if (outPipe[1]!=-1) { | 1297 | if (outPipe[1]!=-1) { |
@@ -1495,7 +1495,7 @@ int shell_main(int argc_l, char **argv_l) | |||
1495 | case 'c': | 1495 | case 'c': |
1496 | input = NULL; | 1496 | input = NULL; |
1497 | if (local_pending_command != 0) | 1497 | if (local_pending_command != 0) |
1498 | fatalError("multiple -c arguments\n"); | 1498 | error_msg_and_die("multiple -c arguments\n"); |
1499 | local_pending_command = xstrdup(argv[optind]); | 1499 | local_pending_command = xstrdup(argv[optind]); |
1500 | optind++; | 1500 | optind++; |
1501 | argv = argv+optind; | 1501 | argv = argv+optind; |
diff --git a/shell/cmdedit.c b/shell/cmdedit.c index 94b8fc7b1..c32330bfd 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c | |||
@@ -106,7 +106,7 @@ cmdedit_setwidth(int w) | |||
106 | cmdedit_termw = w; | 106 | cmdedit_termw = w; |
107 | cmdedit_scroll = w / 3; | 107 | cmdedit_scroll = w / 3; |
108 | } else { | 108 | } else { |
109 | errorMsg("\n*** Error: minimum screen width is 21\n"); | 109 | error_msg("\n*** Error: minimum screen width is 21\n"); |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
diff --git a/shell/lash.c b/shell/lash.c index bb8a456b7..4b1ae6d27 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -250,7 +250,7 @@ static int builtin_exec(struct job *cmd, struct jobSet *junk) | |||
250 | { | 250 | { |
251 | cmd->progs[0].argv++; | 251 | cmd->progs[0].argv++; |
252 | execvp(cmd->progs[0].argv[0], cmd->progs[0].argv); | 252 | execvp(cmd->progs[0].argv[0], cmd->progs[0].argv); |
253 | fatalError("Exec to %s failed: %s\n", cmd->progs[0].argv[0], | 253 | error_msg_and_die("Exec to %s failed: %s\n", cmd->progs[0].argv[0], |
254 | strerror(errno)); | 254 | strerror(errno)); |
255 | } | 255 | } |
256 | return EXIT_SUCCESS; | 256 | return EXIT_SUCCESS; |
@@ -273,12 +273,12 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) | |||
273 | 273 | ||
274 | if (!jobList->head) { | 274 | if (!jobList->head) { |
275 | if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { | 275 | if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) { |
276 | errorMsg("%s: exactly one argument is expected\n", | 276 | error_msg("%s: exactly one argument is expected\n", |
277 | cmd->progs[0].argv[0]); | 277 | cmd->progs[0].argv[0]); |
278 | return EXIT_FAILURE; | 278 | return EXIT_FAILURE; |
279 | } | 279 | } |
280 | if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { | 280 | if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) { |
281 | errorMsg("%s: bad argument '%s'\n", | 281 | error_msg("%s: bad argument '%s'\n", |
282 | cmd->progs[0].argv[0], cmd->progs[0].argv[1]); | 282 | cmd->progs[0].argv[0], cmd->progs[0].argv[1]); |
283 | return EXIT_FAILURE; | 283 | return EXIT_FAILURE; |
284 | for (job = jobList->head; job; job = job->next) { | 284 | for (job = jobList->head; job; job = job->next) { |
@@ -292,7 +292,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList) | |||
292 | } | 292 | } |
293 | 293 | ||
294 | if (!job) { | 294 | if (!job) { |
295 | errorMsg("%s: unknown job %d\n", | 295 | error_msg("%s: unknown job %d\n", |
296 | cmd->progs[0].argv[0], jobNum); | 296 | cmd->progs[0].argv[0], jobNum); |
297 | return EXIT_FAILURE; | 297 | return EXIT_FAILURE; |
298 | } | 298 | } |
@@ -444,7 +444,7 @@ static int builtin_then(struct job *cmd, struct jobSet *junk) | |||
444 | char* charptr1=cmd->text+5; /* skip over the leading 'then ' */ | 444 | char* charptr1=cmd->text+5; /* skip over the leading 'then ' */ |
445 | 445 | ||
446 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { | 446 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { |
447 | errorMsg("unexpected token `then'\n"); | 447 | error_msg("unexpected token `then'\n"); |
448 | return EXIT_FAILURE; | 448 | return EXIT_FAILURE; |
449 | } | 449 | } |
450 | /* If the if result was FALSE, skip the 'then' stuff */ | 450 | /* If the if result was FALSE, skip the 'then' stuff */ |
@@ -471,7 +471,7 @@ static int builtin_else(struct job *cmd, struct jobSet *junk) | |||
471 | char* charptr1=cmd->text+5; /* skip over the leading 'else ' */ | 471 | char* charptr1=cmd->text+5; /* skip over the leading 'else ' */ |
472 | 472 | ||
473 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { | 473 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { |
474 | errorMsg("unexpected token `else'\n"); | 474 | error_msg("unexpected token `else'\n"); |
475 | return EXIT_FAILURE; | 475 | return EXIT_FAILURE; |
476 | } | 476 | } |
477 | /* If the if result was TRUE, skip the 'else' stuff */ | 477 | /* If the if result was TRUE, skip the 'else' stuff */ |
@@ -495,7 +495,7 @@ static int builtin_else(struct job *cmd, struct jobSet *junk) | |||
495 | static int builtin_fi(struct job *cmd, struct jobSet *junk) | 495 | static int builtin_fi(struct job *cmd, struct jobSet *junk) |
496 | { | 496 | { |
497 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { | 497 | if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { |
498 | errorMsg("unexpected token `fi'\n"); | 498 | error_msg("unexpected token `fi'\n"); |
499 | return EXIT_FAILURE; | 499 | return EXIT_FAILURE; |
500 | } | 500 | } |
501 | /* Clear out the if and then context bits */ | 501 | /* Clear out the if and then context bits */ |
@@ -646,7 +646,7 @@ static int setupRedirections(struct childProgram *prog) | |||
646 | if (openfd < 0) { | 646 | if (openfd < 0) { |
647 | /* this could get lost if stderr has been redirected, but | 647 | /* this could get lost if stderr has been redirected, but |
648 | bash and ash both lose it as well (though zsh doesn't!) */ | 648 | bash and ash both lose it as well (though zsh doesn't!) */ |
649 | errorMsg("error opening %s: %s\n", redir->filename, | 649 | error_msg("error opening %s: %s\n", redir->filename, |
650 | strerror(errno)); | 650 | strerror(errno)); |
651 | return 1; | 651 | return 1; |
652 | } | 652 | } |
@@ -820,7 +820,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr, | |||
820 | if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){ | 820 | if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){ |
821 | rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->globResult); | 821 | rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->globResult); |
822 | if (rc == GLOB_NOSPACE) { | 822 | if (rc == GLOB_NOSPACE) { |
823 | errorMsg("out of space during glob operation\n"); | 823 | error_msg("out of space during glob operation\n"); |
824 | return; | 824 | return; |
825 | } else if (rc == GLOB_NOMATCH || | 825 | } else if (rc == GLOB_NOMATCH || |
826 | (!rc && (prog->globResult.gl_pathc - i) == 1 && | 826 | (!rc && (prog->globResult.gl_pathc - i) == 1 && |
@@ -927,7 +927,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
927 | if (*src == '\\') { | 927 | if (*src == '\\') { |
928 | src++; | 928 | src++; |
929 | if (!*src) { | 929 | if (!*src) { |
930 | errorMsg("character expected after \\\n"); | 930 | error_msg("character expected after \\\n"); |
931 | freeJob(job); | 931 | freeJob(job); |
932 | return 1; | 932 | return 1; |
933 | } | 933 | } |
@@ -1009,7 +1009,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1009 | chptr++; | 1009 | chptr++; |
1010 | 1010 | ||
1011 | if (!*chptr) { | 1011 | if (!*chptr) { |
1012 | errorMsg("file name expected after %c\n", *src); | 1012 | error_msg("file name expected after %c\n", *src); |
1013 | freeJob(job); | 1013 | freeJob(job); |
1014 | job->numProgs=0; | 1014 | job->numProgs=0; |
1015 | return 1; | 1015 | return 1; |
@@ -1028,7 +1028,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1028 | if (*prog->argv[argc_l]) | 1028 | if (*prog->argv[argc_l]) |
1029 | argc_l++; | 1029 | argc_l++; |
1030 | if (!argc_l) { | 1030 | if (!argc_l) { |
1031 | errorMsg("empty command in pipe\n"); | 1031 | error_msg("empty command in pipe\n"); |
1032 | freeJob(job); | 1032 | freeJob(job); |
1033 | job->numProgs=0; | 1033 | job->numProgs=0; |
1034 | return 1; | 1034 | return 1; |
@@ -1055,7 +1055,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1055 | src++; | 1055 | src++; |
1056 | 1056 | ||
1057 | if (!*src) { | 1057 | if (!*src) { |
1058 | errorMsg("empty command in pipe\n"); | 1058 | error_msg("empty command in pipe\n"); |
1059 | freeJob(job); | 1059 | freeJob(job); |
1060 | job->numProgs=0; | 1060 | job->numProgs=0; |
1061 | return 1; | 1061 | return 1; |
@@ -1114,7 +1114,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1114 | * command line, making extra room as needed */ | 1114 | * command line, making extra room as needed */ |
1115 | --src; | 1115 | --src; |
1116 | charptr1 = xmalloc(BUFSIZ); | 1116 | charptr1 = xmalloc(BUFSIZ); |
1117 | while ( (size=fullRead(pipefd[0], charptr1, BUFSIZ-1)) >0) { | 1117 | while ( (size=full_read(pipefd[0], charptr1, BUFSIZ-1)) >0) { |
1118 | int newSize=src - *commandPtr + size + 1 + strlen(charptr2); | 1118 | int newSize=src - *commandPtr + size + 1 + strlen(charptr2); |
1119 | if (newSize > BUFSIZ) { | 1119 | if (newSize > BUFSIZ) { |
1120 | *commandPtr=xrealloc(*commandPtr, src - *commandPtr + | 1120 | *commandPtr=xrealloc(*commandPtr, src - *commandPtr + |
@@ -1145,7 +1145,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi | |||
1145 | case '\\': | 1145 | case '\\': |
1146 | src++; | 1146 | src++; |
1147 | if (!*src) { | 1147 | if (!*src) { |
1148 | errorMsg("character expected after \\\n"); | 1148 | error_msg("character expected after \\\n"); |
1149 | freeJob(job); | 1149 | freeJob(job); |
1150 | return 1; | 1150 | return 1; |
1151 | } | 1151 | } |
@@ -1291,7 +1291,7 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||
1291 | #endif | 1291 | #endif |
1292 | 1292 | ||
1293 | execvp(newJob->progs[i].argv[0], newJob->progs[i].argv); | 1293 | execvp(newJob->progs[i].argv[0], newJob->progs[i].argv); |
1294 | fatalError("%s: %s\n", newJob->progs[i].argv[0], | 1294 | error_msg_and_die("%s: %s\n", newJob->progs[i].argv[0], |
1295 | strerror(errno)); | 1295 | strerror(errno)); |
1296 | } | 1296 | } |
1297 | if (outPipe[1]!=-1) { | 1297 | if (outPipe[1]!=-1) { |
@@ -1495,7 +1495,7 @@ int shell_main(int argc_l, char **argv_l) | |||
1495 | case 'c': | 1495 | case 'c': |
1496 | input = NULL; | 1496 | input = NULL; |
1497 | if (local_pending_command != 0) | 1497 | if (local_pending_command != 0) |
1498 | fatalError("multiple -c arguments\n"); | 1498 | error_msg_and_die("multiple -c arguments\n"); |
1499 | local_pending_command = xstrdup(argv[optind]); | 1499 | local_pending_command = xstrdup(argv[optind]); |
1500 | optind++; | 1500 | optind++; |
1501 | argv = argv+optind; | 1501 | argv = argv+optind; |
@@ -247,7 +247,7 @@ int sort_main(int argc, char **argv) | |||
247 | break; | 247 | break; |
248 | #endif | 248 | #endif |
249 | default: | 249 | default: |
250 | errorMsg("invalid option -- %c\n", opt); | 250 | error_msg("invalid option -- %c\n", opt); |
251 | usage(sort_usage); | 251 | usage(sort_usage); |
252 | } | 252 | } |
253 | } else { | 253 | } else { |
@@ -286,4 +286,4 @@ int sort_main(int argc, char **argv) | |||
286 | return(0); | 286 | return(0); |
287 | } | 287 | } |
288 | 288 | ||
289 | /* $Id: sort.c,v 1.23 2000/09/28 17:49:59 beppu Exp $ */ | 289 | /* $Id: sort.c,v 1.24 2000/12/07 19:56:48 markw Exp $ */ |
diff --git a/swaponoff.c b/swaponoff.c index 0ae0c36ee..e40d169dd 100644 --- a/swaponoff.c +++ b/swaponoff.c | |||
@@ -96,7 +96,7 @@ extern int swap_on_off_main(int argc, char **argv) | |||
96 | struct stat statBuf; | 96 | struct stat statBuf; |
97 | 97 | ||
98 | if (stat("/etc/fstab", &statBuf) < 0) | 98 | if (stat("/etc/fstab", &statBuf) < 0) |
99 | fatalError("/etc/fstab file missing\n"); | 99 | error_msg_and_die("/etc/fstab file missing\n"); |
100 | } | 100 | } |
101 | do_em_all(); | 101 | do_em_all(); |
102 | break; | 102 | break; |
diff --git a/sysklogd/logger.c b/sysklogd/logger.c index 8e341efe9..1ed6dc639 100644 --- a/sysklogd/logger.c +++ b/sysklogd/logger.c | |||
@@ -85,14 +85,14 @@ static int pencode(char *s) | |||
85 | *s = '\0'; | 85 | *s = '\0'; |
86 | fac = decode(save, facilitynames); | 86 | fac = decode(save, facilitynames); |
87 | if (fac < 0) | 87 | if (fac < 0) |
88 | fatalError("unknown facility name: %s\n", save); | 88 | error_msg_and_die("unknown facility name: %s\n", save); |
89 | *s++ = '.'; | 89 | *s++ = '.'; |
90 | } else { | 90 | } else { |
91 | s = save; | 91 | s = save; |
92 | } | 92 | } |
93 | lev = decode(s, prioritynames); | 93 | lev = decode(s, prioritynames); |
94 | if (lev < 0) | 94 | if (lev < 0) |
95 | fatalError("unknown priority name: %s\n", save); | 95 | error_msg_and_die("unknown priority name: %s\n", save); |
96 | return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK)); | 96 | return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK)); |
97 | } | 97 | } |
98 | 98 | ||
@@ -152,7 +152,7 @@ extern int logger_main(int argc, char **argv) | |||
152 | if (argc >= 1) | 152 | if (argc >= 1) |
153 | message = *argv; | 153 | message = *argv; |
154 | else | 154 | else |
155 | fatalError("No message\n"); | 155 | error_msg_and_die("No message\n"); |
156 | } | 156 | } |
157 | 157 | ||
158 | openlog(name, option, (pri | LOG_FACMASK)); | 158 | openlog(name, option, (pri | LOG_FACMASK)); |
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index a5071583d..d82aa63fd 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -181,7 +181,7 @@ static void logMessage (int pri, char *msg) | |||
181 | v->iov_len = strlen(msg); | 181 | v->iov_len = strlen(msg); |
182 | 182 | ||
183 | if ( -1 == writev(remotefd,iov, IOV_COUNT)){ | 183 | if ( -1 == writev(remotefd,iov, IOV_COUNT)){ |
184 | fatalError("syslogd: cannot write to remote file handle on" | 184 | error_msg_and_die("syslogd: cannot write to remote file handle on" |
185 | "%s:%d\n",RemoteHost,RemotePort); | 185 | "%s:%d\n",RemoteHost,RemotePort); |
186 | } | 186 | } |
187 | } | 187 | } |
@@ -260,13 +260,13 @@ static void init_RemoteLog (void){ | |||
260 | remotefd = socket(AF_INET, SOCK_DGRAM, 0); | 260 | remotefd = socket(AF_INET, SOCK_DGRAM, 0); |
261 | 261 | ||
262 | if (remotefd < 0) { | 262 | if (remotefd < 0) { |
263 | fatalError("syslogd: cannot create socket\n"); | 263 | error_msg_and_die("syslogd: cannot create socket\n"); |
264 | } | 264 | } |
265 | 265 | ||
266 | hostinfo = (struct hostent *) gethostbyname(RemoteHost); | 266 | hostinfo = (struct hostent *) gethostbyname(RemoteHost); |
267 | 267 | ||
268 | if (!hostinfo) { | 268 | if (!hostinfo) { |
269 | fatalError("syslogd: cannot resolve remote host name [%s]\n", RemoteHost); | 269 | error_msg_and_die("syslogd: cannot resolve remote host name [%s]\n", RemoteHost); |
270 | } | 270 | } |
271 | 271 | ||
272 | remoteaddr.sin_family = AF_INET; | 272 | remoteaddr.sin_family = AF_INET; |
@@ -278,7 +278,7 @@ static void init_RemoteLog (void){ | |||
278 | for future operations | 278 | for future operations |
279 | */ | 279 | */ |
280 | if ( 0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))){ | 280 | if ( 0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))){ |
281 | fatalError("syslogd: cannot connect to remote host %s:%d\n", RemoteHost, RemotePort); | 281 | error_msg_and_die("syslogd: cannot connect to remote host %s:%d\n", RemoteHost, RemotePort); |
282 | } | 282 | } |
283 | 283 | ||
284 | } | 284 | } |
@@ -311,7 +311,7 @@ static void doSyslogd (void) | |||
311 | /* Create the syslog file so realpath() can work. */ | 311 | /* Create the syslog file so realpath() can work. */ |
312 | close (open (_PATH_LOG, O_RDWR | O_CREAT, 0644)); | 312 | close (open (_PATH_LOG, O_RDWR | O_CREAT, 0644)); |
313 | if (realpath (_PATH_LOG, lfile) == NULL) | 313 | if (realpath (_PATH_LOG, lfile) == NULL) |
314 | fatalError ("Could not resolve path to " _PATH_LOG ": %s\n", strerror (errno)); | 314 | error_msg_and_die ("Could not resolve path to " _PATH_LOG ": %s\n", strerror (errno)); |
315 | 315 | ||
316 | unlink (lfile); | 316 | unlink (lfile); |
317 | 317 | ||
@@ -319,14 +319,14 @@ static void doSyslogd (void) | |||
319 | sunx.sun_family = AF_UNIX; | 319 | sunx.sun_family = AF_UNIX; |
320 | strncpy (sunx.sun_path, lfile, sizeof (sunx.sun_path)); | 320 | strncpy (sunx.sun_path, lfile, sizeof (sunx.sun_path)); |
321 | if ((sock_fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) | 321 | if ((sock_fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) |
322 | fatalError ("Couldn't obtain descriptor for socket " _PATH_LOG ": %s\n", strerror (errno)); | 322 | error_msg_and_die ("Couldn't obtain descriptor for socket " _PATH_LOG ": %s\n", strerror (errno)); |
323 | 323 | ||
324 | addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path); | 324 | addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path); |
325 | if ((bind (sock_fd, (struct sockaddr *) &sunx, addrLength)) || (listen (sock_fd, 5))) | 325 | if ((bind (sock_fd, (struct sockaddr *) &sunx, addrLength)) || (listen (sock_fd, 5))) |
326 | fatalError ("Could not connect to socket " _PATH_LOG ": %s\n", strerror (errno)); | 326 | error_msg_and_die ("Could not connect to socket " _PATH_LOG ": %s\n", strerror (errno)); |
327 | 327 | ||
328 | if (chmod (lfile, 0666) < 0) | 328 | if (chmod (lfile, 0666) < 0) |
329 | fatalError ("Could not set permission on " _PATH_LOG ": %s\n", strerror (errno)); | 329 | error_msg_and_die ("Could not set permission on " _PATH_LOG ": %s\n", strerror (errno)); |
330 | 330 | ||
331 | FD_ZERO (&fds); | 331 | FD_ZERO (&fds); |
332 | FD_SET (sock_fd, &fds); | 332 | FD_SET (sock_fd, &fds); |
@@ -349,7 +349,7 @@ static void doSyslogd (void) | |||
349 | 349 | ||
350 | if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) { | 350 | if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) { |
351 | if (errno == EINTR) continue; /* alarm may have happened. */ | 351 | if (errno == EINTR) continue; /* alarm may have happened. */ |
352 | fatalError ("select error: %s\n", strerror (errno)); | 352 | error_msg_and_die ("select error: %s\n", strerror (errno)); |
353 | } | 353 | } |
354 | 354 | ||
355 | for (fd = 0; (n_ready > 0) && (fd < FD_SETSIZE); fd++) { | 355 | for (fd = 0; (n_ready > 0) && (fd < FD_SETSIZE); fd++) { |
@@ -363,7 +363,7 @@ static void doSyslogd (void) | |||
363 | pid_t pid; | 363 | pid_t pid; |
364 | 364 | ||
365 | if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) { | 365 | if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) { |
366 | fatalError ("accept error: %s\n", strerror (errno)); | 366 | error_msg_and_die ("accept error: %s\n", strerror (errno)); |
367 | } | 367 | } |
368 | 368 | ||
369 | pid = fork(); | 369 | pid = fork(); |
@@ -181,7 +181,7 @@ static void logMessage (int pri, char *msg) | |||
181 | v->iov_len = strlen(msg); | 181 | v->iov_len = strlen(msg); |
182 | 182 | ||
183 | if ( -1 == writev(remotefd,iov, IOV_COUNT)){ | 183 | if ( -1 == writev(remotefd,iov, IOV_COUNT)){ |
184 | fatalError("syslogd: cannot write to remote file handle on" | 184 | error_msg_and_die("syslogd: cannot write to remote file handle on" |
185 | "%s:%d\n",RemoteHost,RemotePort); | 185 | "%s:%d\n",RemoteHost,RemotePort); |
186 | } | 186 | } |
187 | } | 187 | } |
@@ -260,13 +260,13 @@ static void init_RemoteLog (void){ | |||
260 | remotefd = socket(AF_INET, SOCK_DGRAM, 0); | 260 | remotefd = socket(AF_INET, SOCK_DGRAM, 0); |
261 | 261 | ||
262 | if (remotefd < 0) { | 262 | if (remotefd < 0) { |
263 | fatalError("syslogd: cannot create socket\n"); | 263 | error_msg_and_die("syslogd: cannot create socket\n"); |
264 | } | 264 | } |
265 | 265 | ||
266 | hostinfo = (struct hostent *) gethostbyname(RemoteHost); | 266 | hostinfo = (struct hostent *) gethostbyname(RemoteHost); |
267 | 267 | ||
268 | if (!hostinfo) { | 268 | if (!hostinfo) { |
269 | fatalError("syslogd: cannot resolve remote host name [%s]\n", RemoteHost); | 269 | error_msg_and_die("syslogd: cannot resolve remote host name [%s]\n", RemoteHost); |
270 | } | 270 | } |
271 | 271 | ||
272 | remoteaddr.sin_family = AF_INET; | 272 | remoteaddr.sin_family = AF_INET; |
@@ -278,7 +278,7 @@ static void init_RemoteLog (void){ | |||
278 | for future operations | 278 | for future operations |
279 | */ | 279 | */ |
280 | if ( 0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))){ | 280 | if ( 0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))){ |
281 | fatalError("syslogd: cannot connect to remote host %s:%d\n", RemoteHost, RemotePort); | 281 | error_msg_and_die("syslogd: cannot connect to remote host %s:%d\n", RemoteHost, RemotePort); |
282 | } | 282 | } |
283 | 283 | ||
284 | } | 284 | } |
@@ -311,7 +311,7 @@ static void doSyslogd (void) | |||
311 | /* Create the syslog file so realpath() can work. */ | 311 | /* Create the syslog file so realpath() can work. */ |
312 | close (open (_PATH_LOG, O_RDWR | O_CREAT, 0644)); | 312 | close (open (_PATH_LOG, O_RDWR | O_CREAT, 0644)); |
313 | if (realpath (_PATH_LOG, lfile) == NULL) | 313 | if (realpath (_PATH_LOG, lfile) == NULL) |
314 | fatalError ("Could not resolve path to " _PATH_LOG ": %s\n", strerror (errno)); | 314 | error_msg_and_die ("Could not resolve path to " _PATH_LOG ": %s\n", strerror (errno)); |
315 | 315 | ||
316 | unlink (lfile); | 316 | unlink (lfile); |
317 | 317 | ||
@@ -319,14 +319,14 @@ static void doSyslogd (void) | |||
319 | sunx.sun_family = AF_UNIX; | 319 | sunx.sun_family = AF_UNIX; |
320 | strncpy (sunx.sun_path, lfile, sizeof (sunx.sun_path)); | 320 | strncpy (sunx.sun_path, lfile, sizeof (sunx.sun_path)); |
321 | if ((sock_fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) | 321 | if ((sock_fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) |
322 | fatalError ("Couldn't obtain descriptor for socket " _PATH_LOG ": %s\n", strerror (errno)); | 322 | error_msg_and_die ("Couldn't obtain descriptor for socket " _PATH_LOG ": %s\n", strerror (errno)); |
323 | 323 | ||
324 | addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path); | 324 | addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path); |
325 | if ((bind (sock_fd, (struct sockaddr *) &sunx, addrLength)) || (listen (sock_fd, 5))) | 325 | if ((bind (sock_fd, (struct sockaddr *) &sunx, addrLength)) || (listen (sock_fd, 5))) |
326 | fatalError ("Could not connect to socket " _PATH_LOG ": %s\n", strerror (errno)); | 326 | error_msg_and_die ("Could not connect to socket " _PATH_LOG ": %s\n", strerror (errno)); |
327 | 327 | ||
328 | if (chmod (lfile, 0666) < 0) | 328 | if (chmod (lfile, 0666) < 0) |
329 | fatalError ("Could not set permission on " _PATH_LOG ": %s\n", strerror (errno)); | 329 | error_msg_and_die ("Could not set permission on " _PATH_LOG ": %s\n", strerror (errno)); |
330 | 330 | ||
331 | FD_ZERO (&fds); | 331 | FD_ZERO (&fds); |
332 | FD_SET (sock_fd, &fds); | 332 | FD_SET (sock_fd, &fds); |
@@ -349,7 +349,7 @@ static void doSyslogd (void) | |||
349 | 349 | ||
350 | if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) { | 350 | if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) { |
351 | if (errno == EINTR) continue; /* alarm may have happened. */ | 351 | if (errno == EINTR) continue; /* alarm may have happened. */ |
352 | fatalError ("select error: %s\n", strerror (errno)); | 352 | error_msg_and_die ("select error: %s\n", strerror (errno)); |
353 | } | 353 | } |
354 | 354 | ||
355 | for (fd = 0; (n_ready > 0) && (fd < FD_SETSIZE); fd++) { | 355 | for (fd = 0; (n_ready > 0) && (fd < FD_SETSIZE); fd++) { |
@@ -363,7 +363,7 @@ static void doSyslogd (void) | |||
363 | pid_t pid; | 363 | pid_t pid; |
364 | 364 | ||
365 | if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) { | 365 | if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) { |
366 | fatalError ("accept error: %s\n", strerror (errno)); | 366 | error_msg_and_die ("accept error: %s\n", strerror (errno)); |
367 | } | 367 | } |
368 | 368 | ||
369 | pid = fork(); | 369 | pid = fork(); |
@@ -225,7 +225,7 @@ int tail_main(int argc, char **argv) | |||
225 | usage(tail_usage); | 225 | usage(tail_usage); |
226 | break; | 226 | break; |
227 | default: | 227 | default: |
228 | errorMsg("\nUnknown arg: %c.\n\n",optopt); | 228 | error_msg("\nUnknown arg: %c.\n\n",optopt); |
229 | usage(tail_usage); | 229 | usage(tail_usage); |
230 | } | 230 | } |
231 | } | 231 | } |
@@ -263,7 +263,7 @@ int tail_main(int argc, char **argv) | |||
263 | else | 263 | else |
264 | fd[test] = open(files[test], O_RDONLY); | 264 | fd[test] = open(files[test], O_RDONLY); |
265 | if (fd[test] == -1) | 265 | if (fd[test] == -1) |
266 | fatalError("Unable to open file %s.\n", files[test]); | 266 | error_msg_and_die("Unable to open file %s.\n", files[test]); |
267 | tail_stream(fd[test]); | 267 | tail_stream(fd[test]); |
268 | 268 | ||
269 | bs=BUFSIZ; | 269 | bs=BUFSIZ; |
@@ -193,10 +193,10 @@ extern int tar_main(int argc, char **argv) | |||
193 | break; | 193 | break; |
194 | case 'f': | 194 | case 'f': |
195 | if (*tarName != '-') | 195 | if (*tarName != '-') |
196 | fatalError( "Only one 'f' option allowed\n"); | 196 | error_msg_and_die( "Only one 'f' option allowed\n"); |
197 | tarName = *(++argv); | 197 | tarName = *(++argv); |
198 | if (tarName == NULL) | 198 | if (tarName == NULL) |
199 | fatalError( "Option requires an argument: No file specified\n"); | 199 | error_msg_and_die( "Option requires an argument: No file specified\n"); |
200 | stopIt=TRUE; | 200 | stopIt=TRUE; |
201 | break; | 201 | break; |
202 | #if defined BB_FEATURE_TAR_EXCLUDE | 202 | #if defined BB_FEATURE_TAR_EXCLUDE |
@@ -205,7 +205,7 @@ extern int tar_main(int argc, char **argv) | |||
205 | excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2)); | 205 | excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2)); |
206 | excludeList[excludeListSize] = *(++argv); | 206 | excludeList[excludeListSize] = *(++argv); |
207 | if (excludeList[excludeListSize] == NULL) | 207 | if (excludeList[excludeListSize] == NULL) |
208 | fatalError( "Option requires an argument: No file specified\n"); | 208 | error_msg_and_die( "Option requires an argument: No file specified\n"); |
209 | /* Remove leading "/"s */ | 209 | /* Remove leading "/"s */ |
210 | if (*excludeList[excludeListSize] =='/') | 210 | if (*excludeList[excludeListSize] =='/') |
211 | excludeList[excludeListSize] = (excludeList[excludeListSize])+1; | 211 | excludeList[excludeListSize] = (excludeList[excludeListSize])+1; |
@@ -216,13 +216,13 @@ extern int tar_main(int argc, char **argv) | |||
216 | } | 216 | } |
217 | case 'X': | 217 | case 'X': |
218 | if (*excludeFileName != '-') | 218 | if (*excludeFileName != '-') |
219 | fatalError("Only one 'X' option allowed\n"); | 219 | error_msg_and_die("Only one 'X' option allowed\n"); |
220 | excludeFileName = *(++argv); | 220 | excludeFileName = *(++argv); |
221 | if (excludeFileName == NULL) | 221 | if (excludeFileName == NULL) |
222 | fatalError("Option requires an argument: No file specified\n"); | 222 | error_msg_and_die("Option requires an argument: No file specified\n"); |
223 | fileList = fopen (excludeFileName, "rt"); | 223 | fileList = fopen (excludeFileName, "rt"); |
224 | if (! fileList) | 224 | if (! fileList) |
225 | fatalError("Exclude file: file not found\n"); | 225 | error_msg_and_die("Exclude file: file not found\n"); |
226 | while (!feof(fileList)) { | 226 | while (!feof(fileList)) { |
227 | fscanf(fileList, "%s", file); | 227 | fscanf(fileList, "%s", file); |
228 | excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2)); | 228 | excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2)); |
@@ -253,7 +253,7 @@ extern int tar_main(int argc, char **argv) | |||
253 | */ | 253 | */ |
254 | if (createFlag == TRUE) { | 254 | if (createFlag == TRUE) { |
255 | #ifndef BB_FEATURE_TAR_CREATE | 255 | #ifndef BB_FEATURE_TAR_CREATE |
256 | fatalError( "This version of tar was not compiled with tar creation support.\n"); | 256 | error_msg_and_die( "This version of tar was not compiled with tar creation support.\n"); |
257 | #else | 257 | #else |
258 | status = writeTarFile(tarName, verboseFlag, argv, excludeList); | 258 | status = writeTarFile(tarName, verboseFlag, argv, excludeList); |
259 | #endif | 259 | #endif |
@@ -271,7 +271,7 @@ extern int tar_main(int argc, char **argv) | |||
271 | return EXIT_FAILURE; | 271 | return EXIT_FAILURE; |
272 | 272 | ||
273 | flagError: | 273 | flagError: |
274 | fatalError( "Exactly one of 'c', 'x' or 't' must be specified\n"); | 274 | error_msg_and_die( "Exactly one of 'c', 'x' or 't' must be specified\n"); |
275 | } | 275 | } |
276 | 276 | ||
277 | static void | 277 | static void |
@@ -301,10 +301,10 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
301 | if (extractFlag==TRUE && tostdoutFlag==FALSE) { | 301 | if (extractFlag==TRUE && tostdoutFlag==FALSE) { |
302 | /* Create the path to the file, just in case it isn't there... | 302 | /* Create the path to the file, just in case it isn't there... |
303 | * This should not screw up path permissions or anything. */ | 303 | * This should not screw up path permissions or anything. */ |
304 | createPath(header->name, 0777); | 304 | create_path(header->name, 0777); |
305 | if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY, | 305 | if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY, |
306 | header->mode & ~S_IFMT)) < 0) { | 306 | header->mode & ~S_IFMT)) < 0) { |
307 | errorMsg(io_error, header->name, strerror(errno)); | 307 | error_msg(io_error, header->name, strerror(errno)); |
308 | return( FALSE); | 308 | return( FALSE); |
309 | } | 309 | } |
310 | } | 310 | } |
@@ -322,9 +322,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
322 | readSize = size; | 322 | readSize = size; |
323 | writeSize = size; | 323 | writeSize = size; |
324 | } | 324 | } |
325 | if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) { | 325 | if ( (readSize = full_read(header->tarFd, buffer, readSize)) <= 0 ) { |
326 | /* Tarball seems to have a problem */ | 326 | /* Tarball seems to have a problem */ |
327 | errorMsg("Unexpected EOF in archive\n"); | 327 | error_msg("Unexpected EOF in archive\n"); |
328 | return( FALSE); | 328 | return( FALSE); |
329 | } | 329 | } |
330 | if ( readSize < writeSize ) | 330 | if ( readSize < writeSize ) |
@@ -333,9 +333,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
333 | /* Write out the file, if we are supposed to be doing that */ | 333 | /* Write out the file, if we are supposed to be doing that */ |
334 | if (extractFlag==TRUE) { | 334 | if (extractFlag==TRUE) { |
335 | 335 | ||
336 | if ((actualWriteSz=fullWrite(outFd, buffer, writeSize)) != writeSize ) { | 336 | if ((actualWriteSz=full_write(outFd, buffer, writeSize)) != writeSize ) { |
337 | /* Output file seems to have a problem */ | 337 | /* Output file seems to have a problem */ |
338 | errorMsg(io_error, header->name, strerror(errno)); | 338 | error_msg(io_error, header->name, strerror(errno)); |
339 | return( FALSE); | 339 | return( FALSE); |
340 | } | 340 | } |
341 | } else { | 341 | } else { |
@@ -361,13 +361,13 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
361 | if (extractFlag==FALSE || tostdoutFlag==TRUE) | 361 | if (extractFlag==FALSE || tostdoutFlag==TRUE) |
362 | return( TRUE); | 362 | return( TRUE); |
363 | 363 | ||
364 | if (createPath(header->name, header->mode) != TRUE) { | 364 | if (create_path(header->name, header->mode) != TRUE) { |
365 | errorMsg("%s: Cannot mkdir: %s\n", | 365 | error_msg("%s: Cannot mkdir: %s\n", |
366 | header->name, strerror(errno)); | 366 | header->name, strerror(errno)); |
367 | return( FALSE); | 367 | return( FALSE); |
368 | } | 368 | } |
369 | /* make the final component, just in case it was | 369 | /* make the final component, just in case it was |
370 | * omitted by createPath() (which will skip the | 370 | * omitted by create_path() (which will skip the |
371 | * directory if it doesn't have a terminating '/') */ | 371 | * directory if it doesn't have a terminating '/') */ |
372 | if (mkdir(header->name, header->mode) == 0) { | 372 | if (mkdir(header->name, header->mode) == 0) { |
373 | fixUpPermissions(header); | 373 | fixUpPermissions(header); |
@@ -382,7 +382,7 @@ tarExtractHardLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
382 | return( TRUE); | 382 | return( TRUE); |
383 | 383 | ||
384 | if (link(header->linkname, header->name) < 0) { | 384 | if (link(header->linkname, header->name) < 0) { |
385 | errorMsg("%s: Cannot create hard link to '%s': %s\n", | 385 | error_msg("%s: Cannot create hard link to '%s': %s\n", |
386 | header->name, header->linkname, strerror(errno)); | 386 | header->name, header->linkname, strerror(errno)); |
387 | return( FALSE); | 387 | return( FALSE); |
388 | } | 388 | } |
@@ -400,7 +400,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
400 | 400 | ||
401 | #ifdef S_ISLNK | 401 | #ifdef S_ISLNK |
402 | if (symlink(header->linkname, header->name) < 0) { | 402 | if (symlink(header->linkname, header->name) < 0) { |
403 | errorMsg("%s: Cannot create symlink to '%s': %s\n", | 403 | error_msg("%s: Cannot create symlink to '%s': %s\n", |
404 | header->name, header->linkname, strerror(errno)); | 404 | header->name, header->linkname, strerror(errno)); |
405 | return( FALSE); | 405 | return( FALSE); |
406 | } | 406 | } |
@@ -415,7 +415,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
415 | /* Do not change permissions or date on symlink, | 415 | /* Do not change permissions or date on symlink, |
416 | * since it changes the pointed to file instead. duh. */ | 416 | * since it changes the pointed to file instead. duh. */ |
417 | #else | 417 | #else |
418 | errorMsg("%s: Cannot create symlink to '%s': %s\n", | 418 | error_msg("%s: Cannot create symlink to '%s': %s\n", |
419 | header->name, header->linkname, | 419 | header->name, header->linkname, |
420 | "symlinks not supported"); | 420 | "symlinks not supported"); |
421 | #endif | 421 | #endif |
@@ -430,13 +430,13 @@ tarExtractSpecial(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
430 | 430 | ||
431 | if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) { | 431 | if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) { |
432 | if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) { | 432 | if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) { |
433 | errorMsg("%s: Cannot mknod: %s\n", | 433 | error_msg("%s: Cannot mknod: %s\n", |
434 | header->name, strerror(errno)); | 434 | header->name, strerror(errno)); |
435 | return( FALSE); | 435 | return( FALSE); |
436 | } | 436 | } |
437 | } else if (S_ISFIFO(header->mode)) { | 437 | } else if (S_ISFIFO(header->mode)) { |
438 | if (mkfifo(header->name, header->mode) < 0) { | 438 | if (mkfifo(header->name, header->mode) < 0) { |
439 | errorMsg("%s: Cannot mkfifo: %s\n", | 439 | error_msg("%s: Cannot mkfifo: %s\n", |
440 | header->name, strerror(errno)); | 440 | header->name, strerror(errno)); |
441 | return( FALSE); | 441 | return( FALSE); |
442 | } | 442 | } |
@@ -455,9 +455,9 @@ static long getOctal(const char *cp, int size) | |||
455 | long val = 0; | 455 | long val = 0; |
456 | 456 | ||
457 | for(;(size > 0) && (*cp == ' '); cp++, size--); | 457 | for(;(size > 0) && (*cp == ' '); cp++, size--); |
458 | if ((size == 0) || !isOctal(*cp)) | 458 | if ((size == 0) || !is_octal(*cp)) |
459 | return -1; | 459 | return -1; |
460 | for(; (size > 0) && isOctal(*cp); size--) { | 460 | for(; (size > 0) && is_octal(*cp); size--) { |
461 | val = val * 8 + *cp++ - '0'; | 461 | val = val * 8 + *cp++ - '0'; |
462 | } | 462 | } |
463 | for (;(size > 0) && (*cp == ' '); cp++, size--); | 463 | for (;(size > 0) && (*cp == ' '); cp++, size--); |
@@ -484,7 +484,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header) | |||
484 | ++*(header->name); | 484 | ++*(header->name); |
485 | 485 | ||
486 | if (alreadyWarned == FALSE) { | 486 | if (alreadyWarned == FALSE) { |
487 | errorMsg("Removing leading '/' from member names\n"); | 487 | error_msg("Removing leading '/' from member names\n"); |
488 | alreadyWarned = TRUE; | 488 | alreadyWarned = TRUE; |
489 | } | 489 | } |
490 | } | 490 | } |
@@ -538,7 +538,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
538 | else | 538 | else |
539 | tarFd = open(tarName, O_RDONLY); | 539 | tarFd = open(tarName, O_RDONLY); |
540 | if (tarFd < 0) { | 540 | if (tarFd < 0) { |
541 | errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno)); | 541 | error_msg( "Error opening '%s': %s\n", tarName, strerror(errno)); |
542 | return ( FALSE); | 542 | return ( FALSE); |
543 | } | 543 | } |
544 | 544 | ||
@@ -547,7 +547,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
547 | umask(0); | 547 | umask(0); |
548 | 548 | ||
549 | /* Read the tar file, and iterate over it one file at a time */ | 549 | /* Read the tar file, and iterate over it one file at a time */ |
550 | while ( (status = fullRead(tarFd, (char*)&rawHeader, TAR_BLOCK_SIZE)) == TAR_BLOCK_SIZE ) { | 550 | while ( (status = full_read(tarFd, (char*)&rawHeader, TAR_BLOCK_SIZE)) == TAR_BLOCK_SIZE ) { |
551 | 551 | ||
552 | /* Try to read the header */ | 552 | /* Try to read the header */ |
553 | if ( readTarHeader(&rawHeader, &header) == FALSE ) { | 553 | if ( readTarHeader(&rawHeader, &header) == FALSE ) { |
@@ -555,7 +555,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
555 | goto endgame; | 555 | goto endgame; |
556 | } else { | 556 | } else { |
557 | errorFlag=TRUE; | 557 | errorFlag=TRUE; |
558 | errorMsg("Bad tar header, skipping\n"); | 558 | error_msg("Bad tar header, skipping\n"); |
559 | continue; | 559 | continue; |
560 | } | 560 | } |
561 | } | 561 | } |
@@ -572,7 +572,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
572 | } | 572 | } |
573 | if ( skipNextHeaderFlag == TRUE ) { | 573 | if ( skipNextHeaderFlag == TRUE ) { |
574 | skipNextHeaderFlag=FALSE; | 574 | skipNextHeaderFlag=FALSE; |
575 | errorMsg(name_longer_than_foo, NAME_SIZE); | 575 | error_msg(name_longer_than_foo, NAME_SIZE); |
576 | if (tarExtractRegularFile(&header, FALSE, FALSE) == FALSE) | 576 | if (tarExtractRegularFile(&header, FALSE, FALSE) == FALSE) |
577 | errorFlag = TRUE; | 577 | errorFlag = TRUE; |
578 | continue; | 578 | continue; |
@@ -638,7 +638,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
638 | char buf[35]; | 638 | char buf[35]; |
639 | struct tm *tm = localtime (&(header.mtime)); | 639 | struct tm *tm = localtime (&(header.mtime)); |
640 | 640 | ||
641 | len=printf("%s ", modeString(header.mode)); | 641 | len=printf("%s ", mode_string(header.mode)); |
642 | memset(buf, 0, 8*sizeof(char)); | 642 | memset(buf, 0, 8*sizeof(char)); |
643 | my_getpwuid(buf, header.uid); | 643 | my_getpwuid(buf, header.uid); |
644 | if (! *buf) | 644 | if (! *buf) |
@@ -731,7 +731,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
731 | break; | 731 | break; |
732 | #endif | 732 | #endif |
733 | default: | 733 | default: |
734 | errorMsg("Unknown file type '%c' in tar file\n", header.type); | 734 | error_msg("Unknown file type '%c' in tar file\n", header.type); |
735 | close( tarFd); | 735 | close( tarFd); |
736 | return( FALSE); | 736 | return( FALSE); |
737 | } | 737 | } |
@@ -739,11 +739,11 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag, | |||
739 | close(tarFd); | 739 | close(tarFd); |
740 | if (status > 0) { | 740 | if (status > 0) { |
741 | /* Bummer - we read a partial header */ | 741 | /* Bummer - we read a partial header */ |
742 | errorMsg( "Error reading '%s': %s\n", tarName, strerror(errno)); | 742 | error_msg( "Error reading '%s': %s\n", tarName, strerror(errno)); |
743 | return ( FALSE); | 743 | return ( FALSE); |
744 | } | 744 | } |
745 | else if (errorFlag==TRUE) { | 745 | else if (errorFlag==TRUE) { |
746 | errorMsg( "Error exit delayed from previous errors\n"); | 746 | error_msg( "Error exit delayed from previous errors\n"); |
747 | return( FALSE); | 747 | return( FALSE); |
748 | } else | 748 | } else |
749 | return( status); | 749 | return( status); |
@@ -753,13 +753,13 @@ endgame: | |||
753 | close( tarFd); | 753 | close( tarFd); |
754 | if (extractList != NULL) { | 754 | if (extractList != NULL) { |
755 | for (; *extractList != NULL; extractList++) { | 755 | for (; *extractList != NULL; extractList++) { |
756 | errorMsg("%s: Not found in archive\n", *extractList); | 756 | error_msg("%s: Not found in archive\n", *extractList); |
757 | errorFlag = TRUE; | 757 | errorFlag = TRUE; |
758 | } | 758 | } |
759 | } | 759 | } |
760 | if ( *(header.name) == '\0' ) { | 760 | if ( *(header.name) == '\0' ) { |
761 | if (errorFlag==TRUE) | 761 | if (errorFlag==TRUE) |
762 | errorMsg( "Error exit delayed from previous errors\n"); | 762 | error_msg( "Error exit delayed from previous errors\n"); |
763 | else | 763 | else |
764 | return( TRUE); | 764 | return( TRUE); |
765 | } | 765 | } |
@@ -903,7 +903,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
903 | if (*fileName=='/') { | 903 | if (*fileName=='/') { |
904 | static int alreadyWarned=FALSE; | 904 | static int alreadyWarned=FALSE; |
905 | if (alreadyWarned==FALSE) { | 905 | if (alreadyWarned==FALSE) { |
906 | errorMsg("Removing leading '/' from member names\n"); | 906 | error_msg("Removing leading '/' from member names\n"); |
907 | alreadyWarned=TRUE; | 907 | alreadyWarned=TRUE; |
908 | } | 908 | } |
909 | strncpy(header.name, fileName+1, sizeof(header.name)); | 909 | strncpy(header.name, fileName+1, sizeof(header.name)); |
@@ -956,7 +956,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
956 | header.typeflag = SYMTYPE; | 956 | header.typeflag = SYMTYPE; |
957 | link_size = readlink(fileName, buffer, sizeof(buffer) - 1); | 957 | link_size = readlink(fileName, buffer, sizeof(buffer) - 1); |
958 | if ( link_size < 0) { | 958 | if ( link_size < 0) { |
959 | errorMsg("Error reading symlink '%s': %s\n", header.name, strerror(errno)); | 959 | error_msg("Error reading symlink '%s': %s\n", header.name, strerror(errno)); |
960 | return ( FALSE); | 960 | return ( FALSE); |
961 | } | 961 | } |
962 | buffer[link_size] = '\0'; | 962 | buffer[link_size] = '\0'; |
@@ -978,7 +978,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
978 | header.typeflag = REGTYPE; | 978 | header.typeflag = REGTYPE; |
979 | putOctal(header.size, sizeof(header.size), statbuf->st_size); | 979 | putOctal(header.size, sizeof(header.size), statbuf->st_size); |
980 | } else { | 980 | } else { |
981 | errorMsg("%s: Unknown file type\n", fileName); | 981 | error_msg("%s: Unknown file type\n", fileName); |
982 | return ( FALSE); | 982 | return ( FALSE); |
983 | } | 983 | } |
984 | 984 | ||
@@ -994,8 +994,8 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st | |||
994 | putOctal(header.chksum, 7, chksum); | 994 | putOctal(header.chksum, 7, chksum); |
995 | 995 | ||
996 | /* Now write the header out to disk */ | 996 | /* Now write the header out to disk */ |
997 | if ((size=fullWrite(tbInfo->tarFd, (char*)&header, sizeof(struct TarHeader))) < 0) { | 997 | if ((size=full_write(tbInfo->tarFd, (char*)&header, sizeof(struct TarHeader))) < 0) { |
998 | errorMsg(io_error, fileName, strerror(errno)); | 998 | error_msg(io_error, fileName, strerror(errno)); |
999 | return ( FALSE); | 999 | return ( FALSE); |
1000 | } | 1000 | } |
1001 | /* Pad the header up to the tar block size */ | 1001 | /* Pad the header up to the tar block size */ |
@@ -1036,7 +1036,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
1036 | 1036 | ||
1037 | /* It is against the rules to archive a socket */ | 1037 | /* It is against the rules to archive a socket */ |
1038 | if (S_ISSOCK(statbuf->st_mode)) { | 1038 | if (S_ISSOCK(statbuf->st_mode)) { |
1039 | errorMsg("%s: socket ignored\n", fileName); | 1039 | error_msg("%s: socket ignored\n", fileName); |
1040 | return( TRUE); | 1040 | return( TRUE); |
1041 | } | 1041 | } |
1042 | 1042 | ||
@@ -1045,12 +1045,12 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
1045 | * the new tarball */ | 1045 | * the new tarball */ |
1046 | if (tbInfo->statBuf.st_dev == statbuf->st_dev && | 1046 | if (tbInfo->statBuf.st_dev == statbuf->st_dev && |
1047 | tbInfo->statBuf.st_ino == statbuf->st_ino) { | 1047 | tbInfo->statBuf.st_ino == statbuf->st_ino) { |
1048 | errorMsg("%s: file is the archive; skipping\n", fileName); | 1048 | error_msg("%s: file is the archive; skipping\n", fileName); |
1049 | return( TRUE); | 1049 | return( TRUE); |
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | if (strlen(fileName) >= NAME_SIZE) { | 1052 | if (strlen(fileName) >= NAME_SIZE) { |
1053 | errorMsg(name_longer_than_foo, NAME_SIZE); | 1053 | error_msg(name_longer_than_foo, NAME_SIZE); |
1054 | return ( TRUE); | 1054 | return ( TRUE); |
1055 | } | 1055 | } |
1056 | 1056 | ||
@@ -1067,21 +1067,21 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* | |||
1067 | 1067 | ||
1068 | /* open the file we want to archive, and make sure all is well */ | 1068 | /* open the file we want to archive, and make sure all is well */ |
1069 | if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { | 1069 | if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { |
1070 | errorMsg("%s: Cannot open: %s\n", fileName, strerror(errno)); | 1070 | error_msg("%s: Cannot open: %s\n", fileName, strerror(errno)); |
1071 | return( FALSE); | 1071 | return( FALSE); |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | /* write the file to the archive */ | 1074 | /* write the file to the archive */ |
1075 | while ( (size = fullRead(inputFileFd, buffer, sizeof(buffer))) > 0 ) { | 1075 | while ( (size = full_read(inputFileFd, buffer, sizeof(buffer))) > 0 ) { |
1076 | if (fullWrite(tbInfo->tarFd, buffer, size) != size ) { | 1076 | if (full_write(tbInfo->tarFd, buffer, size) != size ) { |
1077 | /* Output file seems to have a problem */ | 1077 | /* Output file seems to have a problem */ |
1078 | errorMsg(io_error, fileName, strerror(errno)); | 1078 | error_msg(io_error, fileName, strerror(errno)); |
1079 | return( FALSE); | 1079 | return( FALSE); |
1080 | } | 1080 | } |
1081 | readSize+=size; | 1081 | readSize+=size; |
1082 | } | 1082 | } |
1083 | if (size == -1) { | 1083 | if (size == -1) { |
1084 | errorMsg(io_error, fileName, strerror(errno)); | 1084 | error_msg(io_error, fileName, strerror(errno)); |
1085 | return( FALSE); | 1085 | return( FALSE); |
1086 | } | 1086 | } |
1087 | /* Pad the file up to the tar block size */ | 1087 | /* Pad the file up to the tar block size */ |
@@ -1106,7 +1106,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1106 | 1106 | ||
1107 | /* Make sure there is at least one file to tar up. */ | 1107 | /* Make sure there is at least one file to tar up. */ |
1108 | if (*argv == NULL) | 1108 | if (*argv == NULL) |
1109 | fatalError("Cowardly refusing to create an empty archive\n"); | 1109 | error_msg_and_die("Cowardly refusing to create an empty archive\n"); |
1110 | 1110 | ||
1111 | /* Open the tar file for writing. */ | 1111 | /* Open the tar file for writing. */ |
1112 | if (!strcmp(tarName, "-")) | 1112 | if (!strcmp(tarName, "-")) |
@@ -1114,7 +1114,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1114 | else | 1114 | else |
1115 | tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644); | 1115 | tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644); |
1116 | if (tbInfo.tarFd < 0) { | 1116 | if (tbInfo.tarFd < 0) { |
1117 | errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno)); | 1117 | error_msg( "Error opening '%s': %s\n", tarName, strerror(errno)); |
1118 | freeHardLinkInfo(&tbInfo.hlInfoHead); | 1118 | freeHardLinkInfo(&tbInfo.hlInfoHead); |
1119 | return ( FALSE); | 1119 | return ( FALSE); |
1120 | } | 1120 | } |
@@ -1122,7 +1122,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1122 | /* Store the stat info for the tarball's file, so | 1122 | /* Store the stat info for the tarball's file, so |
1123 | * can avoid including the tarball into itself.... */ | 1123 | * can avoid including the tarball into itself.... */ |
1124 | if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0) | 1124 | if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0) |
1125 | fatalError(io_error, tarName, strerror(errno)); | 1125 | error_msg_and_die(io_error, tarName, strerror(errno)); |
1126 | 1126 | ||
1127 | /* Set the umask for this process so it doesn't | 1127 | /* Set the umask for this process so it doesn't |
1128 | * screw up permission setting for us later. */ | 1128 | * screw up permission setting for us later. */ |
@@ -1130,7 +1130,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1130 | 1130 | ||
1131 | /* Read the directory/files and iterate over them one at a time */ | 1131 | /* Read the directory/files and iterate over them one at a time */ |
1132 | while (*argv != NULL) { | 1132 | while (*argv != NULL) { |
1133 | if (recursiveAction(*argv++, TRUE, FALSE, FALSE, | 1133 | if (recursive_action(*argv++, TRUE, FALSE, FALSE, |
1134 | writeFileToTarball, writeFileToTarball, | 1134 | writeFileToTarball, writeFileToTarball, |
1135 | (void*) &tbInfo) == FALSE) { | 1135 | (void*) &tbInfo) == FALSE) { |
1136 | errorFlag = TRUE; | 1136 | errorFlag = TRUE; |
@@ -1149,7 +1149,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, | |||
1149 | /* Hang up the tools, close up shop, head home */ | 1149 | /* Hang up the tools, close up shop, head home */ |
1150 | close(tarFd); | 1150 | close(tarFd); |
1151 | if (errorFlag == TRUE) { | 1151 | if (errorFlag == TRUE) { |
1152 | errorMsg("Error exit delayed from previous errors\n"); | 1152 | error_msg("Error exit delayed from previous errors\n"); |
1153 | freeHardLinkInfo(&tbInfo.hlInfoHead); | 1153 | freeHardLinkInfo(&tbInfo.hlInfoHead); |
1154 | return(FALSE); | 1154 | return(FALSE); |
1155 | } | 1155 | } |
@@ -47,7 +47,7 @@ tee_main(int argc, char **argv) | |||
47 | while (optind < argc) { | 47 | while (optind < argc) { |
48 | if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) { | 48 | if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) { |
49 | nfiles--; | 49 | nfiles--; |
50 | errorMsg("%s: %s\n", argv[optind-1], strerror(errno)); | 50 | error_msg("%s: %s\n", argv[optind-1], strerror(errno)); |
51 | status = 1; | 51 | status = 1; |
52 | } | 52 | } |
53 | } | 53 | } |
@@ -583,7 +583,7 @@ static int getport(char * p) | |||
583 | 583 | ||
584 | if ((unsigned)(port - 1 ) > 65534) | 584 | if ((unsigned)(port - 1 ) > 65534) |
585 | { | 585 | { |
586 | fatalError("%s: bad port number\n", p); | 586 | error_msg_and_die("%s: bad port number\n", p); |
587 | } | 587 | } |
588 | return port; | 588 | return port; |
589 | } | 589 | } |
@@ -595,7 +595,7 @@ static struct in_addr getserver(char * host) | |||
595 | struct hostent * he; | 595 | struct hostent * he; |
596 | if ((he = gethostbyname(host)) == NULL) | 596 | if ((he = gethostbyname(host)) == NULL) |
597 | { | 597 | { |
598 | fatalError("%s: Unknown host\n", host); | 598 | error_msg_and_die("%s: Unknown host\n", host); |
599 | } | 599 | } |
600 | memcpy(&addr, he->h_addr, sizeof addr); | 600 | memcpy(&addr, he->h_addr, sizeof addr); |
601 | 601 | ||
@@ -650,7 +650,7 @@ static int remote_connect(struct in_addr addr, int port) | |||
650 | 650 | ||
651 | if (connect(s, (struct sockaddr *)&s_addr, sizeof s_addr) < 0) | 651 | if (connect(s, (struct sockaddr *)&s_addr, sizeof s_addr) < 0) |
652 | { | 652 | { |
653 | fatalError("Unable to connect to remote host: %s\n", strerror(errno)); | 653 | error_msg_and_die("Unable to connect to remote host: %s\n", strerror(errno)); |
654 | } | 654 | } |
655 | return s; | 655 | return s; |
656 | } | 656 | } |
@@ -184,7 +184,7 @@ test_main(int argc, char** argv) | |||
184 | 184 | ||
185 | if (strcmp(applet_name, "[") == 0) { | 185 | if (strcmp(applet_name, "[") == 0) { |
186 | if (strcmp(argv[--argc], "]")) | 186 | if (strcmp(argv[--argc], "]")) |
187 | fatalError("missing ]\n"); | 187 | error_msg_and_die("missing ]\n"); |
188 | argv[argc] = NULL; | 188 | argv[argc] = NULL; |
189 | } | 189 | } |
190 | /* Implement special cases from POSIX.2, section 4.62.4 */ | 190 | /* Implement special cases from POSIX.2, section 4.62.4 */ |
@@ -233,9 +233,9 @@ syntax(op, msg) | |||
233 | char *msg; | 233 | char *msg; |
234 | { | 234 | { |
235 | if (op && *op) | 235 | if (op && *op) |
236 | fatalError("%s: %s\n", op, msg); | 236 | error_msg_and_die("%s: %s\n", op, msg); |
237 | else | 237 | else |
238 | fatalError("%s\n", msg); | 238 | error_msg_and_die("%s\n", msg); |
239 | } | 239 | } |
240 | 240 | ||
241 | static int | 241 | static int |
@@ -470,13 +470,13 @@ getn(s) | |||
470 | r = strtol(s, &p, 10); | 470 | r = strtol(s, &p, 10); |
471 | 471 | ||
472 | if (errno != 0) | 472 | if (errno != 0) |
473 | fatalError("%s: out of range\n", s); | 473 | error_msg_and_die("%s: out of range\n", s); |
474 | 474 | ||
475 | while (isspace(*p)) | 475 | while (isspace(*p)) |
476 | p++; | 476 | p++; |
477 | 477 | ||
478 | if (*p) | 478 | if (*p) |
479 | fatalError("%s: bad number\n", s); | 479 | error_msg_and_die("%s: bad number\n", s); |
480 | 480 | ||
481 | return (int) r; | 481 | return (int) r; |
482 | } | 482 | } |
@@ -58,12 +58,12 @@ extern int touch_main(int argc, char **argv) | |||
58 | if (create == FALSE && errno == ENOENT) | 58 | if (create == FALSE && errno == ENOENT) |
59 | return EXIT_SUCCESS; | 59 | return EXIT_SUCCESS; |
60 | else { | 60 | else { |
61 | fatalError("%s", strerror(errno)); | 61 | error_msg_and_die("%s", strerror(errno)); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | close(fd); | 64 | close(fd); |
65 | if (utime(*argv, NULL)) { | 65 | if (utime(*argv, NULL)) { |
66 | fatalError("%s", strerror(errno)); | 66 | error_msg_and_die("%s", strerror(errno)); |
67 | } | 67 | } |
68 | argc--; | 68 | argc--; |
69 | argv++; | 69 | argv++; |
@@ -173,7 +173,7 @@ extern int tr_main(int argc, char **argv) | |||
173 | input_length = complement(input, input_length); | 173 | input_length = complement(input, input_length); |
174 | if (argv[index] != NULL) { | 174 | if (argv[index] != NULL) { |
175 | if (*argv[index] == '\0') | 175 | if (*argv[index] == '\0') |
176 | fatalError("STRING2 cannot be empty\n"); | 176 | error_msg_and_die("STRING2 cannot be empty\n"); |
177 | output_length = expand(argv[index], output); | 177 | output_length = expand(argv[index], output); |
178 | map(input, input_length, output, output_length); | 178 | map(input, input_length, output, output_length); |
179 | } | 179 | } |
@@ -79,7 +79,7 @@ void mtab_read(void) | |||
79 | return; | 79 | return; |
80 | 80 | ||
81 | if ((fp = setmntent(mtab_file, "r")) == NULL) { | 81 | if ((fp = setmntent(mtab_file, "r")) == NULL) { |
82 | errorMsg("Cannot open %s\n", mtab_file); | 82 | error_msg("Cannot open %s\n", mtab_file); |
83 | return; | 83 | return; |
84 | } | 84 | } |
85 | while ((e = getmntent(fp))) { | 85 | while ((e = getmntent(fp))) { |
@@ -179,7 +179,7 @@ static int do_umount(const char *name, int useMtab) | |||
179 | if (status != 0 && doForce == TRUE) { | 179 | if (status != 0 && doForce == TRUE) { |
180 | status = umount2(blockDevice, MNT_FORCE); | 180 | status = umount2(blockDevice, MNT_FORCE); |
181 | if (status != 0) { | 181 | if (status != 0) { |
182 | fatalError("forced umount of %s failed!\n", blockDevice); | 182 | error_msg_and_die("forced umount of %s failed!\n", blockDevice); |
183 | } | 183 | } |
184 | } | 184 | } |
185 | #endif | 185 | #endif |
@@ -187,9 +187,9 @@ static int do_umount(const char *name, int useMtab) | |||
187 | status = mount(blockDevice, name, NULL, | 187 | status = mount(blockDevice, name, NULL, |
188 | MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); | 188 | MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); |
189 | if (status == 0) { | 189 | if (status == 0) { |
190 | errorMsg("%s busy - remounted read-only\n", blockDevice); | 190 | error_msg("%s busy - remounted read-only\n", blockDevice); |
191 | } else { | 191 | } else { |
192 | errorMsg("Cannot remount %s read-only\n", blockDevice); | 192 | error_msg("Cannot remount %s read-only\n", blockDevice); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | if (status == 0) { | 195 | if (status == 0) { |
diff --git a/util-linux/fbset.c b/util-linux/fbset.c index 47130e355..86f7733c9 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c | |||
@@ -283,7 +283,7 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn, | |||
283 | } | 283 | } |
284 | } | 284 | } |
285 | #else | 285 | #else |
286 | errorMsg( "mode reading not compiled in\n"); | 286 | error_msg( "mode reading not compiled in\n"); |
287 | #endif | 287 | #endif |
288 | return 0; | 288 | return 0; |
289 | } | 289 | } |
@@ -433,7 +433,7 @@ extern int fbset_main(int argc, char **argv) | |||
433 | PERROR("fbset(ioctl)"); | 433 | PERROR("fbset(ioctl)"); |
434 | if (g_options & OPT_READMODE) { | 434 | if (g_options & OPT_READMODE) { |
435 | if (!readmode(&var, modefile, mode)) { | 435 | if (!readmode(&var, modefile, mode)) { |
436 | errorMsg("Unknown video mode `%s'\n", mode); | 436 | error_msg("Unknown video mode `%s'\n", mode); |
437 | return EXIT_FAILURE; | 437 | return EXIT_FAILURE; |
438 | } | 438 | } |
439 | } | 439 | } |
diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c index 567151455..a568cc67c 100644 --- a/util-linux/freeramdisk.c +++ b/util-linux/freeramdisk.c | |||
@@ -43,10 +43,10 @@ freeramdisk_main(int argc, char **argv) | |||
43 | } | 43 | } |
44 | 44 | ||
45 | if ((f = open(argv[1], O_RDWR)) == -1) { | 45 | if ((f = open(argv[1], O_RDWR)) == -1) { |
46 | fatalError( "cannot open %s: %s\n", argv[1], strerror(errno)); | 46 | error_msg_and_die( "cannot open %s: %s\n", argv[1], strerror(errno)); |
47 | } | 47 | } |
48 | if (ioctl(f, BLKFLSBUF) < 0) { | 48 | if (ioctl(f, BLKFLSBUF) < 0) { |
49 | fatalError( "failed ioctl on %s: %s\n", argv[1], strerror(errno)); | 49 | error_msg_and_die( "failed ioctl on %s: %s\n", argv[1], strerror(errno)); |
50 | } | 50 | } |
51 | /* Don't bother closing. Exit does | 51 | /* Don't bother closing. Exit does |
52 | * that, so we can save a few bytes */ | 52 | * that, so we can save a few bytes */ |
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index ef65e3073..9ebabe9e5 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
@@ -296,7 +296,7 @@ static void show_usage(void) | |||
296 | 296 | ||
297 | static void die(const char *str) | 297 | static void die(const char *str) |
298 | { | 298 | { |
299 | errorMsg("%s\n", str); | 299 | error_msg("%s\n", str); |
300 | leave(8); | 300 | leave(8); |
301 | } | 301 | } |
302 | 302 | ||
diff --git a/util-linux/getopt.c b/util-linux/getopt.c index 8c94bb4c1..0ebf9df08 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c | |||
@@ -37,7 +37,7 @@ | |||
37 | * <misiek@misiek.eu.org>) | 37 | * <misiek@misiek.eu.org>) |
38 | * Ported to Busybox - Alfred M. Szmidt <ams@trillian.itslinux.org> | 38 | * Ported to Busybox - Alfred M. Szmidt <ams@trillian.itslinux.org> |
39 | * Removed --version/-V and --help/-h in | 39 | * Removed --version/-V and --help/-h in |
40 | * Removed prase_error(), using errorMsg() from Busybox instead | 40 | * Removed prase_error(), using error_msg() from Busybox instead |
41 | * Replaced our_malloc with xmalloc and our_realloc with xrealloc | 41 | * Replaced our_malloc with xmalloc and our_realloc with xrealloc |
42 | * | 42 | * |
43 | */ | 43 | */ |
@@ -258,7 +258,7 @@ void add_long_options(char *options) | |||
258 | arg_opt=required_argument; | 258 | arg_opt=required_argument; |
259 | } | 259 | } |
260 | if (strlen(tokptr) == 0) | 260 | if (strlen(tokptr) == 0) |
261 | errorMsg("empty long option after -l or --long argument\n"); | 261 | error_msg("empty long option after -l or --long argument\n"); |
262 | } | 262 | } |
263 | add_longopt(tokptr,arg_opt); | 263 | add_longopt(tokptr,arg_opt); |
264 | } | 264 | } |
@@ -277,7 +277,7 @@ void set_shell(const char *new_shell) | |||
277 | else if (!strcmp(new_shell,"csh")) | 277 | else if (!strcmp(new_shell,"csh")) |
278 | shell=TCSH; | 278 | shell=TCSH; |
279 | else | 279 | else |
280 | errorMsg("unknown shell after -s or --shell argument\n"); | 280 | error_msg("unknown shell after -s or --shell argument\n"); |
281 | } | 281 | } |
282 | 282 | ||
283 | 283 | ||
@@ -326,7 +326,7 @@ int getopt_main(int argc, char *argv[]) | |||
326 | printf(" --\n"); | 326 | printf(" --\n"); |
327 | exit(0); | 327 | exit(0); |
328 | } else | 328 | } else |
329 | fatalError("missing optstring argument\n"); | 329 | error_msg_and_die("missing optstring argument\n"); |
330 | } | 330 | } |
331 | 331 | ||
332 | if (argv[1][0] != '-' || compatible) { | 332 | if (argv[1][0] != '-' || compatible) { |
@@ -377,7 +377,7 @@ int getopt_main(int argc, char *argv[]) | |||
377 | 377 | ||
378 | if (!optstr) { | 378 | if (!optstr) { |
379 | if (optind >= argc) | 379 | if (optind >= argc) |
380 | fatalError("missing optstring argument\n"); | 380 | error_msg_and_die("missing optstring argument\n"); |
381 | else { | 381 | else { |
382 | optstr=xmalloc(strlen(argv[optind])+1); | 382 | optstr=xmalloc(strlen(argv[optind])+1); |
383 | strcpy(optstr,argv[optind]); | 383 | strcpy(optstr,argv[optind]); |
diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 15cf531f0..95815fd4d 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c | |||
@@ -262,7 +262,7 @@ static inline int bit(char * a,unsigned int i) | |||
262 | */ | 262 | */ |
263 | static volatile void die(char *str) | 263 | static volatile void die(char *str) |
264 | { | 264 | { |
265 | errorMsg("%s\n", str); | 265 | error_msg("%s\n", str); |
266 | exit(8); | 266 | exit(8); |
267 | } | 267 | } |
268 | 268 | ||
@@ -796,7 +796,7 @@ extern int mkfs_minix_main(int argc, char **argv) | |||
796 | #ifdef BB_FEATURE_MINIX2 | 796 | #ifdef BB_FEATURE_MINIX2 |
797 | version2 = 1; | 797 | version2 = 1; |
798 | #else | 798 | #else |
799 | errorMsg("%s: not compiled with minix v2 support\n", | 799 | error_msg("%s: not compiled with minix v2 support\n", |
800 | device_name); | 800 | device_name); |
801 | exit(-1); | 801 | exit(-1); |
802 | #endif | 802 | #endif |
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index 4757e15f8..3a396894c 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c | |||
@@ -87,7 +87,7 @@ static void init_signature_page() | |||
87 | 87 | ||
88 | #ifdef PAGE_SIZE | 88 | #ifdef PAGE_SIZE |
89 | if (pagesize != PAGE_SIZE) | 89 | if (pagesize != PAGE_SIZE) |
90 | errorMsg("Assuming pages of size %d\n", pagesize); | 90 | error_msg("Assuming pages of size %d\n", pagesize); |
91 | #endif | 91 | #endif |
92 | signature_page = (int *) xmalloc(pagesize); | 92 | signature_page = (int *) xmalloc(pagesize); |
93 | memset(signature_page, 0, pagesize); | 93 | memset(signature_page, 0, pagesize); |
@@ -175,7 +175,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr) | |||
175 | 175 | ||
176 | void die(const char *str) | 176 | void die(const char *str) |
177 | { | 177 | { |
178 | errorMsg("%s\n", str); | 178 | error_msg("%s\n", str); |
179 | exit(EXIT_FAILURE); | 179 | exit(EXIT_FAILURE); |
180 | } | 180 | } |
181 | 181 | ||
@@ -316,14 +316,14 @@ int mkswap_main(int argc, char **argv) | |||
316 | } | 316 | } |
317 | } | 317 | } |
318 | if (!device_name) { | 318 | if (!device_name) { |
319 | errorMsg("error: Nowhere to set up swap on?\n"); | 319 | error_msg("error: Nowhere to set up swap on?\n"); |
320 | usage(mkswap_usage); | 320 | usage(mkswap_usage); |
321 | } | 321 | } |
322 | sz = get_size(device_name); | 322 | sz = get_size(device_name); |
323 | if (!PAGES) { | 323 | if (!PAGES) { |
324 | PAGES = sz; | 324 | PAGES = sz; |
325 | } else if (PAGES > sz && !force) { | 325 | } else if (PAGES > sz && !force) { |
326 | errorMsg("error: size %ld is larger than device size %d\n", | 326 | error_msg("error: size %ld is larger than device size %d\n", |
327 | PAGES * (pagesize / 1024), sz * (pagesize / 1024)); | 327 | PAGES * (pagesize / 1024), sz * (pagesize / 1024)); |
328 | return EXIT_FAILURE; | 328 | return EXIT_FAILURE; |
329 | } | 329 | } |
@@ -339,11 +339,11 @@ int mkswap_main(int argc, char **argv) | |||
339 | version = 1; | 339 | version = 1; |
340 | } | 340 | } |
341 | if (version != 0 && version != 1) { | 341 | if (version != 0 && version != 1) { |
342 | errorMsg("error: unknown version %d\n", version); | 342 | error_msg("error: unknown version %d\n", version); |
343 | usage(mkswap_usage); | 343 | usage(mkswap_usage); |
344 | } | 344 | } |
345 | if (PAGES < 10) { | 345 | if (PAGES < 10) { |
346 | errorMsg("error: swap area needs to be at least %ldkB\n", | 346 | error_msg("error: swap area needs to be at least %ldkB\n", |
347 | (long) (10 * pagesize / 1024)); | 347 | (long) (10 * pagesize / 1024)); |
348 | usage(mkswap_usage); | 348 | usage(mkswap_usage); |
349 | } | 349 | } |
@@ -362,7 +362,7 @@ int mkswap_main(int argc, char **argv) | |||
362 | #endif | 362 | #endif |
363 | if (PAGES > maxpages) { | 363 | if (PAGES > maxpages) { |
364 | PAGES = maxpages; | 364 | PAGES = maxpages; |
365 | errorMsg("warning: truncating swap area to %ldkB\n", | 365 | error_msg("warning: truncating swap area to %ldkB\n", |
366 | PAGES * pagesize / 1024); | 366 | PAGES * pagesize / 1024); |
367 | } | 367 | } |
368 | 368 | ||
@@ -389,7 +389,7 @@ int mkswap_main(int argc, char **argv) | |||
389 | for (sum = 0; q >= (unsigned short *) buffer;) | 389 | for (sum = 0; q >= (unsigned short *) buffer;) |
390 | sum ^= *q--; | 390 | sum ^= *q--; |
391 | if (!sum) { | 391 | if (!sum) { |
392 | errorMsg("Device '%s' contains a valid Sun disklabel.\n" | 392 | error_msg("Device '%s' contains a valid Sun disklabel.\n" |
393 | "This probably means creating v0 swap would destroy your partition table\n" | 393 | "This probably means creating v0 swap would destroy your partition table\n" |
394 | "No swap created. If you really want to create swap v0 on that device, use\n" | 394 | "No swap created. If you really want to create swap v0 on that device, use\n" |
395 | "the -f option to force it.\n", device_name); | 395 | "the -f option to force it.\n", device_name); |
diff --git a/util-linux/mount.c b/util-linux/mount.c index ff8aef379..fa998122b 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -132,22 +132,22 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
132 | 132 | ||
133 | specialfile = find_unused_loop_device(); | 133 | specialfile = find_unused_loop_device(); |
134 | if (specialfile == NULL) { | 134 | if (specialfile == NULL) { |
135 | errorMsg("Could not find a spare loop device\n"); | 135 | error_msg("Could not find a spare loop device\n"); |
136 | return (FALSE); | 136 | return (FALSE); |
137 | } | 137 | } |
138 | if (set_loop(specialfile, lofile, 0, &loro)) { | 138 | if (set_loop(specialfile, lofile, 0, &loro)) { |
139 | errorMsg("Could not setup loop device\n"); | 139 | error_msg("Could not setup loop device\n"); |
140 | return (FALSE); | 140 | return (FALSE); |
141 | } | 141 | } |
142 | if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ | 142 | if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ |
143 | errorMsg("WARNING: loop device is read-only\n"); | 143 | error_msg("WARNING: loop device is read-only\n"); |
144 | flags &= ~MS_RDONLY; | 144 | flags &= ~MS_RDONLY; |
145 | } | 145 | } |
146 | } | 146 | } |
147 | #endif | 147 | #endif |
148 | status = mount(specialfile, dir, filesystemtype, flags, string_flags); | 148 | status = mount(specialfile, dir, filesystemtype, flags, string_flags); |
149 | if (errno == EROFS) { | 149 | if (errno == EROFS) { |
150 | errorMsg("%s is write-protected, mounting read-only\n", specialfile); | 150 | error_msg("%s is write-protected, mounting read-only\n", specialfile); |
151 | status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags); | 151 | status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags); |
152 | } | 152 | } |
153 | } | 153 | } |
@@ -173,7 +173,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, | |||
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | if (errno == EPERM) { | 175 | if (errno == EPERM) { |
176 | fatalError("permission denied. Are you root?\n"); | 176 | error_msg_and_die("permission denied. Are you root?\n"); |
177 | } | 177 | } |
178 | 178 | ||
179 | return (FALSE); | 179 | return (FALSE); |
@@ -273,18 +273,18 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
273 | /* open device */ | 273 | /* open device */ |
274 | fd = open(device, O_RDONLY); | 274 | fd = open(device, O_RDONLY); |
275 | if (fd < 0) | 275 | if (fd < 0) |
276 | fatalError("open failed for `%s': %s\n", device, strerror (errno)); | 276 | error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno)); |
277 | 277 | ||
278 | /* How many filesystems? We need to know to allocate enough space */ | 278 | /* How many filesystems? We need to know to allocate enough space */ |
279 | numfilesystems = ioctl (fd, DEVMTAB_COUNT_FILESYSTEMS); | 279 | numfilesystems = ioctl (fd, DEVMTAB_COUNT_FILESYSTEMS); |
280 | if (numfilesystems<0) | 280 | if (numfilesystems<0) |
281 | fatalError("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno)); | 281 | error_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno)); |
282 | fslist = (struct k_fstype *) xcalloc ( numfilesystems, sizeof(struct k_fstype)); | 282 | fslist = (struct k_fstype *) xcalloc ( numfilesystems, sizeof(struct k_fstype)); |
283 | 283 | ||
284 | /* Grab the list of available filesystems */ | 284 | /* Grab the list of available filesystems */ |
285 | status = ioctl (fd, DEVMTAB_GET_FILESYSTEMS, fslist); | 285 | status = ioctl (fd, DEVMTAB_GET_FILESYSTEMS, fslist); |
286 | if (status<0) | 286 | if (status<0) |
287 | fatalError("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno)); | 287 | error_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno)); |
288 | 288 | ||
289 | /* Walk the list trying to mount filesystems | 289 | /* Walk the list trying to mount filesystems |
290 | * that do not claim to be nodev filesystems */ | 290 | * that do not claim to be nodev filesystems */ |
@@ -309,7 +309,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType, | |||
309 | 309 | ||
310 | if (status == FALSE) { | 310 | if (status == FALSE) { |
311 | if (whineOnErrors == TRUE) { | 311 | if (whineOnErrors == TRUE) { |
312 | errorMsg("Mounting %s on %s failed: %s\n", | 312 | error_msg("Mounting %s on %s failed: %s\n", |
313 | blockDevice, directory, strerror(errno)); | 313 | blockDevice, directory, strerror(errno)); |
314 | } | 314 | } |
315 | return (FALSE); | 315 | return (FALSE); |
@@ -342,18 +342,18 @@ extern int mount_main(int argc, char **argv) | |||
342 | /* open device */ | 342 | /* open device */ |
343 | fd = open(device, O_RDONLY); | 343 | fd = open(device, O_RDONLY); |
344 | if (fd < 0) | 344 | if (fd < 0) |
345 | fatalError("open failed for `%s': %s\n", device, strerror (errno)); | 345 | error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno)); |
346 | 346 | ||
347 | /* How many mounted filesystems? We need to know to | 347 | /* How many mounted filesystems? We need to know to |
348 | * allocate enough space for later... */ | 348 | * allocate enough space for later... */ |
349 | numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS); | 349 | numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS); |
350 | if (numfilesystems<0) | 350 | if (numfilesystems<0) |
351 | fatalError( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno)); | 351 | error_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno)); |
352 | mntentlist = (struct k_mntent *) xcalloc ( numfilesystems, sizeof(struct k_mntent)); | 352 | mntentlist = (struct k_mntent *) xcalloc ( numfilesystems, sizeof(struct k_mntent)); |
353 | 353 | ||
354 | /* Grab the list of mounted filesystems */ | 354 | /* Grab the list of mounted filesystems */ |
355 | if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0) | 355 | if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0) |
356 | fatalError( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno)); | 356 | error_msg_and_die( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno)); |
357 | 357 | ||
358 | for( i = 0 ; i < numfilesystems ; i++) { | 358 | for( i = 0 ; i < numfilesystems ; i++) { |
359 | fprintf( stdout, "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname, | 359 | fprintf( stdout, "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname, |
@@ -455,7 +455,7 @@ extern int mount_main(int argc, char **argv) | |||
455 | fstabmount = TRUE; | 455 | fstabmount = TRUE; |
456 | 456 | ||
457 | if (f == NULL) | 457 | if (f == NULL) |
458 | fatalError( "\nCannot read /etc/fstab: %s\n", strerror (errno)); | 458 | error_msg_and_die( "\nCannot read /etc/fstab: %s\n", strerror (errno)); |
459 | 459 | ||
460 | while ((m = getmntent(f)) != NULL) { | 460 | while ((m = getmntent(f)) != NULL) { |
461 | if (all == FALSE && directory == NULL && ( | 461 | if (all == FALSE && directory == NULL && ( |
@@ -488,7 +488,7 @@ singlemount: | |||
488 | rc = nfsmount (device, directory, &flags, | 488 | rc = nfsmount (device, directory, &flags, |
489 | &extra_opts, &string_flags, 1); | 489 | &extra_opts, &string_flags, 1); |
490 | if ( rc != 0) { | 490 | if ( rc != 0) { |
491 | fatalError("nfsmount failed: %s\n", strerror(errno)); | 491 | error_msg_and_die("nfsmount failed: %s\n", strerror(errno)); |
492 | rc = EXIT_FAILURE; | 492 | rc = EXIT_FAILURE; |
493 | } | 493 | } |
494 | } | 494 | } |
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c index f8735e52c..a8c0b0ea6 100644 --- a/util-linux/nfsmount.c +++ b/util-linux/nfsmount.c | |||
@@ -300,7 +300,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
300 | msock = fsock = -1; | 300 | msock = fsock = -1; |
301 | mclient = NULL; | 301 | mclient = NULL; |
302 | if (strlen(spec) >= sizeof(hostdir)) { | 302 | if (strlen(spec) >= sizeof(hostdir)) { |
303 | errorMsg("excessively long host:dir argument\n"); | 303 | error_msg("excessively long host:dir argument\n"); |
304 | goto fail; | 304 | goto fail; |
305 | } | 305 | } |
306 | strcpy(hostdir, spec); | 306 | strcpy(hostdir, spec); |
@@ -312,10 +312,10 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
312 | until they can be fully supported. (mack@sgi.com) */ | 312 | until they can be fully supported. (mack@sgi.com) */ |
313 | if ((s = strchr(hostdir, ','))) { | 313 | if ((s = strchr(hostdir, ','))) { |
314 | *s = '\0'; | 314 | *s = '\0'; |
315 | errorMsg("warning: multiple hostnames not supported\n"); | 315 | error_msg("warning: multiple hostnames not supported\n"); |
316 | } | 316 | } |
317 | } else { | 317 | } else { |
318 | errorMsg("directory to mount not in host:dir format\n"); | 318 | error_msg("directory to mount not in host:dir format\n"); |
319 | goto fail; | 319 | goto fail; |
320 | } | 320 | } |
321 | 321 | ||
@@ -325,11 +325,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
325 | #endif | 325 | #endif |
326 | { | 326 | { |
327 | if ((hp = gethostbyname(hostname)) == NULL) { | 327 | if ((hp = gethostbyname(hostname)) == NULL) { |
328 | errorMsg("can't get address for %s\n", hostname); | 328 | error_msg("can't get address for %s\n", hostname); |
329 | goto fail; | 329 | goto fail; |
330 | } else { | 330 | } else { |
331 | if (hp->h_length > sizeof(struct in_addr)) { | 331 | if (hp->h_length > sizeof(struct in_addr)) { |
332 | errorMsg("got bad hp->h_length\n"); | 332 | error_msg("got bad hp->h_length\n"); |
333 | hp->h_length = sizeof(struct in_addr); | 333 | hp->h_length = sizeof(struct in_addr); |
334 | } | 334 | } |
335 | memcpy(&server_addr.sin_addr, | 335 | memcpy(&server_addr.sin_addr, |
@@ -346,7 +346,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
346 | if (!old_opts) | 346 | if (!old_opts) |
347 | old_opts = ""; | 347 | old_opts = ""; |
348 | if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { | 348 | if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { |
349 | errorMsg("excessively long option argument\n"); | 349 | error_msg("excessively long option argument\n"); |
350 | goto fail; | 350 | goto fail; |
351 | } | 351 | } |
352 | sprintf(new_opts, "%s%saddr=%s", | 352 | sprintf(new_opts, "%s%saddr=%s", |
@@ -506,11 +506,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
506 | data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); | 506 | data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); |
507 | #endif | 507 | #endif |
508 | if (nfsvers > MAX_NFSPROT) { | 508 | if (nfsvers > MAX_NFSPROT) { |
509 | errorMsg("NFSv%d not supported!\n", nfsvers); | 509 | error_msg("NFSv%d not supported!\n", nfsvers); |
510 | return 0; | 510 | return 0; |
511 | } | 511 | } |
512 | if (mountvers > MAX_NFSPROT) { | 512 | if (mountvers > MAX_NFSPROT) { |
513 | errorMsg("NFSv%d not supported!\n", nfsvers); | 513 | error_msg("NFSv%d not supported!\n", nfsvers); |
514 | return 0; | 514 | return 0; |
515 | } | 515 | } |
516 | if (nfsvers && !mountvers) | 516 | if (nfsvers && !mountvers) |
@@ -570,11 +570,11 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
570 | mount_server_addr.sin_addr.s_addr = inet_addr(hostname); | 570 | mount_server_addr.sin_addr.s_addr = inet_addr(hostname); |
571 | } else { | 571 | } else { |
572 | if ((hp = gethostbyname(mounthost)) == NULL) { | 572 | if ((hp = gethostbyname(mounthost)) == NULL) { |
573 | errorMsg("can't get address for %s\n", hostname); | 573 | error_msg("can't get address for %s\n", hostname); |
574 | goto fail; | 574 | goto fail; |
575 | } else { | 575 | } else { |
576 | if (hp->h_length > sizeof(struct in_addr)) { | 576 | if (hp->h_length > sizeof(struct in_addr)) { |
577 | errorMsg("got bad hp->h_length?\n"); | 577 | error_msg("got bad hp->h_length?\n"); |
578 | hp->h_length = sizeof(struct in_addr); | 578 | hp->h_length = sizeof(struct in_addr); |
579 | } | 579 | } |
580 | mount_server_addr.sin_family = AF_INET; | 580 | mount_server_addr.sin_family = AF_INET; |
@@ -709,7 +709,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
709 | 709 | ||
710 | if (nfsvers == 2) { | 710 | if (nfsvers == 2) { |
711 | if (status.nfsv2.fhs_status != 0) { | 711 | if (status.nfsv2.fhs_status != 0) { |
712 | errorMsg("%s:%s failed, reason given by server: %s\n", | 712 | error_msg("%s:%s failed, reason given by server: %s\n", |
713 | hostname, dirname, | 713 | hostname, dirname, |
714 | nfs_strerror(status.nfsv2.fhs_status)); | 714 | nfs_strerror(status.nfsv2.fhs_status)); |
715 | goto fail; | 715 | goto fail; |
@@ -727,7 +727,7 @@ int nfsmount(const char *spec, const char *node, int *flags, | |||
727 | #if NFS_MOUNT_VERSION >= 4 | 727 | #if NFS_MOUNT_VERSION >= 4 |
728 | fhandle3 *fhandle; | 728 | fhandle3 *fhandle; |
729 | if (status.nfsv3.fhs_status != 0) { | 729 | if (status.nfsv3.fhs_status != 0) { |
730 | errorMsg("%s:%s failed, reason given by server: %s\n", | 730 | error_msg("%s:%s failed, reason given by server: %s\n", |
731 | hostname, dirname, | 731 | hostname, dirname, |
732 | nfs_strerror(status.nfsv3.fhs_status)); | 732 | nfs_strerror(status.nfsv3.fhs_status)); |
733 | goto fail; | 733 | goto fail; |
diff --git a/util-linux/rdate.c b/util-linux/rdate.c index 7c8d54117..87edecbfc 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c | |||
@@ -47,15 +47,15 @@ time_t askremotedate(char *host) | |||
47 | int fd; | 47 | int fd; |
48 | 48 | ||
49 | if (!(h = gethostbyname(host))) { /* get the IP addr */ | 49 | if (!(h = gethostbyname(host))) { /* get the IP addr */ |
50 | errorMsg("%s: %s\n", host, strerror(errno)); | 50 | error_msg("%s: %s\n", host, strerror(errno)); |
51 | return(-1); | 51 | return(-1); |
52 | } | 52 | } |
53 | if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */ | 53 | if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */ |
54 | errorMsg("%s: %s\n", "time", strerror(errno)); | 54 | error_msg("%s: %s\n", "time", strerror(errno)); |
55 | return(-1); | 55 | return(-1); |
56 | } | 56 | } |
57 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { /* get net connection */ | 57 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { /* get net connection */ |
58 | errorMsg("%s: %s\n", "socket", strerror(errno)); | 58 | error_msg("%s: %s\n", "socket", strerror(errno)); |
59 | return(-1); | 59 | return(-1); |
60 | } | 60 | } |
61 | 61 | ||
@@ -64,13 +64,13 @@ time_t askremotedate(char *host) | |||
64 | sin.sin_family = AF_INET; | 64 | sin.sin_family = AF_INET; |
65 | 65 | ||
66 | if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { /* connect to time server */ | 66 | if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { /* connect to time server */ |
67 | errorMsg("%s: %s\n", host, strerror(errno)); | 67 | error_msg("%s: %s\n", host, strerror(errno)); |
68 | close(fd); | 68 | close(fd); |
69 | return(-1); | 69 | return(-1); |
70 | } | 70 | } |
71 | if (read(fd, (void *)&nett, 4) != 4) { /* read time from server */ | 71 | if (read(fd, (void *)&nett, 4) != 4) { /* read time from server */ |
72 | close(fd); | 72 | close(fd); |
73 | errorMsg("%s did not send the complete time\n", host); | 73 | error_msg("%s did not send the complete time\n", host); |
74 | } | 74 | } |
75 | close(fd); | 75 | close(fd); |
76 | 76 | ||
@@ -123,7 +123,7 @@ int rdate_main(int argc, char **argv) | |||
123 | } | 123 | } |
124 | if (setdate) { | 124 | if (setdate) { |
125 | if (stime(&time) < 0) | 125 | if (stime(&time) < 0) |
126 | fatalError("Could not set time of day: %s\n", strerror(errno)); | 126 | error_msg_and_die("Could not set time of day: %s\n", strerror(errno)); |
127 | } | 127 | } |
128 | if (printdate) { | 128 | if (printdate) { |
129 | fprintf(stdout, "%s", ctime(&time)); | 129 | fprintf(stdout, "%s", ctime(&time)); |
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index 0ae0c36ee..e40d169dd 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c | |||
@@ -96,7 +96,7 @@ extern int swap_on_off_main(int argc, char **argv) | |||
96 | struct stat statBuf; | 96 | struct stat statBuf; |
97 | 97 | ||
98 | if (stat("/etc/fstab", &statBuf) < 0) | 98 | if (stat("/etc/fstab", &statBuf) < 0) |
99 | fatalError("/etc/fstab file missing\n"); | 99 | error_msg_and_die("/etc/fstab file missing\n"); |
100 | } | 100 | } |
101 | do_em_all(); | 101 | do_em_all(); |
102 | break; | 102 | break; |
diff --git a/util-linux/umount.c b/util-linux/umount.c index eff080463..e76e0521f 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c | |||
@@ -79,7 +79,7 @@ void mtab_read(void) | |||
79 | return; | 79 | return; |
80 | 80 | ||
81 | if ((fp = setmntent(mtab_file, "r")) == NULL) { | 81 | if ((fp = setmntent(mtab_file, "r")) == NULL) { |
82 | errorMsg("Cannot open %s\n", mtab_file); | 82 | error_msg("Cannot open %s\n", mtab_file); |
83 | return; | 83 | return; |
84 | } | 84 | } |
85 | while ((e = getmntent(fp))) { | 85 | while ((e = getmntent(fp))) { |
@@ -179,7 +179,7 @@ static int do_umount(const char *name, int useMtab) | |||
179 | if (status != 0 && doForce == TRUE) { | 179 | if (status != 0 && doForce == TRUE) { |
180 | status = umount2(blockDevice, MNT_FORCE); | 180 | status = umount2(blockDevice, MNT_FORCE); |
181 | if (status != 0) { | 181 | if (status != 0) { |
182 | fatalError("forced umount of %s failed!\n", blockDevice); | 182 | error_msg_and_die("forced umount of %s failed!\n", blockDevice); |
183 | } | 183 | } |
184 | } | 184 | } |
185 | #endif | 185 | #endif |
@@ -187,9 +187,9 @@ static int do_umount(const char *name, int useMtab) | |||
187 | status = mount(blockDevice, name, NULL, | 187 | status = mount(blockDevice, name, NULL, |
188 | MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); | 188 | MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); |
189 | if (status == 0) { | 189 | if (status == 0) { |
190 | errorMsg("%s busy - remounted read-only\n", blockDevice); | 190 | error_msg("%s busy - remounted read-only\n", blockDevice); |
191 | } else { | 191 | } else { |
192 | errorMsg("Cannot remount %s read-only\n", blockDevice); | 192 | error_msg("Cannot remount %s read-only\n", blockDevice); |
193 | } | 193 | } |
194 | } | 194 | } |
195 | if (status == 0) { | 195 | if (status == 0) { |
@@ -33,7 +33,7 @@ | |||
33 | || defined (BB_LS) \ | 33 | || defined (BB_LS) \ |
34 | || defined (BB_RM) \ | 34 | || defined (BB_RM) \ |
35 | || defined (BB_TAR) | 35 | || defined (BB_TAR) |
36 | /* same conditions as recursiveAction */ | 36 | /* same conditions as recursive_action */ |
37 | #define bb_need_name_too_long | 37 | #define bb_need_name_too_long |
38 | #endif | 38 | #endif |
39 | #define bb_need_memory_exhausted | 39 | #define bb_need_memory_exhausted |
@@ -84,7 +84,7 @@ extern void usage(const char *usage) | |||
84 | exit(EXIT_FAILURE); | 84 | exit(EXIT_FAILURE); |
85 | } | 85 | } |
86 | 86 | ||
87 | static void verrorMsg(const char *s, va_list p) | 87 | static void verror_msg(const char *s, va_list p) |
88 | { | 88 | { |
89 | fflush(stdout); | 89 | fflush(stdout); |
90 | fprintf(stderr, "%s: ", applet_name); | 90 | fprintf(stderr, "%s: ", applet_name); |
@@ -92,26 +92,26 @@ static void verrorMsg(const char *s, va_list p) | |||
92 | fflush(stderr); | 92 | fflush(stderr); |
93 | } | 93 | } |
94 | 94 | ||
95 | extern void errorMsg(const char *s, ...) | 95 | extern void error_msg(const char *s, ...) |
96 | { | 96 | { |
97 | va_list p; | 97 | va_list p; |
98 | 98 | ||
99 | va_start(p, s); | 99 | va_start(p, s); |
100 | verrorMsg(s, p); | 100 | verror_msg(s, p); |
101 | va_end(p); | 101 | va_end(p); |
102 | } | 102 | } |
103 | 103 | ||
104 | extern void fatalError(const char *s, ...) | 104 | extern void error_msg_and_die(const char *s, ...) |
105 | { | 105 | { |
106 | va_list p; | 106 | va_list p; |
107 | 107 | ||
108 | va_start(p, s); | 108 | va_start(p, s); |
109 | verrorMsg(s, p); | 109 | verror_msg(s, p); |
110 | va_end(p); | 110 | va_end(p); |
111 | exit(EXIT_FAILURE); | 111 | exit(EXIT_FAILURE); |
112 | } | 112 | } |
113 | 113 | ||
114 | static void vperrorMsg(const char *s, va_list p) | 114 | static void vperror_msg(const char *s, va_list p) |
115 | { | 115 | { |
116 | fflush(stdout); | 116 | fflush(stdout); |
117 | fprintf(stderr, "%s: ", applet_name); | 117 | fprintf(stderr, "%s: ", applet_name); |
@@ -123,21 +123,21 @@ static void vperrorMsg(const char *s, va_list p) | |||
123 | fflush(stderr); | 123 | fflush(stderr); |
124 | } | 124 | } |
125 | 125 | ||
126 | extern void perrorMsg(const char *s, ...) | 126 | extern void perror_msg(const char *s, ...) |
127 | { | 127 | { |
128 | va_list p; | 128 | va_list p; |
129 | 129 | ||
130 | va_start(p, s); | 130 | va_start(p, s); |
131 | vperrorMsg(s, p); | 131 | vperror_msg(s, p); |
132 | va_end(p); | 132 | va_end(p); |
133 | } | 133 | } |
134 | 134 | ||
135 | extern void fatalPerror(const char *s, ...) | 135 | extern void perror_msg_and_die(const char *s, ...) |
136 | { | 136 | { |
137 | va_list p; | 137 | va_list p; |
138 | 138 | ||
139 | va_start(p, s); | 139 | va_start(p, s); |
140 | vperrorMsg(s, p); | 140 | vperror_msg(s, p); |
141 | va_end(p); | 141 | va_end(p); |
142 | exit(EXIT_FAILURE); | 142 | exit(EXIT_FAILURE); |
143 | } | 143 | } |
@@ -266,7 +266,7 @@ void reset_ino_dev_hashtable(void) | |||
266 | * Return TRUE if a fileName is a directory. | 266 | * Return TRUE if a fileName is a directory. |
267 | * Nonexistant files return FALSE. | 267 | * Nonexistant files return FALSE. |
268 | */ | 268 | */ |
269 | int isDirectory(const char *fileName, const int followLinks, struct stat *statBuf) | 269 | int is_directory(const char *fileName, const int followLinks, struct stat *statBuf) |
270 | { | 270 | { |
271 | int status; | 271 | int status; |
272 | int didMalloc = 0; | 272 | int didMalloc = 0; |
@@ -308,7 +308,7 @@ int copy_file_chunk(int srcfd, int dstfd, size_t chunksize) | |||
308 | size = BUFSIZ; | 308 | size = BUFSIZ; |
309 | else | 309 | else |
310 | size = chunksize; | 310 | size = chunksize; |
311 | if (fullWrite(dstfd, buffer, fullRead(srcfd, buffer, size)) < size) | 311 | if (full_write(dstfd, buffer, full_read(srcfd, buffer, size)) < size) |
312 | return(FALSE); | 312 | return(FALSE); |
313 | chunksize -= size; | 313 | chunksize -= size; |
314 | } | 314 | } |
@@ -325,7 +325,7 @@ int copy_file_chunk(int srcfd, int dstfd, size_t chunksize) | |||
325 | * -Erik Andersen | 325 | * -Erik Andersen |
326 | */ | 326 | */ |
327 | int | 327 | int |
328 | copyFile(const char *srcName, const char *destName, | 328 | copy_file(const char *srcName, const char *destName, |
329 | int setModes, int followLinks, int forceFlag) | 329 | int setModes, int followLinks, int forceFlag) |
330 | { | 330 | { |
331 | int rfd; | 331 | int rfd; |
@@ -358,7 +358,7 @@ copyFile(const char *srcName, const char *destName, | |||
358 | 358 | ||
359 | if ((srcStatBuf.st_dev == dstStatBuf.st_dev) && | 359 | if ((srcStatBuf.st_dev == dstStatBuf.st_dev) && |
360 | (srcStatBuf.st_ino == dstStatBuf.st_ino)) { | 360 | (srcStatBuf.st_ino == dstStatBuf.st_ino)) { |
361 | errorMsg("Copying file \"%s\" to itself\n", srcName); | 361 | error_msg("Copying file \"%s\" to itself\n", srcName); |
362 | return FALSE; | 362 | return FALSE; |
363 | } | 363 | } |
364 | 364 | ||
@@ -491,7 +491,7 @@ static const char SMODE0[] = "..S..S..T"; | |||
491 | * Return the standard ls-like mode string from a file mode. | 491 | * Return the standard ls-like mode string from a file mode. |
492 | * This is static and so is overwritten on each call. | 492 | * This is static and so is overwritten on each call. |
493 | */ | 493 | */ |
494 | const char *modeString(int mode) | 494 | const char *mode_string(int mode) |
495 | { | 495 | { |
496 | static char buf[12]; | 496 | static char buf[12]; |
497 | 497 | ||
@@ -514,7 +514,7 @@ const char *modeString(int mode) | |||
514 | * Return the standard ls-like time string from a time_t | 514 | * Return the standard ls-like time string from a time_t |
515 | * This is static and so is overwritten on each call. | 515 | * This is static and so is overwritten on each call. |
516 | */ | 516 | */ |
517 | const char *timeString(time_t timeVal) | 517 | const char *time_string(time_t timeVal) |
518 | { | 518 | { |
519 | time_t now; | 519 | time_t now; |
520 | char *str; | 520 | char *str; |
@@ -542,7 +542,7 @@ const char *timeString(time_t timeVal) | |||
542 | * This does multiple writes as necessary. | 542 | * This does multiple writes as necessary. |
543 | * Returns the amount written, or -1 on an error. | 543 | * Returns the amount written, or -1 on an error. |
544 | */ | 544 | */ |
545 | int fullWrite(int fd, const char *buf, int len) | 545 | int full_write(int fd, const char *buf, int len) |
546 | { | 546 | { |
547 | int cc; | 547 | int cc; |
548 | int total; | 548 | int total; |
@@ -572,7 +572,7 @@ int fullWrite(int fd, const char *buf, int len) | |||
572 | * Returns the amount read, or -1 on an error. | 572 | * Returns the amount read, or -1 on an error. |
573 | * A short read is returned on an end of file. | 573 | * A short read is returned on an end of file. |
574 | */ | 574 | */ |
575 | int fullRead(int fd, char *buf, int len) | 575 | int full_read(int fd, char *buf, int len) |
576 | { | 576 | { |
577 | int cc; | 577 | int cc; |
578 | int total; | 578 | int total; |
@@ -616,7 +616,7 @@ int fullRead(int fd, char *buf, int len) | |||
616 | * and so isn't sufficiently portable to take over since glibc2.1 | 616 | * and so isn't sufficiently portable to take over since glibc2.1 |
617 | * is so stinking huge. | 617 | * is so stinking huge. |
618 | */ | 618 | */ |
619 | int recursiveAction(const char *fileName, | 619 | int recursive_action(const char *fileName, |
620 | int recurse, int followLinks, int depthFirst, | 620 | int recurse, int followLinks, int depthFirst, |
621 | int (*fileAction) (const char *fileName, | 621 | int (*fileAction) (const char *fileName, |
622 | struct stat * statbuf, | 622 | struct stat * statbuf, |
@@ -641,7 +641,7 @@ int recursiveAction(const char *fileName, | |||
641 | "status=%d followLinks=%d TRUE=%d\n", | 641 | "status=%d followLinks=%d TRUE=%d\n", |
642 | status, followLinks, TRUE); | 642 | status, followLinks, TRUE); |
643 | #endif | 643 | #endif |
644 | perrorMsg("%s", fileName); | 644 | perror_msg("%s", fileName); |
645 | return FALSE; | 645 | return FALSE; |
646 | } | 646 | } |
647 | 647 | ||
@@ -666,13 +666,13 @@ int recursiveAction(const char *fileName, | |||
666 | 666 | ||
667 | dir = opendir(fileName); | 667 | dir = opendir(fileName); |
668 | if (!dir) { | 668 | if (!dir) { |
669 | perrorMsg("%s", fileName); | 669 | perror_msg("%s", fileName); |
670 | return FALSE; | 670 | return FALSE; |
671 | } | 671 | } |
672 | if (dirAction != NULL && depthFirst == FALSE) { | 672 | if (dirAction != NULL && depthFirst == FALSE) { |
673 | status = dirAction(fileName, &statbuf, userData); | 673 | status = dirAction(fileName, &statbuf, userData); |
674 | if (status == FALSE) { | 674 | if (status == FALSE) { |
675 | perrorMsg("%s", fileName); | 675 | perror_msg("%s", fileName); |
676 | return FALSE; | 676 | return FALSE; |
677 | } | 677 | } |
678 | } | 678 | } |
@@ -684,13 +684,13 @@ int recursiveAction(const char *fileName, | |||
684 | continue; | 684 | continue; |
685 | } | 685 | } |
686 | if (strlen(fileName) + strlen(next->d_name) + 1 > BUFSIZ) { | 686 | if (strlen(fileName) + strlen(next->d_name) + 1 > BUFSIZ) { |
687 | errorMsg(name_too_long); | 687 | error_msg(name_too_long); |
688 | return FALSE; | 688 | return FALSE; |
689 | } | 689 | } |
690 | memset(nextFile, 0, sizeof(nextFile)); | 690 | memset(nextFile, 0, sizeof(nextFile)); |
691 | sprintf(nextFile, "%s/%s", fileName, next->d_name); | 691 | sprintf(nextFile, "%s/%s", fileName, next->d_name); |
692 | status = | 692 | status = |
693 | recursiveAction(nextFile, TRUE, followLinks, depthFirst, | 693 | recursive_action(nextFile, TRUE, followLinks, depthFirst, |
694 | fileAction, dirAction, userData); | 694 | fileAction, dirAction, userData); |
695 | if (status == FALSE) { | 695 | if (status == FALSE) { |
696 | closedir(dir); | 696 | closedir(dir); |
@@ -699,13 +699,13 @@ int recursiveAction(const char *fileName, | |||
699 | } | 699 | } |
700 | status = closedir(dir); | 700 | status = closedir(dir); |
701 | if (status < 0) { | 701 | if (status < 0) { |
702 | perrorMsg("%s", fileName); | 702 | perror_msg("%s", fileName); |
703 | return FALSE; | 703 | return FALSE; |
704 | } | 704 | } |
705 | if (dirAction != NULL && depthFirst == TRUE) { | 705 | if (dirAction != NULL && depthFirst == TRUE) { |
706 | status = dirAction(fileName, &statbuf, userData); | 706 | status = dirAction(fileName, &statbuf, userData); |
707 | if (status == FALSE) { | 707 | if (status == FALSE) { |
708 | perrorMsg("%s", fileName); | 708 | perror_msg("%s", fileName); |
709 | return FALSE; | 709 | return FALSE; |
710 | } | 710 | } |
711 | } | 711 | } |
@@ -729,7 +729,7 @@ int recursiveAction(const char *fileName, | |||
729 | * while all previous ones get default protections. Errors are not reported | 729 | * while all previous ones get default protections. Errors are not reported |
730 | * here, as failures to restore files can be reported later. | 730 | * here, as failures to restore files can be reported later. |
731 | */ | 731 | */ |
732 | extern int createPath(const char *name, int mode) | 732 | extern int create_path(const char *name, int mode) |
733 | { | 733 | { |
734 | char *cp; | 734 | char *cp; |
735 | char *cpOld; | 735 | char *cpOld; |
@@ -1058,7 +1058,7 @@ int get_console_fd(char *tty_name) | |||
1058 | if (is_a_console(fd)) | 1058 | if (is_a_console(fd)) |
1059 | return fd; | 1059 | return fd; |
1060 | 1060 | ||
1061 | errorMsg("Couldnt get a file descriptor referring to the console\n"); | 1061 | error_msg("Couldnt get a file descriptor referring to the console\n"); |
1062 | return -1; /* total failure */ | 1062 | return -1; /* total failure */ |
1063 | } | 1063 | } |
1064 | 1064 | ||
@@ -1179,7 +1179,7 @@ extern int check_wildcard_match(const char *text, const char *pattern) | |||
1179 | * Given any other file (or directory), find the mount table entry for its | 1179 | * Given any other file (or directory), find the mount table entry for its |
1180 | * filesystem. | 1180 | * filesystem. |
1181 | */ | 1181 | */ |
1182 | extern struct mntent *findMountPoint(const char *name, const char *table) | 1182 | extern struct mntent *find_mount_point(const char *name, const char *table) |
1183 | { | 1183 | { |
1184 | struct stat s; | 1184 | struct stat s; |
1185 | dev_t mountDevice; | 1185 | dev_t mountDevice; |
@@ -1219,16 +1219,16 @@ extern struct mntent *findMountPoint(const char *name, const char *table) | |||
1219 | * Read a number with a possible multiplier. | 1219 | * Read a number with a possible multiplier. |
1220 | * Returns -1 if the number format is illegal. | 1220 | * Returns -1 if the number format is illegal. |
1221 | */ | 1221 | */ |
1222 | extern long getNum(const char *cp) | 1222 | extern long atoi_w_units(const char *cp) |
1223 | { | 1223 | { |
1224 | long value; | 1224 | long value; |
1225 | 1225 | ||
1226 | if (!isDecimal(*cp)) | 1226 | if (!is_decimal(*cp)) |
1227 | return -1; | 1227 | return -1; |
1228 | 1228 | ||
1229 | value = 0; | 1229 | value = 0; |
1230 | 1230 | ||
1231 | while (isDecimal(*cp)) | 1231 | while (is_decimal(*cp)) |
1232 | value = value * 10 + *cp++ - '0'; | 1232 | value = value * 10 + *cp++ - '0'; |
1233 | 1233 | ||
1234 | switch (*cp++) { | 1234 | switch (*cp++) { |
@@ -1292,14 +1292,14 @@ extern int device_open(char *device, int mode) | |||
1292 | #endif | 1292 | #endif |
1293 | 1293 | ||
1294 | #if defined BB_FEATURE_USE_DEVPS_PATCH | 1294 | #if defined BB_FEATURE_USE_DEVPS_PATCH |
1295 | /* findPidByName() | 1295 | /* find_pid_by_name() |
1296 | * | 1296 | * |
1297 | * This finds the pid of the specified process, | 1297 | * This finds the pid of the specified process, |
1298 | * by using the /dev/ps device driver. | 1298 | * by using the /dev/ps device driver. |
1299 | * | 1299 | * |
1300 | * Returns a list of all matching PIDs | 1300 | * Returns a list of all matching PIDs |
1301 | */ | 1301 | */ |
1302 | extern pid_t* findPidByName( char* pidName) | 1302 | extern pid_t* find_pid_by_name( char* pidName) |
1303 | { | 1303 | { |
1304 | int fd, i, j; | 1304 | int fd, i, j; |
1305 | char device[] = "/dev/ps"; | 1305 | char device[] = "/dev/ps"; |
@@ -1310,11 +1310,11 @@ extern pid_t* findPidByName( char* pidName) | |||
1310 | /* open device */ | 1310 | /* open device */ |
1311 | fd = open(device, O_RDONLY); | 1311 | fd = open(device, O_RDONLY); |
1312 | if (fd < 0) | 1312 | if (fd < 0) |
1313 | fatalError( "open failed for `%s': %s\n", device, strerror (errno)); | 1313 | error_msg_and_die( "open failed for `%s': %s\n", device, strerror (errno)); |
1314 | 1314 | ||
1315 | /* Find out how many processes there are */ | 1315 | /* Find out how many processes there are */ |
1316 | if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0) | 1316 | if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0) |
1317 | fatalError( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno)); | 1317 | error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno)); |
1318 | 1318 | ||
1319 | /* Allocate some memory -- grab a few extras just in case | 1319 | /* Allocate some memory -- grab a few extras just in case |
1320 | * some new processes start up while we wait. The kernel will | 1320 | * some new processes start up while we wait. The kernel will |
@@ -1325,7 +1325,7 @@ extern pid_t* findPidByName( char* pidName) | |||
1325 | 1325 | ||
1326 | /* Now grab the pid list */ | 1326 | /* Now grab the pid list */ |
1327 | if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0) | 1327 | if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0) |
1328 | fatalError( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno)); | 1328 | error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno)); |
1329 | 1329 | ||
1330 | /* Now search for a match */ | 1330 | /* Now search for a match */ |
1331 | for (i=1, j=0; i<pid_array[0] ; i++) { | 1331 | for (i=1, j=0; i<pid_array[0] ; i++) { |
@@ -1334,7 +1334,7 @@ extern pid_t* findPidByName( char* pidName) | |||
1334 | 1334 | ||
1335 | info.pid = pid_array[i]; | 1335 | info.pid = pid_array[i]; |
1336 | if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0) | 1336 | if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0) |
1337 | fatalError( "\nDEVPS_GET_PID_INFO: %s\n", strerror (errno)); | 1337 | error_msg_and_die( "\nDEVPS_GET_PID_INFO: %s\n", strerror (errno)); |
1338 | 1338 | ||
1339 | /* Make sure we only match on the process name */ | 1339 | /* Make sure we only match on the process name */ |
1340 | p=info.command_line+1; | 1340 | p=info.command_line+1; |
@@ -1358,7 +1358,7 @@ extern pid_t* findPidByName( char* pidName) | |||
1358 | 1358 | ||
1359 | /* close device */ | 1359 | /* close device */ |
1360 | if (close (fd) != 0) | 1360 | if (close (fd) != 0) |
1361 | fatalError( "close failed for `%s': %s\n",device, strerror (errno)); | 1361 | error_msg_and_die( "close failed for `%s': %s\n",device, strerror (errno)); |
1362 | 1362 | ||
1363 | return pidList; | 1363 | return pidList; |
1364 | } | 1364 | } |
@@ -1367,7 +1367,7 @@ extern pid_t* findPidByName( char* pidName) | |||
1367 | #error Sorry, I depend on the /proc filesystem right now. | 1367 | #error Sorry, I depend on the /proc filesystem right now. |
1368 | #endif | 1368 | #endif |
1369 | 1369 | ||
1370 | /* findPidByName() | 1370 | /* find_pid_by_name() |
1371 | * | 1371 | * |
1372 | * This finds the pid of the specified process. | 1372 | * This finds the pid of the specified process. |
1373 | * Currently, it's implemented by rummaging through | 1373 | * Currently, it's implemented by rummaging through |
@@ -1375,7 +1375,7 @@ extern pid_t* findPidByName( char* pidName) | |||
1375 | * | 1375 | * |
1376 | * Returns a list of all matching PIDs | 1376 | * Returns a list of all matching PIDs |
1377 | */ | 1377 | */ |
1378 | extern pid_t* findPidByName( char* pidName) | 1378 | extern pid_t* find_pid_by_name( char* pidName) |
1379 | { | 1379 | { |
1380 | DIR *dir; | 1380 | DIR *dir; |
1381 | struct dirent *next; | 1381 | struct dirent *next; |
@@ -1384,7 +1384,7 @@ extern pid_t* findPidByName( char* pidName) | |||
1384 | 1384 | ||
1385 | dir = opendir("/proc"); | 1385 | dir = opendir("/proc"); |
1386 | if (!dir) | 1386 | if (!dir) |
1387 | fatalError( "Cannot open /proc: %s\n", strerror (errno)); | 1387 | error_msg_and_die( "Cannot open /proc: %s\n", strerror (errno)); |
1388 | 1388 | ||
1389 | while ((next = readdir(dir)) != NULL) { | 1389 | while ((next = readdir(dir)) != NULL) { |
1390 | FILE *status; | 1390 | FILE *status; |
@@ -1423,7 +1423,7 @@ extern void *xmalloc(size_t size) | |||
1423 | void *ptr = malloc(size); | 1423 | void *ptr = malloc(size); |
1424 | 1424 | ||
1425 | if (!ptr) | 1425 | if (!ptr) |
1426 | fatalError(memory_exhausted); | 1426 | error_msg_and_die(memory_exhausted); |
1427 | return ptr; | 1427 | return ptr; |
1428 | } | 1428 | } |
1429 | 1429 | ||
@@ -1431,7 +1431,7 @@ extern void *xrealloc(void *old, size_t size) | |||
1431 | { | 1431 | { |
1432 | void *ptr = realloc(old, size); | 1432 | void *ptr = realloc(old, size); |
1433 | if (!ptr) | 1433 | if (!ptr) |
1434 | fatalError(memory_exhausted); | 1434 | error_msg_and_die(memory_exhausted); |
1435 | return ptr; | 1435 | return ptr; |
1436 | } | 1436 | } |
1437 | 1437 | ||
@@ -1439,7 +1439,7 @@ extern void *xcalloc(size_t nmemb, size_t size) | |||
1439 | { | 1439 | { |
1440 | void *ptr = calloc(nmemb, size); | 1440 | void *ptr = calloc(nmemb, size); |
1441 | if (!ptr) | 1441 | if (!ptr) |
1442 | fatalError(memory_exhausted); | 1442 | error_msg_and_die(memory_exhausted); |
1443 | return ptr; | 1443 | return ptr; |
1444 | } | 1444 | } |
1445 | #endif | 1445 | #endif |
@@ -1455,7 +1455,7 @@ extern char * xstrdup (const char *s) { | |||
1455 | t = strdup (s); | 1455 | t = strdup (s); |
1456 | 1456 | ||
1457 | if (t == NULL) | 1457 | if (t == NULL) |
1458 | fatalError(memory_exhausted); | 1458 | error_msg_and_die(memory_exhausted); |
1459 | 1459 | ||
1460 | return t; | 1460 | return t; |
1461 | } | 1461 | } |
@@ -1467,7 +1467,7 @@ extern char * xstrndup (const char *s, int n) { | |||
1467 | char *t; | 1467 | char *t; |
1468 | 1468 | ||
1469 | if (s == NULL) | 1469 | if (s == NULL) |
1470 | fatalError("xstrndup bug"); | 1470 | error_msg_and_die("xstrndup bug"); |
1471 | 1471 | ||
1472 | t = xmalloc(n+1); | 1472 | t = xmalloc(n+1); |
1473 | strncpy(t,s,n); | 1473 | strncpy(t,s,n); |
@@ -1588,13 +1588,13 @@ extern int find_real_root_device_name(char* name) | |||
1588 | char fileName[BUFSIZ]; | 1588 | char fileName[BUFSIZ]; |
1589 | 1589 | ||
1590 | if (stat("/", &rootStat) != 0) { | 1590 | if (stat("/", &rootStat) != 0) { |
1591 | errorMsg("could not stat '/'\n"); | 1591 | error_msg("could not stat '/'\n"); |
1592 | return( FALSE); | 1592 | return( FALSE); |
1593 | } | 1593 | } |
1594 | 1594 | ||
1595 | dir = opendir("/dev"); | 1595 | dir = opendir("/dev"); |
1596 | if (!dir) { | 1596 | if (!dir) { |
1597 | errorMsg("could not open '/dev'\n"); | 1597 | error_msg("could not open '/dev'\n"); |
1598 | return( FALSE); | 1598 | return( FALSE); |
1599 | } | 1599 | } |
1600 | 1600 | ||
@@ -1749,7 +1749,7 @@ void xregcomp(regex_t *preg, const char *regex, int cflags) | |||
1749 | int errmsgsz = regerror(ret, preg, NULL, 0); | 1749 | int errmsgsz = regerror(ret, preg, NULL, 0); |
1750 | char *errmsg = xmalloc(errmsgsz); | 1750 | char *errmsg = xmalloc(errmsgsz); |
1751 | regerror(ret, preg, errmsg, errmsgsz); | 1751 | regerror(ret, preg, errmsg, errmsgsz); |
1752 | fatalError("xregcomp: %s\n", errmsg); | 1752 | error_msg_and_die("xregcomp: %s\n", errmsg); |
1753 | } | 1753 | } |
1754 | } | 1754 | } |
1755 | #endif | 1755 | #endif |
@@ -1759,7 +1759,7 @@ FILE *wfopen(const char *path, const char *mode) | |||
1759 | { | 1759 | { |
1760 | FILE *fp; | 1760 | FILE *fp; |
1761 | if ((fp = fopen(path, mode)) == NULL) { | 1761 | if ((fp = fopen(path, mode)) == NULL) { |
1762 | errorMsg("%s: %s\n", path, strerror(errno)); | 1762 | error_msg("%s: %s\n", path, strerror(errno)); |
1763 | errno = 0; | 1763 | errno = 0; |
1764 | } | 1764 | } |
1765 | return fp; | 1765 | return fp; |
@@ -1773,7 +1773,7 @@ FILE *xfopen(const char *path, const char *mode) | |||
1773 | { | 1773 | { |
1774 | FILE *fp; | 1774 | FILE *fp; |
1775 | if ((fp = fopen(path, mode)) == NULL) | 1775 | if ((fp = fopen(path, mode)) == NULL) |
1776 | fatalError("%s: %s\n", path, strerror(errno)); | 1776 | error_msg_and_die("%s: %s\n", path, strerror(errno)); |
1777 | return fp; | 1777 | return fp; |
1778 | } | 1778 | } |
1779 | #endif | 1779 | #endif |
diff --git a/uudecode.c b/uudecode.c index 825fdb562..ff4a9d9e6 100644 --- a/uudecode.c +++ b/uudecode.c | |||
@@ -43,7 +43,7 @@ static int read_stduu (const char *inname) | |||
43 | char *p; | 43 | char *p; |
44 | 44 | ||
45 | if (fgets (buf, sizeof(buf), stdin) == NULL) { | 45 | if (fgets (buf, sizeof(buf), stdin) == NULL) { |
46 | errorMsg("%s: Short file\n", inname); | 46 | error_msg("%s: Short file\n", inname); |
47 | return FALSE; | 47 | return FALSE; |
48 | } | 48 | } |
49 | p = buf; | 49 | p = buf; |
@@ -78,7 +78,7 @@ static int read_stduu (const char *inname) | |||
78 | 78 | ||
79 | if (fgets (buf, sizeof(buf), stdin) == NULL | 79 | if (fgets (buf, sizeof(buf), stdin) == NULL |
80 | || strcmp (buf, "end\n")) { | 80 | || strcmp (buf, "end\n")) { |
81 | errorMsg("%s: No `end' line\n", inname); | 81 | error_msg("%s: No `end' line\n", inname); |
82 | return FALSE; | 82 | return FALSE; |
83 | } | 83 | } |
84 | 84 | ||
@@ -128,7 +128,7 @@ static int read_base64 (const char *inname) | |||
128 | unsigned char *p; | 128 | unsigned char *p; |
129 | 129 | ||
130 | if (fgets (buf, sizeof(buf), stdin) == NULL) { | 130 | if (fgets (buf, sizeof(buf), stdin) == NULL) { |
131 | errorMsg("%s: Short file\n", inname); | 131 | error_msg("%s: Short file\n", inname); |
132 | return FALSE; | 132 | return FALSE; |
133 | } | 133 | } |
134 | p = buf; | 134 | p = buf; |
@@ -136,7 +136,7 @@ static int read_base64 (const char *inname) | |||
136 | if (memcmp (buf, "====", 4) == 0) | 136 | if (memcmp (buf, "====", 4) == 0) |
137 | break; | 137 | break; |
138 | if (last_data != 0) { | 138 | if (last_data != 0) { |
139 | errorMsg("%s: data following `=' padding character\n", inname); | 139 | error_msg("%s: data following `=' padding character\n", inname); |
140 | return FALSE; | 140 | return FALSE; |
141 | } | 141 | } |
142 | 142 | ||
@@ -158,14 +158,14 @@ static int read_base64 (const char *inname) | |||
158 | 158 | ||
159 | while ((b64_tab[*p] & '\100') != 0) | 159 | while ((b64_tab[*p] & '\100') != 0) |
160 | if (*p == '\n' || *p++ == '=') { | 160 | if (*p == '\n' || *p++ == '=') { |
161 | errorMsg("%s: illegal line\n", inname); | 161 | error_msg("%s: illegal line\n", inname); |
162 | return FALSE; | 162 | return FALSE; |
163 | } | 163 | } |
164 | c2 = b64_tab[*p++]; | 164 | c2 = b64_tab[*p++]; |
165 | 165 | ||
166 | while (b64_tab[*p] == '\177') | 166 | while (b64_tab[*p] == '\177') |
167 | if (*p++ == '\n') { | 167 | if (*p++ == '\n') { |
168 | errorMsg("%s: illegal line\n", inname); | 168 | error_msg("%s: illegal line\n", inname); |
169 | return FALSE; | 169 | return FALSE; |
170 | } | 170 | } |
171 | if (*p == '=') { | 171 | if (*p == '=') { |
@@ -177,7 +177,7 @@ static int read_base64 (const char *inname) | |||
177 | 177 | ||
178 | while (b64_tab[*p] == '\177') | 178 | while (b64_tab[*p] == '\177') |
179 | if (*p++ == '\n') { | 179 | if (*p++ == '\n') { |
180 | errorMsg("%s: illegal line\n", inname); | 180 | error_msg("%s: illegal line\n", inname); |
181 | return FALSE; | 181 | return FALSE; |
182 | } | 182 | } |
183 | putchar (c1 << 2 | c2 >> 4); | 183 | putchar (c1 << 2 | c2 >> 4); |
@@ -209,7 +209,7 @@ static int decode (const char *inname, | |||
209 | 209 | ||
210 | while (1) { | 210 | while (1) { |
211 | if (fgets (buf, sizeof (buf), stdin) == NULL) { | 211 | if (fgets (buf, sizeof (buf), stdin) == NULL) { |
212 | errorMsg("%s: No `begin' line\n", inname); | 212 | error_msg("%s: No `begin' line\n", inname); |
213 | return FALSE; | 213 | return FALSE; |
214 | } | 214 | } |
215 | 215 | ||
@@ -234,13 +234,13 @@ static int decode (const char *inname, | |||
234 | while (*p != '/') | 234 | while (*p != '/') |
235 | ++p; | 235 | ++p; |
236 | if (*p == '\0') { | 236 | if (*p == '\0') { |
237 | errorMsg("%s: Illegal ~user\n", inname); | 237 | error_msg("%s: Illegal ~user\n", inname); |
238 | return FALSE; | 238 | return FALSE; |
239 | } | 239 | } |
240 | *p++ = '\0'; | 240 | *p++ = '\0'; |
241 | pw = getpwnam (buf + 1); | 241 | pw = getpwnam (buf + 1); |
242 | if (pw == NULL) { | 242 | if (pw == NULL) { |
243 | errorMsg("%s: No user `%s'\n", inname, buf + 1); | 243 | error_msg("%s: No user `%s'\n", inname, buf + 1); |
244 | return FALSE; | 244 | return FALSE; |
245 | } | 245 | } |
246 | n = strlen (pw->pw_dir); | 246 | n = strlen (pw->pw_dir); |
@@ -257,7 +257,7 @@ static int decode (const char *inname, | |||
257 | && (freopen (outname, "w", stdout) == NULL | 257 | && (freopen (outname, "w", stdout) == NULL |
258 | || chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)) | 258 | || chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO)) |
259 | )) { | 259 | )) { |
260 | errorMsg("%s: %s %s\n", outname, inname, strerror(errno)); /* */ | 260 | error_msg("%s: %s %s\n", outname, inname, strerror(errno)); /* */ |
261 | return FALSE; | 261 | return FALSE; |
262 | } | 262 | } |
263 | 263 | ||
@@ -302,7 +302,7 @@ int uudecode_main (int argc, | |||
302 | if (decode (argv[optind], outname) != 0) | 302 | if (decode (argv[optind], outname) != 0) |
303 | exit_status = FALSE; | 303 | exit_status = FALSE; |
304 | } else { | 304 | } else { |
305 | errorMsg("%s: %s\n", argv[optind], strerror(errno)); | 305 | error_msg("%s: %s\n", argv[optind], strerror(errno)); |
306 | exit_status = EXIT_FAILURE; | 306 | exit_status = EXIT_FAILURE; |
307 | } | 307 | } |
308 | optind++; | 308 | optind++; |
diff --git a/uuencode.c b/uuencode.c index 8d15adbf6..41e659075 100644 --- a/uuencode.c +++ b/uuencode.c | |||
@@ -142,7 +142,7 @@ static void encode() | |||
142 | } | 142 | } |
143 | 143 | ||
144 | if (ferror (stdin)) | 144 | if (ferror (stdin)) |
145 | errorMsg("Read error\n"); | 145 | error_msg("Read error\n"); |
146 | 146 | ||
147 | if (trans_ptr == uu_std) { | 147 | if (trans_ptr == uu_std) { |
148 | putchar (ENC ('\0')); | 148 | putchar (ENC ('\0')); |
@@ -178,7 +178,7 @@ int uuencode_main (int argc, | |||
178 | case 2: | 178 | case 2: |
179 | /* Optional first argument is input file. */ | 179 | /* Optional first argument is input file. */ |
180 | if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) { | 180 | if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) { |
181 | errorMsg("%s: %s\n", argv[optind], strerror(errno)); | 181 | error_msg("%s: %s\n", argv[optind], strerror(errno)); |
182 | return EXIT_FAILURE; | 182 | return EXIT_FAILURE; |
183 | } | 183 | } |
184 | mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); | 184 | mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); |
@@ -199,7 +199,7 @@ int uuencode_main (int argc, | |||
199 | encode(); | 199 | encode(); |
200 | printf(trans_ptr == uu_std ? "end\n" : "====\n"); | 200 | printf(trans_ptr == uu_std ? "end\n" : "====\n"); |
201 | if (ferror (stdout)) { | 201 | if (ferror (stdout)) { |
202 | errorMsg("Write error\n"); | 202 | error_msg("Write error\n"); |
203 | return EXIT_FAILURE; | 203 | return EXIT_FAILURE; |
204 | } | 204 | } |
205 | return EXIT_SUCCESS; | 205 | return EXIT_SUCCESS; |
@@ -100,7 +100,7 @@ int wget_main(int argc, char **argv) | |||
100 | 100 | ||
101 | 101 | ||
102 | if (do_continue && !fname_out) | 102 | if (do_continue && !fname_out) |
103 | fatalError("cannot specify continue (-c) without a filename (-O)\n"); | 103 | error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n"); |
104 | /* | 104 | /* |
105 | * Parse url into components. | 105 | * Parse url into components. |
106 | */ | 106 | */ |
@@ -117,7 +117,7 @@ int wget_main(int argc, char **argv) | |||
117 | if (fname_out != (char *)1) { | 117 | if (fname_out != (char *)1) { |
118 | if ( (output=fopen(fname_out, (do_continue ? "a" : "w"))) | 118 | if ( (output=fopen(fname_out, (do_continue ? "a" : "w"))) |
119 | == NULL) | 119 | == NULL) |
120 | fatalPerror("fopen(%s)", fname_out); | 120 | perror_msg_and_die("fopen(%s)", fname_out); |
121 | } else { | 121 | } else { |
122 | output = stdout; | 122 | output = stdout; |
123 | } | 123 | } |
@@ -128,7 +128,7 @@ int wget_main(int argc, char **argv) | |||
128 | if (do_continue) { | 128 | if (do_continue) { |
129 | struct stat sbuf; | 129 | struct stat sbuf; |
130 | if (fstat(fileno(output), &sbuf) < 0) | 130 | if (fstat(fileno(output), &sbuf) < 0) |
131 | fatalError("fstat()"); | 131 | error_msg_and_die("fstat()"); |
132 | if (sbuf.st_size > 0) | 132 | if (sbuf.st_size > 0) |
133 | beg_range = sbuf.st_size; | 133 | beg_range = sbuf.st_size; |
134 | else | 134 | else |
@@ -147,7 +147,7 @@ int wget_main(int argc, char **argv) | |||
147 | * Retrieve HTTP response line and check for "200" status code. | 147 | * Retrieve HTTP response line and check for "200" status code. |
148 | */ | 148 | */ |
149 | if (fgets(buf, sizeof(buf), sfp) == NULL) | 149 | if (fgets(buf, sizeof(buf), sfp) == NULL) |
150 | fatalError("no response from server\n"); | 150 | error_msg_and_die("no response from server\n"); |
151 | for (s = buf ; *s != '\0' && !isspace(*s) ; ++s) | 151 | for (s = buf ; *s != '\0' && !isspace(*s) ; ++s) |
152 | ; | 152 | ; |
153 | for ( ; isspace(*s) ; ++s) | 153 | for ( ; isspace(*s) ; ++s) |
@@ -156,13 +156,13 @@ int wget_main(int argc, char **argv) | |||
156 | case 200: | 156 | case 200: |
157 | if (!do_continue) | 157 | if (!do_continue) |
158 | break; | 158 | break; |
159 | fatalError("server does not support ranges\n"); | 159 | error_msg_and_die("server does not support ranges\n"); |
160 | case 206: | 160 | case 206: |
161 | if (do_continue) | 161 | if (do_continue) |
162 | break; | 162 | break; |
163 | /*FALLTHRU*/ | 163 | /*FALLTHRU*/ |
164 | default: | 164 | default: |
165 | fatalError("server returned error: %s", buf); | 165 | error_msg_and_die("server returned error: %s", buf); |
166 | } | 166 | } |
167 | 167 | ||
168 | /* | 168 | /* |
@@ -175,7 +175,7 @@ int wget_main(int argc, char **argv) | |||
175 | continue; | 175 | continue; |
176 | } | 176 | } |
177 | if (strcmp(buf, "transfer-encoding") == 0) { | 177 | if (strcmp(buf, "transfer-encoding") == 0) { |
178 | fatalError("server wants to do %s transfer encoding\n", s); | 178 | error_msg_and_die("server wants to do %s transfer encoding\n", s); |
179 | continue; | 179 | continue; |
180 | } | 180 | } |
181 | } | 181 | } |
@@ -197,7 +197,7 @@ int wget_main(int argc, char **argv) | |||
197 | filesize -= n; | 197 | filesize -= n; |
198 | } | 198 | } |
199 | if (n == 0 && ferror(sfp)) | 199 | if (n == 0 && ferror(sfp)) |
200 | fatalPerror("network read error"); | 200 | perror_msg_and_die("network read error"); |
201 | 201 | ||
202 | exit(0); | 202 | exit(0); |
203 | } | 203 | } |
@@ -211,7 +211,7 @@ void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path) | |||
211 | *uri_port = 80; | 211 | *uri_port = 80; |
212 | 212 | ||
213 | if (strncmp(url, "http://", 7) != 0) | 213 | if (strncmp(url, "http://", 7) != 0) |
214 | fatalError("not an http url: %s\n", url); | 214 | error_msg_and_die("not an http url: %s\n", url); |
215 | 215 | ||
216 | /* pull the host portion to the front of the buffer */ | 216 | /* pull the host portion to the front of the buffer */ |
217 | for (s = url, h = url+7 ; *h != '/' && *h != 0; ++h) { | 217 | for (s = url, h = url+7 ; *h != '/' && *h != 0; ++h) { |
@@ -240,7 +240,7 @@ FILE *open_socket(char *host, int port) | |||
240 | memzero(&sin, sizeof(sin)); | 240 | memzero(&sin, sizeof(sin)); |
241 | sin.sin_family = AF_INET; | 241 | sin.sin_family = AF_INET; |
242 | if ((hp = (struct hostent *) gethostbyname(host)) == NULL) | 242 | if ((hp = (struct hostent *) gethostbyname(host)) == NULL) |
243 | fatalError("cannot resolve %s\n", host); | 243 | error_msg_and_die("cannot resolve %s\n", host); |
244 | memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length); | 244 | memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length); |
245 | sin.sin_port = htons(port); | 245 | sin.sin_port = htons(port); |
246 | 246 | ||
@@ -248,11 +248,11 @@ FILE *open_socket(char *host, int port) | |||
248 | * Get the server onto a stdio stream. | 248 | * Get the server onto a stdio stream. |
249 | */ | 249 | */ |
250 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) | 250 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) |
251 | fatalPerror("socket()"); | 251 | perror_msg_and_die("socket()"); |
252 | if (connect(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0) | 252 | if (connect(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0) |
253 | fatalPerror("connect(%s)", host); | 253 | perror_msg_and_die("connect(%s)", host); |
254 | if ((fp = fdopen(fd, "r+")) == NULL) | 254 | if ((fp = fdopen(fd, "r+")) == NULL) |
255 | fatalPerror("fdopen()"); | 255 | perror_msg_and_die("fdopen()"); |
256 | 256 | ||
257 | return fp; | 257 | return fp; |
258 | } | 258 | } |
@@ -281,7 +281,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc) | |||
281 | 281 | ||
282 | /* verify we are at the end of the header name */ | 282 | /* verify we are at the end of the header name */ |
283 | if (*s != ':') | 283 | if (*s != ':') |
284 | fatalError("bad header line: %s\n", buf); | 284 | error_msg_and_die("bad header line: %s\n", buf); |
285 | 285 | ||
286 | /* locate the start of the header value */ | 286 | /* locate the start of the header value */ |
287 | for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s) | 287 | for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s) |
@@ -475,7 +475,7 @@ progressmeter(int flag) | |||
475 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 475 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
476 | * SUCH DAMAGE. | 476 | * SUCH DAMAGE. |
477 | * | 477 | * |
478 | * $Id: wget.c,v 1.9 2000/12/07 03:55:35 tausq Exp $ | 478 | * $Id: wget.c,v 1.10 2000/12/07 19:56:48 markw Exp $ |
479 | */ | 479 | */ |
480 | 480 | ||
481 | 481 | ||
@@ -37,5 +37,5 @@ extern int whoami_main(int argc, char **argv) | |||
37 | puts(user); | 37 | puts(user); |
38 | return EXIT_SUCCESS; | 38 | return EXIT_SUCCESS; |
39 | } | 39 | } |
40 | fatalError("cannot find username for UID %u\n", (unsigned) uid); | 40 | error_msg_and_die("cannot find username for UID %u\n", (unsigned) uid); |
41 | } | 41 | } |