aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--applets/busybox.c4
-rw-r--r--ar.c24
-rw-r--r--archival/ar.c24
-rw-r--r--archival/gunzip.c22
-rw-r--r--archival/gzip.c18
-rw-r--r--archival/tar.c106
-rw-r--r--busybox.c4
-rw-r--r--busybox.h36
-rw-r--r--chmod_chown_chgrp.c12
-rw-r--r--chroot.c4
-rw-r--r--cmdedit.c2
-rw-r--r--console-tools/deallocvt.c6
-rw-r--r--console-tools/dumpkmap.c4
-rw-r--r--console-tools/loadacm.c16
-rw-r--r--console-tools/loadfont.c28
-rw-r--r--console-tools/loadkmap.c8
-rw-r--r--console-tools/setkeycodes.c6
-rw-r--r--coreutils/chroot.c4
-rw-r--r--coreutils/cut.c18
-rw-r--r--coreutils/date.c14
-rw-r--r--coreutils/dd.c24
-rw-r--r--coreutils/df.c8
-rw-r--r--coreutils/du.c6
-rw-r--r--coreutils/expr.c20
-rw-r--r--coreutils/head.c2
-rw-r--r--coreutils/id.c2
-rw-r--r--coreutils/ln.c4
-rw-r--r--coreutils/logname.c2
-rw-r--r--coreutils/ls.c8
-rw-r--r--coreutils/md5sum.c36
-rw-r--r--coreutils/mkdir.c8
-rw-r--r--coreutils/mknod.c2
-rw-r--r--coreutils/pwd.c2
-rw-r--r--coreutils/rm.c8
-rw-r--r--coreutils/rmdir.c2
-rw-r--r--coreutils/sort.c4
-rw-r--r--coreutils/tail.c4
-rw-r--r--coreutils/tee.c2
-rw-r--r--coreutils/test.c10
-rw-r--r--coreutils/touch.c4
-rw-r--r--coreutils/tr.c2
-rw-r--r--coreutils/uudecode.c24
-rw-r--r--coreutils/uuencode.c6
-rw-r--r--coreutils/whoami.c2
-rw-r--r--cp_mv.c40
-rw-r--r--cut.c18
-rw-r--r--date.c14
-rw-r--r--dc.c6
-rw-r--r--dd.c24
-rw-r--r--deallocvt.c6
-rw-r--r--df.c8
-rw-r--r--du.c6
-rw-r--r--dumpkmap.c4
-rw-r--r--dutmp.c2
-rw-r--r--editors/sed.c22
-rw-r--r--expr.c20
-rw-r--r--fbset.c4
-rw-r--r--find.c2
-rw-r--r--findutils/find.c2
-rw-r--r--findutils/grep.c2
-rw-r--r--freeramdisk.c4
-rw-r--r--fsck_minix.c2
-rw-r--r--getopt.c10
-rw-r--r--grep.c2
-rw-r--r--gunzip.c22
-rw-r--r--gzip.c18
-rw-r--r--halt.c2
-rw-r--r--head.c2
-rw-r--r--hostname.c4
-rw-r--r--id.c2
-rw-r--r--include/busybox.h36
-rw-r--r--init.c2
-rw-r--r--init/halt.c2
-rw-r--r--init/init.c2
-rw-r--r--init/poweroff.c2
-rw-r--r--init/reboot.c2
-rw-r--r--insmod.c94
-rw-r--r--kill.c14
-rw-r--r--lash.c34
-rw-r--r--ln.c4
-rw-r--r--loadacm.c16
-rw-r--r--loadfont.c28
-rw-r--r--loadkmap.c8
-rw-r--r--logger.c6
-rw-r--r--logname.c2
-rw-r--r--ls.c8
-rw-r--r--lsmod.c8
-rw-r--r--md5sum.c36
-rw-r--r--miscutils/dc.c6
-rw-r--r--miscutils/dutmp.c2
-rw-r--r--miscutils/mt.c2
-rw-r--r--miscutils/readlink.c2
-rw-r--r--mkdir.c8
-rw-r--r--mkfs_minix.c4
-rw-r--r--mknod.c2
-rw-r--r--mkswap.c16
-rw-r--r--modutils/insmod.c94
-rw-r--r--modutils/lsmod.c8
-rw-r--r--mount.c28
-rw-r--r--mt.c2
-rw-r--r--mtab.c2
-rw-r--r--nc.c2
-rw-r--r--networking/hostname.c4
-rw-r--r--networking/nc.c2
-rw-r--r--networking/ping.c18
-rw-r--r--networking/telnet.c6
-rw-r--r--networking/wget.c30
-rw-r--r--nfsmount.c24
-rw-r--r--ping.c18
-rw-r--r--poweroff.c2
-rw-r--r--procps/kill.c14
-rw-r--r--procps/ps.c18
-rw-r--r--procps/renice.c2
-rw-r--r--ps.c18
-rw-r--r--pwd.c2
-rw-r--r--rdate.c12
-rw-r--r--readlink.c2
-rw-r--r--reboot.c2
-rw-r--r--renice.c2
-rw-r--r--rm.c8
-rw-r--r--rmdir.c2
-rw-r--r--sed.c22
-rw-r--r--setkeycodes.c6
-rw-r--r--sh.c34
-rw-r--r--shell/cmdedit.c2
-rw-r--r--shell/lash.c34
-rw-r--r--sort.c4
-rw-r--r--swaponoff.c2
-rw-r--r--sysklogd/logger.c6
-rw-r--r--sysklogd/syslogd.c20
-rw-r--r--syslogd.c20
-rw-r--r--tail.c4
-rw-r--r--tar.c106
-rw-r--r--tee.c2
-rw-r--r--telnet.c6
-rw-r--r--test.c10
-rw-r--r--touch.c4
-rw-r--r--tr.c2
-rw-r--r--umount.c8
-rw-r--r--util-linux/fbset.c4
-rw-r--r--util-linux/freeramdisk.c4
-rw-r--r--util-linux/fsck_minix.c2
-rw-r--r--util-linux/getopt.c10
-rw-r--r--util-linux/mkfs_minix.c4
-rw-r--r--util-linux/mkswap.c16
-rw-r--r--util-linux/mount.c28
-rw-r--r--util-linux/nfsmount.c24
-rw-r--r--util-linux/rdate.c12
-rw-r--r--util-linux/swaponoff.c2
-rw-r--r--util-linux/umount.c8
-rw-r--r--utility.c106
-rw-r--r--uudecode.c24
-rw-r--r--uuencode.c6
-rw-r--r--wget.c30
-rw-r--r--whoami.c2
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()
if (len != -1) {
path[len] = 0;
} else {
- errorMsg("%s: %s\n", proc, strerror(errno));
+ error_msg("%s: %s\n", proc, strerror(errno));
return NULL;
}
return strdup(path);
@@ -78,7 +78,7 @@ static void install_links(const char *busybox, int use_symbolic_links)
rc = Link(busybox, command);
if (rc) {
- errorMsg("%s: %s\n", command, strerror(errno));
+ error_msg("%s: %s\n", command, strerror(errno));
}
}
}
diff --git a/ar.c b/ar.c
index a9a0a0a71..88cdd4f9f 100644
--- a/ar.c
+++ b/ar.c
@@ -106,7 +106,7 @@ static int checkTarMagic(int srcFd)
headerStart = lseek(srcFd, 0, SEEK_CUR);
lseek(srcFd, (off_t) 257, SEEK_CUR);
- fullRead(srcFd, magic, 6);
+ full_read(srcFd, magic, 6);
lseek(srcFd, headerStart, SEEK_SET);
if (strncmp(magic, "ustar", 5)!=0)
return(FALSE);
@@ -123,7 +123,7 @@ static int readTarHeader(int srcFd, headerL_t *current)
off_t initialOffset;
initialOffset = lseek(srcFd, 0, SEEK_CUR);
- if (fullRead(srcFd, (char *) &rawTarHeader, 512) != 512) {
+ if (full_read(srcFd, (char *) &rawTarHeader, 512) != 512) {
lseek(srcFd, initialOffset, SEEK_SET);
return(FALSE);
}
@@ -157,8 +157,8 @@ static int checkArMagic(int srcFd)
char arMagic[8];
headerStart = lseek(srcFd, 0, SEEK_CUR);
- if (fullRead(srcFd, arMagic, 8) != 8) {
- errorMsg("fatal error\n");
+ if (full_read(srcFd, arMagic, 8) != 8) {
+ error_msg("fatal error\n");
return (FALSE);
}
lseek(srcFd, headerStart, SEEK_SET);
@@ -178,7 +178,7 @@ static int readArEntry(int srcFd, headerL_t *entry)
off_t initialOffset;
initialOffset = lseek(srcFd, 0, SEEK_CUR);
- if (fullRead(srcFd, (char *) &rawArHeader, 60) != 60) {
+ if (full_read(srcFd, (char *) &rawArHeader, 60) != 60) {
lseek(srcFd, initialOffset, SEEK_SET);
return(FALSE);
}
@@ -215,7 +215,7 @@ static int readArEntry(int srcFd, headerL_t *entry)
if (entry->size > MAX_NAME_LENGTH)
entry->size = MAX_NAME_LENGTH;
- fullRead(srcFd, tempName, entry->size);
+ full_read(srcFd, tempName, entry->size);
tempName[entry->size-3]='\0';
/* read the second header for this entry */
@@ -226,7 +226,7 @@ static int readArEntry(int srcFd, headerL_t *entry)
if ((entry->name[0]='/') && (entry->name[1]='0'))
strcpy(entry->name, tempName);
else {
- errorMsg("Invalid long filename\n");
+ error_msg("Invalid long filename\n");
return(FALSE);
}
}
@@ -343,7 +343,7 @@ extern int ar_main(int argc, char **argv)
usage(ar_usage);
if ( (srcFd = open(argv[optind], O_RDONLY)) < 0)
- fatalError("Cannot read %s\n", argv[optind]);
+ error_msg_and_die("Cannot read %s\n", argv[optind]);
optind++;
entry = (headerL_t *) xmalloc(sizeof(headerL_t));
@@ -368,8 +368,8 @@ extern int ar_main(int argc, char **argv)
while(extractList->next != NULL) {
if (funct & EXT_TO_FILE) {
- if (isDirectory(extractList->name, TRUE, NULL)==FALSE)
- createPath(extractList->name, 0666);
+ if (is_directory(extractList->name, TRUE, NULL)==FALSE)
+ create_path(extractList->name, 0666);
dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode);
lseek(srcFd, extractList->offset, SEEK_SET);
copy_file_chunk(srcFd, dstFd, (size_t) extractList->size);
@@ -380,9 +380,9 @@ extern int ar_main(int argc, char **argv)
}
if ( (funct & DISPLAY) || (funct & VERBOSE)) {
if (funct & VERBOSE)
- printf("%s %d/%d %8d %s ", modeString(extractList->mode),
+ printf("%s %d/%d %8d %s ", mode_string(extractList->mode),
extractList->uid, extractList->gid,
- extractList->size, timeString(extractList->mtime));
+ extractList->size, time_string(extractList->mtime));
printf("%s\n", extractList->name);
}
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)
headerStart = lseek(srcFd, 0, SEEK_CUR);
lseek(srcFd, (off_t) 257, SEEK_CUR);
- fullRead(srcFd, magic, 6);
+ full_read(srcFd, magic, 6);
lseek(srcFd, headerStart, SEEK_SET);
if (strncmp(magic, "ustar", 5)!=0)
return(FALSE);
@@ -123,7 +123,7 @@ static int readTarHeader(int srcFd, headerL_t *current)
off_t initialOffset;
initialOffset = lseek(srcFd, 0, SEEK_CUR);
- if (fullRead(srcFd, (char *) &rawTarHeader, 512) != 512) {
+ if (full_read(srcFd, (char *) &rawTarHeader, 512) != 512) {
lseek(srcFd, initialOffset, SEEK_SET);
return(FALSE);
}
@@ -157,8 +157,8 @@ static int checkArMagic(int srcFd)
char arMagic[8];
headerStart = lseek(srcFd, 0, SEEK_CUR);
- if (fullRead(srcFd, arMagic, 8) != 8) {
- errorMsg("fatal error\n");
+ if (full_read(srcFd, arMagic, 8) != 8) {
+ error_msg("fatal error\n");
return (FALSE);
}
lseek(srcFd, headerStart, SEEK_SET);
@@ -178,7 +178,7 @@ static int readArEntry(int srcFd, headerL_t *entry)
off_t initialOffset;
initialOffset = lseek(srcFd, 0, SEEK_CUR);
- if (fullRead(srcFd, (char *) &rawArHeader, 60) != 60) {
+ if (full_read(srcFd, (char *) &rawArHeader, 60) != 60) {
lseek(srcFd, initialOffset, SEEK_SET);
return(FALSE);
}
@@ -215,7 +215,7 @@ static int readArEntry(int srcFd, headerL_t *entry)
if (entry->size > MAX_NAME_LENGTH)
entry->size = MAX_NAME_LENGTH;
- fullRead(srcFd, tempName, entry->size);
+ full_read(srcFd, tempName, entry->size);
tempName[entry->size-3]='\0';
/* read the second header for this entry */
@@ -226,7 +226,7 @@ static int readArEntry(int srcFd, headerL_t *entry)
if ((entry->name[0]='/') && (entry->name[1]='0'))
strcpy(entry->name, tempName);
else {
- errorMsg("Invalid long filename\n");
+ error_msg("Invalid long filename\n");
return(FALSE);
}
}
@@ -343,7 +343,7 @@ extern int ar_main(int argc, char **argv)
usage(ar_usage);
if ( (srcFd = open(argv[optind], O_RDONLY)) < 0)
- fatalError("Cannot read %s\n", argv[optind]);
+ error_msg_and_die("Cannot read %s\n", argv[optind]);
optind++;
entry = (headerL_t *) xmalloc(sizeof(headerL_t));
@@ -368,8 +368,8 @@ extern int ar_main(int argc, char **argv)
while(extractList->next != NULL) {
if (funct & EXT_TO_FILE) {
- if (isDirectory(extractList->name, TRUE, NULL)==FALSE)
- createPath(extractList->name, 0666);
+ if (is_directory(extractList->name, TRUE, NULL)==FALSE)
+ create_path(extractList->name, 0666);
dstFd = open(extractList->name, O_WRONLY | O_CREAT, extractList->mode);
lseek(srcFd, extractList->offset, SEEK_SET);
copy_file_chunk(srcFd, dstFd, (size_t) extractList->size);
@@ -380,9 +380,9 @@ extern int ar_main(int argc, char **argv)
}
if ( (funct & DISPLAY) || (funct & VERBOSE)) {
if (funct & VERBOSE)
- printf("%s %d/%d %8d %s ", modeString(extractList->mode),
+ printf("%s %d/%d %8d %s ", mode_string(extractList->mode),
extractList->uid, extractList->gid,
- extractList->size, timeString(extractList->mtime));
+ extractList->size, time_string(extractList->mtime));
printf("%s\n", extractList->name);
}
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[] = {
/* Diagnostic functions */
#ifdef DEBUG
-# define Assert(cond,msg) {if(!(cond)) errorMsg(msg);}
+# define Assert(cond,msg) {if(!(cond)) error_msg(msg);}
# define Trace(x) fprintf x
# define Tracev(x) {if (verbose) fprintf x ;}
# define Tracevv(x) {if (verbose>1) fprintf x ;}
@@ -297,7 +297,7 @@ int in; /* input file descriptor */
method = (int) get_byte();
if (method != DEFLATED) {
- errorMsg("unknown method %d -- get newer version of gzip\n", method);
+ error_msg("unknown method %d -- get newer version of gzip\n", method);
exit_code = ERROR;
return -1;
}
@@ -1114,13 +1114,13 @@ int in, out; /* input and output file descriptors */
int res = inflate();
if (res == 3) {
- errorMsg(memory_exhausted);
+ error_msg(memory_exhausted);
} else if (res != 0) {
- errorMsg("invalid compressed data--format violated\n");
+ error_msg("invalid compressed data--format violated\n");
}
} else {
- errorMsg("internal error, invalid method\n");
+ error_msg("internal error, invalid method\n");
}
/* Get the crc and original length */
@@ -1149,10 +1149,10 @@ int in, out; /* input and output file descriptors */
/* Validate decompression */
if (orig_crc != updcrc(outbuf, 0)) {
- errorMsg("invalid compressed data--crc error\n");
+ error_msg("invalid compressed data--crc error\n");
}
if (orig_len != (ulg) bytes_out) {
- errorMsg("invalid compressed data--length error\n");
+ error_msg("invalid compressed data--length error\n");
}
/* Check if there are more entries in a pkzip file */
@@ -1225,9 +1225,9 @@ int gunzip_main(int argc, char **argv)
}
if (isatty(fileno(stdin)) && fromstdin==1 && force==0)
- fatalError( "data not read from terminal. Use -f to force it.\n");
+ error_msg_and_die( "data not read from terminal. Use -f to force it.\n");
if (isatty(fileno(stdout)) && tostdout==1 && force==0)
- fatalError( "data not written to terminal. Use -f to force it.\n");
+ error_msg_and_die( "data not written to terminal. Use -f to force it.\n");
foreground = signal(SIGINT, SIG_IGN) != SIG_IGN;
@@ -1265,7 +1265,7 @@ int gunzip_main(int argc, char **argv)
if (argc <= 0)
usage(gunzip_usage);
if (strlen(*argv) > MAX_PATH_LEN) {
- errorMsg(name_too_long);
+ error_msg(name_too_long);
exit(WARNING);
}
strcpy(ifname, *argv);
@@ -1304,7 +1304,7 @@ int gunzip_main(int argc, char **argv)
/* And get to work */
if (strlen(ifname) > MAX_PATH_LEN - 4) {
- errorMsg(name_too_long);
+ error_msg(name_too_long);
exit(WARNING);
}
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 */
# define DECLARE(type, array, size) type * array
# define ALLOC(type, array, size) { \
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
- if (array == NULL) errorMsg(memory_exhausted); \
+ if (array == NULL) error_msg(memory_exhausted); \
}
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
#else
@@ -251,7 +251,7 @@ extern int save_orig_name; /* set if original name must be saved */
/* Diagnostic functions */
#ifdef DEBUG
-# define Assert(cond,msg) {if(!(cond)) errorMsg(msg);}
+# define Assert(cond,msg) {if(!(cond)) error_msg(msg);}
# define Trace(x) fprintf x
# define Tracev(x) {if (verbose) fprintf x ;}
# define Tracevv(x) {if (verbose>1) fprintf x ;}
@@ -1381,7 +1381,7 @@ int length;
(char *) window + start, length) != EQUAL) {
fprintf(stderr,
" start %d, match %d, length %d\n", start, match, length);
- errorMsg("invalid match\n");
+ error_msg("invalid match\n");
}
if (verbose > 1) {
fprintf(stderr, "\\[%d,%d]", start - match, length);
@@ -1819,9 +1819,9 @@ int gzip_main(int argc, char **argv)
}
if (isatty(fileno(stdin)) && fromstdin==1 && force==0)
- fatalError( "data not read from terminal. Use -f to force it.\n");
+ error_msg_and_die( "data not read from terminal. Use -f to force it.\n");
if (isatty(fileno(stdout)) && tostdout==1 && force==0)
- fatalError( "data not written to terminal. Use -f to force it.\n");
+ error_msg_and_die( "data not written to terminal. Use -f to force it.\n");
foreground = signal(SIGINT, SIG_IGN) != SIG_IGN;
if (foreground) {
@@ -2900,7 +2900,7 @@ int eof; /* true if this is the last block for a file */
#endif
/* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
if (buf == (char *) 0)
- errorMsg("block vanished\n");
+ error_msg("block vanished\n");
copy_block(buf, (unsigned) stored_len, 0); /* without header */
compressed_len = stored_len << 3;
@@ -3083,7 +3083,7 @@ local void set_file_type()
bin_freq += dyn_ltree[n++].Freq;
*file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII;
if (*file_type == BINARY && translate_eol) {
- errorMsg("-l used on binary file\n");
+ error_msg("-l used on binary file\n");
}
}
@@ -3239,13 +3239,13 @@ char *env; /* name of environment variable */
nargv = (char **) calloc(*argcp + 1, sizeof(char *));
if (nargv == NULL)
- errorMsg(memory_exhausted);
+ error_msg(memory_exhausted);
oargv = *argvp;
*argvp = nargv;
/* Copy the program name first */
if (oargc-- < 0)
- errorMsg("argc<=0\n");
+ error_msg("argc<=0\n");
*(nargv++) = *(oargv++);
/* 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)
break;
case 'f':
if (*tarName != '-')
- fatalError( "Only one 'f' option allowed\n");
+ error_msg_and_die( "Only one 'f' option allowed\n");
tarName = *(++argv);
if (tarName == NULL)
- fatalError( "Option requires an argument: No file specified\n");
+ error_msg_and_die( "Option requires an argument: No file specified\n");
stopIt=TRUE;
break;
#if defined BB_FEATURE_TAR_EXCLUDE
@@ -205,7 +205,7 @@ extern int tar_main(int argc, char **argv)
excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2));
excludeList[excludeListSize] = *(++argv);
if (excludeList[excludeListSize] == NULL)
- fatalError( "Option requires an argument: No file specified\n");
+ error_msg_and_die( "Option requires an argument: No file specified\n");
/* Remove leading "/"s */
if (*excludeList[excludeListSize] =='/')
excludeList[excludeListSize] = (excludeList[excludeListSize])+1;
@@ -216,13 +216,13 @@ extern int tar_main(int argc, char **argv)
}
case 'X':
if (*excludeFileName != '-')
- fatalError("Only one 'X' option allowed\n");
+ error_msg_and_die("Only one 'X' option allowed\n");
excludeFileName = *(++argv);
if (excludeFileName == NULL)
- fatalError("Option requires an argument: No file specified\n");
+ error_msg_and_die("Option requires an argument: No file specified\n");
fileList = fopen (excludeFileName, "rt");
if (! fileList)
- fatalError("Exclude file: file not found\n");
+ error_msg_and_die("Exclude file: file not found\n");
while (!feof(fileList)) {
fscanf(fileList, "%s", file);
excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2));
@@ -253,7 +253,7 @@ extern int tar_main(int argc, char **argv)
*/
if (createFlag == TRUE) {
#ifndef BB_FEATURE_TAR_CREATE
- fatalError( "This version of tar was not compiled with tar creation support.\n");
+ error_msg_and_die( "This version of tar was not compiled with tar creation support.\n");
#else
status = writeTarFile(tarName, verboseFlag, argv, excludeList);
#endif
@@ -271,7 +271,7 @@ extern int tar_main(int argc, char **argv)
return EXIT_FAILURE;
flagError:
- fatalError( "Exactly one of 'c', 'x' or 't' must be specified\n");
+ error_msg_and_die( "Exactly one of 'c', 'x' or 't' must be specified\n");
}
static void
@@ -301,10 +301,10 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
if (extractFlag==TRUE && tostdoutFlag==FALSE) {
/* Create the path to the file, just in case it isn't there...
* This should not screw up path permissions or anything. */
- createPath(header->name, 0777);
+ create_path(header->name, 0777);
if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY,
header->mode & ~S_IFMT)) < 0) {
- errorMsg(io_error, header->name, strerror(errno));
+ error_msg(io_error, header->name, strerror(errno));
return( FALSE);
}
}
@@ -322,9 +322,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
readSize = size;
writeSize = size;
}
- if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) {
+ if ( (readSize = full_read(header->tarFd, buffer, readSize)) <= 0 ) {
/* Tarball seems to have a problem */
- errorMsg("Unexpected EOF in archive\n");
+ error_msg("Unexpected EOF in archive\n");
return( FALSE);
}
if ( readSize < writeSize )
@@ -333,9 +333,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
/* Write out the file, if we are supposed to be doing that */
if (extractFlag==TRUE) {
- if ((actualWriteSz=fullWrite(outFd, buffer, writeSize)) != writeSize ) {
+ if ((actualWriteSz=full_write(outFd, buffer, writeSize)) != writeSize ) {
/* Output file seems to have a problem */
- errorMsg(io_error, header->name, strerror(errno));
+ error_msg(io_error, header->name, strerror(errno));
return( FALSE);
}
} else {
@@ -361,13 +361,13 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag)
if (extractFlag==FALSE || tostdoutFlag==TRUE)
return( TRUE);
- if (createPath(header->name, header->mode) != TRUE) {
- errorMsg("%s: Cannot mkdir: %s\n",
+ if (create_path(header->name, header->mode) != TRUE) {
+ error_msg("%s: Cannot mkdir: %s\n",
header->name, strerror(errno));
return( FALSE);
}
/* make the final component, just in case it was
- * omitted by createPath() (which will skip the
+ * omitted by create_path() (which will skip the
* directory if it doesn't have a terminating '/') */
if (mkdir(header->name, header->mode) == 0) {
fixUpPermissions(header);
@@ -382,7 +382,7 @@ tarExtractHardLink(TarInfo *header, int extractFlag, int tostdoutFlag)
return( TRUE);
if (link(header->linkname, header->name) < 0) {
- errorMsg("%s: Cannot create hard link to '%s': %s\n",
+ error_msg("%s: Cannot create hard link to '%s': %s\n",
header->name, header->linkname, strerror(errno));
return( FALSE);
}
@@ -400,7 +400,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag)
#ifdef S_ISLNK
if (symlink(header->linkname, header->name) < 0) {
- errorMsg("%s: Cannot create symlink to '%s': %s\n",
+ error_msg("%s: Cannot create symlink to '%s': %s\n",
header->name, header->linkname, strerror(errno));
return( FALSE);
}
@@ -415,7 +415,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag)
/* Do not change permissions or date on symlink,
* since it changes the pointed to file instead. duh. */
#else
- errorMsg("%s: Cannot create symlink to '%s': %s\n",
+ error_msg("%s: Cannot create symlink to '%s': %s\n",
header->name, header->linkname,
"symlinks not supported");
#endif
@@ -430,13 +430,13 @@ tarExtractSpecial(TarInfo *header, int extractFlag, int tostdoutFlag)
if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) {
if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) {
- errorMsg("%s: Cannot mknod: %s\n",
+ error_msg("%s: Cannot mknod: %s\n",
header->name, strerror(errno));
return( FALSE);
}
} else if (S_ISFIFO(header->mode)) {
if (mkfifo(header->name, header->mode) < 0) {
- errorMsg("%s: Cannot mkfifo: %s\n",
+ error_msg("%s: Cannot mkfifo: %s\n",
header->name, strerror(errno));
return( FALSE);
}
@@ -455,9 +455,9 @@ static long getOctal(const char *cp, int size)
long val = 0;
for(;(size > 0) && (*cp == ' '); cp++, size--);
- if ((size == 0) || !isOctal(*cp))
+ if ((size == 0) || !is_octal(*cp))
return -1;
- for(; (size > 0) && isOctal(*cp); size--) {
+ for(; (size > 0) && is_octal(*cp); size--) {
val = val * 8 + *cp++ - '0';
}
for (;(size > 0) && (*cp == ' '); cp++, size--);
@@ -484,7 +484,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header)
++*(header->name);
if (alreadyWarned == FALSE) {
- errorMsg("Removing leading '/' from member names\n");
+ error_msg("Removing leading '/' from member names\n");
alreadyWarned = TRUE;
}
}
@@ -538,7 +538,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
else
tarFd = open(tarName, O_RDONLY);
if (tarFd < 0) {
- errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno));
+ error_msg( "Error opening '%s': %s\n", tarName, strerror(errno));
return ( FALSE);
}
@@ -547,7 +547,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
umask(0);
/* Read the tar file, and iterate over it one file at a time */
- while ( (status = fullRead(tarFd, (char*)&rawHeader, TAR_BLOCK_SIZE)) == TAR_BLOCK_SIZE ) {
+ while ( (status = full_read(tarFd, (char*)&rawHeader, TAR_BLOCK_SIZE)) == TAR_BLOCK_SIZE ) {
/* Try to read the header */
if ( readTarHeader(&rawHeader, &header) == FALSE ) {
@@ -555,7 +555,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
goto endgame;
} else {
errorFlag=TRUE;
- errorMsg("Bad tar header, skipping\n");
+ error_msg("Bad tar header, skipping\n");
continue;
}
}
@@ -572,7 +572,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
}
if ( skipNextHeaderFlag == TRUE ) {
skipNextHeaderFlag=FALSE;
- errorMsg(name_longer_than_foo, NAME_SIZE);
+ error_msg(name_longer_than_foo, NAME_SIZE);
if (tarExtractRegularFile(&header, FALSE, FALSE) == FALSE)
errorFlag = TRUE;
continue;
@@ -638,7 +638,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
char buf[35];
struct tm *tm = localtime (&(header.mtime));
- len=printf("%s ", modeString(header.mode));
+ len=printf("%s ", mode_string(header.mode));
memset(buf, 0, 8*sizeof(char));
my_getpwuid(buf, header.uid);
if (! *buf)
@@ -731,7 +731,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
break;
#endif
default:
- errorMsg("Unknown file type '%c' in tar file\n", header.type);
+ error_msg("Unknown file type '%c' in tar file\n", header.type);
close( tarFd);
return( FALSE);
}
@@ -739,11 +739,11 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
close(tarFd);
if (status > 0) {
/* Bummer - we read a partial header */
- errorMsg( "Error reading '%s': %s\n", tarName, strerror(errno));
+ error_msg( "Error reading '%s': %s\n", tarName, strerror(errno));
return ( FALSE);
}
else if (errorFlag==TRUE) {
- errorMsg( "Error exit delayed from previous errors\n");
+ error_msg( "Error exit delayed from previous errors\n");
return( FALSE);
} else
return( status);
@@ -753,13 +753,13 @@ endgame:
close( tarFd);
if (extractList != NULL) {
for (; *extractList != NULL; extractList++) {
- errorMsg("%s: Not found in archive\n", *extractList);
+ error_msg("%s: Not found in archive\n", *extractList);
errorFlag = TRUE;
}
}
if ( *(header.name) == '\0' ) {
if (errorFlag==TRUE)
- errorMsg( "Error exit delayed from previous errors\n");
+ error_msg( "Error exit delayed from previous errors\n");
else
return( TRUE);
}
@@ -903,7 +903,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
if (*fileName=='/') {
static int alreadyWarned=FALSE;
if (alreadyWarned==FALSE) {
- errorMsg("Removing leading '/' from member names\n");
+ error_msg("Removing leading '/' from member names\n");
alreadyWarned=TRUE;
}
strncpy(header.name, fileName+1, sizeof(header.name));
@@ -956,7 +956,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
header.typeflag = SYMTYPE;
link_size = readlink(fileName, buffer, sizeof(buffer) - 1);
if ( link_size < 0) {
- errorMsg("Error reading symlink '%s': %s\n", header.name, strerror(errno));
+ error_msg("Error reading symlink '%s': %s\n", header.name, strerror(errno));
return ( FALSE);
}
buffer[link_size] = '\0';
@@ -978,7 +978,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
header.typeflag = REGTYPE;
putOctal(header.size, sizeof(header.size), statbuf->st_size);
} else {
- errorMsg("%s: Unknown file type\n", fileName);
+ error_msg("%s: Unknown file type\n", fileName);
return ( FALSE);
}
@@ -994,8 +994,8 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
putOctal(header.chksum, 7, chksum);
/* Now write the header out to disk */
- if ((size=fullWrite(tbInfo->tarFd, (char*)&header, sizeof(struct TarHeader))) < 0) {
- errorMsg(io_error, fileName, strerror(errno));
+ if ((size=full_write(tbInfo->tarFd, (char*)&header, sizeof(struct TarHeader))) < 0) {
+ error_msg(io_error, fileName, strerror(errno));
return ( FALSE);
}
/* Pad the header up to the tar block size */
@@ -1036,7 +1036,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
/* It is against the rules to archive a socket */
if (S_ISSOCK(statbuf->st_mode)) {
- errorMsg("%s: socket ignored\n", fileName);
+ error_msg("%s: socket ignored\n", fileName);
return( TRUE);
}
@@ -1045,12 +1045,12 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
* the new tarball */
if (tbInfo->statBuf.st_dev == statbuf->st_dev &&
tbInfo->statBuf.st_ino == statbuf->st_ino) {
- errorMsg("%s: file is the archive; skipping\n", fileName);
+ error_msg("%s: file is the archive; skipping\n", fileName);
return( TRUE);
}
if (strlen(fileName) >= NAME_SIZE) {
- errorMsg(name_longer_than_foo, NAME_SIZE);
+ error_msg(name_longer_than_foo, NAME_SIZE);
return ( TRUE);
}
@@ -1067,21 +1067,21 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
/* open the file we want to archive, and make sure all is well */
if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
- errorMsg("%s: Cannot open: %s\n", fileName, strerror(errno));
+ error_msg("%s: Cannot open: %s\n", fileName, strerror(errno));
return( FALSE);
}
/* write the file to the archive */
- while ( (size = fullRead(inputFileFd, buffer, sizeof(buffer))) > 0 ) {
- if (fullWrite(tbInfo->tarFd, buffer, size) != size ) {
+ while ( (size = full_read(inputFileFd, buffer, sizeof(buffer))) > 0 ) {
+ if (full_write(tbInfo->tarFd, buffer, size) != size ) {
/* Output file seems to have a problem */
- errorMsg(io_error, fileName, strerror(errno));
+ error_msg(io_error, fileName, strerror(errno));
return( FALSE);
}
readSize+=size;
}
if (size == -1) {
- errorMsg(io_error, fileName, strerror(errno));
+ error_msg(io_error, fileName, strerror(errno));
return( FALSE);
}
/* Pad the file up to the tar block size */
@@ -1106,7 +1106,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
/* Make sure there is at least one file to tar up. */
if (*argv == NULL)
- fatalError("Cowardly refusing to create an empty archive\n");
+ error_msg_and_die("Cowardly refusing to create an empty archive\n");
/* Open the tar file for writing. */
if (!strcmp(tarName, "-"))
@@ -1114,7 +1114,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
else
tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (tbInfo.tarFd < 0) {
- errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno));
+ error_msg( "Error opening '%s': %s\n", tarName, strerror(errno));
freeHardLinkInfo(&tbInfo.hlInfoHead);
return ( FALSE);
}
@@ -1122,7 +1122,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
/* Store the stat info for the tarball's file, so
* can avoid including the tarball into itself.... */
if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0)
- fatalError(io_error, tarName, strerror(errno));
+ error_msg_and_die(io_error, tarName, strerror(errno));
/* Set the umask for this process so it doesn't
* screw up permission setting for us later. */
@@ -1130,7 +1130,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
/* Read the directory/files and iterate over them one at a time */
while (*argv != NULL) {
- if (recursiveAction(*argv++, TRUE, FALSE, FALSE,
+ if (recursive_action(*argv++, TRUE, FALSE, FALSE,
writeFileToTarball, writeFileToTarball,
(void*) &tbInfo) == FALSE) {
errorFlag = TRUE;
@@ -1149,7 +1149,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
/* Hang up the tools, close up shop, head home */
close(tarFd);
if (errorFlag == TRUE) {
- errorMsg("Error exit delayed from previous errors\n");
+ error_msg("Error exit delayed from previous errors\n");
freeHardLinkInfo(&tbInfo.hlInfoHead);
return(FALSE);
}
diff --git a/busybox.c b/busybox.c
index 857367b5f..212d46742 100644
--- a/busybox.c
+++ b/busybox.c
@@ -54,7 +54,7 @@ static char *busybox_fullpath()
if (len != -1) {
path[len] = 0;
} else {
- errorMsg("%s: %s\n", proc, strerror(errno));
+ error_msg("%s: %s\n", proc, strerror(errno));
return NULL;
}
return strdup(path);
@@ -78,7 +78,7 @@ static void install_links(const char *busybox, int use_symbolic_links)
rc = Link(busybox, command);
if (rc) {
- errorMsg("%s: %s\n", command, strerror(errno));
+ error_msg("%s: %s\n", command, strerror(errno));
}
}
}
diff --git a/busybox.h b/busybox.h
index 63f39590f..41421ae56 100644
--- a/busybox.h
+++ b/busybox.h
@@ -55,8 +55,8 @@
#define BUF_SIZE 8192
#define EXPAND_ALLOC 1024
-static inline int isDecimal(ch) { return ((ch >= '0') && (ch <= '9')); }
-static inline int isOctal(ch) { return ((ch >= '0') && (ch <= '7')); }
+static inline int is_decimal(ch) { return ((ch >= '0') && (ch <= '9')); }
+static inline int is_octal(ch) { return ((ch >= '0') && (ch <= '7')); }
/* Macros for min/max. */
#ifndef MIN
@@ -119,14 +119,14 @@ extern const char *applet_name;
extern int applet_name_compare(const void *x, const void *y);
extern void usage(const char *usage) __attribute__ ((noreturn));
-extern void errorMsg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
-extern void fatalError(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
-extern void perrorMsg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
-extern void fatalPerror(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
-
-const char *modeString(int mode);
-const char *timeString(time_t timeVal);
-int isDirectory(const char *name, const int followLinks, struct stat *statBuf);
+extern void error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
+extern void error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
+extern void perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
+extern void perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
+
+const char *mode_string(int mode);
+const char *time_string(time_t timeVal);
+int is_directory(const char *name, const int followLinks, struct stat *statBuf);
int isDevice(const char *name);
typedef struct ino_dev_hash_bucket_struct {
@@ -139,7 +139,7 @@ int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name);
void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name);
void reset_ino_dev_hashtable(void);
-int copyFile(const char *srcName, const char *destName,
+int copy_file(const char *srcName, const char *destName,
int setModes, int followLinks, int forceFlag);
int copy_file_chunk(int srcFd, int dstFd, size_t remaining);
char *buildName(const char *dirName, const char *fileName);
@@ -147,20 +147,20 @@ int makeString(int argc, const char **argv, char *buf, int bufLen);
char *getChunk(int size);
char *chunkstrdup(const char *str);
void freeChunks(void);
-int fullWrite(int fd, const char *buf, int len);
-int fullRead(int fd, char *buf, int len);
-int recursiveAction(const char *fileName, int recurse, int followLinks, int depthFirst,
+int full_write(int fd, const char *buf, int len);
+int full_read(int fd, char *buf, int len);
+int recursive_action(const char *fileName, int recurse, int followLinks, int depthFirst,
int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData),
int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData),
void* userData);
-extern int createPath (const char *name, int mode);
+extern int create_path (const char *name, int mode);
extern int parse_mode( const char* s, mode_t* theMode);
extern int get_kernel_revision(void);
extern int get_console_fd(char* tty_name);
-extern struct mntent *findMountPoint(const char *name, const char *table);
+extern struct mntent *find_mount_point(const char *name, const char *table);
extern void write_mtab(char* blockDevice, char* directory,
char* filesystemType, long flags, char* string_flags);
extern void erase_mtab(const char * name);
@@ -169,8 +169,8 @@ extern char *mtab_first(void **iter);
extern char *mtab_next(void **iter);
extern char *mtab_getinfo(const char *match, const char which);
extern int check_wildcard_match(const char* text, const char* pattern);
-extern long getNum (const char *cp);
-extern pid_t* findPidByName( char* pidName);
+extern long atoi_w_units (const char *cp);
+extern pid_t* find_pid_by_name( char* pidName);
extern int find_real_root_device_name(char* name);
extern char *get_line_from_file(FILE *file);
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)
case CHMOD_APP:
/* Parse the specified modes */
if (parse_mode(theMode, &(statbuf->st_mode)) == FALSE) {
- fatalError( "unknown mode: %s\n", theMode);
+ error_msg_and_die( "unknown mode: %s\n", theMode);
}
if (chmod(fileName, statbuf->st_mode) == 0)
return (TRUE);
@@ -111,7 +111,7 @@ int chmod_chown_chgrp_main(int argc, char **argv)
}
if (argc == 0 || *argv == NULL) {
- errorMsg(too_few_args);
+ error_msg(too_few_args);
}
if (whichApp == CHMOD_APP) {
@@ -149,24 +149,24 @@ int chmod_chown_chgrp_main(int argc, char **argv)
if (*argv == p)
uid = my_getpwnam(*argv);
if (uid == -1) {
- fatalError( "unknown user name: %s\n", *argv);
+ error_msg_and_die( "unknown user name: %s\n", *argv);
}
}
}
/* Ok, ready to do the deed now */
if (argc < 1) {
- fatalError(too_few_args);
+ error_msg_and_die(too_few_args);
}
while (argc-- > 1) {
- if (recursiveAction (*(++argv), recursiveFlag, FALSE, FALSE,
+ if (recursive_action (*(++argv), recursiveFlag, FALSE, FALSE,
fileAction, fileAction, NULL) == FALSE)
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
bad_group:
- fatalError( "unknown group name: %s\n", groupName);
+ error_msg_and_die( "unknown group name: %s\n", groupName);
}
/*
diff --git a/chroot.c b/chroot.c
index f279af18d..34daf7f25 100644
--- a/chroot.c
+++ b/chroot.c
@@ -38,7 +38,7 @@ int chroot_main(int argc, char **argv)
argv++;
if (chroot(*argv) || (chdir("/"))) {
- fatalError("cannot change root directory to %s: %s\n", *argv, strerror(errno));
+ error_msg_and_die("cannot change root directory to %s: %s\n", *argv, strerror(errno));
}
argc--;
@@ -57,7 +57,7 @@ int chroot_main(int argc, char **argv)
return EXIT_SUCCESS;
#endif
}
- fatalError("cannot execute %s: %s\n", prog, strerror(errno));
+ error_msg_and_die("cannot execute %s: %s\n", prog, strerror(errno));
}
diff --git a/cmdedit.c b/cmdedit.c
index 94b8fc7b1..c32330bfd 100644
--- a/cmdedit.c
+++ b/cmdedit.c
@@ -106,7 +106,7 @@ cmdedit_setwidth(int w)
cmdedit_termw = w;
cmdedit_scroll = w / 3;
} else {
- errorMsg("\n*** Error: minimum screen width is 21\n");
+ error_msg("\n*** Error: minimum screen width is 21\n");
}
}
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");
for (i = 1; i < argc; i++) {
num = atoi(argv[i]);
if (num == 0)
- errorMsg("0: illegal VT number\n");
+ error_msg("0: illegal VT number\n");
else if (num == 1)
- errorMsg("VT 1 cannot be deallocated\n");
+ error_msg("VT 1 cannot be deallocated\n");
else if (ioctl(fd, VT_DISALLOCATE, num)) {
perror("VT_DISALLOCATE");
- fatalError("could not deallocate console %d\n", num);
+ error_msg_and_die("could not deallocate console %d\n", num);
}
}
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)
fd = open("/dev/tty0", O_RDWR);
if (fd < 0) {
- errorMsg("Error opening /dev/tty0: %s\n", strerror(errno));
+ error_msg("Error opening /dev/tty0: %s\n", strerror(errno));
return EXIT_FAILURE;
}
@@ -78,7 +78,7 @@ int dumpkmap_main(int argc, char **argv)
ke.kb_table = i;
if (ioctl(fd, KDGKBENT, &ke) < 0) {
- errorMsg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
+ error_msg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
}
else {
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)
fd = open("/dev/tty", O_RDWR);
if (fd < 0) {
- errorMsg("Error opening /dev/tty1: %s\n", strerror(errno));
+ error_msg("Error opening /dev/tty1: %s\n", strerror(errno));
return EXIT_FAILURE;
}
if (screen_map_load(fd, stdin)) {
- errorMsg("Error loading acm: %s\n", strerror(errno));
+ error_msg("Error loading acm: %s\n", strerror(errno));
return EXIT_FAILURE;
}
@@ -72,7 +72,7 @@ int screen_map_load(int fd, FILE * fp)
if (parse_failed) {
if (-1 == fseek(fp, 0, SEEK_SET)) {
if (errno == ESPIPE)
- errorMsg("16bit screen-map MUST be a regular file.\n"),
+ error_msg("16bit screen-map MUST be a regular file.\n"),
exit(1);
else
perror("fseek failed reading binary 16bit screen-map"),
@@ -83,7 +83,7 @@ int screen_map_load(int fd, FILE * fp)
perror("Cannot read [new] map from file"), exit(1);
#if 0
else
- errorMsg("Input screen-map is binary.\n");
+ error_msg("Input screen-map is binary.\n");
#endif
}
@@ -100,7 +100,7 @@ int screen_map_load(int fd, FILE * fp)
/* rewind... */
if (-1 == fseek(fp, 0, SEEK_SET)) {
if (errno == ESPIPE)
- errorMsg("Assuming 8bit screen-map - MUST be a regular file.\n"),
+ error_msg("Assuming 8bit screen-map - MUST be a regular file.\n"),
exit(1);
else
perror("fseek failed assuming 8bit screen-map"), exit(1);
@@ -113,7 +113,7 @@ int screen_map_load(int fd, FILE * fp)
if (-1 == fseek(fp, 0, SEEK_SET)) {
if (errno == ESPIPE)
/* should not - it succedeed above */
- errorMsg("fseek() returned ESPIPE !\n"),
+ error_msg("fseek() returned ESPIPE !\n"),
exit(1);
else
perror("fseek for binary 8bit screen-map"), exit(1);
@@ -123,7 +123,7 @@ int screen_map_load(int fd, FILE * fp)
perror("Cannot read [old] map from file"), exit(1);
#if 0
else
- errorMsg("Input screen-map is binary.\n");
+ error_msg("Input screen-map is binary.\n");
#endif
}
@@ -132,7 +132,7 @@ int screen_map_load(int fd, FILE * fp)
else
return 0;
}
- errorMsg("Error parsing symbolic map\n");
+ error_msg("Error parsing symbolic map\n");
return(1);
}
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)
fd = open("/dev/tty0", O_RDWR);
if (fd < 0)
- fatalPerror("Error opening /dev/tty0");
+ perror_msg_and_die("Error opening /dev/tty0");
loadnewfont(fd);
return EXIT_SUCCESS;
@@ -62,7 +62,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
memset(buf, 0, sizeof(buf));
if (unit < 1 || unit > 32)
- fatalError("Bad character size %d\n", unit);
+ error_msg_and_die("Bad character size %d\n", unit);
for (i = 0; i < fontsize; i++)
memcpy(buf + (32 * i), inbuf + (unit * i), unit);
@@ -77,11 +77,11 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
if (ioctl(fd, PIO_FONTX, &cfd) == 0)
return; /* success */
- perrorMsg("PIO_FONTX ioctl error (trying PIO_FONT)");
+ perror_msg("PIO_FONTX ioctl error (trying PIO_FONT)");
}
#endif
if (ioctl(fd, PIO_FONT, buf))
- fatalPerror("PIO_FONT ioctl error");
+ perror_msg_and_die("PIO_FONT ioctl error");
}
static void
@@ -119,11 +119,11 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
if (ioctl(fd, PIO_UNIMAPCLR, &advice)) {
#ifdef ENOIOCTLCMD
if (errno == ENOIOCTLCMD) {
- errorMsg("It seems this kernel is older than 1.1.92\n");
- fatalError("No Unicode mapping table loaded.\n");
+ error_msg("It seems this kernel is older than 1.1.92\n");
+ error_msg_and_die("No Unicode mapping table loaded.\n");
} else
#endif
- fatalPerror("PIO_UNIMAPCLR");
+ perror_msg_and_die("PIO_UNIMAPCLR");
}
ud.entry_ct = ct;
ud.entries = up;
@@ -133,7 +133,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
/* change advice parameters */
}
#endif
- fatalPerror("PIO_UNIMAP");
+ perror_msg_and_die("PIO_UNIMAP");
}
}
@@ -150,13 +150,13 @@ static void loadnewfont(int fd)
*/
inputlth = fread(inbuf, 1, sizeof(inbuf), stdin);
if (ferror(stdin))
- fatalPerror("Error reading input font");
+ perror_msg_and_die("Error reading input font");
/* use malloc/realloc in case of giant files;
maybe these do not occur: 16kB for the font,
and 16kB for the map leaves 32 unicode values
for each font position */
if (!feof(stdin))
- fatalPerror("Font too large");
+ perror_msg_and_die("Font too large");
/* test for psf first */
{
@@ -174,11 +174,11 @@ static void loadnewfont(int fd)
goto no_psf;
if (psfhdr.mode > PSF_MAXMODE)
- fatalError("Unsupported psf file mode\n");
+ error_msg_and_die("Unsupported psf file mode\n");
fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256);
#if !defined( PIO_FONTX ) || defined( __sparc__ )
if (fontsize != 256)
- fatalError("Only fontsize 256 supported\n");
+ error_msg_and_die("Only fontsize 256 supported\n");
#endif
hastable = (psfhdr.mode & PSF_MODEHASTAB);
unit = psfhdr.charsize;
@@ -186,7 +186,7 @@ static void loadnewfont(int fd)
head = head0 + fontsize * unit;
if (head > inputlth || (!hastable && head != inputlth))
- fatalError("Input file: bad length\n");
+ error_msg_and_die("Input file: bad length\n");
do_loadfont(fd, inbuf + head0, unit, fontsize);
if (hastable)
do_loadtable(fd, inbuf + head, inputlth - head, fontsize);
@@ -201,7 +201,7 @@ static void loadnewfont(int fd)
} else {
/* bare font */
if (inputlth & 0377)
- fatalError("Bad input file size\n");
+ error_msg_and_die("Bad input file size\n");
offset = 0;
unit = inputlth / 256;
}
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)
fd = open("/dev/tty0", O_RDWR);
if (fd < 0)
- fatalPerror("Error opening /dev/tty0");
+ perror_msg_and_die("Error opening /dev/tty0");
read(0, buff, 7);
if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
- fatalError("This is not a valid binary keymap.\n");
+ error_msg_and_die("This is not a valid binary keymap.\n");
if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS))
- fatalPerror("Error reading keymap flags");
+ perror_msg_and_die("Error reading keymap flags");
ibuff = (u_short *) xmalloc(ibuffsz);
@@ -68,7 +68,7 @@ int loadkmap_main(int argc, char **argv)
pos = 0;
while (pos < ibuffsz) {
if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) < 0)
- fatalPerror("Error reading keymap");
+ perror_msg_and_die("Error reading keymap");
pos += readsz;
}
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)
a.keycode = atoi(argv[2]);
a.scancode = sc = strtol(argv[1], &ep, 16);
if (*ep) {
- fatalError("error reading SCANCODE: '%s'\n", argv[1]);
+ error_msg_and_die("error reading SCANCODE: '%s'\n", argv[1]);
}
if (a.scancode > 127) {
a.scancode -= 0xe000;
a.scancode += 128;
}
if (a.scancode > 255 || a.keycode > 127) {
- fatalError("SCANCODE or KEYCODE outside bounds\n");
+ error_msg_and_die("SCANCODE or KEYCODE outside bounds\n");
}
if (ioctl(fd,KDSETKEYCODE,&a)) {
perror("KDSETKEYCODE");
- fatalError("failed to set SCANCODE %x to KEYCODE %d\n", sc, a.keycode);
+ error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d\n", sc, a.keycode);
}
argc -= 2;
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)
argv++;
if (chroot(*argv) || (chdir("/"))) {
- fatalError("cannot change root directory to %s: %s\n", *argv, strerror(errno));
+ error_msg_and_die("cannot change root directory to %s: %s\n", *argv, strerror(errno));
}
argc--;
@@ -57,7 +57,7 @@ int chroot_main(int argc, char **argv)
return EXIT_SUCCESS;
#endif
}
- fatalError("cannot execute %s: %s\n", prog, strerror(errno));
+ error_msg_and_die("cannot execute %s: %s\n", prog, strerror(errno));
}
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)
/* the list must contain only digits and no more than one minus sign */
for (ptr = (char *)list; *ptr; ptr++) {
if (!isdigit(*ptr) && *ptr != '-') {
- fatalError("invalid byte or field list\n");
+ error_msg_and_die("invalid byte or field list\n");
}
if (*ptr == '-') {
nminus++;
if (nminus > 1) {
- fatalError("invalid byte or field list\n");
+ error_msg_and_die("invalid byte or field list\n");
}
}
}
@@ -68,7 +68,7 @@ static void decompose_list(const char *list)
if (nminus == 0) {
startpos = strtol(list, &ptr, 10);
if (startpos == 0) {
- fatalError("missing list of fields\n");
+ error_msg_and_die("missing list of fields\n");
}
endpos = startpos;
}
@@ -188,14 +188,14 @@ extern int cut_main(int argc, char **argv)
case 'f':
/* make sure they didn't ask for two types of lists */
if (part != 0) {
- fatalError("only one type of list may be specified");
+ error_msg_and_die("only one type of list may be specified");
}
part = (char)opt;
decompose_list(optarg);
break;
case 'd':
if (strlen(optarg) > 1) {
- fatalError("the delimiter must be a single character\n");
+ error_msg_and_die("the delimiter must be a single character\n");
}
delim = optarg[0];
break;
@@ -209,16 +209,16 @@ extern int cut_main(int argc, char **argv)
}
if (part == 0) {
- fatalError("you must specify a list of bytes, characters, or fields\n");
+ error_msg_and_die("you must specify a list of bytes, characters, or fields\n");
}
if (supress_non_delimited_lines && part != 'f') {
- fatalError("suppressing non-delimited lines makes sense
+ error_msg_and_die("suppressing non-delimited lines makes sense
only when operating on fields\n");
}
if (delim != '\t' && part != 'f') {
- fatalError("a delimiter may be specified only when operating on fields\n");
+ error_msg_and_die("a delimiter may be specified only when operating on fields\n");
}
/* 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)
for (i = optind; i < argc; i++) {
file = fopen(argv[i], "r");
if (file == NULL) {
- errorMsg("%s: %s\n", argv[i], strerror(errno));
+ error_msg("%s: %s\n", argv[i], strerror(errno));
} else {
cut_file(file);
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)
&(tm_time->tm_min), &(tm_time->tm_year));
if (nr < 4 || nr > 5) {
- fatalError(invalid_date, t_string);
+ error_msg_and_die(invalid_date, t_string);
}
/* correct for century - minor Y2K problem here? */
@@ -121,7 +121,7 @@ struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
} else {
- fatalError(invalid_date, t_string);
+ error_msg_and_die(invalid_date, t_string);
}
*tm_time = t;
return (tm_time);
@@ -156,7 +156,7 @@ int date_main(int argc, char **argv)
case 'u':
utc = 1;
if (putenv("TZ=UTC0") != 0)
- fatalError(memory_exhausted);
+ error_msg_and_die(memory_exhausted);
break;
case 'd':
use_arg = 1;
@@ -176,7 +176,7 @@ int date_main(int argc, char **argv)
}
#if 0
else {
- errorMsg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt);
+ error_msg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt);
usage(date_usage);
}
#endif
@@ -205,16 +205,16 @@ int date_main(int argc, char **argv)
/* Correct any day of week and day of year etc fields */
tm = mktime(&tm_time);
if (tm < 0)
- fatalError(invalid_date, date_str);
+ error_msg_and_die(invalid_date, date_str);
if ( utc ) {
if (putenv("TZ=UTC0") != 0)
- fatalError(memory_exhausted);
+ error_msg_and_die(memory_exhausted);
}
/* if setting time, set it */
if (set_time) {
if (stime(&tm) < 0) {
- perrorMsg("cannot set date");
+ perror_msg("cannot set date");
}
}
}
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)
else if (outFile == NULL && (strncmp(*argv, "of", 2) == 0))
outFile = ((strchr(*argv, '=')) + 1);
else if (strncmp("count", *argv, 5) == 0) {
- count = getNum((strchr(*argv, '=')) + 1);
+ count = atoi_w_units((strchr(*argv, '=')) + 1);
if (count < 0) {
- errorMsg("Bad count value %s\n", *argv);
+ error_msg("Bad count value %s\n", *argv);
goto usage;
}
} else if (strncmp(*argv, "bs", 2) == 0) {
- blockSize = getNum((strchr(*argv, '=')) + 1);
+ blockSize = atoi_w_units((strchr(*argv, '=')) + 1);
if (blockSize <= 0) {
- errorMsg("Bad block size value %s\n", *argv);
+ error_msg("Bad block size value %s\n", *argv);
goto usage;
}
} else if (strncmp(*argv, "skip", 4) == 0) {
- skipBlocks = getNum((strchr(*argv, '=')) + 1);
+ skipBlocks = atoi_w_units((strchr(*argv, '=')) + 1);
if (skipBlocks <= 0) {
- errorMsg("Bad skip value %s\n", *argv);
+ error_msg("Bad skip value %s\n", *argv);
goto usage;
}
} else if (strncmp(*argv, "seek", 4) == 0) {
- seekBlocks = getNum((strchr(*argv, '=')) + 1);
+ seekBlocks = atoi_w_units((strchr(*argv, '=')) + 1);
if (seekBlocks <= 0) {
- errorMsg("Bad seek value %s\n", *argv);
+ error_msg("Bad seek value %s\n", *argv);
goto usage;
}
} else if (strncmp(*argv, "conv", 4) == 0) {
@@ -119,7 +119,7 @@ extern int dd_main(int argc, char **argv)
* here anyways... */
/* free(buf); */
- fatalPerror("%s", inFile);
+ perror_msg_and_die("%s", inFile);
}
if (outFile == NULL)
@@ -134,7 +134,7 @@ extern int dd_main(int argc, char **argv)
/* close(inFd);
free(buf); */
- fatalPerror("%s", outFile);
+ perror_msg_and_die("%s", outFile);
}
lseek(inFd, (off_t) (skipBlocks * blockSize), SEEK_SET);
@@ -146,13 +146,13 @@ extern int dd_main(int argc, char **argv)
ibs=BUFSIZ;
while (totalSize > outTotal) {
- inCc = fullRead(inFd, buf, ibs);
+ inCc = full_read(inFd, buf, ibs);
inTotal += inCc;
if ( (sync==TRUE) && (inCc>0) )
while (inCc<ibs)
buf[inCc++]='\0';
- if ((outCc = fullWrite(outFd, buf, inCc)) < 1){
+ if ((outCc = full_write(outFd, buf, inCc)) < 1){
if (outCc < 0 ){
perror("Error during write");
}
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)
long blocks_percent_used;
if (statfs(mountPoint, &s) != 0) {
- perrorMsg("%s", mountPoint);
+ perror_msg("%s", mountPoint);
return FALSE;
}
@@ -75,8 +75,8 @@ extern int df_main(int argc, char **argv)
usage(df_usage);
}
while (argc > 1) {
- if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) {
- errorMsg("%s: can't find mount point.\n", argv[1]);
+ if ((mountEntry = find_mount_point(argv[1], mtab_file)) == 0) {
+ error_msg("%s: can't find mount point.\n", argv[1]);
status = EXIT_FAILURE;
} else if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir))
status = EXIT_FAILURE;
@@ -89,7 +89,7 @@ extern int df_main(int argc, char **argv)
mountTable = setmntent(mtab_file, "r");
if (mountTable == 0) {
- perrorMsg("%s", mtab_file);
+ perror_msg("%s", mtab_file);
return EXIT_FAILURE;
}
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)
}
if (len + strlen(name) + 1 > BUFSIZ) {
- errorMsg(name_too_long);
+ error_msg(name_too_long);
du_depth--;
return 0;
}
@@ -156,7 +156,7 @@ int du_main(int argc, char **argv)
for (i=optind; i < argc; i++) {
if ((sum = du(argv[i])) == 0)
status = EXIT_FAILURE;
- if (sum && isDirectory(argv[i], FALSE, NULL)) {
+ if (sum && is_directory(argv[i], FALSE, NULL)) {
print_normal(sum, argv[i]);
}
reset_ino_dev_hashtable();
@@ -166,7 +166,7 @@ int du_main(int argc, char **argv)
return status;
}
-/* $Id: du.c,v 1.28 2000/12/06 15:56:31 kraai Exp $ */
+/* $Id: du.c,v 1.29 2000/12/07 19:56:48 markw Exp $ */
/*
Local Variables:
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)
VALUE *v;
if (argc == 1) {
- fatalError("too few arguments\n");
+ error_msg_and_die("too few arguments\n");
}
args = argv + 1;
v = eval ();
if (*args)
- fatalError ("syntax error\n");
+ error_msg_and_die ("syntax error\n");
if (v->type == integer)
printf ("%d\n", v->u.i);
@@ -216,7 +216,7 @@ static \
int name (l, r) VALUE *l; VALUE *r; \
{ \
if (!toarith (l) || !toarith (r)) \
- fatalError ("non-numeric argument\n"); \
+ error_msg_and_die ("non-numeric argument\n"); \
return l->u.i op r->u.i; \
}
@@ -224,9 +224,9 @@ int name (l, r) VALUE *l; VALUE *r; \
int name (l, r) VALUE *l; VALUE *r; \
{ \
if (!toarith (l) || !toarith (r)) \
- fatalError ( "non-numeric argument\n"); \
+ error_msg_and_die ( "non-numeric argument\n"); \
if (r->u.i == 0) \
- fatalError ( "division by zero\n"); \
+ error_msg_and_die ( "division by zero\n"); \
return l->u.i op r->u.i; \
}
@@ -270,7 +270,7 @@ of a basic regular expression is not portable; it is being ignored",
re_syntax_options = RE_SYNTAX_POSIX_BASIC;
errmsg = re_compile_pattern (pv->u.s, len, &re_buffer);
if (errmsg) {
- fatalError("%s\n", errmsg);
+ error_msg_and_die("%s\n", errmsg);
}
len = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs);
@@ -301,19 +301,19 @@ static VALUE *eval7 (void)
VALUE *v;
if (!*args)
- fatalError ( "syntax error\n");
+ error_msg_and_die ( "syntax error\n");
if (nextarg ("(")) {
args++;
v = eval ();
if (!nextarg (")"))
- fatalError ( "syntax error\n");
+ error_msg_and_die ( "syntax error\n");
args++;
return v;
}
if (nextarg (")"))
- fatalError ( "syntax error\n");
+ error_msg_and_die ( "syntax error\n");
return str_value (*args++);
}
@@ -327,7 +327,7 @@ static VALUE *eval6 (void)
if (nextarg ("quote")) {
args++;
if (!*args)
- fatalError ( "syntax error\n");
+ error_msg_and_die ( "syntax error\n");
return str_value (*args++);
}
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)
}
head(len, fp);
if (errno) {
- errorMsg("%s: %s\n", argv[optind], strerror(errno));
+ error_msg("%s: %s\n", argv[optind], strerror(errno));
status = EXIT_FAILURE;
errno = 0;
}
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)
pwnam=my_getpwnam(user);
grnam=my_getgrnam(group);
if (gid == -1 || pwnam==-1 || grnam==-1) {
- fatalError("%s: No such user\n", user);
+ error_msg_and_die("%s: No such user\n", user);
}
if (no_group)
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
strcpy(srcName, link_SrcName);
if (flag&LN_NODEREFERENCE)
- srcIsDir = isDirectory(srcName, TRUE, NULL);
+ srcIsDir = is_directory(srcName, TRUE, NULL);
else
- srcIsDir = isDirectory(srcName, FALSE, NULL);
+ srcIsDir = is_directory(srcName, FALSE, NULL);
if ((srcIsDir==TRUE)&&((flag&LN_NODEREFERENCE)==0)) {
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)
puts(user);
return EXIT_SUCCESS;
}
- fatalError("no login name\n");
+ error_msg_and_die("no login name\n");
}
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)
#ifdef BB_FEATURE_LS_FOLLOWLINKS
if (follow_links == TRUE) {
if (stat(cur->fullname, &cur->dstat)) {
- errorMsg("%s: %s\n", cur->fullname, strerror(errno));
+ error_msg("%s: %s\n", cur->fullname, strerror(errno));
status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
@@ -190,7 +190,7 @@ static int my_stat(struct dnode *cur)
} else
#endif
if (lstat(cur->fullname, &cur->dstat)) {
- errorMsg("%s: %s\n", cur->fullname, strerror(errno));
+ error_msg("%s: %s\n", cur->fullname, strerror(errno));
status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
@@ -511,7 +511,7 @@ struct dnode **list_dir(char *path)
nfiles= 0;
dir = opendir(path);
if (dir == NULL) {
- errorMsg("%s: %s\n", path, strerror(errno));
+ error_msg("%s: %s\n", path, strerror(errno));
status = EXIT_FAILURE;
return(NULL); /* could not open the dir */
}
@@ -591,7 +591,7 @@ int list_single(struct dnode *dn)
column += 5;
break;
case LIST_MODEBITS:
- fprintf(stdout, "%10s", (char *)modeString(dn->dstat.st_mode));
+ fprintf(stdout, "%10s", (char *)mode_string(dn->dstat.st_mode));
column += 10;
break;
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,
} else {
fp = fopen(filename, OPENOPTS(binary));
if (fp == NULL) {
- errorMsg("%s: %s\n", filename, strerror(errno));
+ error_msg("%s: %s\n", filename, strerror(errno));
return FALSE;
}
}
if (md5_stream(fp, md5_result)) {
- errorMsg("%s: %s\n", filename, strerror(errno));
+ error_msg("%s: %s\n", filename, strerror(errno));
if (fp != stdin)
fclose(fp);
@@ -665,7 +665,7 @@ static int md5_file(const char *filename,
}
if (fp != stdin && fclose(fp) == EOF) {
- errorMsg("%s: %s\n", filename, strerror(errno));
+ error_msg("%s: %s\n", filename, strerror(errno));
return FALSE;
}
@@ -689,7 +689,7 @@ static int md5_check(const char *checkfile_name)
} else {
checkfile_stream = fopen(checkfile_name, "r");
if (checkfile_stream == NULL) {
- errorMsg("%s: %s\n", checkfile_name, strerror(errno));
+ error_msg("%s: %s\n", checkfile_name, strerror(errno));
return FALSE;
}
}
@@ -722,7 +722,7 @@ static int md5_check(const char *checkfile_name)
if (split_3(line, line_length, &md5num, &binary, &filename)
|| !hex_digits(md5num)) {
if (warn) {
- errorMsg("%s: %lu: improperly formatted MD5 checksum line\n",
+ error_msg("%s: %lu: improperly formatted MD5 checksum line\n",
checkfile_name, (unsigned long) line_number);
}
} else {
@@ -770,18 +770,18 @@ static int md5_check(const char *checkfile_name)
free(line);
if (ferror(checkfile_stream)) {
- errorMsg("%s: read error\n", checkfile_name); /* */
+ error_msg("%s: read error\n", checkfile_name); /* */
return FALSE;
}
if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) {
- errorMsg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
+ error_msg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
return FALSE;
}
if (n_properly_formated_lines == 0) {
/* Warn if no tests are found. */
- errorMsg("%s: no properly formatted MD5 checksum lines found\n",
+ error_msg("%s: no properly formatted MD5 checksum lines found\n",
checkfile_name);
return FALSE;
} else {
@@ -790,13 +790,13 @@ static int md5_check(const char *checkfile_name)
- n_open_or_read_failures);
if (n_open_or_read_failures > 0) {
- errorMsg("WARNING: %d of %d listed files could not be read\n",
+ error_msg("WARNING: %d of %d listed files could not be read\n",
n_open_or_read_failures, n_properly_formated_lines);
return FALSE;
}
if (n_mismatched_checksums > 0) {
- errorMsg("WARNING: %d of %d computed checksums did NOT match\n",
+ error_msg("WARNING: %d of %d computed checksums did NOT match\n",
n_mismatched_checksums, n_computed_checkums);
return FALSE;
}
@@ -861,22 +861,22 @@ int md5sum_main(int argc,
}
if (file_type_specified && do_check) {
- errorMsg("the -b and -t options are meaningless when verifying checksums\n");
+ error_msg("the -b and -t options are meaningless when verifying checksums\n");
return EXIT_FAILURE;
}
if (n_strings > 0 && do_check) {
- errorMsg("the -g and -c options are mutually exclusive\n");
+ error_msg("the -g and -c options are mutually exclusive\n");
return EXIT_FAILURE;
}
if (status_only && !do_check) {
- errorMsg("the -s option is meaningful only when verifying checksums\n");
+ error_msg("the -s option is meaningful only when verifying checksums\n");
return EXIT_FAILURE;
}
if (warn && !do_check) {
- errorMsg("the -w option is meaningful only when verifying checksums\n");
+ error_msg("the -w option is meaningful only when verifying checksums\n");
return EXIT_FAILURE;
}
@@ -884,7 +884,7 @@ int md5sum_main(int argc,
size_t i;
if (optind < argc) {
- errorMsg("no files may be specified when using -g\n");
+ error_msg("no files may be specified when using -g\n");
return EXIT_FAILURE;
}
for (i = 0; i < n_strings; ++i) {
@@ -898,7 +898,7 @@ int md5sum_main(int argc,
}
} else if (do_check) {
if (optind + 1 < argc) {
- errorMsg("only one argument may be specified when using -c\n");
+ error_msg("only one argument may be specified when using -c\n");
}
err = md5_check ((optind == argc) ? "-" : argv[optind]);
@@ -951,12 +951,12 @@ int md5sum_main(int argc,
}
if (fclose (stdout) == EOF) {
- errorMsg("write error\n");
+ error_msg("write error\n");
return EXIT_FAILURE;
}
if (have_read_stdin && fclose (stdin) == EOF) {
- errorMsg("standard input\n");
+ error_msg("standard input\n");
return EXIT_FAILURE;
}
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)
/* Find the specified modes */
mode = 0;
if (parse_mode(*(++argv), &mode) == FALSE) {
- errorMsg("Unknown mode: %s\n", *argv);
+ error_msg("Unknown mode: %s\n", *argv);
return EXIT_FAILURE;
}
/* Set the umask for this process so it doesn't
@@ -79,18 +79,18 @@ extern int mkdir_main(int argc, char **argv)
char buf[BUFSIZ + 1];
if (strlen(*argv) > BUFSIZ - 1) {
- errorMsg(name_too_long);
+ error_msg(name_too_long);
return EXIT_FAILURE;
}
strcpy(buf, *argv);
status = stat(buf, &statBuf);
if (parentFlag == FALSE && status != -1 && errno != ENOENT) {
- errorMsg("%s: File exists\n", buf);
+ error_msg("%s: File exists\n", buf);
return EXIT_FAILURE;
}
if (parentFlag == TRUE) {
strcat(buf, "/");
- createPath(buf, mode);
+ create_path(buf, mode);
} else {
if (mkdir(buf, mode) != 0 && parentFlag == FALSE) {
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)
mode |= perm;
if (mknod(argv[0], mode, dev) != 0)
- fatalError("%s: %s\n", argv[0], strerror(errno));
+ error_msg_and_die("%s: %s\n", argv[0], strerror(errno));
return EXIT_SUCCESS;
}
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)
char buf[BUFSIZ + 1];
if (getcwd(buf, sizeof(buf)) == NULL)
- fatalError("%s\n", strerror(errno));
+ error_msg_and_die("%s\n", strerror(errno));
printf("%s\n", buf);
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;
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
{
if (unlink(fileName) < 0) {
- perrorMsg("%s", fileName);
+ perror_msg("%s", fileName);
return (FALSE);
}
return (TRUE);
@@ -47,11 +47,11 @@ static int dirAction(const char *fileName, struct stat *statbuf, void* junk)
{
if (recursiveFlag == FALSE) {
errno = EISDIR;
- perrorMsg("%s", fileName);
+ perror_msg("%s", fileName);
return (FALSE);
}
if (rmdir(fileName) < 0) {
- perrorMsg("%s", fileName);
+ perror_msg("%s", fileName);
return (FALSE);
}
return (TRUE);
@@ -101,7 +101,7 @@ extern int rm_main(int argc, char **argv)
&& errno == ENOENT) {
/* do not reports errors for non-existent files if -f, just skip them */
} else {
- if (recursiveAction(srcName, recursiveFlag, FALSE,
+ if (recursive_action(srcName, recursiveFlag, FALSE,
TRUE, fileAction, dirAction, NULL) == FALSE) {
status = EXIT_FAILURE;
}
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)
while (--argc > 0) {
if (rmdir(*(++argv)) == -1) {
- perrorMsg("%s", *argv);
+ perror_msg("%s", *argv);
status = EXIT_FAILURE;
}
}
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)
break;
#endif
default:
- errorMsg("invalid option -- %c\n", opt);
+ error_msg("invalid option -- %c\n", opt);
usage(sort_usage);
}
} else {
@@ -286,4 +286,4 @@ int sort_main(int argc, char **argv)
return(0);
}
-/* $Id: sort.c,v 1.23 2000/09/28 17:49:59 beppu Exp $ */
+/* $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)
usage(tail_usage);
break;
default:
- errorMsg("\nUnknown arg: %c.\n\n",optopt);
+ error_msg("\nUnknown arg: %c.\n\n",optopt);
usage(tail_usage);
}
}
@@ -263,7 +263,7 @@ int tail_main(int argc, char **argv)
else
fd[test] = open(files[test], O_RDONLY);
if (fd[test] == -1)
- fatalError("Unable to open file %s.\n", files[test]);
+ error_msg_and_die("Unable to open file %s.\n", files[test]);
tail_stream(fd[test]);
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)
while (optind < argc) {
if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) {
nfiles--;
- errorMsg("%s: %s\n", argv[optind-1], strerror(errno));
+ error_msg("%s: %s\n", argv[optind-1], strerror(errno));
status = 1;
}
}
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)
if (strcmp(applet_name, "[") == 0) {
if (strcmp(argv[--argc], "]"))
- fatalError("missing ]\n");
+ error_msg_and_die("missing ]\n");
argv[argc] = NULL;
}
/* Implement special cases from POSIX.2, section 4.62.4 */
@@ -233,9 +233,9 @@ syntax(op, msg)
char *msg;
{
if (op && *op)
- fatalError("%s: %s\n", op, msg);
+ error_msg_and_die("%s: %s\n", op, msg);
else
- fatalError("%s\n", msg);
+ error_msg_and_die("%s\n", msg);
}
static int
@@ -470,13 +470,13 @@ getn(s)
r = strtol(s, &p, 10);
if (errno != 0)
- fatalError("%s: out of range\n", s);
+ error_msg_and_die("%s: out of range\n", s);
while (isspace(*p))
p++;
if (*p)
- fatalError("%s: bad number\n", s);
+ error_msg_and_die("%s: bad number\n", s);
return (int) r;
}
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)
if (create == FALSE && errno == ENOENT)
return EXIT_SUCCESS;
else {
- fatalError("%s", strerror(errno));
+ error_msg_and_die("%s", strerror(errno));
}
}
close(fd);
if (utime(*argv, NULL)) {
- fatalError("%s", strerror(errno));
+ error_msg_and_die("%s", strerror(errno));
}
argc--;
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)
input_length = complement(input, input_length);
if (argv[index] != NULL) {
if (*argv[index] == '\0')
- fatalError("STRING2 cannot be empty\n");
+ error_msg_and_die("STRING2 cannot be empty\n");
output_length = expand(argv[index], output);
map(input, input_length, output, output_length);
}
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)
char *p;
if (fgets (buf, sizeof(buf), stdin) == NULL) {
- errorMsg("%s: Short file\n", inname);
+ error_msg("%s: Short file\n", inname);
return FALSE;
}
p = buf;
@@ -78,7 +78,7 @@ static int read_stduu (const char *inname)
if (fgets (buf, sizeof(buf), stdin) == NULL
|| strcmp (buf, "end\n")) {
- errorMsg("%s: No `end' line\n", inname);
+ error_msg("%s: No `end' line\n", inname);
return FALSE;
}
@@ -128,7 +128,7 @@ static int read_base64 (const char *inname)
unsigned char *p;
if (fgets (buf, sizeof(buf), stdin) == NULL) {
- errorMsg("%s: Short file\n", inname);
+ error_msg("%s: Short file\n", inname);
return FALSE;
}
p = buf;
@@ -136,7 +136,7 @@ static int read_base64 (const char *inname)
if (memcmp (buf, "====", 4) == 0)
break;
if (last_data != 0) {
- errorMsg("%s: data following `=' padding character\n", inname);
+ error_msg("%s: data following `=' padding character\n", inname);
return FALSE;
}
@@ -158,14 +158,14 @@ static int read_base64 (const char *inname)
while ((b64_tab[*p] & '\100') != 0)
if (*p == '\n' || *p++ == '=') {
- errorMsg("%s: illegal line\n", inname);
+ error_msg("%s: illegal line\n", inname);
return FALSE;
}
c2 = b64_tab[*p++];
while (b64_tab[*p] == '\177')
if (*p++ == '\n') {
- errorMsg("%s: illegal line\n", inname);
+ error_msg("%s: illegal line\n", inname);
return FALSE;
}
if (*p == '=') {
@@ -177,7 +177,7 @@ static int read_base64 (const char *inname)
while (b64_tab[*p] == '\177')
if (*p++ == '\n') {
- errorMsg("%s: illegal line\n", inname);
+ error_msg("%s: illegal line\n", inname);
return FALSE;
}
putchar (c1 << 2 | c2 >> 4);
@@ -209,7 +209,7 @@ static int decode (const char *inname,
while (1) {
if (fgets (buf, sizeof (buf), stdin) == NULL) {
- errorMsg("%s: No `begin' line\n", inname);
+ error_msg("%s: No `begin' line\n", inname);
return FALSE;
}
@@ -234,13 +234,13 @@ static int decode (const char *inname,
while (*p != '/')
++p;
if (*p == '\0') {
- errorMsg("%s: Illegal ~user\n", inname);
+ error_msg("%s: Illegal ~user\n", inname);
return FALSE;
}
*p++ = '\0';
pw = getpwnam (buf + 1);
if (pw == NULL) {
- errorMsg("%s: No user `%s'\n", inname, buf + 1);
+ error_msg("%s: No user `%s'\n", inname, buf + 1);
return FALSE;
}
n = strlen (pw->pw_dir);
@@ -257,7 +257,7 @@ static int decode (const char *inname,
&& (freopen (outname, "w", stdout) == NULL
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
)) {
- errorMsg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
+ error_msg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
return FALSE;
}
@@ -302,7 +302,7 @@ int uudecode_main (int argc,
if (decode (argv[optind], outname) != 0)
exit_status = FALSE;
} else {
- errorMsg("%s: %s\n", argv[optind], strerror(errno));
+ error_msg("%s: %s\n", argv[optind], strerror(errno));
exit_status = EXIT_FAILURE;
}
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()
}
if (ferror (stdin))
- errorMsg("Read error\n");
+ error_msg("Read error\n");
if (trans_ptr == uu_std) {
putchar (ENC ('\0'));
@@ -178,7 +178,7 @@ int uuencode_main (int argc,
case 2:
/* Optional first argument is input file. */
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
- errorMsg("%s: %s\n", argv[optind], strerror(errno));
+ error_msg("%s: %s\n", argv[optind], strerror(errno));
return EXIT_FAILURE;
}
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
@@ -199,7 +199,7 @@ int uuencode_main (int argc,
encode();
printf(trans_ptr == uu_std ? "end\n" : "====\n");
if (ferror (stdout)) {
- errorMsg("Write error\n");
+ error_msg("Write error\n");
return EXIT_FAILURE;
}
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)
puts(user);
return EXIT_SUCCESS;
}
- fatalError("cannot find username for UID %u\n", (unsigned) uid);
+ error_msg_and_die("cannot find username for UID %u\n", (unsigned) uid);
}
diff --git a/cp_mv.c b/cp_mv.c
index 580c92046..b334206fb 100644
--- a/cp_mv.c
+++ b/cp_mv.c
@@ -75,7 +75,7 @@ static void name_too_long__exit (void) __attribute__((noreturn));
static
void name_too_long__exit (void)
{
- fatalError(name_too_long);
+ error_msg_and_die(name_too_long);
}
static void
@@ -109,14 +109,14 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk)
if (srcDirFlag == TRUE) {
if (recursiveFlag == FALSE) {
- errorMsg(omitting_directory, baseSrcName);
+ error_msg(omitting_directory, baseSrcName);
return TRUE;
}
srcBasename = (strstr(fileName, baseSrcName)
+ strlen(baseSrcName));
if (destLen + strlen(srcBasename) > BUFSIZ) {
- errorMsg(name_too_long);
+ error_msg(name_too_long);
return FALSE;
}
strcat(destName, srcBasename);
@@ -130,7 +130,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk)
if (mv_Action_first_time && (dz_i == is_mv)) {
mv_Action_first_time = errno = 0;
if (rename(fileName, destName) < 0 && errno != EXDEV) {
- errorMsg("rename(%s, %s): %s\n", fileName, destName,
+ error_msg("rename(%s, %s): %s\n", fileName, destName,
strerror(errno));
goto do_copyFile; /* Try anyway... */
}
@@ -143,7 +143,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk)
if (preserveFlag == TRUE && statbuf->st_nlink > 1) {
if (is_in_ino_dev_hashtable(statbuf, &name)) {
if (link(name, destName) < 0) {
- errorMsg("link(%s, %s): %s\n", name, destName, strerror(errno));
+ error_msg("link(%s, %s): %s\n", name, destName, strerror(errno));
return FALSE;
}
return TRUE;
@@ -152,7 +152,7 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk)
add_to_ino_dev_hashtable(statbuf, destName);
}
}
- return copyFile(fileName, destName, preserveFlag, followLinks, forceFlag);
+ return copy_file(fileName, destName, preserveFlag, followLinks, forceFlag);
}
static int
@@ -162,11 +162,11 @@ rm_Action(const char *fileName, struct stat *statbuf, void* junk)
if (S_ISDIR(statbuf->st_mode)) {
if (rmdir(fileName) < 0) {
- errorMsg("rmdir(%s): %s\n", fileName, strerror(errno));
+ error_msg("rmdir(%s): %s\n", fileName, strerror(errno));
status = FALSE;
}
} else if (unlink(fileName) < 0) {
- errorMsg("unlink(%s): %s\n", fileName, strerror(errno));
+ error_msg("unlink(%s): %s\n", fileName, strerror(errno));
status = FALSE;
}
return status;
@@ -224,7 +224,7 @@ extern int cp_mv_main(int argc, char **argv)
if (strlen(argv[argc - 1]) > BUFSIZ) {
- errorMsg(name_too_long);
+ error_msg(name_too_long);
goto exit_false;
}
strcpy(baseDestName, argv[argc - 1]);
@@ -232,9 +232,9 @@ extern int cp_mv_main(int argc, char **argv)
if (baseDestLen == 0)
goto exit_false;
- destDirFlag = isDirectory(baseDestName, TRUE, &destStatBuf);
+ destDirFlag = is_directory(baseDestName, TRUE, &destStatBuf);
if (argc - optind > 2 && destDirFlag == FALSE) {
- errorMsg(not_a_directory, baseDestName);
+ error_msg(not_a_directory, baseDestName);
goto exit_false;
}
@@ -250,7 +250,7 @@ extern int cp_mv_main(int argc, char **argv)
if (srcLen == 0) continue; /* "" */
- srcDirFlag = isDirectory(baseSrcName, followLinks, &srcStatBuf);
+ srcDirFlag = is_directory(baseSrcName, followLinks, &srcStatBuf);
if ((flags_memo = (recursiveFlag == TRUE &&
srcDirFlag == TRUE && destDirFlag == TRUE))) {
@@ -260,26 +260,26 @@ extern int cp_mv_main(int argc, char **argv)
char *pushd, *d, *p;
if ((pushd = getcwd(NULL, BUFSIZ + 1)) == NULL) {
- errorMsg("getcwd(): %s\n", strerror(errno));
+ error_msg("getcwd(): %s\n", strerror(errno));
continue;
}
if (chdir(baseDestName) < 0) {
- errorMsg("chdir(%s): %s\n", baseSrcName, strerror(errno));
+ error_msg("chdir(%s): %s\n", baseSrcName, strerror(errno));
continue;
}
if ((d = getcwd(NULL, BUFSIZ + 1)) == NULL) {
- errorMsg("getcwd(): %s\n", strerror(errno));
+ error_msg("getcwd(): %s\n", strerror(errno));
continue;
}
while (!state && *d != '\0') {
if (stat(d, &sb) < 0) { /* stat not lstat - always dereference targets */
- errorMsg("stat(%s): %s\n", d, strerror(errno));
+ error_msg("stat(%s): %s\n", d, strerror(errno));
state = -1;
continue;
}
if ((sb.st_ino == srcStatBuf.st_ino) &&
(sb.st_dev == srcStatBuf.st_dev)) {
- errorMsg("Cannot %s `%s' into a subdirectory of itself, "
+ error_msg("Cannot %s `%s' into a subdirectory of itself, "
"`%s/%s'\n", applet_name, baseSrcName,
baseDestName, baseSrcName);
state = -1;
@@ -290,7 +290,7 @@ extern int cp_mv_main(int argc, char **argv)
}
}
if (chdir(pushd) < 0) {
- errorMsg("chdir(%s): %s\n", pushd, strerror(errno));
+ error_msg("chdir(%s): %s\n", pushd, strerror(errno));
free(pushd);
free(d);
continue;
@@ -305,11 +305,11 @@ extern int cp_mv_main(int argc, char **argv)
status = setjmp(catch);
if (status == 0) {
mv_Action_first_time = 1;
- if (recursiveAction(baseSrcName,
+ if (recursive_action(baseSrcName,
recursiveFlag, followLinks, FALSE,
cp_mv_Action, cp_mv_Action, NULL) == FALSE) goto exit_false;
if (dz_i == is_mv &&
- recursiveAction(baseSrcName,
+ recursive_action(baseSrcName,
recursiveFlag, followLinks, TRUE,
rm_Action, rm_Action, NULL) == FALSE) goto exit_false;
}
diff --git a/cut.c b/cut.c
index b281fa234..6e0fe83fc 100644
--- a/cut.c
+++ b/cut.c
@@ -54,12 +54,12 @@ static void decompose_list(const char *list)
/* the list must contain only digits and no more than one minus sign */
for (ptr = (char *)list; *ptr; ptr++) {
if (!isdigit(*ptr) && *ptr != '-') {
- fatalError("invalid byte or field list\n");
+ error_msg_and_die("invalid byte or field list\n");
}
if (*ptr == '-') {
nminus++;
if (nminus > 1) {
- fatalError("invalid byte or field list\n");
+ error_msg_and_die("invalid byte or field list\n");
}
}
}
@@ -68,7 +68,7 @@ static void decompose_list(const char *list)
if (nminus == 0) {
startpos = strtol(list, &ptr, 10);
if (startpos == 0) {
- fatalError("missing list of fields\n");
+ error_msg_and_die("missing list of fields\n");
}
endpos = startpos;
}
@@ -188,14 +188,14 @@ extern int cut_main(int argc, char **argv)
case 'f':
/* make sure they didn't ask for two types of lists */
if (part != 0) {
- fatalError("only one type of list may be specified");
+ error_msg_and_die("only one type of list may be specified");
}
part = (char)opt;
decompose_list(optarg);
break;
case 'd':
if (strlen(optarg) > 1) {
- fatalError("the delimiter must be a single character\n");
+ error_msg_and_die("the delimiter must be a single character\n");
}
delim = optarg[0];
break;
@@ -209,16 +209,16 @@ extern int cut_main(int argc, char **argv)
}
if (part == 0) {
- fatalError("you must specify a list of bytes, characters, or fields\n");
+ error_msg_and_die("you must specify a list of bytes, characters, or fields\n");
}
if (supress_non_delimited_lines && part != 'f') {
- fatalError("suppressing non-delimited lines makes sense
+ error_msg_and_die("suppressing non-delimited lines makes sense
only when operating on fields\n");
}
if (delim != '\t' && part != 'f') {
- fatalError("a delimiter may be specified only when operating on fields\n");
+ error_msg_and_die("a delimiter may be specified only when operating on fields\n");
}
/* 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)
for (i = optind; i < argc; i++) {
file = fopen(argv[i], "r");
if (file == NULL) {
- errorMsg("%s: %s\n", argv[i], strerror(errno));
+ error_msg("%s: %s\n", argv[i], strerror(errno));
} else {
cut_file(file);
fclose(file);
diff --git a/date.c b/date.c
index 2e69bde4a..73fc70511 100644
--- a/date.c
+++ b/date.c
@@ -56,7 +56,7 @@ struct tm *date_conv_time(struct tm *tm_time, const char *t_string)
&(tm_time->tm_min), &(tm_time->tm_year));
if (nr < 4 || nr > 5) {
- fatalError(invalid_date, t_string);
+ error_msg_and_die(invalid_date, t_string);
}
/* correct for century - minor Y2K problem here? */
@@ -121,7 +121,7 @@ struct tm *date_conv_ftime(struct tm *tm_time, const char *t_string)
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
} else {
- fatalError(invalid_date, t_string);
+ error_msg_and_die(invalid_date, t_string);
}
*tm_time = t;
return (tm_time);
@@ -156,7 +156,7 @@ int date_main(int argc, char **argv)
case 'u':
utc = 1;
if (putenv("TZ=UTC0") != 0)
- fatalError(memory_exhausted);
+ error_msg_and_die(memory_exhausted);
break;
case 'd':
use_arg = 1;
@@ -176,7 +176,7 @@ int date_main(int argc, char **argv)
}
#if 0
else {
- errorMsg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt);
+ error_msg("date_str='%s' date_fmt='%s'\n", date_str, date_fmt);
usage(date_usage);
}
#endif
@@ -205,16 +205,16 @@ int date_main(int argc, char **argv)
/* Correct any day of week and day of year etc fields */
tm = mktime(&tm_time);
if (tm < 0)
- fatalError(invalid_date, date_str);
+ error_msg_and_die(invalid_date, date_str);
if ( utc ) {
if (putenv("TZ=UTC0") != 0)
- fatalError(memory_exhausted);
+ error_msg_and_die(memory_exhausted);
}
/* if setting time, set it */
if (set_time) {
if (stime(&tm) < 0) {
- perrorMsg("cannot set date");
+ perror_msg("cannot set date");
}
}
}
diff --git a/dc.c b/dc.c
index 0f5f1fc77..d462100a2 100644
--- a/dc.c
+++ b/dc.c
@@ -14,14 +14,14 @@ static unsigned int pointer;
static void push(double a)
{
if (pointer >= (sizeof(stack) / sizeof(*stack)))
- fatalError("stack overflow\n");
+ error_msg_and_die("stack overflow\n");
stack[pointer++] = a;
}
static double pop()
{
if (pointer == 0)
- fatalError("stack underflow\n");
+ error_msg_and_die("stack underflow\n");
return stack[--pointer];
}
@@ -120,7 +120,7 @@ static void stack_machine(const char *argument)
}
o++;
}
- fatalError("%s: syntax error.\n", argument);
+ error_msg_and_die("%s: syntax error.\n", argument);
}
/* return pointer to next token in buffer and set *buffer to one char
diff --git a/dd.c b/dd.c
index 044f167c3..626b54898 100644
--- a/dd.c
+++ b/dd.c
@@ -71,28 +71,28 @@ extern int dd_main(int argc, char **argv)
else if (outFile == NULL && (strncmp(*argv, "of", 2) == 0))
outFile = ((strchr(*argv, '=')) + 1);
else if (strncmp("count", *argv, 5) == 0) {
- count = getNum((strchr(*argv, '=')) + 1);
+ count = atoi_w_units((strchr(*argv, '=')) + 1);
if (count < 0) {
- errorMsg("Bad count value %s\n", *argv);
+ error_msg("Bad count value %s\n", *argv);
goto usage;
}
} else if (strncmp(*argv, "bs", 2) == 0) {
- blockSize = getNum((strchr(*argv, '=')) + 1);
+ blockSize = atoi_w_units((strchr(*argv, '=')) + 1);
if (blockSize <= 0) {
- errorMsg("Bad block size value %s\n", *argv);
+ error_msg("Bad block size value %s\n", *argv);
goto usage;
}
} else if (strncmp(*argv, "skip", 4) == 0) {
- skipBlocks = getNum((strchr(*argv, '=')) + 1);
+ skipBlocks = atoi_w_units((strchr(*argv, '=')) + 1);
if (skipBlocks <= 0) {
- errorMsg("Bad skip value %s\n", *argv);
+ error_msg("Bad skip value %s\n", *argv);
goto usage;
}
} else if (strncmp(*argv, "seek", 4) == 0) {
- seekBlocks = getNum((strchr(*argv, '=')) + 1);
+ seekBlocks = atoi_w_units((strchr(*argv, '=')) + 1);
if (seekBlocks <= 0) {
- errorMsg("Bad seek value %s\n", *argv);
+ error_msg("Bad seek value %s\n", *argv);
goto usage;
}
} else if (strncmp(*argv, "conv", 4) == 0) {
@@ -119,7 +119,7 @@ extern int dd_main(int argc, char **argv)
* here anyways... */
/* free(buf); */
- fatalPerror("%s", inFile);
+ perror_msg_and_die("%s", inFile);
}
if (outFile == NULL)
@@ -134,7 +134,7 @@ extern int dd_main(int argc, char **argv)
/* close(inFd);
free(buf); */
- fatalPerror("%s", outFile);
+ perror_msg_and_die("%s", outFile);
}
lseek(inFd, (off_t) (skipBlocks * blockSize), SEEK_SET);
@@ -146,13 +146,13 @@ extern int dd_main(int argc, char **argv)
ibs=BUFSIZ;
while (totalSize > outTotal) {
- inCc = fullRead(inFd, buf, ibs);
+ inCc = full_read(inFd, buf, ibs);
inTotal += inCc;
if ( (sync==TRUE) && (inCc>0) )
while (inCc<ibs)
buf[inCc++]='\0';
- if ((outCc = fullWrite(outFd, buf, inCc)) < 1){
+ if ((outCc = full_write(outFd, buf, inCc)) < 1){
if (outCc < 0 ){
perror("Error during write");
}
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");
for (i = 1; i < argc; i++) {
num = atoi(argv[i]);
if (num == 0)
- errorMsg("0: illegal VT number\n");
+ error_msg("0: illegal VT number\n");
else if (num == 1)
- errorMsg("VT 1 cannot be deallocated\n");
+ error_msg("VT 1 cannot be deallocated\n");
else if (ioctl(fd, VT_DISALLOCATE, num)) {
perror("VT_DISALLOCATE");
- fatalError("could not deallocate console %d\n", num);
+ error_msg_and_die("could not deallocate console %d\n", num);
}
}
printf("erik: C\n");
diff --git a/df.c b/df.c
index 969a5b982..dc4849049 100644
--- a/df.c
+++ b/df.c
@@ -36,7 +36,7 @@ static int df(char *device, const char *mountPoint)
long blocks_percent_used;
if (statfs(mountPoint, &s) != 0) {
- perrorMsg("%s", mountPoint);
+ perror_msg("%s", mountPoint);
return FALSE;
}
@@ -75,8 +75,8 @@ extern int df_main(int argc, char **argv)
usage(df_usage);
}
while (argc > 1) {
- if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) {
- errorMsg("%s: can't find mount point.\n", argv[1]);
+ if ((mountEntry = find_mount_point(argv[1], mtab_file)) == 0) {
+ error_msg("%s: can't find mount point.\n", argv[1]);
status = EXIT_FAILURE;
} else if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir))
status = EXIT_FAILURE;
@@ -89,7 +89,7 @@ extern int df_main(int argc, char **argv)
mountTable = setmntent(mtab_file, "r");
if (mountTable == 0) {
- perrorMsg("%s", mtab_file);
+ perror_msg("%s", mtab_file);
return EXIT_FAILURE;
}
diff --git a/du.c b/du.c
index 313a910ad..fa76465e7 100644
--- a/du.c
+++ b/du.c
@@ -97,7 +97,7 @@ static long du(char *filename)
}
if (len + strlen(name) + 1 > BUFSIZ) {
- errorMsg(name_too_long);
+ error_msg(name_too_long);
du_depth--;
return 0;
}
@@ -156,7 +156,7 @@ int du_main(int argc, char **argv)
for (i=optind; i < argc; i++) {
if ((sum = du(argv[i])) == 0)
status = EXIT_FAILURE;
- if (sum && isDirectory(argv[i], FALSE, NULL)) {
+ if (sum && is_directory(argv[i], FALSE, NULL)) {
print_normal(sum, argv[i]);
}
reset_ino_dev_hashtable();
@@ -166,7 +166,7 @@ int du_main(int argc, char **argv)
return status;
}
-/* $Id: du.c,v 1.28 2000/12/06 15:56:31 kraai Exp $ */
+/* $Id: du.c,v 1.29 2000/12/07 19:56:48 markw Exp $ */
/*
Local Variables:
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)
fd = open("/dev/tty0", O_RDWR);
if (fd < 0) {
- errorMsg("Error opening /dev/tty0: %s\n", strerror(errno));
+ error_msg("Error opening /dev/tty0: %s\n", strerror(errno));
return EXIT_FAILURE;
}
@@ -78,7 +78,7 @@ int dumpkmap_main(int argc, char **argv)
ke.kb_table = i;
if (ioctl(fd, KDGKBENT, &ke) < 0) {
- errorMsg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
+ error_msg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
}
else {
write(1,(void*)&ke.kb_value,2);
diff --git a/dutmp.c b/dutmp.c
index 03d80d87d..efd15dfbf 100644
--- a/dutmp.c
+++ b/dutmp.c
@@ -35,7 +35,7 @@ extern int dutmp_main(int argc, char **argv)
} else {
file = open(argv[1], O_RDONLY);
if (file < 0) {
- fatalError(io_error, argv[1], strerror(errno));
+ error_msg_and_die(io_error, argv[1], strerror(errno));
}
}
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)
else if (my_str[idx] == '/') {
idx = index_of_next_unescaped_slash(my_str, ++idx);
if (idx == -1)
- fatalError("unterminated match expression\n");
+ error_msg_and_die("unterminated match expression\n");
my_str[idx] = '\0';
*regex = (regex_t *)xmalloc(sizeof(regex_t));
xregcomp(*regex, my_str+1, 0);
idx++; /* so it points to the next character after the last '/' */
}
else {
- errorMsg("get_address: no address found in string\n"
+ error_msg("get_address: no address found in string\n"
"\t(you probably didn't check the string you passed me)\n");
idx = -1;
}
@@ -258,13 +258,13 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr)
/* verify that the 's' is followed by a 'slash' */
if (substr[++idx] != '/')
- fatalError("bad format in substitution expression\n");
+ error_msg_and_die("bad format in substitution expression\n");
/* save the match string */
oldidx = idx+1;
idx = index_of_next_unescaped_slash(substr, ++idx);
if (idx == -1)
- fatalError("bad format in substitution expression\n");
+ error_msg_and_die("bad format in substitution expression\n");
match = strdup_substr(substr, oldidx, idx);
/* 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)
oldidx = idx+1;
idx = index_of_next_unescaped_slash(substr, ++idx);
if (idx == -1)
- fatalError("bad format in substitution expression\n");
+ error_msg_and_die("bad format in substitution expression\n");
sed_cmd->replace = strdup_substr(substr, oldidx, idx);
/* process the flags */
@@ -303,7 +303,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr)
if (strchr("; \t\v\n\r", substr[idx]))
goto out;
/* else */
- fatalError("bad option in substitution expression\n");
+ error_msg_and_die("bad option in substitution expression\n");
}
}
@@ -345,7 +345,7 @@ static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr)
*/
if (editstr[1] != '\\' && (editstr[2] != '\n' || editstr[2] != '\r'))
- fatalError("bad format in edit expression\n");
+ error_msg_and_die("bad format in edit expression\n");
/* store the edit line text */
/* 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)
/* last part (mandatory) will be a command */
if (cmdstr[idx] == '\0')
- fatalError("missing command\n");
+ error_msg_and_die("missing command\n");
if (!strchr("pdsaic", cmdstr[idx])) /* <-- XXX add new commands here */
- fatalError("invalid command\n");
+ error_msg_and_die("invalid command\n");
sed_cmd->cmd = cmdstr[idx];
/* special-case handling for (s)ubstitution */
@@ -421,7 +421,7 @@ static char *parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr)
/* special-case handling for (a)ppend, (i)nsert, and (c)hange */
else if (strchr("aic", cmdstr[idx])) {
if (sed_cmd->end_line || sed_cmd->end_match)
- fatalError("only a beginning address can be specified for edit commands\n");
+ error_msg_and_die("only a beginning address can be specified for edit commands\n");
idx += parse_edit_cmd(sed_cmd, &cmdstr[idx]);
}
/* 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)
for (i = optind; i < argc; i++) {
file = fopen(argv[i], "r");
if (file == NULL) {
- errorMsg("%s: %s\n", argv[i], strerror(errno));
+ error_msg("%s: %s\n", argv[i], strerror(errno));
} else {
process_file(file);
fclose(file);
diff --git a/expr.c b/expr.c
index 670352eb6..eed2637f2 100644
--- a/expr.c
+++ b/expr.c
@@ -74,14 +74,14 @@ int expr_main (int argc, char **argv)
VALUE *v;
if (argc == 1) {
- fatalError("too few arguments\n");
+ error_msg_and_die("too few arguments\n");
}
args = argv + 1;
v = eval ();
if (*args)
- fatalError ("syntax error\n");
+ error_msg_and_die ("syntax error\n");
if (v->type == integer)
printf ("%d\n", v->u.i);
@@ -216,7 +216,7 @@ static \
int name (l, r) VALUE *l; VALUE *r; \
{ \
if (!toarith (l) || !toarith (r)) \
- fatalError ("non-numeric argument\n"); \
+ error_msg_and_die ("non-numeric argument\n"); \
return l->u.i op r->u.i; \
}
@@ -224,9 +224,9 @@ int name (l, r) VALUE *l; VALUE *r; \
int name (l, r) VALUE *l; VALUE *r; \
{ \
if (!toarith (l) || !toarith (r)) \
- fatalError ( "non-numeric argument\n"); \
+ error_msg_and_die ( "non-numeric argument\n"); \
if (r->u.i == 0) \
- fatalError ( "division by zero\n"); \
+ error_msg_and_die ( "division by zero\n"); \
return l->u.i op r->u.i; \
}
@@ -270,7 +270,7 @@ of a basic regular expression is not portable; it is being ignored",
re_syntax_options = RE_SYNTAX_POSIX_BASIC;
errmsg = re_compile_pattern (pv->u.s, len, &re_buffer);
if (errmsg) {
- fatalError("%s\n", errmsg);
+ error_msg_and_die("%s\n", errmsg);
}
len = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs);
@@ -301,19 +301,19 @@ static VALUE *eval7 (void)
VALUE *v;
if (!*args)
- fatalError ( "syntax error\n");
+ error_msg_and_die ( "syntax error\n");
if (nextarg ("(")) {
args++;
v = eval ();
if (!nextarg (")"))
- fatalError ( "syntax error\n");
+ error_msg_and_die ( "syntax error\n");
args++;
return v;
}
if (nextarg (")"))
- fatalError ( "syntax error\n");
+ error_msg_and_die ( "syntax error\n");
return str_value (*args++);
}
@@ -327,7 +327,7 @@ static VALUE *eval6 (void)
if (nextarg ("quote")) {
args++;
if (!*args)
- fatalError ( "syntax error\n");
+ error_msg_and_die ( "syntax error\n");
return str_value (*args++);
}
else if (nextarg ("length")) {
diff --git a/fbset.c b/fbset.c
index 47130e355..86f7733c9 100644
--- a/fbset.c
+++ b/fbset.c
@@ -283,7 +283,7 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn,
}
}
#else
- errorMsg( "mode reading not compiled in\n");
+ error_msg( "mode reading not compiled in\n");
#endif
return 0;
}
@@ -433,7 +433,7 @@ extern int fbset_main(int argc, char **argv)
PERROR("fbset(ioctl)");
if (g_options & OPT_READMODE) {
if (!readmode(&var, modefile, mode)) {
- errorMsg("Unknown video mode `%s'\n", mode);
+ error_msg("Unknown video mode `%s'\n", mode);
return EXIT_FAILURE;
}
}
diff --git a/find.c b/find.c
index a86b07e73..c82b509b6 100644
--- a/find.c
+++ b/find.c
@@ -98,7 +98,7 @@ int find_main(int argc, char **argv)
break;
}
- if (recursiveAction(directory, TRUE, FALSE, FALSE,
+ if (recursive_action(directory, TRUE, FALSE, FALSE,
fileAction, fileAction, NULL) == FALSE) {
return EXIT_FAILURE;
}
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)
break;
}
- if (recursiveAction(directory, TRUE, FALSE, FALSE,
+ if (recursive_action(directory, TRUE, FALSE, FALSE,
fileAction, fileAction, NULL) == FALSE) {
return EXIT_FAILURE;
}
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)
file = fopen(cur_file, "r");
if (file == NULL) {
if (!suppress_err_msgs)
- errorMsg("%s: %s\n", cur_file, strerror(errno));
+ error_msg("%s: %s\n", cur_file, strerror(errno));
}
else {
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)
}
if ((f = open(argv[1], O_RDWR)) == -1) {
- fatalError( "cannot open %s: %s\n", argv[1], strerror(errno));
+ error_msg_and_die( "cannot open %s: %s\n", argv[1], strerror(errno));
}
if (ioctl(f, BLKFLSBUF) < 0) {
- fatalError( "failed ioctl on %s: %s\n", argv[1], strerror(errno));
+ error_msg_and_die( "failed ioctl on %s: %s\n", argv[1], strerror(errno));
}
/* Don't bother closing. Exit does
* 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)
static void die(const char *str)
{
- errorMsg("%s\n", str);
+ error_msg("%s\n", str);
leave(8);
}
diff --git a/getopt.c b/getopt.c
index 8c94bb4c1..0ebf9df08 100644
--- a/getopt.c
+++ b/getopt.c
@@ -37,7 +37,7 @@
* <misiek@misiek.eu.org>)
* Ported to Busybox - Alfred M. Szmidt <ams@trillian.itslinux.org>
* Removed --version/-V and --help/-h in
- * Removed prase_error(), using errorMsg() from Busybox instead
+ * Removed prase_error(), using error_msg() from Busybox instead
* Replaced our_malloc with xmalloc and our_realloc with xrealloc
*
*/
@@ -258,7 +258,7 @@ void add_long_options(char *options)
arg_opt=required_argument;
}
if (strlen(tokptr) == 0)
- errorMsg("empty long option after -l or --long argument\n");
+ error_msg("empty long option after -l or --long argument\n");
}
add_longopt(tokptr,arg_opt);
}
@@ -277,7 +277,7 @@ void set_shell(const char *new_shell)
else if (!strcmp(new_shell,"csh"))
shell=TCSH;
else
- errorMsg("unknown shell after -s or --shell argument\n");
+ error_msg("unknown shell after -s or --shell argument\n");
}
@@ -326,7 +326,7 @@ int getopt_main(int argc, char *argv[])
printf(" --\n");
exit(0);
} else
- fatalError("missing optstring argument\n");
+ error_msg_and_die("missing optstring argument\n");
}
if (argv[1][0] != '-' || compatible) {
@@ -377,7 +377,7 @@ int getopt_main(int argc, char *argv[])
if (!optstr) {
if (optind >= argc)
- fatalError("missing optstring argument\n");
+ error_msg_and_die("missing optstring argument\n");
else {
optstr=xmalloc(strlen(argv[optind])+1);
strcpy(optstr,argv[optind]);
diff --git a/grep.c b/grep.c
index c0193bce3..9014443b1 100644
--- a/grep.c
+++ b/grep.c
@@ -169,7 +169,7 @@ extern int grep_main(int argc, char **argv)
file = fopen(cur_file, "r");
if (file == NULL) {
if (!suppress_err_msgs)
- errorMsg("%s: %s\n", cur_file, strerror(errno));
+ error_msg("%s: %s\n", cur_file, strerror(errno));
}
else {
grep_file(file);
diff --git a/gunzip.c b/gunzip.c
index eeff9774a..a5846c378 100644
--- a/gunzip.c
+++ b/gunzip.c
@@ -113,7 +113,7 @@ static char *license_msg[] = {
/* Diagnostic functions */
#ifdef DEBUG
-# define Assert(cond,msg) {if(!(cond)) errorMsg(msg);}
+# define Assert(cond,msg) {if(!(cond)) error_msg(msg);}
# define Trace(x) fprintf x
# define Tracev(x) {if (verbose) fprintf x ;}
# define Tracevv(x) {if (verbose>1) fprintf x ;}
@@ -297,7 +297,7 @@ int in; /* input file descriptor */
method = (int) get_byte();
if (method != DEFLATED) {
- errorMsg("unknown method %d -- get newer version of gzip\n", method);
+ error_msg("unknown method %d -- get newer version of gzip\n", method);
exit_code = ERROR;
return -1;
}
@@ -1114,13 +1114,13 @@ int in, out; /* input and output file descriptors */
int res = inflate();
if (res == 3) {
- errorMsg(memory_exhausted);
+ error_msg(memory_exhausted);
} else if (res != 0) {
- errorMsg("invalid compressed data--format violated\n");
+ error_msg("invalid compressed data--format violated\n");
}
} else {
- errorMsg("internal error, invalid method\n");
+ error_msg("internal error, invalid method\n");
}
/* Get the crc and original length */
@@ -1149,10 +1149,10 @@ int in, out; /* input and output file descriptors */
/* Validate decompression */
if (orig_crc != updcrc(outbuf, 0)) {
- errorMsg("invalid compressed data--crc error\n");
+ error_msg("invalid compressed data--crc error\n");
}
if (orig_len != (ulg) bytes_out) {
- errorMsg("invalid compressed data--length error\n");
+ error_msg("invalid compressed data--length error\n");
}
/* Check if there are more entries in a pkzip file */
@@ -1225,9 +1225,9 @@ int gunzip_main(int argc, char **argv)
}
if (isatty(fileno(stdin)) && fromstdin==1 && force==0)
- fatalError( "data not read from terminal. Use -f to force it.\n");
+ error_msg_and_die( "data not read from terminal. Use -f to force it.\n");
if (isatty(fileno(stdout)) && tostdout==1 && force==0)
- fatalError( "data not written to terminal. Use -f to force it.\n");
+ error_msg_and_die( "data not written to terminal. Use -f to force it.\n");
foreground = signal(SIGINT, SIG_IGN) != SIG_IGN;
@@ -1265,7 +1265,7 @@ int gunzip_main(int argc, char **argv)
if (argc <= 0)
usage(gunzip_usage);
if (strlen(*argv) > MAX_PATH_LEN) {
- errorMsg(name_too_long);
+ error_msg(name_too_long);
exit(WARNING);
}
strcpy(ifname, *argv);
@@ -1304,7 +1304,7 @@ int gunzip_main(int argc, char **argv)
/* And get to work */
if (strlen(ifname) > MAX_PATH_LEN - 4) {
- errorMsg(name_too_long);
+ error_msg(name_too_long);
exit(WARNING);
}
strcpy(ofname, ifname);
diff --git a/gzip.c b/gzip.c
index d8c22a924..49c429b3a 100644
--- a/gzip.c
+++ b/gzip.c
@@ -114,7 +114,7 @@ extern int method; /* compression method */
# define DECLARE(type, array, size) type * array
# define ALLOC(type, array, size) { \
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
- if (array == NULL) errorMsg(memory_exhausted); \
+ if (array == NULL) error_msg(memory_exhausted); \
}
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
#else
@@ -251,7 +251,7 @@ extern int save_orig_name; /* set if original name must be saved */
/* Diagnostic functions */
#ifdef DEBUG
-# define Assert(cond,msg) {if(!(cond)) errorMsg(msg);}
+# define Assert(cond,msg) {if(!(cond)) error_msg(msg);}
# define Trace(x) fprintf x
# define Tracev(x) {if (verbose) fprintf x ;}
# define Tracevv(x) {if (verbose>1) fprintf x ;}
@@ -1381,7 +1381,7 @@ int length;
(char *) window + start, length) != EQUAL) {
fprintf(stderr,
" start %d, match %d, length %d\n", start, match, length);
- errorMsg("invalid match\n");
+ error_msg("invalid match\n");
}
if (verbose > 1) {
fprintf(stderr, "\\[%d,%d]", start - match, length);
@@ -1819,9 +1819,9 @@ int gzip_main(int argc, char **argv)
}
if (isatty(fileno(stdin)) && fromstdin==1 && force==0)
- fatalError( "data not read from terminal. Use -f to force it.\n");
+ error_msg_and_die( "data not read from terminal. Use -f to force it.\n");
if (isatty(fileno(stdout)) && tostdout==1 && force==0)
- fatalError( "data not written to terminal. Use -f to force it.\n");
+ error_msg_and_die( "data not written to terminal. Use -f to force it.\n");
foreground = signal(SIGINT, SIG_IGN) != SIG_IGN;
if (foreground) {
@@ -2900,7 +2900,7 @@ int eof; /* true if this is the last block for a file */
#endif
/* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
if (buf == (char *) 0)
- errorMsg("block vanished\n");
+ error_msg("block vanished\n");
copy_block(buf, (unsigned) stored_len, 0); /* without header */
compressed_len = stored_len << 3;
@@ -3083,7 +3083,7 @@ local void set_file_type()
bin_freq += dyn_ltree[n++].Freq;
*file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII;
if (*file_type == BINARY && translate_eol) {
- errorMsg("-l used on binary file\n");
+ error_msg("-l used on binary file\n");
}
}
@@ -3239,13 +3239,13 @@ char *env; /* name of environment variable */
nargv = (char **) calloc(*argcp + 1, sizeof(char *));
if (nargv == NULL)
- errorMsg(memory_exhausted);
+ error_msg(memory_exhausted);
oargv = *argvp;
*argvp = nargv;
/* Copy the program name first */
if (oargc-- < 0)
- errorMsg("argc<=0\n");
+ error_msg("argc<=0\n");
*(nargv++) = *(oargv++);
/* Then copy the environment args */
diff --git a/halt.c b/halt.c
index c3e2523c0..e875d04f0 100644
--- a/halt.c
+++ b/halt.c
@@ -28,7 +28,7 @@ extern int halt_main(int argc, char **argv)
{
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
- return(kill(*(findPidByName("init")), SIGUSR1));
+ return(kill(*(find_pid_by_name("init")), SIGUSR1));
#else
return(kill(1, SIGUSR1));
#endif
diff --git a/head.c b/head.c
index 92b43bae2..f3aef1b9b 100644
--- a/head.c
+++ b/head.c
@@ -80,7 +80,7 @@ int head_main(int argc, char **argv)
}
head(len, fp);
if (errno) {
- errorMsg("%s: %s\n", argv[optind], strerror(errno));
+ error_msg("%s: %s\n", argv[optind], strerror(errno));
status = EXIT_FAILURE;
errno = 0;
}
diff --git a/hostname.c b/hostname.c
index 44d529c83..13e52c41d 100644
--- a/hostname.c
+++ b/hostname.c
@@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
- * $Id: hostname.c,v 1.15 2000/10/12 22:30:31 andersen Exp $
+ * $Id: hostname.c,v 1.16 2000/12/07 19:56:48 markw Exp $
* Mini hostname implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -40,7 +40,7 @@ void do_sethostname(char *s, int isfile)
if (!isfile) {
if (sethostname(s, strlen(s)) < 0) {
if (errno == EPERM)
- errorMsg("you must be root to change the hostname\n");
+ error_msg("you must be root to change the hostname\n");
else
perror("sethostname");
exit(1);
diff --git a/id.c b/id.c
index fdfc33cdc..86667f516 100644
--- a/id.c
+++ b/id.c
@@ -78,7 +78,7 @@ extern int id_main(int argc, char **argv)
pwnam=my_getpwnam(user);
grnam=my_getgrnam(group);
if (gid == -1 || pwnam==-1 || grnam==-1) {
- fatalError("%s: No such user\n", user);
+ error_msg_and_die("%s: No such user\n", user);
}
if (no_group)
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 @@
#define BUF_SIZE 8192
#define EXPAND_ALLOC 1024
-static inline int isDecimal(ch) { return ((ch >= '0') && (ch <= '9')); }
-static inline int isOctal(ch) { return ((ch >= '0') && (ch <= '7')); }
+static inline int is_decimal(ch) { return ((ch >= '0') && (ch <= '9')); }
+static inline int is_octal(ch) { return ((ch >= '0') && (ch <= '7')); }
/* Macros for min/max. */
#ifndef MIN
@@ -119,14 +119,14 @@ extern const char *applet_name;
extern int applet_name_compare(const void *x, const void *y);
extern void usage(const char *usage) __attribute__ ((noreturn));
-extern void errorMsg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
-extern void fatalError(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
-extern void perrorMsg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
-extern void fatalPerror(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
-
-const char *modeString(int mode);
-const char *timeString(time_t timeVal);
-int isDirectory(const char *name, const int followLinks, struct stat *statBuf);
+extern void error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
+extern void error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
+extern void perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
+extern void perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
+
+const char *mode_string(int mode);
+const char *time_string(time_t timeVal);
+int is_directory(const char *name, const int followLinks, struct stat *statBuf);
int isDevice(const char *name);
typedef struct ino_dev_hash_bucket_struct {
@@ -139,7 +139,7 @@ int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name);
void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name);
void reset_ino_dev_hashtable(void);
-int copyFile(const char *srcName, const char *destName,
+int copy_file(const char *srcName, const char *destName,
int setModes, int followLinks, int forceFlag);
int copy_file_chunk(int srcFd, int dstFd, size_t remaining);
char *buildName(const char *dirName, const char *fileName);
@@ -147,20 +147,20 @@ int makeString(int argc, const char **argv, char *buf, int bufLen);
char *getChunk(int size);
char *chunkstrdup(const char *str);
void freeChunks(void);
-int fullWrite(int fd, const char *buf, int len);
-int fullRead(int fd, char *buf, int len);
-int recursiveAction(const char *fileName, int recurse, int followLinks, int depthFirst,
+int full_write(int fd, const char *buf, int len);
+int full_read(int fd, char *buf, int len);
+int recursive_action(const char *fileName, int recurse, int followLinks, int depthFirst,
int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData),
int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData),
void* userData);
-extern int createPath (const char *name, int mode);
+extern int create_path (const char *name, int mode);
extern int parse_mode( const char* s, mode_t* theMode);
extern int get_kernel_revision(void);
extern int get_console_fd(char* tty_name);
-extern struct mntent *findMountPoint(const char *name, const char *table);
+extern struct mntent *find_mount_point(const char *name, const char *table);
extern void write_mtab(char* blockDevice, char* directory,
char* filesystemType, long flags, char* string_flags);
extern void erase_mtab(const char * name);
@@ -169,8 +169,8 @@ extern char *mtab_first(void **iter);
extern char *mtab_next(void **iter);
extern char *mtab_getinfo(const char *match, const char which);
extern int check_wildcard_match(const char* text, const char* pattern);
-extern long getNum (const char *cp);
-extern pid_t* findPidByName( char* pidName);
+extern long atoi_w_units (const char *cp);
+extern pid_t* find_pid_by_name( char* pidName);
extern int find_real_root_device_name(char* name);
extern char *get_line_from_file(FILE *file);
extern void print_file(FILE *file);
diff --git a/init.c b/init.c
index c4440894c..e5b1a3931 100644
--- a/init.c
+++ b/init.c
@@ -296,7 +296,7 @@ static int check_free_memory()
unsigned int result, u, s=10;
if (sysinfo(&info) != 0) {
- perrorMsg("Error checking free memory: ");
+ perror_msg("Error checking free memory: ");
return -1;
}
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)
{
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
- return(kill(*(findPidByName("init")), SIGUSR1));
+ return(kill(*(find_pid_by_name("init")), SIGUSR1));
#else
return(kill(1, SIGUSR1));
#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()
unsigned int result, u, s=10;
if (sysinfo(&info) != 0) {
- perrorMsg("Error checking free memory: ");
+ perror_msg("Error checking free memory: ");
return -1;
}
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)
{
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
- return(kill(*(findPidByName("init")), SIGUSR2));
+ return(kill(*(find_pid_by_name("init")), SIGUSR2));
#else
return(kill(1, SIGUSR2));
#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)
{
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
- return(kill(*(findPidByName("init")), SIGINT));
+ return(kill(*(find_pid_by_name("init")), SIGINT));
#else
return(kill(1, SIGINT));
#endif
diff --git a/insmod.c b/insmod.c
index 0963225fa..0b12c694d 100644
--- a/insmod.c
+++ b/insmod.c
@@ -78,7 +78,7 @@
#ifndef MODUTILS_MODULE_H
#define MODUTILS_MODULE_H 1
-#ident "$Id: insmod.c,v 1.30 2000/12/06 18:18:26 andersen Exp $"
+#ident "$Id: insmod.c,v 1.31 2000/12/07 19:56:48 markw Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
@@ -284,7 +284,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
#define MODUTILS_OBJ_H 1
-#ident "$Id: insmod.c,v 1.30 2000/12/06 18:18:26 andersen Exp $"
+#ident "$Id: insmod.c,v 1.31 2000/12/07 19:56:48 markw Exp $"
/* The relocatable object is manipulated using elfin types. */
@@ -1157,7 +1157,7 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
/* Don't report an error if the symbol is coming from
the kernel or some external module. */
if (secidx <= SHN_HIRESERVE)
- errorMsg("%s multiply defined\n", name);
+ error_msg("%s multiply defined\n", name);
return sym;
}
}
@@ -1420,7 +1420,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
/* Also check that the parameter was not resolved from the kernel. */
if (sym == NULL || sym->secidx > SHN_HIRESERVE) {
- errorMsg("symbol for parameter %s not found\n", p);
+ error_msg("symbol for parameter %s not found\n", p);
return 0;
}
@@ -1433,7 +1433,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
str = alloca(strlen(q));
for (r = str, q++; *q != '"'; ++q, ++r) {
if (*q == '\0') {
- errorMsg("improperly terminated string argument for %s\n", p);
+ error_msg("improperly terminated string argument for %s\n", p);
return 0;
} else if (*q == '\\')
switch (*++q) {
@@ -1562,7 +1562,7 @@ static int old_get_kernel_symbols(const char *m_name)
nks = get_kernel_syms(NULL);
if (nks < 0) {
- errorMsg("get_kernel_syms: %s: %s\n", m_name, strerror(errno));
+ error_msg("get_kernel_syms: %s: %s\n", m_name, strerror(errno));
return 0;
}
@@ -1743,7 +1743,7 @@ old_init_module(const char *m_name, struct obj_file *f,
m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN
: 0), &routines, symtab);
if (ret)
- errorMsg("init_module: %s: %s\n", m_name, strerror(errno));
+ error_msg("init_module: %s: %s\n", m_name, strerror(errno));
free(image);
free(symtab);
@@ -1786,7 +1786,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
p = get_modinfo_value(f, key);
key += 5;
if (p == NULL) {
- errorMsg("invalid parameter %s\n", key);
+ error_msg("invalid parameter %s\n", key);
return 0;
}
@@ -1794,7 +1794,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
/* Also check that the parameter was not resolved from the kernel. */
if (sym == NULL || sym->secidx > SHN_HIRESERVE) {
- errorMsg("symbol for parameter %s not found\n", key);
+ error_msg("symbol for parameter %s not found\n", key);
return 0;
}
@@ -1822,7 +1822,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
str = alloca(strlen(q));
for (r = str, q++; *q != '"'; ++q, ++r) {
if (*q == '\0') {
- errorMsg("improperly terminated string argument for %s\n",
+ error_msg("improperly terminated string argument for %s\n",
key);
return 0;
} else if (*q == '\\')
@@ -1916,7 +1916,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
/* Get the size of each member */
/* Probably we should do that outside the loop ? */
if (!isdigit(*(p + 1))) {
- errorMsg("parameter type 'c' for %s must be followed by"
+ error_msg("parameter type 'c' for %s must be followed by"
" the maximum size\n", key);
return 0;
}
@@ -1924,7 +1924,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
/* Check length */
if (strlen(str) >= charssize) {
- errorMsg("string too long for %s (max %ld)\n", key,
+ error_msg("string too long for %s (max %ld)\n", key,
charssize - 1);
return 0;
}
@@ -1953,7 +1953,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
break;
default:
- errorMsg("unknown parameter type '%c' for %s\n", *p, key);
+ error_msg("unknown parameter type '%c' for %s\n", *p, key);
return 0;
}
}
@@ -1972,21 +1972,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
case ',':
if (++n > max) {
- errorMsg("too many values for %s (max %d)\n", key, max);
+ error_msg("too many values for %s (max %d)\n", key, max);
return 0;
}
++q;
break;
default:
- errorMsg("invalid argument syntax for %s\n", key);
+ error_msg("invalid argument syntax for %s\n", key);
return 0;
}
}
end_of_arg:
if (n < min) {
- errorMsg("too few values for %s (min %d)\n", key, min);
+ error_msg("too few values for %s (min %d)\n", key, min);
return 0;
}
@@ -2055,7 +2055,7 @@ static int new_get_kernel_symbols(void)
module_names = xrealloc(module_names, bufsize = ret);
goto retry_modules_load;
}
- errorMsg("QM_MODULES: %s\n", strerror(errno));
+ error_msg("QM_MODULES: %s\n", strerror(errno));
return 0;
}
@@ -2074,7 +2074,7 @@ static int new_get_kernel_symbols(void)
/* The module was removed out from underneath us. */
continue;
}
- errorMsg("query_module: QM_INFO: %s: %s\n", mn, strerror(errno));
+ error_msg("query_module: QM_INFO: %s: %s\n", mn, strerror(errno));
return 0;
}
@@ -2089,7 +2089,7 @@ static int new_get_kernel_symbols(void)
/* The module was removed out from underneath us. */
continue;
default:
- errorMsg("query_module: QM_SYMBOLS: %s: %s\n", mn, strerror(errno));
+ error_msg("query_module: QM_SYMBOLS: %s: %s\n", mn, strerror(errno));
return 0;
}
}
@@ -2114,7 +2114,7 @@ static int new_get_kernel_symbols(void)
syms = xrealloc(syms, bufsize = ret);
goto retry_kern_sym_load;
}
- errorMsg("kernel: QM_SYMBOLS: %s\n", strerror(errno));
+ error_msg("kernel: QM_SYMBOLS: %s\n", strerror(errno));
return 0;
}
nksyms = nsyms = ret;
@@ -2295,7 +2295,7 @@ new_init_module(const char *m_name, struct obj_file *f,
ret = new_sys_init_module(m_name, (struct new_module *) image);
if (ret)
- errorMsg("init_module: %s: %s\n", m_name, strerror(errno));
+ error_msg("init_module: %s: %s\n", m_name, strerror(errno));
free(image);
@@ -2372,7 +2372,7 @@ int obj_check_undefineds(struct obj_file *f)
sym->secidx = SHN_ABS;
sym->value = 0;
} else {
- errorMsg("unresolved symbol %s\n", sym->name);
+ error_msg("unresolved symbol %s\n", sym->name);
ret = 0;
}
}
@@ -2599,11 +2599,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base)
errmsg = "Unhandled relocation";
bad_reloc:
if (extsym) {
- errorMsg("%s of type %ld for %s\n", errmsg,
+ error_msg("%s of type %ld for %s\n", errmsg,
(long) ELFW(R_TYPE) (rel->r_info),
strtab + extsym->st_name);
} else {
- errorMsg("%s of type %ld\n", errmsg,
+ error_msg("%s of type %ld\n", errmsg,
(long) ELFW(R_TYPE) (rel->r_info));
}
ret = 0;
@@ -2680,7 +2680,7 @@ struct obj_file *obj_load(FILE * fp)
fseek(fp, 0, SEEK_SET);
if (fread(&f->header, sizeof(f->header), 1, fp) != 1) {
- errorMsg("error reading ELF header: %s\n", strerror(errno));
+ error_msg("error reading ELF header: %s\n", strerror(errno));
return NULL;
}
@@ -2688,25 +2688,25 @@ struct obj_file *obj_load(FILE * fp)
|| f->header.e_ident[EI_MAG1] != ELFMAG1
|| f->header.e_ident[EI_MAG2] != ELFMAG2
|| f->header.e_ident[EI_MAG3] != ELFMAG3) {
- errorMsg("not an ELF file\n");
+ error_msg("not an ELF file\n");
return NULL;
}
if (f->header.e_ident[EI_CLASS] != ELFCLASSM
|| f->header.e_ident[EI_DATA] != ELFDATAM
|| f->header.e_ident[EI_VERSION] != EV_CURRENT
|| !MATCH_MACHINE(f->header.e_machine)) {
- errorMsg("ELF file not for this architecture\n");
+ error_msg("ELF file not for this architecture\n");
return NULL;
}
if (f->header.e_type != ET_REL) {
- errorMsg("ELF file not a relocatable object\n");
+ error_msg("ELF file not a relocatable object\n");
return NULL;
}
/* Read the section headers. */
if (f->header.e_shentsize != sizeof(ElfW(Shdr))) {
- errorMsg("section header size mismatch: %lu != %lu\n",
+ error_msg("section header size mismatch: %lu != %lu\n",
(unsigned long) f->header.e_shentsize,
(unsigned long) sizeof(ElfW(Shdr)));
return NULL;
@@ -2719,7 +2719,7 @@ struct obj_file *obj_load(FILE * fp)
section_headers = alloca(sizeof(ElfW(Shdr)) * shnum);
fseek(fp, f->header.e_shoff, SEEK_SET);
if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) {
- errorMsg("error reading ELF section headers: %s\n", strerror(errno));
+ error_msg("error reading ELF section headers: %s\n", strerror(errno));
return NULL;
}
@@ -2749,7 +2749,7 @@ struct obj_file *obj_load(FILE * fp)
sec->contents = xmalloc(sec->header.sh_size);
fseek(fp, sec->header.sh_offset, SEEK_SET);
if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) {
- errorMsg("error reading ELF section data: %s\n", strerror(errno));
+ error_msg("error reading ELF section data: %s\n", strerror(errno));
return NULL;
}
} else {
@@ -2759,11 +2759,11 @@ struct obj_file *obj_load(FILE * fp)
#if SHT_RELM == SHT_REL
case SHT_RELA:
- errorMsg("RELA relocations not supported on this architecture\n");
+ error_msg("RELA relocations not supported on this architecture\n");
return NULL;
#else
case SHT_REL:
- errorMsg("REL relocations not supported on this architecture\n");
+ error_msg("REL relocations not supported on this architecture\n");
return NULL;
#endif
@@ -2776,7 +2776,7 @@ struct obj_file *obj_load(FILE * fp)
break;
}
- errorMsg("can't handle sections of type %ld\n",
+ error_msg("can't handle sections of type %ld\n",
(long) sec->header.sh_type);
return NULL;
}
@@ -2805,7 +2805,7 @@ struct obj_file *obj_load(FILE * fp)
ElfW(Sym) * sym;
if (sec->header.sh_entsize != sizeof(ElfW(Sym))) {
- errorMsg("symbol size mismatch: %lu != %lu\n",
+ error_msg("symbol size mismatch: %lu != %lu\n",
(unsigned long) sec->header.sh_entsize,
(unsigned long) sizeof(ElfW(Sym)));
return NULL;
@@ -2837,7 +2837,7 @@ struct obj_file *obj_load(FILE * fp)
case SHT_RELM:
if (sec->header.sh_entsize != sizeof(ElfW(RelM))) {
- errorMsg("relocation entry size mismatch: %lu != %lu\n",
+ error_msg("relocation entry size mismatch: %lu != %lu\n",
(unsigned long) sec->header.sh_entsize,
(unsigned long) sizeof(ElfW(RelM)));
return NULL;
@@ -2937,17 +2937,17 @@ extern int insmod_main( int argc, char **argv)
/* Get a filedesc for the module */
if ((fp = fopen(*argv, "r")) == NULL) {
/* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */
- if (recursiveAction(_PATH_MODULES, TRUE, FALSE, FALSE,
+ if (recursive_action(_PATH_MODULES, TRUE, FALSE, FALSE,
findNamedModule, 0, m_fullName) == FALSE)
{
if (m_filename[0] == '\0'
|| ((fp = fopen(m_filename, "r")) == NULL))
{
- errorMsg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
+ error_msg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
return EXIT_FAILURE;
}
} else
- fatalError("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
+ error_msg_and_die("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
} else
memcpy(m_filename, *argv, strlen(*argv));
@@ -2971,7 +2971,7 @@ extern int insmod_main( int argc, char **argv)
} else {
m_version = old_get_module_version(f, m_strversion);
if (m_version == -1) {
- errorMsg("couldn't find the kernel version the module was "
+ error_msg("couldn't find the kernel version the module was "
"compiled for\n");
goto out;
}
@@ -2979,12 +2979,12 @@ extern int insmod_main( int argc, char **argv)
if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) {
if (flag_force_load) {
- errorMsg("Warning: kernel-module version mismatch\n"
+ error_msg("Warning: kernel-module version mismatch\n"
"\t%s was compiled for kernel version %s\n"
"\twhile this kernel is version %s\n",
m_filename, m_strversion, k_strversion);
} else {
- errorMsg("kernel-module version mismatch\n"
+ error_msg("kernel-module version mismatch\n"
"\t%s was compiled for kernel version %s\n"
"\twhile this kernel is version %s.\n",
m_filename, m_strversion, k_strversion);
@@ -3002,7 +3002,7 @@ extern int insmod_main( int argc, char **argv)
goto out;
k_crcs = new_is_kernel_checksummed();
#else
- errorMsg("Not configured to support new kernels\n");
+ error_msg("Not configured to support new kernels\n");
goto out;
#endif
} else {
@@ -3011,7 +3011,7 @@ extern int insmod_main( int argc, char **argv)
goto out;
k_crcs = old_is_kernel_checksummed();
#else
- errorMsg("Not configured to support old kernels\n");
+ error_msg("Not configured to support old kernels\n");
goto out;
#endif
}
@@ -3068,14 +3068,14 @@ extern int insmod_main( int argc, char **argv)
case 0:
break;
case EEXIST:
- errorMsg("A module named %s already exists\n", m_name);
+ error_msg("A module named %s already exists\n", m_name);
goto out;
case ENOMEM:
- errorMsg("Can't allocate kernel memory for module; needed %lu bytes\n",
+ error_msg("Can't allocate kernel memory for module; needed %lu bytes\n",
m_size);
goto out;
default:
- errorMsg("create_module: %s: %s\n", m_name, strerror(errno));
+ error_msg("create_module: %s: %s\n", m_name, strerror(errno));
goto out;
}
diff --git a/kill.c b/kill.c
index dd5ca49fa..caaa52a5b 100644
--- a/kill.c
+++ b/kill.c
@@ -204,10 +204,10 @@ extern int kill_main(int argc, char **argv)
int pid;
if (!isdigit(**argv))
- fatalError( "Bad PID: %s\n", strerror(errno));
+ error_msg_and_die( "Bad PID: %s\n", strerror(errno));
pid = strtol(*argv, NULL, 0);
if (kill(pid, sig) != 0)
- fatalError( "Could not kill pid '%d': %s\n", pid, strerror(errno));
+ error_msg_and_die( "Could not kill pid '%d': %s\n", pid, strerror(errno));
argv++;
}
}
@@ -219,20 +219,20 @@ extern int kill_main(int argc, char **argv)
while (--argc >= 0) {
pid_t* pidList;
- pidList = findPidByName( *argv);
+ pidList = find_pid_by_name( *argv);
if (!pidList) {
all_found = FALSE;
- errorMsg( "%s: no process killed\n", *argv);
+ error_msg( "%s: no process killed\n", *argv);
}
for(; pidList && *pidList!=0; pidList++) {
if (*pidList==myPid)
continue;
if (kill(*pidList, sig) != 0)
- fatalError( "Could not kill pid '%d': %s\n", *pidList, strerror(errno));
+ error_msg_and_die( "Could not kill pid '%d': %s\n", *pidList, strerror(errno));
}
/* Note that we don't bother to free the memory
- * allocated in findPidByName(). It will be freed
+ * allocated in find_pid_by_name(). It will be freed
* upon exit, so we can save a byte or two */
argv++;
}
@@ -245,5 +245,5 @@ extern int kill_main(int argc, char **argv)
end:
- fatalError( "bad signal name: %s\n", *argv);
+ error_msg_and_die( "bad signal name: %s\n", *argv);
}
diff --git a/lash.c b/lash.c
index bb8a456b7..4b1ae6d27 100644
--- a/lash.c
+++ b/lash.c
@@ -250,7 +250,7 @@ static int builtin_exec(struct job *cmd, struct jobSet *junk)
{
cmd->progs[0].argv++;
execvp(cmd->progs[0].argv[0], cmd->progs[0].argv);
- fatalError("Exec to %s failed: %s\n", cmd->progs[0].argv[0],
+ error_msg_and_die("Exec to %s failed: %s\n", cmd->progs[0].argv[0],
strerror(errno));
}
return EXIT_SUCCESS;
@@ -273,12 +273,12 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList)
if (!jobList->head) {
if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) {
- errorMsg("%s: exactly one argument is expected\n",
+ error_msg("%s: exactly one argument is expected\n",
cmd->progs[0].argv[0]);
return EXIT_FAILURE;
}
if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) {
- errorMsg("%s: bad argument '%s'\n",
+ error_msg("%s: bad argument '%s'\n",
cmd->progs[0].argv[0], cmd->progs[0].argv[1]);
return EXIT_FAILURE;
for (job = jobList->head; job; job = job->next) {
@@ -292,7 +292,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList)
}
if (!job) {
- errorMsg("%s: unknown job %d\n",
+ error_msg("%s: unknown job %d\n",
cmd->progs[0].argv[0], jobNum);
return EXIT_FAILURE;
}
@@ -444,7 +444,7 @@ static int builtin_then(struct job *cmd, struct jobSet *junk)
char* charptr1=cmd->text+5; /* skip over the leading 'then ' */
if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
- errorMsg("unexpected token `then'\n");
+ error_msg("unexpected token `then'\n");
return EXIT_FAILURE;
}
/* If the if result was FALSE, skip the 'then' stuff */
@@ -471,7 +471,7 @@ static int builtin_else(struct job *cmd, struct jobSet *junk)
char* charptr1=cmd->text+5; /* skip over the leading 'else ' */
if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
- errorMsg("unexpected token `else'\n");
+ error_msg("unexpected token `else'\n");
return EXIT_FAILURE;
}
/* If the if result was TRUE, skip the 'else' stuff */
@@ -495,7 +495,7 @@ static int builtin_else(struct job *cmd, struct jobSet *junk)
static int builtin_fi(struct job *cmd, struct jobSet *junk)
{
if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
- errorMsg("unexpected token `fi'\n");
+ error_msg("unexpected token `fi'\n");
return EXIT_FAILURE;
}
/* Clear out the if and then context bits */
@@ -646,7 +646,7 @@ static int setupRedirections(struct childProgram *prog)
if (openfd < 0) {
/* this could get lost if stderr has been redirected, but
bash and ash both lose it as well (though zsh doesn't!) */
- errorMsg("error opening %s: %s\n", redir->filename,
+ error_msg("error opening %s: %s\n", redir->filename,
strerror(errno));
return 1;
}
@@ -820,7 +820,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){
rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->globResult);
if (rc == GLOB_NOSPACE) {
- errorMsg("out of space during glob operation\n");
+ error_msg("out of space during glob operation\n");
return;
} else if (rc == GLOB_NOMATCH ||
(!rc && (prog->globResult.gl_pathc - i) == 1 &&
@@ -927,7 +927,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
if (*src == '\\') {
src++;
if (!*src) {
- errorMsg("character expected after \\\n");
+ error_msg("character expected after \\\n");
freeJob(job);
return 1;
}
@@ -1009,7 +1009,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
chptr++;
if (!*chptr) {
- errorMsg("file name expected after %c\n", *src);
+ error_msg("file name expected after %c\n", *src);
freeJob(job);
job->numProgs=0;
return 1;
@@ -1028,7 +1028,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
if (*prog->argv[argc_l])
argc_l++;
if (!argc_l) {
- errorMsg("empty command in pipe\n");
+ error_msg("empty command in pipe\n");
freeJob(job);
job->numProgs=0;
return 1;
@@ -1055,7 +1055,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
src++;
if (!*src) {
- errorMsg("empty command in pipe\n");
+ error_msg("empty command in pipe\n");
freeJob(job);
job->numProgs=0;
return 1;
@@ -1114,7 +1114,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
* command line, making extra room as needed */
--src;
charptr1 = xmalloc(BUFSIZ);
- while ( (size=fullRead(pipefd[0], charptr1, BUFSIZ-1)) >0) {
+ while ( (size=full_read(pipefd[0], charptr1, BUFSIZ-1)) >0) {
int newSize=src - *commandPtr + size + 1 + strlen(charptr2);
if (newSize > BUFSIZ) {
*commandPtr=xrealloc(*commandPtr, src - *commandPtr +
@@ -1145,7 +1145,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
case '\\':
src++;
if (!*src) {
- errorMsg("character expected after \\\n");
+ error_msg("character expected after \\\n");
freeJob(job);
return 1;
}
@@ -1291,7 +1291,7 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int
#endif
execvp(newJob->progs[i].argv[0], newJob->progs[i].argv);
- fatalError("%s: %s\n", newJob->progs[i].argv[0],
+ error_msg_and_die("%s: %s\n", newJob->progs[i].argv[0],
strerror(errno));
}
if (outPipe[1]!=-1) {
@@ -1495,7 +1495,7 @@ int shell_main(int argc_l, char **argv_l)
case 'c':
input = NULL;
if (local_pending_command != 0)
- fatalError("multiple -c arguments\n");
+ error_msg_and_die("multiple -c arguments\n");
local_pending_command = xstrdup(argv[optind]);
optind++;
argv = argv+optind;
diff --git a/ln.c b/ln.c
index e81dbafae..ead5322fa 100644
--- a/ln.c
+++ b/ln.c
@@ -55,9 +55,9 @@ static int fs_link(const char *link_DestName, const char *link_SrcName, const in
strcpy(srcName, link_SrcName);
if (flag&LN_NODEREFERENCE)
- srcIsDir = isDirectory(srcName, TRUE, NULL);
+ srcIsDir = is_directory(srcName, TRUE, NULL);
else
- srcIsDir = isDirectory(srcName, FALSE, NULL);
+ srcIsDir = is_directory(srcName, FALSE, NULL);
if ((srcIsDir==TRUE)&&((flag&LN_NODEREFERENCE)==0)) {
strcat(srcName, "/");
diff --git a/loadacm.c b/loadacm.c
index 156210890..a69664031 100644
--- a/loadacm.c
+++ b/loadacm.c
@@ -39,12 +39,12 @@ int loadacm_main(int argc, char **argv)
fd = open("/dev/tty", O_RDWR);
if (fd < 0) {
- errorMsg("Error opening /dev/tty1: %s\n", strerror(errno));
+ error_msg("Error opening /dev/tty1: %s\n", strerror(errno));
return EXIT_FAILURE;
}
if (screen_map_load(fd, stdin)) {
- errorMsg("Error loading acm: %s\n", strerror(errno));
+ error_msg("Error loading acm: %s\n", strerror(errno));
return EXIT_FAILURE;
}
@@ -72,7 +72,7 @@ int screen_map_load(int fd, FILE * fp)
if (parse_failed) {
if (-1 == fseek(fp, 0, SEEK_SET)) {
if (errno == ESPIPE)
- errorMsg("16bit screen-map MUST be a regular file.\n"),
+ error_msg("16bit screen-map MUST be a regular file.\n"),
exit(1);
else
perror("fseek failed reading binary 16bit screen-map"),
@@ -83,7 +83,7 @@ int screen_map_load(int fd, FILE * fp)
perror("Cannot read [new] map from file"), exit(1);
#if 0
else
- errorMsg("Input screen-map is binary.\n");
+ error_msg("Input screen-map is binary.\n");
#endif
}
@@ -100,7 +100,7 @@ int screen_map_load(int fd, FILE * fp)
/* rewind... */
if (-1 == fseek(fp, 0, SEEK_SET)) {
if (errno == ESPIPE)
- errorMsg("Assuming 8bit screen-map - MUST be a regular file.\n"),
+ error_msg("Assuming 8bit screen-map - MUST be a regular file.\n"),
exit(1);
else
perror("fseek failed assuming 8bit screen-map"), exit(1);
@@ -113,7 +113,7 @@ int screen_map_load(int fd, FILE * fp)
if (-1 == fseek(fp, 0, SEEK_SET)) {
if (errno == ESPIPE)
/* should not - it succedeed above */
- errorMsg("fseek() returned ESPIPE !\n"),
+ error_msg("fseek() returned ESPIPE !\n"),
exit(1);
else
perror("fseek for binary 8bit screen-map"), exit(1);
@@ -123,7 +123,7 @@ int screen_map_load(int fd, FILE * fp)
perror("Cannot read [old] map from file"), exit(1);
#if 0
else
- errorMsg("Input screen-map is binary.\n");
+ error_msg("Input screen-map is binary.\n");
#endif
}
@@ -132,7 +132,7 @@ int screen_map_load(int fd, FILE * fp)
else
return 0;
}
- errorMsg("Error parsing symbolic map\n");
+ error_msg("Error parsing symbolic map\n");
return(1);
}
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)
fd = open("/dev/tty0", O_RDWR);
if (fd < 0)
- fatalPerror("Error opening /dev/tty0");
+ perror_msg_and_die("Error opening /dev/tty0");
loadnewfont(fd);
return EXIT_SUCCESS;
@@ -62,7 +62,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
memset(buf, 0, sizeof(buf));
if (unit < 1 || unit > 32)
- fatalError("Bad character size %d\n", unit);
+ error_msg_and_die("Bad character size %d\n", unit);
for (i = 0; i < fontsize; i++)
memcpy(buf + (32 * i), inbuf + (unit * i), unit);
@@ -77,11 +77,11 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
if (ioctl(fd, PIO_FONTX, &cfd) == 0)
return; /* success */
- perrorMsg("PIO_FONTX ioctl error (trying PIO_FONT)");
+ perror_msg("PIO_FONTX ioctl error (trying PIO_FONT)");
}
#endif
if (ioctl(fd, PIO_FONT, buf))
- fatalPerror("PIO_FONT ioctl error");
+ perror_msg_and_die("PIO_FONT ioctl error");
}
static void
@@ -119,11 +119,11 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
if (ioctl(fd, PIO_UNIMAPCLR, &advice)) {
#ifdef ENOIOCTLCMD
if (errno == ENOIOCTLCMD) {
- errorMsg("It seems this kernel is older than 1.1.92\n");
- fatalError("No Unicode mapping table loaded.\n");
+ error_msg("It seems this kernel is older than 1.1.92\n");
+ error_msg_and_die("No Unicode mapping table loaded.\n");
} else
#endif
- fatalPerror("PIO_UNIMAPCLR");
+ perror_msg_and_die("PIO_UNIMAPCLR");
}
ud.entry_ct = ct;
ud.entries = up;
@@ -133,7 +133,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
/* change advice parameters */
}
#endif
- fatalPerror("PIO_UNIMAP");
+ perror_msg_and_die("PIO_UNIMAP");
}
}
@@ -150,13 +150,13 @@ static void loadnewfont(int fd)
*/
inputlth = fread(inbuf, 1, sizeof(inbuf), stdin);
if (ferror(stdin))
- fatalPerror("Error reading input font");
+ perror_msg_and_die("Error reading input font");
/* use malloc/realloc in case of giant files;
maybe these do not occur: 16kB for the font,
and 16kB for the map leaves 32 unicode values
for each font position */
if (!feof(stdin))
- fatalPerror("Font too large");
+ perror_msg_and_die("Font too large");
/* test for psf first */
{
@@ -174,11 +174,11 @@ static void loadnewfont(int fd)
goto no_psf;
if (psfhdr.mode > PSF_MAXMODE)
- fatalError("Unsupported psf file mode\n");
+ error_msg_and_die("Unsupported psf file mode\n");
fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256);
#if !defined( PIO_FONTX ) || defined( __sparc__ )
if (fontsize != 256)
- fatalError("Only fontsize 256 supported\n");
+ error_msg_and_die("Only fontsize 256 supported\n");
#endif
hastable = (psfhdr.mode & PSF_MODEHASTAB);
unit = psfhdr.charsize;
@@ -186,7 +186,7 @@ static void loadnewfont(int fd)
head = head0 + fontsize * unit;
if (head > inputlth || (!hastable && head != inputlth))
- fatalError("Input file: bad length\n");
+ error_msg_and_die("Input file: bad length\n");
do_loadfont(fd, inbuf + head0, unit, fontsize);
if (hastable)
do_loadtable(fd, inbuf + head, inputlth - head, fontsize);
@@ -201,7 +201,7 @@ static void loadnewfont(int fd)
} else {
/* bare font */
if (inputlth & 0377)
- fatalError("Bad input file size\n");
+ error_msg_and_die("Bad input file size\n");
offset = 0;
unit = inputlth / 256;
}
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)
fd = open("/dev/tty0", O_RDWR);
if (fd < 0)
- fatalPerror("Error opening /dev/tty0");
+ perror_msg_and_die("Error opening /dev/tty0");
read(0, buff, 7);
if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
- fatalError("This is not a valid binary keymap.\n");
+ error_msg_and_die("This is not a valid binary keymap.\n");
if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS))
- fatalPerror("Error reading keymap flags");
+ perror_msg_and_die("Error reading keymap flags");
ibuff = (u_short *) xmalloc(ibuffsz);
@@ -68,7 +68,7 @@ int loadkmap_main(int argc, char **argv)
pos = 0;
while (pos < ibuffsz) {
if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos)) < 0)
- fatalPerror("Error reading keymap");
+ perror_msg_and_die("Error reading keymap");
pos += readsz;
}
for (j = 0; j < NR_KEYS; j++) {
diff --git a/logger.c b/logger.c
index 8e341efe9..1ed6dc639 100644
--- a/logger.c
+++ b/logger.c
@@ -85,14 +85,14 @@ static int pencode(char *s)
*s = '\0';
fac = decode(save, facilitynames);
if (fac < 0)
- fatalError("unknown facility name: %s\n", save);
+ error_msg_and_die("unknown facility name: %s\n", save);
*s++ = '.';
} else {
s = save;
}
lev = decode(s, prioritynames);
if (lev < 0)
- fatalError("unknown priority name: %s\n", save);
+ error_msg_and_die("unknown priority name: %s\n", save);
return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK));
}
@@ -152,7 +152,7 @@ extern int logger_main(int argc, char **argv)
if (argc >= 1)
message = *argv;
else
- fatalError("No message\n");
+ error_msg_and_die("No message\n");
}
openlog(name, option, (pri | LOG_FACMASK));
diff --git a/logname.c b/logname.c
index 89c409f00..1fc518bfc 100644
--- a/logname.c
+++ b/logname.c
@@ -35,5 +35,5 @@ extern int logname_main(int argc, char **argv)
puts(user);
return EXIT_SUCCESS;
}
- fatalError("no login name\n");
+ error_msg_and_die("no login name\n");
}
diff --git a/ls.c b/ls.c
index 225132ba4..94c73b377 100644
--- a/ls.c
+++ b/ls.c
@@ -181,7 +181,7 @@ static int my_stat(struct dnode *cur)
#ifdef BB_FEATURE_LS_FOLLOWLINKS
if (follow_links == TRUE) {
if (stat(cur->fullname, &cur->dstat)) {
- errorMsg("%s: %s\n", cur->fullname, strerror(errno));
+ error_msg("%s: %s\n", cur->fullname, strerror(errno));
status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
@@ -190,7 +190,7 @@ static int my_stat(struct dnode *cur)
} else
#endif
if (lstat(cur->fullname, &cur->dstat)) {
- errorMsg("%s: %s\n", cur->fullname, strerror(errno));
+ error_msg("%s: %s\n", cur->fullname, strerror(errno));
status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
@@ -511,7 +511,7 @@ struct dnode **list_dir(char *path)
nfiles= 0;
dir = opendir(path);
if (dir == NULL) {
- errorMsg("%s: %s\n", path, strerror(errno));
+ error_msg("%s: %s\n", path, strerror(errno));
status = EXIT_FAILURE;
return(NULL); /* could not open the dir */
}
@@ -591,7 +591,7 @@ int list_single(struct dnode *dn)
column += 5;
break;
case LIST_MODEBITS:
- fprintf(stdout, "%10s", (char *)modeString(dn->dstat.st_mode));
+ fprintf(stdout, "%10s", (char *)mode_string(dn->dstat.st_mode));
column += 10;
break;
case LIST_NLINKS:
diff --git a/lsmod.c b/lsmod.c
index 6fe505bf6..f957d2d00 100644
--- a/lsmod.c
+++ b/lsmod.c
@@ -83,7 +83,7 @@ extern int lsmod_main(int argc, char **argv)
module_names = xmalloc(bufsize = 256);
deps = xmalloc(bufsize);
if (query_module(NULL, QM_MODULES, module_names, bufsize, &nmod)) {
- fatalError("QM_MODULES: %s\n", strerror(errno));
+ error_msg_and_die("QM_MODULES: %s\n", strerror(errno));
}
printf("Module Size Used by\n");
@@ -94,7 +94,7 @@ extern int lsmod_main(int argc, char **argv)
continue;
}
/* else choke */
- fatalError("module %s: QM_INFO: %s\n", mn, strerror(errno));
+ error_msg_and_die("module %s: QM_INFO: %s\n", mn, strerror(errno));
}
while (query_module(mn, QM_REFS, deps, bufsize, &count)) {
if (errno == ENOENT) {
@@ -102,7 +102,7 @@ extern int lsmod_main(int argc, char **argv)
continue;
}
if (errno != ENOSPC) {
- fatalError("module %s: QM_REFS: %s", mn, strerror(errno));
+ error_msg_and_die("module %s: QM_REFS: %s", mn, strerror(errno));
}
deps = xrealloc(deps, bufsize = count);
}
@@ -153,7 +153,7 @@ extern int lsmod_main(int argc, char **argv)
close(fd);
return 0;
}
- fatalError("/proc/modules: %s\n", strerror(errno));
+ error_msg_and_die("/proc/modules: %s\n", strerror(errno));
return 1;
}
diff --git a/md5sum.c b/md5sum.c
index 84e037a61..57fac7450 100644
--- a/md5sum.c
+++ b/md5sum.c
@@ -651,13 +651,13 @@ static int md5_file(const char *filename,
} else {
fp = fopen(filename, OPENOPTS(binary));
if (fp == NULL) {
- errorMsg("%s: %s\n", filename, strerror(errno));
+ error_msg("%s: %s\n", filename, strerror(errno));
return FALSE;
}
}
if (md5_stream(fp, md5_result)) {
- errorMsg("%s: %s\n", filename, strerror(errno));
+ error_msg("%s: %s\n", filename, strerror(errno));
if (fp != stdin)
fclose(fp);
@@ -665,7 +665,7 @@ static int md5_file(const char *filename,
}
if (fp != stdin && fclose(fp) == EOF) {
- errorMsg("%s: %s\n", filename, strerror(errno));
+ error_msg("%s: %s\n", filename, strerror(errno));
return FALSE;
}
@@ -689,7 +689,7 @@ static int md5_check(const char *checkfile_name)
} else {
checkfile_stream = fopen(checkfile_name, "r");
if (checkfile_stream == NULL) {
- errorMsg("%s: %s\n", checkfile_name, strerror(errno));
+ error_msg("%s: %s\n", checkfile_name, strerror(errno));
return FALSE;
}
}
@@ -722,7 +722,7 @@ static int md5_check(const char *checkfile_name)
if (split_3(line, line_length, &md5num, &binary, &filename)
|| !hex_digits(md5num)) {
if (warn) {
- errorMsg("%s: %lu: improperly formatted MD5 checksum line\n",
+ error_msg("%s: %lu: improperly formatted MD5 checksum line\n",
checkfile_name, (unsigned long) line_number);
}
} else {
@@ -770,18 +770,18 @@ static int md5_check(const char *checkfile_name)
free(line);
if (ferror(checkfile_stream)) {
- errorMsg("%s: read error\n", checkfile_name); /* */
+ error_msg("%s: read error\n", checkfile_name); /* */
return FALSE;
}
if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) {
- errorMsg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
+ error_msg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
return FALSE;
}
if (n_properly_formated_lines == 0) {
/* Warn if no tests are found. */
- errorMsg("%s: no properly formatted MD5 checksum lines found\n",
+ error_msg("%s: no properly formatted MD5 checksum lines found\n",
checkfile_name);
return FALSE;
} else {
@@ -790,13 +790,13 @@ static int md5_check(const char *checkfile_name)
- n_open_or_read_failures);
if (n_open_or_read_failures > 0) {
- errorMsg("WARNING: %d of %d listed files could not be read\n",
+ error_msg("WARNING: %d of %d listed files could not be read\n",
n_open_or_read_failures, n_properly_formated_lines);
return FALSE;
}
if (n_mismatched_checksums > 0) {
- errorMsg("WARNING: %d of %d computed checksums did NOT match\n",
+ error_msg("WARNING: %d of %d computed checksums did NOT match\n",
n_mismatched_checksums, n_computed_checkums);
return FALSE;
}
@@ -861,22 +861,22 @@ int md5sum_main(int argc,
}
if (file_type_specified && do_check) {
- errorMsg("the -b and -t options are meaningless when verifying checksums\n");
+ error_msg("the -b and -t options are meaningless when verifying checksums\n");
return EXIT_FAILURE;
}
if (n_strings > 0 && do_check) {
- errorMsg("the -g and -c options are mutually exclusive\n");
+ error_msg("the -g and -c options are mutually exclusive\n");
return EXIT_FAILURE;
}
if (status_only && !do_check) {
- errorMsg("the -s option is meaningful only when verifying checksums\n");
+ error_msg("the -s option is meaningful only when verifying checksums\n");
return EXIT_FAILURE;
}
if (warn && !do_check) {
- errorMsg("the -w option is meaningful only when verifying checksums\n");
+ error_msg("the -w option is meaningful only when verifying checksums\n");
return EXIT_FAILURE;
}
@@ -884,7 +884,7 @@ int md5sum_main(int argc,
size_t i;
if (optind < argc) {
- errorMsg("no files may be specified when using -g\n");
+ error_msg("no files may be specified when using -g\n");
return EXIT_FAILURE;
}
for (i = 0; i < n_strings; ++i) {
@@ -898,7 +898,7 @@ int md5sum_main(int argc,
}
} else if (do_check) {
if (optind + 1 < argc) {
- errorMsg("only one argument may be specified when using -c\n");
+ error_msg("only one argument may be specified when using -c\n");
}
err = md5_check ((optind == argc) ? "-" : argv[optind]);
@@ -951,12 +951,12 @@ int md5sum_main(int argc,
}
if (fclose (stdout) == EOF) {
- errorMsg("write error\n");
+ error_msg("write error\n");
return EXIT_FAILURE;
}
if (have_read_stdin && fclose (stdin) == EOF) {
- errorMsg("standard input\n");
+ error_msg("standard input\n");
return EXIT_FAILURE;
}
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;
static void push(double a)
{
if (pointer >= (sizeof(stack) / sizeof(*stack)))
- fatalError("stack overflow\n");
+ error_msg_and_die("stack overflow\n");
stack[pointer++] = a;
}
static double pop()
{
if (pointer == 0)
- fatalError("stack underflow\n");
+ error_msg_and_die("stack underflow\n");
return stack[--pointer];
}
@@ -120,7 +120,7 @@ static void stack_machine(const char *argument)
}
o++;
}
- fatalError("%s: syntax error.\n", argument);
+ error_msg_and_die("%s: syntax error.\n", argument);
}
/* 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)
} else {
file = open(argv[1], O_RDONLY);
if (file < 0) {
- fatalError(io_error, argv[1], strerror(errno));
+ error_msg_and_die(io_error, argv[1], strerror(errno));
}
}
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)
}
if (code->name == 0) {
- errorMsg("unrecognized opcode %s.\n", argv[1]);
+ error_msg("unrecognized opcode %s.\n", argv[1]);
return EXIT_FAILURE;
}
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)
buf = xrealloc(buf, bufsize);
size = readlink(argv[1], buf, bufsize);
if (size == -1)
- fatalError("%s: %s\n", argv[1], strerror(errno));
+ error_msg_and_die("%s: %s\n", argv[1], strerror(errno));
}
buf[size] = '\0';
diff --git a/mkdir.c b/mkdir.c
index c950847dc..92357a665 100644
--- a/mkdir.c
+++ b/mkdir.c
@@ -50,7 +50,7 @@ extern int mkdir_main(int argc, char **argv)
/* Find the specified modes */
mode = 0;
if (parse_mode(*(++argv), &mode) == FALSE) {
- errorMsg("Unknown mode: %s\n", *argv);
+ error_msg("Unknown mode: %s\n", *argv);
return EXIT_FAILURE;
}
/* Set the umask for this process so it doesn't
@@ -79,18 +79,18 @@ extern int mkdir_main(int argc, char **argv)
char buf[BUFSIZ + 1];
if (strlen(*argv) > BUFSIZ - 1) {
- errorMsg(name_too_long);
+ error_msg(name_too_long);
return EXIT_FAILURE;
}
strcpy(buf, *argv);
status = stat(buf, &statBuf);
if (parentFlag == FALSE && status != -1 && errno != ENOENT) {
- errorMsg("%s: File exists\n", buf);
+ error_msg("%s: File exists\n", buf);
return EXIT_FAILURE;
}
if (parentFlag == TRUE) {
strcat(buf, "/");
- createPath(buf, mode);
+ create_path(buf, mode);
} else {
if (mkdir(buf, mode) != 0 && parentFlag == FALSE) {
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)
*/
static volatile void die(char *str)
{
- errorMsg("%s\n", str);
+ error_msg("%s\n", str);
exit(8);
}
@@ -796,7 +796,7 @@ extern int mkfs_minix_main(int argc, char **argv)
#ifdef BB_FEATURE_MINIX2
version2 = 1;
#else
- errorMsg("%s: not compiled with minix v2 support\n",
+ error_msg("%s: not compiled with minix v2 support\n",
device_name);
exit(-1);
#endif
diff --git a/mknod.c b/mknod.c
index 21b2689cc..022ab8571 100644
--- a/mknod.c
+++ b/mknod.c
@@ -84,7 +84,7 @@ int mknod_main(int argc, char **argv)
mode |= perm;
if (mknod(argv[0], mode, dev) != 0)
- fatalError("%s: %s\n", argv[0], strerror(errno));
+ error_msg_and_die("%s: %s\n", argv[0], strerror(errno));
return EXIT_SUCCESS;
}
diff --git a/mkswap.c b/mkswap.c
index 4757e15f8..3a396894c 100644
--- a/mkswap.c
+++ b/mkswap.c
@@ -87,7 +87,7 @@ static void init_signature_page()
#ifdef PAGE_SIZE
if (pagesize != PAGE_SIZE)
- errorMsg("Assuming pages of size %d\n", pagesize);
+ error_msg("Assuming pages of size %d\n", pagesize);
#endif
signature_page = (int *) xmalloc(pagesize);
memset(signature_page, 0, pagesize);
@@ -175,7 +175,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr)
void die(const char *str)
{
- errorMsg("%s\n", str);
+ error_msg("%s\n", str);
exit(EXIT_FAILURE);
}
@@ -316,14 +316,14 @@ int mkswap_main(int argc, char **argv)
}
}
if (!device_name) {
- errorMsg("error: Nowhere to set up swap on?\n");
+ error_msg("error: Nowhere to set up swap on?\n");
usage(mkswap_usage);
}
sz = get_size(device_name);
if (!PAGES) {
PAGES = sz;
} else if (PAGES > sz && !force) {
- errorMsg("error: size %ld is larger than device size %d\n",
+ error_msg("error: size %ld is larger than device size %d\n",
PAGES * (pagesize / 1024), sz * (pagesize / 1024));
return EXIT_FAILURE;
}
@@ -339,11 +339,11 @@ int mkswap_main(int argc, char **argv)
version = 1;
}
if (version != 0 && version != 1) {
- errorMsg("error: unknown version %d\n", version);
+ error_msg("error: unknown version %d\n", version);
usage(mkswap_usage);
}
if (PAGES < 10) {
- errorMsg("error: swap area needs to be at least %ldkB\n",
+ error_msg("error: swap area needs to be at least %ldkB\n",
(long) (10 * pagesize / 1024));
usage(mkswap_usage);
}
@@ -362,7 +362,7 @@ int mkswap_main(int argc, char **argv)
#endif
if (PAGES > maxpages) {
PAGES = maxpages;
- errorMsg("warning: truncating swap area to %ldkB\n",
+ error_msg("warning: truncating swap area to %ldkB\n",
PAGES * pagesize / 1024);
}
@@ -389,7 +389,7 @@ int mkswap_main(int argc, char **argv)
for (sum = 0; q >= (unsigned short *) buffer;)
sum ^= *q--;
if (!sum) {
- errorMsg("Device '%s' contains a valid Sun disklabel.\n"
+ error_msg("Device '%s' contains a valid Sun disklabel.\n"
"This probably means creating v0 swap would destroy your partition table\n"
"No swap created. If you really want to create swap v0 on that device, use\n"
"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 @@
#ifndef MODUTILS_MODULE_H
#define MODUTILS_MODULE_H 1
-#ident "$Id: insmod.c,v 1.30 2000/12/06 18:18:26 andersen Exp $"
+#ident "$Id: insmod.c,v 1.31 2000/12/07 19:56:48 markw Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
@@ -284,7 +284,7 @@ int delete_module(const char *);
#ifndef MODUTILS_OBJ_H
#define MODUTILS_OBJ_H 1
-#ident "$Id: insmod.c,v 1.30 2000/12/06 18:18:26 andersen Exp $"
+#ident "$Id: insmod.c,v 1.31 2000/12/07 19:56:48 markw Exp $"
/* The relocatable object is manipulated using elfin types. */
@@ -1157,7 +1157,7 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
/* Don't report an error if the symbol is coming from
the kernel or some external module. */
if (secidx <= SHN_HIRESERVE)
- errorMsg("%s multiply defined\n", name);
+ error_msg("%s multiply defined\n", name);
return sym;
}
}
@@ -1420,7 +1420,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
/* Also check that the parameter was not resolved from the kernel. */
if (sym == NULL || sym->secidx > SHN_HIRESERVE) {
- errorMsg("symbol for parameter %s not found\n", p);
+ error_msg("symbol for parameter %s not found\n", p);
return 0;
}
@@ -1433,7 +1433,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
str = alloca(strlen(q));
for (r = str, q++; *q != '"'; ++q, ++r) {
if (*q == '\0') {
- errorMsg("improperly terminated string argument for %s\n", p);
+ error_msg("improperly terminated string argument for %s\n", p);
return 0;
} else if (*q == '\\')
switch (*++q) {
@@ -1562,7 +1562,7 @@ static int old_get_kernel_symbols(const char *m_name)
nks = get_kernel_syms(NULL);
if (nks < 0) {
- errorMsg("get_kernel_syms: %s: %s\n", m_name, strerror(errno));
+ error_msg("get_kernel_syms: %s: %s\n", m_name, strerror(errno));
return 0;
}
@@ -1743,7 +1743,7 @@ old_init_module(const char *m_name, struct obj_file *f,
m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN
: 0), &routines, symtab);
if (ret)
- errorMsg("init_module: %s: %s\n", m_name, strerror(errno));
+ error_msg("init_module: %s: %s\n", m_name, strerror(errno));
free(image);
free(symtab);
@@ -1786,7 +1786,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
p = get_modinfo_value(f, key);
key += 5;
if (p == NULL) {
- errorMsg("invalid parameter %s\n", key);
+ error_msg("invalid parameter %s\n", key);
return 0;
}
@@ -1794,7 +1794,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
/* Also check that the parameter was not resolved from the kernel. */
if (sym == NULL || sym->secidx > SHN_HIRESERVE) {
- errorMsg("symbol for parameter %s not found\n", key);
+ error_msg("symbol for parameter %s not found\n", key);
return 0;
}
@@ -1822,7 +1822,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
str = alloca(strlen(q));
for (r = str, q++; *q != '"'; ++q, ++r) {
if (*q == '\0') {
- errorMsg("improperly terminated string argument for %s\n",
+ error_msg("improperly terminated string argument for %s\n",
key);
return 0;
} else if (*q == '\\')
@@ -1916,7 +1916,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
/* Get the size of each member */
/* Probably we should do that outside the loop ? */
if (!isdigit(*(p + 1))) {
- errorMsg("parameter type 'c' for %s must be followed by"
+ error_msg("parameter type 'c' for %s must be followed by"
" the maximum size\n", key);
return 0;
}
@@ -1924,7 +1924,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
/* Check length */
if (strlen(str) >= charssize) {
- errorMsg("string too long for %s (max %ld)\n", key,
+ error_msg("string too long for %s (max %ld)\n", key,
charssize - 1);
return 0;
}
@@ -1953,7 +1953,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
break;
default:
- errorMsg("unknown parameter type '%c' for %s\n", *p, key);
+ error_msg("unknown parameter type '%c' for %s\n", *p, key);
return 0;
}
}
@@ -1972,21 +1972,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
case ',':
if (++n > max) {
- errorMsg("too many values for %s (max %d)\n", key, max);
+ error_msg("too many values for %s (max %d)\n", key, max);
return 0;
}
++q;
break;
default:
- errorMsg("invalid argument syntax for %s\n", key);
+ error_msg("invalid argument syntax for %s\n", key);
return 0;
}
}
end_of_arg:
if (n < min) {
- errorMsg("too few values for %s (min %d)\n", key, min);
+ error_msg("too few values for %s (min %d)\n", key, min);
return 0;
}
@@ -2055,7 +2055,7 @@ static int new_get_kernel_symbols(void)
module_names = xrealloc(module_names, bufsize = ret);
goto retry_modules_load;
}
- errorMsg("QM_MODULES: %s\n", strerror(errno));
+ error_msg("QM_MODULES: %s\n", strerror(errno));
return 0;
}
@@ -2074,7 +2074,7 @@ static int new_get_kernel_symbols(void)
/* The module was removed out from underneath us. */
continue;
}
- errorMsg("query_module: QM_INFO: %s: %s\n", mn, strerror(errno));
+ error_msg("query_module: QM_INFO: %s: %s\n", mn, strerror(errno));
return 0;
}
@@ -2089,7 +2089,7 @@ static int new_get_kernel_symbols(void)
/* The module was removed out from underneath us. */
continue;
default:
- errorMsg("query_module: QM_SYMBOLS: %s: %s\n", mn, strerror(errno));
+ error_msg("query_module: QM_SYMBOLS: %s: %s\n", mn, strerror(errno));
return 0;
}
}
@@ -2114,7 +2114,7 @@ static int new_get_kernel_symbols(void)
syms = xrealloc(syms, bufsize = ret);
goto retry_kern_sym_load;
}
- errorMsg("kernel: QM_SYMBOLS: %s\n", strerror(errno));
+ error_msg("kernel: QM_SYMBOLS: %s\n", strerror(errno));
return 0;
}
nksyms = nsyms = ret;
@@ -2295,7 +2295,7 @@ new_init_module(const char *m_name, struct obj_file *f,
ret = new_sys_init_module(m_name, (struct new_module *) image);
if (ret)
- errorMsg("init_module: %s: %s\n", m_name, strerror(errno));
+ error_msg("init_module: %s: %s\n", m_name, strerror(errno));
free(image);
@@ -2372,7 +2372,7 @@ int obj_check_undefineds(struct obj_file *f)
sym->secidx = SHN_ABS;
sym->value = 0;
} else {
- errorMsg("unresolved symbol %s\n", sym->name);
+ error_msg("unresolved symbol %s\n", sym->name);
ret = 0;
}
}
@@ -2599,11 +2599,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base)
errmsg = "Unhandled relocation";
bad_reloc:
if (extsym) {
- errorMsg("%s of type %ld for %s\n", errmsg,
+ error_msg("%s of type %ld for %s\n", errmsg,
(long) ELFW(R_TYPE) (rel->r_info),
strtab + extsym->st_name);
} else {
- errorMsg("%s of type %ld\n", errmsg,
+ error_msg("%s of type %ld\n", errmsg,
(long) ELFW(R_TYPE) (rel->r_info));
}
ret = 0;
@@ -2680,7 +2680,7 @@ struct obj_file *obj_load(FILE * fp)
fseek(fp, 0, SEEK_SET);
if (fread(&f->header, sizeof(f->header), 1, fp) != 1) {
- errorMsg("error reading ELF header: %s\n", strerror(errno));
+ error_msg("error reading ELF header: %s\n", strerror(errno));
return NULL;
}
@@ -2688,25 +2688,25 @@ struct obj_file *obj_load(FILE * fp)
|| f->header.e_ident[EI_MAG1] != ELFMAG1
|| f->header.e_ident[EI_MAG2] != ELFMAG2
|| f->header.e_ident[EI_MAG3] != ELFMAG3) {
- errorMsg("not an ELF file\n");
+ error_msg("not an ELF file\n");
return NULL;
}
if (f->header.e_ident[EI_CLASS] != ELFCLASSM
|| f->header.e_ident[EI_DATA] != ELFDATAM
|| f->header.e_ident[EI_VERSION] != EV_CURRENT
|| !MATCH_MACHINE(f->header.e_machine)) {
- errorMsg("ELF file not for this architecture\n");
+ error_msg("ELF file not for this architecture\n");
return NULL;
}
if (f->header.e_type != ET_REL) {
- errorMsg("ELF file not a relocatable object\n");
+ error_msg("ELF file not a relocatable object\n");
return NULL;
}
/* Read the section headers. */
if (f->header.e_shentsize != sizeof(ElfW(Shdr))) {
- errorMsg("section header size mismatch: %lu != %lu\n",
+ error_msg("section header size mismatch: %lu != %lu\n",
(unsigned long) f->header.e_shentsize,
(unsigned long) sizeof(ElfW(Shdr)));
return NULL;
@@ -2719,7 +2719,7 @@ struct obj_file *obj_load(FILE * fp)
section_headers = alloca(sizeof(ElfW(Shdr)) * shnum);
fseek(fp, f->header.e_shoff, SEEK_SET);
if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) {
- errorMsg("error reading ELF section headers: %s\n", strerror(errno));
+ error_msg("error reading ELF section headers: %s\n", strerror(errno));
return NULL;
}
@@ -2749,7 +2749,7 @@ struct obj_file *obj_load(FILE * fp)
sec->contents = xmalloc(sec->header.sh_size);
fseek(fp, sec->header.sh_offset, SEEK_SET);
if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) {
- errorMsg("error reading ELF section data: %s\n", strerror(errno));
+ error_msg("error reading ELF section data: %s\n", strerror(errno));
return NULL;
}
} else {
@@ -2759,11 +2759,11 @@ struct obj_file *obj_load(FILE * fp)
#if SHT_RELM == SHT_REL
case SHT_RELA:
- errorMsg("RELA relocations not supported on this architecture\n");
+ error_msg("RELA relocations not supported on this architecture\n");
return NULL;
#else
case SHT_REL:
- errorMsg("REL relocations not supported on this architecture\n");
+ error_msg("REL relocations not supported on this architecture\n");
return NULL;
#endif
@@ -2776,7 +2776,7 @@ struct obj_file *obj_load(FILE * fp)
break;
}
- errorMsg("can't handle sections of type %ld\n",
+ error_msg("can't handle sections of type %ld\n",
(long) sec->header.sh_type);
return NULL;
}
@@ -2805,7 +2805,7 @@ struct obj_file *obj_load(FILE * fp)
ElfW(Sym) * sym;
if (sec->header.sh_entsize != sizeof(ElfW(Sym))) {
- errorMsg("symbol size mismatch: %lu != %lu\n",
+ error_msg("symbol size mismatch: %lu != %lu\n",
(unsigned long) sec->header.sh_entsize,
(unsigned long) sizeof(ElfW(Sym)));
return NULL;
@@ -2837,7 +2837,7 @@ struct obj_file *obj_load(FILE * fp)
case SHT_RELM:
if (sec->header.sh_entsize != sizeof(ElfW(RelM))) {
- errorMsg("relocation entry size mismatch: %lu != %lu\n",
+ error_msg("relocation entry size mismatch: %lu != %lu\n",
(unsigned long) sec->header.sh_entsize,
(unsigned long) sizeof(ElfW(RelM)));
return NULL;
@@ -2937,17 +2937,17 @@ extern int insmod_main( int argc, char **argv)
/* Get a filedesc for the module */
if ((fp = fopen(*argv, "r")) == NULL) {
/* Hmpf. Could not open it. Search through _PATH_MODULES to find a module named m_name */
- if (recursiveAction(_PATH_MODULES, TRUE, FALSE, FALSE,
+ if (recursive_action(_PATH_MODULES, TRUE, FALSE, FALSE,
findNamedModule, 0, m_fullName) == FALSE)
{
if (m_filename[0] == '\0'
|| ((fp = fopen(m_filename, "r")) == NULL))
{
- errorMsg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
+ error_msg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
return EXIT_FAILURE;
}
} else
- fatalError("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
+ error_msg_and_die("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES);
} else
memcpy(m_filename, *argv, strlen(*argv));
@@ -2971,7 +2971,7 @@ extern int insmod_main( int argc, char **argv)
} else {
m_version = old_get_module_version(f, m_strversion);
if (m_version == -1) {
- errorMsg("couldn't find the kernel version the module was "
+ error_msg("couldn't find the kernel version the module was "
"compiled for\n");
goto out;
}
@@ -2979,12 +2979,12 @@ extern int insmod_main( int argc, char **argv)
if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) {
if (flag_force_load) {
- errorMsg("Warning: kernel-module version mismatch\n"
+ error_msg("Warning: kernel-module version mismatch\n"
"\t%s was compiled for kernel version %s\n"
"\twhile this kernel is version %s\n",
m_filename, m_strversion, k_strversion);
} else {
- errorMsg("kernel-module version mismatch\n"
+ error_msg("kernel-module version mismatch\n"
"\t%s was compiled for kernel version %s\n"
"\twhile this kernel is version %s.\n",
m_filename, m_strversion, k_strversion);
@@ -3002,7 +3002,7 @@ extern int insmod_main( int argc, char **argv)
goto out;
k_crcs = new_is_kernel_checksummed();
#else
- errorMsg("Not configured to support new kernels\n");
+ error_msg("Not configured to support new kernels\n");
goto out;
#endif
} else {
@@ -3011,7 +3011,7 @@ extern int insmod_main( int argc, char **argv)
goto out;
k_crcs = old_is_kernel_checksummed();
#else
- errorMsg("Not configured to support old kernels\n");
+ error_msg("Not configured to support old kernels\n");
goto out;
#endif
}
@@ -3068,14 +3068,14 @@ extern int insmod_main( int argc, char **argv)
case 0:
break;
case EEXIST:
- errorMsg("A module named %s already exists\n", m_name);
+ error_msg("A module named %s already exists\n", m_name);
goto out;
case ENOMEM:
- errorMsg("Can't allocate kernel memory for module; needed %lu bytes\n",
+ error_msg("Can't allocate kernel memory for module; needed %lu bytes\n",
m_size);
goto out;
default:
- errorMsg("create_module: %s: %s\n", m_name, strerror(errno));
+ error_msg("create_module: %s: %s\n", m_name, strerror(errno));
goto out;
}
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)
module_names = xmalloc(bufsize = 256);
deps = xmalloc(bufsize);
if (query_module(NULL, QM_MODULES, module_names, bufsize, &nmod)) {
- fatalError("QM_MODULES: %s\n", strerror(errno));
+ error_msg_and_die("QM_MODULES: %s\n", strerror(errno));
}
printf("Module Size Used by\n");
@@ -94,7 +94,7 @@ extern int lsmod_main(int argc, char **argv)
continue;
}
/* else choke */
- fatalError("module %s: QM_INFO: %s\n", mn, strerror(errno));
+ error_msg_and_die("module %s: QM_INFO: %s\n", mn, strerror(errno));
}
while (query_module(mn, QM_REFS, deps, bufsize, &count)) {
if (errno == ENOENT) {
@@ -102,7 +102,7 @@ extern int lsmod_main(int argc, char **argv)
continue;
}
if (errno != ENOSPC) {
- fatalError("module %s: QM_REFS: %s", mn, strerror(errno));
+ error_msg_and_die("module %s: QM_REFS: %s", mn, strerror(errno));
}
deps = xrealloc(deps, bufsize = count);
}
@@ -153,7 +153,7 @@ extern int lsmod_main(int argc, char **argv)
close(fd);
return 0;
}
- fatalError("/proc/modules: %s\n", strerror(errno));
+ error_msg_and_die("/proc/modules: %s\n", strerror(errno));
return 1;
}
diff --git a/mount.c b/mount.c
index ff8aef379..fa998122b 100644
--- a/mount.c
+++ b/mount.c
@@ -132,22 +132,22 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
specialfile = find_unused_loop_device();
if (specialfile == NULL) {
- errorMsg("Could not find a spare loop device\n");
+ error_msg("Could not find a spare loop device\n");
return (FALSE);
}
if (set_loop(specialfile, lofile, 0, &loro)) {
- errorMsg("Could not setup loop device\n");
+ error_msg("Could not setup loop device\n");
return (FALSE);
}
if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */
- errorMsg("WARNING: loop device is read-only\n");
+ error_msg("WARNING: loop device is read-only\n");
flags &= ~MS_RDONLY;
}
}
#endif
status = mount(specialfile, dir, filesystemtype, flags, string_flags);
if (errno == EROFS) {
- errorMsg("%s is write-protected, mounting read-only\n", specialfile);
+ error_msg("%s is write-protected, mounting read-only\n", specialfile);
status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags);
}
}
@@ -173,7 +173,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
#endif
if (errno == EPERM) {
- fatalError("permission denied. Are you root?\n");
+ error_msg_and_die("permission denied. Are you root?\n");
}
return (FALSE);
@@ -273,18 +273,18 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- fatalError("open failed for `%s': %s\n", device, strerror (errno));
+ error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno));
/* How many filesystems? We need to know to allocate enough space */
numfilesystems = ioctl (fd, DEVMTAB_COUNT_FILESYSTEMS);
if (numfilesystems<0)
- fatalError("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno));
+ error_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno));
fslist = (struct k_fstype *) xcalloc ( numfilesystems, sizeof(struct k_fstype));
/* Grab the list of available filesystems */
status = ioctl (fd, DEVMTAB_GET_FILESYSTEMS, fslist);
if (status<0)
- fatalError("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno));
+ error_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno));
/* Walk the list trying to mount filesystems
* that do not claim to be nodev filesystems */
@@ -309,7 +309,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
if (status == FALSE) {
if (whineOnErrors == TRUE) {
- errorMsg("Mounting %s on %s failed: %s\n",
+ error_msg("Mounting %s on %s failed: %s\n",
blockDevice, directory, strerror(errno));
}
return (FALSE);
@@ -342,18 +342,18 @@ extern int mount_main(int argc, char **argv)
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- fatalError("open failed for `%s': %s\n", device, strerror (errno));
+ error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno));
/* How many mounted filesystems? We need to know to
* allocate enough space for later... */
numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS);
if (numfilesystems<0)
- fatalError( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno));
+ error_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno));
mntentlist = (struct k_mntent *) xcalloc ( numfilesystems, sizeof(struct k_mntent));
/* Grab the list of mounted filesystems */
if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0)
- fatalError( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno));
+ error_msg_and_die( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno));
for( i = 0 ; i < numfilesystems ; i++) {
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)
fstabmount = TRUE;
if (f == NULL)
- fatalError( "\nCannot read /etc/fstab: %s\n", strerror (errno));
+ error_msg_and_die( "\nCannot read /etc/fstab: %s\n", strerror (errno));
while ((m = getmntent(f)) != NULL) {
if (all == FALSE && directory == NULL && (
@@ -488,7 +488,7 @@ singlemount:
rc = nfsmount (device, directory, &flags,
&extra_opts, &string_flags, 1);
if ( rc != 0) {
- fatalError("nfsmount failed: %s\n", strerror(errno));
+ error_msg_and_die("nfsmount failed: %s\n", strerror(errno));
rc = EXIT_FAILURE;
}
}
diff --git a/mt.c b/mt.c
index 583674b18..2d35c7c22 100644
--- a/mt.c
+++ b/mt.c
@@ -75,7 +75,7 @@ extern int mt_main(int argc, char **argv)
}
if (code->name == 0) {
- errorMsg("unrecognized opcode %s.\n", argv[1]);
+ error_msg("unrecognized opcode %s.\n", argv[1]);
return EXIT_FAILURE;
}
diff --git a/mtab.c b/mtab.c
index 8984d8822..1f2083709 100644
--- a/mtab.c
+++ b/mtab.c
@@ -76,7 +76,7 @@ void write_mtab(char *blockDevice, char *directory,
#ifdef BB_FEATURE_USE_PROCFS
if (filesystemType == 0) {
- struct mntent *p = findMountPoint(blockDevice, "/proc/mounts");
+ struct mntent *p = find_mount_point(blockDevice, "/proc/mounts");
if (p && p->mnt_type)
filesystemType = p->mnt_type;
diff --git a/nc.c b/nc.c
index fcacb0c45..805bbd4d8 100644
--- a/nc.c
+++ b/nc.c
@@ -63,7 +63,7 @@ int nc_main(int argc, char **argv)
hostinfo = (struct hostent *) gethostbyname(*argv);
if (!hostinfo) {
- fatalError("cannot resolve %s\n", *argv);
+ error_msg_and_die("cannot resolve %s\n", *argv);
}
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 @@
/* vi: set sw=4 ts=4: */
/*
- * $Id: hostname.c,v 1.15 2000/10/12 22:30:31 andersen Exp $
+ * $Id: hostname.c,v 1.16 2000/12/07 19:56:48 markw Exp $
* Mini hostname implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -40,7 +40,7 @@ void do_sethostname(char *s, int isfile)
if (!isfile) {
if (sethostname(s, strlen(s)) < 0) {
if (errno == EPERM)
- errorMsg("you must be root to change the hostname\n");
+ error_msg("you must be root to change the hostname\n");
else
perror("sethostname");
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)
hostinfo = (struct hostent *) gethostbyname(*argv);
if (!hostinfo) {
- fatalError("cannot resolve %s\n", *argv);
+ error_msg_and_die("cannot resolve %s\n", *argv);
}
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 @@
/* vi: set sw=4 ts=4: */
/*
- * $Id: ping.c,v 1.27 2000/12/01 02:55:13 kraai Exp $
+ * $Id: ping.c,v 1.28 2000/12/07 19:56:48 markw Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -202,7 +202,7 @@ static void ping(const char *host)
pingaddr.sin_family = AF_INET;
if (!(h = gethostbyname(host))) {
- errorMsg("unknown host %s\n", host);
+ error_msg("unknown host %s\n", host);
exit(1);
}
memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr));
@@ -219,7 +219,7 @@ static void ping(const char *host)
if (c < 0 || c != sizeof(packet)) {
if (c < 0)
perror("ping: sendto");
- errorMsg("write incomplete\n");
+ error_msg("write incomplete\n");
exit(1);
}
@@ -325,9 +325,9 @@ static void sendping(int junk)
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
if (i < 0)
- fatalError("sendto: %s\n", strerror(errno));
+ error_msg_and_die("sendto: %s\n", strerror(errno));
else if ((size_t)i != sizeof(packet))
- fatalError("ping wrote %d chars; %d expected\n", i,
+ error_msg_and_die("ping wrote %d chars; %d expected\n", i,
(int)sizeof(packet));
signal(SIGALRM, sendping);
@@ -422,7 +422,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from)
printf("\n");
} else
if (icmppkt->icmp_type != ICMP_ECHO)
- errorMsg("Warning: Got ICMP %d (%s)\n",
+ error_msg("Warning: Got ICMP %d (%s)\n",
icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type));
}
@@ -440,7 +440,7 @@ static void ping(const char *host)
if ((pingsock = socket(AF_INET, SOCK_RAW,
(proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */
if (errno == EPERM) {
- errorMsg("permission denied. (are you root?)\n");
+ error_msg("permission denied. (are you root?)\n");
} else {
perror("ping: creating a raw socket");
}
@@ -454,12 +454,12 @@ static void ping(const char *host)
pingaddr.sin_family = AF_INET;
if (!(h = gethostbyname(host))) {
- errorMsg("unknown host %s\n", host);
+ error_msg("unknown host %s\n", host);
exit(1);
}
if (h->h_addrtype != AF_INET) {
- errorMsg("unknown address type; only AF_INET is currently supported.\n");
+ error_msg("unknown address type; only AF_INET is currently supported.\n");
exit(1);
}
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)
if ((unsigned)(port - 1 ) > 65534)
{
- fatalError("%s: bad port number\n", p);
+ error_msg_and_die("%s: bad port number\n", p);
}
return port;
}
@@ -595,7 +595,7 @@ static struct in_addr getserver(char * host)
struct hostent * he;
if ((he = gethostbyname(host)) == NULL)
{
- fatalError("%s: Unknown host\n", host);
+ error_msg_and_die("%s: Unknown host\n", host);
}
memcpy(&addr, he->h_addr, sizeof addr);
@@ -650,7 +650,7 @@ static int remote_connect(struct in_addr addr, int port)
if (connect(s, (struct sockaddr *)&s_addr, sizeof s_addr) < 0)
{
- fatalError("Unable to connect to remote host: %s\n", strerror(errno));
+ error_msg_and_die("Unable to connect to remote host: %s\n", strerror(errno));
}
return s;
}
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)
if (do_continue && !fname_out)
- fatalError("cannot specify continue (-c) without a filename (-O)\n");
+ error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n");
/*
* Parse url into components.
*/
@@ -117,7 +117,7 @@ int wget_main(int argc, char **argv)
if (fname_out != (char *)1) {
if ( (output=fopen(fname_out, (do_continue ? "a" : "w")))
== NULL)
- fatalPerror("fopen(%s)", fname_out);
+ perror_msg_and_die("fopen(%s)", fname_out);
} else {
output = stdout;
}
@@ -128,7 +128,7 @@ int wget_main(int argc, char **argv)
if (do_continue) {
struct stat sbuf;
if (fstat(fileno(output), &sbuf) < 0)
- fatalError("fstat()");
+ error_msg_and_die("fstat()");
if (sbuf.st_size > 0)
beg_range = sbuf.st_size;
else
@@ -147,7 +147,7 @@ int wget_main(int argc, char **argv)
* Retrieve HTTP response line and check for "200" status code.
*/
if (fgets(buf, sizeof(buf), sfp) == NULL)
- fatalError("no response from server\n");
+ error_msg_and_die("no response from server\n");
for (s = buf ; *s != '\0' && !isspace(*s) ; ++s)
;
for ( ; isspace(*s) ; ++s)
@@ -156,13 +156,13 @@ int wget_main(int argc, char **argv)
case 200:
if (!do_continue)
break;
- fatalError("server does not support ranges\n");
+ error_msg_and_die("server does not support ranges\n");
case 206:
if (do_continue)
break;
/*FALLTHRU*/
default:
- fatalError("server returned error: %s", buf);
+ error_msg_and_die("server returned error: %s", buf);
}
/*
@@ -175,7 +175,7 @@ int wget_main(int argc, char **argv)
continue;
}
if (strcmp(buf, "transfer-encoding") == 0) {
- fatalError("server wants to do %s transfer encoding\n", s);
+ error_msg_and_die("server wants to do %s transfer encoding\n", s);
continue;
}
}
@@ -197,7 +197,7 @@ int wget_main(int argc, char **argv)
filesize -= n;
}
if (n == 0 && ferror(sfp))
- fatalPerror("network read error");
+ perror_msg_and_die("network read error");
exit(0);
}
@@ -211,7 +211,7 @@ void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path)
*uri_port = 80;
if (strncmp(url, "http://", 7) != 0)
- fatalError("not an http url: %s\n", url);
+ error_msg_and_die("not an http url: %s\n", url);
/* pull the host portion to the front of the buffer */
for (s = url, h = url+7 ; *h != '/' && *h != 0; ++h) {
@@ -240,7 +240,7 @@ FILE *open_socket(char *host, int port)
memzero(&sin, sizeof(sin));
sin.sin_family = AF_INET;
if ((hp = (struct hostent *) gethostbyname(host)) == NULL)
- fatalError("cannot resolve %s\n", host);
+ error_msg_and_die("cannot resolve %s\n", host);
memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length);
sin.sin_port = htons(port);
@@ -248,11 +248,11 @@ FILE *open_socket(char *host, int port)
* Get the server onto a stdio stream.
*/
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
- fatalPerror("socket()");
+ perror_msg_and_die("socket()");
if (connect(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0)
- fatalPerror("connect(%s)", host);
+ perror_msg_and_die("connect(%s)", host);
if ((fp = fdopen(fd, "r+")) == NULL)
- fatalPerror("fdopen()");
+ perror_msg_and_die("fdopen()");
return fp;
}
@@ -281,7 +281,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc)
/* verify we are at the end of the header name */
if (*s != ':')
- fatalError("bad header line: %s\n", buf);
+ error_msg_and_die("bad header line: %s\n", buf);
/* locate the start of the header value */
for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s)
@@ -475,7 +475,7 @@ progressmeter(int flag)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: wget.c,v 1.9 2000/12/07 03:55:35 tausq Exp $
+ * $Id: wget.c,v 1.10 2000/12/07 19:56:48 markw Exp $
*/
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,
msock = fsock = -1;
mclient = NULL;
if (strlen(spec) >= sizeof(hostdir)) {
- errorMsg("excessively long host:dir argument\n");
+ error_msg("excessively long host:dir argument\n");
goto fail;
}
strcpy(hostdir, spec);
@@ -312,10 +312,10 @@ int nfsmount(const char *spec, const char *node, int *flags,
until they can be fully supported. (mack@sgi.com) */
if ((s = strchr(hostdir, ','))) {
*s = '\0';
- errorMsg("warning: multiple hostnames not supported\n");
+ error_msg("warning: multiple hostnames not supported\n");
}
} else {
- errorMsg("directory to mount not in host:dir format\n");
+ error_msg("directory to mount not in host:dir format\n");
goto fail;
}
@@ -325,11 +325,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
#endif
{
if ((hp = gethostbyname(hostname)) == NULL) {
- errorMsg("can't get address for %s\n", hostname);
+ error_msg("can't get address for %s\n", hostname);
goto fail;
} else {
if (hp->h_length > sizeof(struct in_addr)) {
- errorMsg("got bad hp->h_length\n");
+ error_msg("got bad hp->h_length\n");
hp->h_length = sizeof(struct in_addr);
}
memcpy(&server_addr.sin_addr,
@@ -346,7 +346,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
if (!old_opts)
old_opts = "";
if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
- errorMsg("excessively long option argument\n");
+ error_msg("excessively long option argument\n");
goto fail;
}
sprintf(new_opts, "%s%saddr=%s",
@@ -506,11 +506,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
data.flags |= (nolock ? NFS_MOUNT_NONLM : 0);
#endif
if (nfsvers > MAX_NFSPROT) {
- errorMsg("NFSv%d not supported!\n", nfsvers);
+ error_msg("NFSv%d not supported!\n", nfsvers);
return 0;
}
if (mountvers > MAX_NFSPROT) {
- errorMsg("NFSv%d not supported!\n", nfsvers);
+ error_msg("NFSv%d not supported!\n", nfsvers);
return 0;
}
if (nfsvers && !mountvers)
@@ -570,11 +570,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
mount_server_addr.sin_addr.s_addr = inet_addr(hostname);
} else {
if ((hp = gethostbyname(mounthost)) == NULL) {
- errorMsg("can't get address for %s\n", hostname);
+ error_msg("can't get address for %s\n", hostname);
goto fail;
} else {
if (hp->h_length > sizeof(struct in_addr)) {
- errorMsg("got bad hp->h_length?\n");
+ error_msg("got bad hp->h_length?\n");
hp->h_length = sizeof(struct in_addr);
}
mount_server_addr.sin_family = AF_INET;
@@ -709,7 +709,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
if (nfsvers == 2) {
if (status.nfsv2.fhs_status != 0) {
- errorMsg("%s:%s failed, reason given by server: %s\n",
+ error_msg("%s:%s failed, reason given by server: %s\n",
hostname, dirname,
nfs_strerror(status.nfsv2.fhs_status));
goto fail;
@@ -727,7 +727,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
#if NFS_MOUNT_VERSION >= 4
fhandle3 *fhandle;
if (status.nfsv3.fhs_status != 0) {
- errorMsg("%s:%s failed, reason given by server: %s\n",
+ error_msg("%s:%s failed, reason given by server: %s\n",
hostname, dirname,
nfs_strerror(status.nfsv3.fhs_status));
goto fail;
diff --git a/ping.c b/ping.c
index af109cf0a..ccc535b26 100644
--- a/ping.c
+++ b/ping.c
@@ -1,6 +1,6 @@
/* vi: set sw=4 ts=4: */
/*
- * $Id: ping.c,v 1.27 2000/12/01 02:55:13 kraai Exp $
+ * $Id: ping.c,v 1.28 2000/12/07 19:56:48 markw Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -202,7 +202,7 @@ static void ping(const char *host)
pingaddr.sin_family = AF_INET;
if (!(h = gethostbyname(host))) {
- errorMsg("unknown host %s\n", host);
+ error_msg("unknown host %s\n", host);
exit(1);
}
memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr));
@@ -219,7 +219,7 @@ static void ping(const char *host)
if (c < 0 || c != sizeof(packet)) {
if (c < 0)
perror("ping: sendto");
- errorMsg("write incomplete\n");
+ error_msg("write incomplete\n");
exit(1);
}
@@ -325,9 +325,9 @@ static void sendping(int junk)
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
if (i < 0)
- fatalError("sendto: %s\n", strerror(errno));
+ error_msg_and_die("sendto: %s\n", strerror(errno));
else if ((size_t)i != sizeof(packet))
- fatalError("ping wrote %d chars; %d expected\n", i,
+ error_msg_and_die("ping wrote %d chars; %d expected\n", i,
(int)sizeof(packet));
signal(SIGALRM, sendping);
@@ -422,7 +422,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from)
printf("\n");
} else
if (icmppkt->icmp_type != ICMP_ECHO)
- errorMsg("Warning: Got ICMP %d (%s)\n",
+ error_msg("Warning: Got ICMP %d (%s)\n",
icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type));
}
@@ -440,7 +440,7 @@ static void ping(const char *host)
if ((pingsock = socket(AF_INET, SOCK_RAW,
(proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */
if (errno == EPERM) {
- errorMsg("permission denied. (are you root?)\n");
+ error_msg("permission denied. (are you root?)\n");
} else {
perror("ping: creating a raw socket");
}
@@ -454,12 +454,12 @@ static void ping(const char *host)
pingaddr.sin_family = AF_INET;
if (!(h = gethostbyname(host))) {
- errorMsg("unknown host %s\n", host);
+ error_msg("unknown host %s\n", host);
exit(1);
}
if (h->h_addrtype != AF_INET) {
- errorMsg("unknown address type; only AF_INET is currently supported.\n");
+ error_msg("unknown address type; only AF_INET is currently supported.\n");
exit(1);
}
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)
{
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
- return(kill(*(findPidByName("init")), SIGUSR2));
+ return(kill(*(find_pid_by_name("init")), SIGUSR2));
#else
return(kill(1, SIGUSR2));
#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)
int pid;
if (!isdigit(**argv))
- fatalError( "Bad PID: %s\n", strerror(errno));
+ error_msg_and_die( "Bad PID: %s\n", strerror(errno));
pid = strtol(*argv, NULL, 0);
if (kill(pid, sig) != 0)
- fatalError( "Could not kill pid '%d': %s\n", pid, strerror(errno));
+ error_msg_and_die( "Could not kill pid '%d': %s\n", pid, strerror(errno));
argv++;
}
}
@@ -219,20 +219,20 @@ extern int kill_main(int argc, char **argv)
while (--argc >= 0) {
pid_t* pidList;
- pidList = findPidByName( *argv);
+ pidList = find_pid_by_name( *argv);
if (!pidList) {
all_found = FALSE;
- errorMsg( "%s: no process killed\n", *argv);
+ error_msg( "%s: no process killed\n", *argv);
}
for(; pidList && *pidList!=0; pidList++) {
if (*pidList==myPid)
continue;
if (kill(*pidList, sig) != 0)
- fatalError( "Could not kill pid '%d': %s\n", *pidList, strerror(errno));
+ error_msg_and_die( "Could not kill pid '%d': %s\n", *pidList, strerror(errno));
}
/* Note that we don't bother to free the memory
- * allocated in findPidByName(). It will be freed
+ * allocated in find_pid_by_name(). It will be freed
* upon exit, so we can save a byte or two */
argv++;
}
@@ -245,5 +245,5 @@ extern int kill_main(int argc, char **argv)
end:
- fatalError( "bad signal name: %s\n", *argv);
+ error_msg_and_die( "bad signal name: %s\n", *argv);
}
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)
if (tmp)
sscanf(tmp, "Pid:\t%d\n" "PPid:\t%d\n", &P->pid, &P->ppid);
else
- errorMsg("Internal error!\n");
+ error_msg("Internal error!\n");
/* For busybox, ignoring effective, saved, etc */
tmp = strstr(S, "Uid:");
if (tmp)
sscanf(tmp, "Uid:\t%d", &P->ruid);
else
- errorMsg("Internal error!\n");
+ error_msg("Internal error!\n");
tmp = strstr(S, "Gid:");
if (tmp)
sscanf(tmp, "Gid:\t%d", &P->rgid);
else
- errorMsg("Internal error!\n");
+ error_msg("Internal error!\n");
}
@@ -135,7 +135,7 @@ extern int ps_main(int argc, char **argv)
dir = opendir("/proc");
if (!dir)
- fatalError("Can't open /proc\n");
+ error_msg_and_die("Can't open /proc\n");
#ifdef BB_FEATURE_AUTOWIDTH
ioctl(fileno(stdout), TIOCGWINSZ, &win);
@@ -219,11 +219,11 @@ extern int ps_main(int argc, char **argv)
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- fatalError( "open failed for `%s': %s\n", device, strerror (errno));
+ error_msg_and_die( "open failed for `%s': %s\n", device, strerror (errno));
/* Find out how many processes there are */
if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0)
- fatalError( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
+ error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
/* Allocate some memory -- grab a few extras just in case
* some new processes start up while we wait. The kernel will
@@ -234,7 +234,7 @@ extern int ps_main(int argc, char **argv)
/* Now grab the pid list */
if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0)
- fatalError("\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
+ error_msg_and_die("\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
#ifdef BB_FEATURE_AUTOWIDTH
ioctl(fileno(stdout), TIOCGWINSZ, &win);
@@ -252,7 +252,7 @@ extern int ps_main(int argc, char **argv)
info.pid = pid_array[i];
if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)
- fatalError("\nDEVPS_GET_PID_INFO: %s\n", strerror (errno));
+ error_msg_and_die("\nDEVPS_GET_PID_INFO: %s\n", strerror (errno));
/* Make some adjustments as needed */
my_getpwuid(uidName, info.euid);
@@ -282,7 +282,7 @@ extern int ps_main(int argc, char **argv)
/* close device */
if (close (fd) != 0)
- fatalError("close failed for `%s': %s\n", device, strerror (errno));
+ error_msg_and_die("close failed for `%s': %s\n", device, strerror (errno));
exit (0);
}
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)
if (setpriority(PRIO_PROCESS, ps, prio) == 0) {
printf("%d: old priority %d, new priority %d\n", ps, oldp, prio );
} else {
- perrorMsg("%d: setpriority", ps);
+ perror_msg("%d: setpriority", ps);
status = EXIT_FAILURE;
}
}
diff --git a/ps.c b/ps.c
index 4998e15b1..79910fe34 100644
--- a/ps.c
+++ b/ps.c
@@ -97,20 +97,20 @@ static void parse_proc_status(char *S, proc_t * P)
if (tmp)
sscanf(tmp, "Pid:\t%d\n" "PPid:\t%d\n", &P->pid, &P->ppid);
else
- errorMsg("Internal error!\n");
+ error_msg("Internal error!\n");
/* For busybox, ignoring effective, saved, etc */
tmp = strstr(S, "Uid:");
if (tmp)
sscanf(tmp, "Uid:\t%d", &P->ruid);
else
- errorMsg("Internal error!\n");
+ error_msg("Internal error!\n");
tmp = strstr(S, "Gid:");
if (tmp)
sscanf(tmp, "Gid:\t%d", &P->rgid);
else
- errorMsg("Internal error!\n");
+ error_msg("Internal error!\n");
}
@@ -135,7 +135,7 @@ extern int ps_main(int argc, char **argv)
dir = opendir("/proc");
if (!dir)
- fatalError("Can't open /proc\n");
+ error_msg_and_die("Can't open /proc\n");
#ifdef BB_FEATURE_AUTOWIDTH
ioctl(fileno(stdout), TIOCGWINSZ, &win);
@@ -219,11 +219,11 @@ extern int ps_main(int argc, char **argv)
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- fatalError( "open failed for `%s': %s\n", device, strerror (errno));
+ error_msg_and_die( "open failed for `%s': %s\n", device, strerror (errno));
/* Find out how many processes there are */
if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0)
- fatalError( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
+ error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
/* Allocate some memory -- grab a few extras just in case
* some new processes start up while we wait. The kernel will
@@ -234,7 +234,7 @@ extern int ps_main(int argc, char **argv)
/* Now grab the pid list */
if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0)
- fatalError("\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
+ error_msg_and_die("\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
#ifdef BB_FEATURE_AUTOWIDTH
ioctl(fileno(stdout), TIOCGWINSZ, &win);
@@ -252,7 +252,7 @@ extern int ps_main(int argc, char **argv)
info.pid = pid_array[i];
if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)
- fatalError("\nDEVPS_GET_PID_INFO: %s\n", strerror (errno));
+ error_msg_and_die("\nDEVPS_GET_PID_INFO: %s\n", strerror (errno));
/* Make some adjustments as needed */
my_getpwuid(uidName, info.euid);
@@ -282,7 +282,7 @@ extern int ps_main(int argc, char **argv)
/* close device */
if (close (fd) != 0)
- fatalError("close failed for `%s': %s\n", device, strerror (errno));
+ error_msg_and_die("close failed for `%s': %s\n", device, strerror (errno));
exit (0);
}
diff --git a/pwd.c b/pwd.c
index 54129b175..71731944c 100644
--- a/pwd.c
+++ b/pwd.c
@@ -31,7 +31,7 @@ extern int pwd_main(int argc, char **argv)
char buf[BUFSIZ + 1];
if (getcwd(buf, sizeof(buf)) == NULL)
- fatalError("%s\n", strerror(errno));
+ error_msg_and_die("%s\n", strerror(errno));
printf("%s\n", buf);
return EXIT_SUCCESS;
diff --git a/rdate.c b/rdate.c
index 7c8d54117..87edecbfc 100644
--- a/rdate.c
+++ b/rdate.c
@@ -47,15 +47,15 @@ time_t askremotedate(char *host)
int fd;
if (!(h = gethostbyname(host))) { /* get the IP addr */
- errorMsg("%s: %s\n", host, strerror(errno));
+ error_msg("%s: %s\n", host, strerror(errno));
return(-1);
}
if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */
- errorMsg("%s: %s\n", "time", strerror(errno));
+ error_msg("%s: %s\n", "time", strerror(errno));
return(-1);
}
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { /* get net connection */
- errorMsg("%s: %s\n", "socket", strerror(errno));
+ error_msg("%s: %s\n", "socket", strerror(errno));
return(-1);
}
@@ -64,13 +64,13 @@ time_t askremotedate(char *host)
sin.sin_family = AF_INET;
if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { /* connect to time server */
- errorMsg("%s: %s\n", host, strerror(errno));
+ error_msg("%s: %s\n", host, strerror(errno));
close(fd);
return(-1);
}
if (read(fd, (void *)&nett, 4) != 4) { /* read time from server */
close(fd);
- errorMsg("%s did not send the complete time\n", host);
+ error_msg("%s did not send the complete time\n", host);
}
close(fd);
@@ -123,7 +123,7 @@ int rdate_main(int argc, char **argv)
}
if (setdate) {
if (stime(&time) < 0)
- fatalError("Could not set time of day: %s\n", strerror(errno));
+ error_msg_and_die("Could not set time of day: %s\n", strerror(errno));
}
if (printdate) {
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)
buf = xrealloc(buf, bufsize);
size = readlink(argv[1], buf, bufsize);
if (size == -1)
- fatalError("%s: %s\n", argv[1], strerror(errno));
+ error_msg_and_die("%s: %s\n", argv[1], strerror(errno));
}
buf[size] = '\0';
diff --git a/reboot.c b/reboot.c
index 354286d47..3e5f2382c 100644
--- a/reboot.c
+++ b/reboot.c
@@ -28,7 +28,7 @@ extern int reboot_main(int argc, char **argv)
{
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
- return(kill(*(findPidByName("init")), SIGINT));
+ return(kill(*(find_pid_by_name("init")), SIGINT));
#else
return(kill(1, SIGINT));
#endif
diff --git a/renice.c b/renice.c
index c81f31c5c..8f0618126 100644
--- a/renice.c
+++ b/renice.c
@@ -44,7 +44,7 @@ extern int renice_main(int argc, char **argv)
if (setpriority(PRIO_PROCESS, ps, prio) == 0) {
printf("%d: old priority %d, new priority %d\n", ps, oldp, prio );
} else {
- perrorMsg("%d: setpriority", ps);
+ perror_msg("%d: setpriority", ps);
status = EXIT_FAILURE;
}
}
diff --git a/rm.c b/rm.c
index 566335158..a9501ec7f 100644
--- a/rm.c
+++ b/rm.c
@@ -37,7 +37,7 @@ static const char *srcName;
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
{
if (unlink(fileName) < 0) {
- perrorMsg("%s", fileName);
+ perror_msg("%s", fileName);
return (FALSE);
}
return (TRUE);
@@ -47,11 +47,11 @@ static int dirAction(const char *fileName, struct stat *statbuf, void* junk)
{
if (recursiveFlag == FALSE) {
errno = EISDIR;
- perrorMsg("%s", fileName);
+ perror_msg("%s", fileName);
return (FALSE);
}
if (rmdir(fileName) < 0) {
- perrorMsg("%s", fileName);
+ perror_msg("%s", fileName);
return (FALSE);
}
return (TRUE);
@@ -101,7 +101,7 @@ extern int rm_main(int argc, char **argv)
&& errno == ENOENT) {
/* do not reports errors for non-existent files if -f, just skip them */
} else {
- if (recursiveAction(srcName, recursiveFlag, FALSE,
+ if (recursive_action(srcName, recursiveFlag, FALSE,
TRUE, fileAction, dirAction, NULL) == FALSE) {
status = EXIT_FAILURE;
}
diff --git a/rmdir.c b/rmdir.c
index dfe53b215..f9f82bba4 100644
--- a/rmdir.c
+++ b/rmdir.c
@@ -35,7 +35,7 @@ extern int rmdir_main(int argc, char **argv)
while (--argc > 0) {
if (rmdir(*(++argv)) == -1) {
- perrorMsg("%s", *argv);
+ perror_msg("%s", *argv);
status = EXIT_FAILURE;
}
}
diff --git a/sed.c b/sed.c
index f26e6e304..812f62145 100644
--- a/sed.c
+++ b/sed.c
@@ -215,14 +215,14 @@ static int get_address(const char *str, int *line, regex_t **regex)
else if (my_str[idx] == '/') {
idx = index_of_next_unescaped_slash(my_str, ++idx);
if (idx == -1)
- fatalError("unterminated match expression\n");
+ error_msg_and_die("unterminated match expression\n");
my_str[idx] = '\0';
*regex = (regex_t *)xmalloc(sizeof(regex_t));
xregcomp(*regex, my_str+1, 0);
idx++; /* so it points to the next character after the last '/' */
}
else {
- errorMsg("get_address: no address found in string\n"
+ error_msg("get_address: no address found in string\n"
"\t(you probably didn't check the string you passed me)\n");
idx = -1;
}
@@ -258,13 +258,13 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr)
/* verify that the 's' is followed by a 'slash' */
if (substr[++idx] != '/')
- fatalError("bad format in substitution expression\n");
+ error_msg_and_die("bad format in substitution expression\n");
/* save the match string */
oldidx = idx+1;
idx = index_of_next_unescaped_slash(substr, ++idx);
if (idx == -1)
- fatalError("bad format in substitution expression\n");
+ error_msg_and_die("bad format in substitution expression\n");
match = strdup_substr(substr, oldidx, idx);
/* 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)
oldidx = idx+1;
idx = index_of_next_unescaped_slash(substr, ++idx);
if (idx == -1)
- fatalError("bad format in substitution expression\n");
+ error_msg_and_die("bad format in substitution expression\n");
sed_cmd->replace = strdup_substr(substr, oldidx, idx);
/* process the flags */
@@ -303,7 +303,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr)
if (strchr("; \t\v\n\r", substr[idx]))
goto out;
/* else */
- fatalError("bad option in substitution expression\n");
+ error_msg_and_die("bad option in substitution expression\n");
}
}
@@ -345,7 +345,7 @@ static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr)
*/
if (editstr[1] != '\\' && (editstr[2] != '\n' || editstr[2] != '\r'))
- fatalError("bad format in edit expression\n");
+ error_msg_and_die("bad format in edit expression\n");
/* store the edit line text */
/* 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)
/* last part (mandatory) will be a command */
if (cmdstr[idx] == '\0')
- fatalError("missing command\n");
+ error_msg_and_die("missing command\n");
if (!strchr("pdsaic", cmdstr[idx])) /* <-- XXX add new commands here */
- fatalError("invalid command\n");
+ error_msg_and_die("invalid command\n");
sed_cmd->cmd = cmdstr[idx];
/* special-case handling for (s)ubstitution */
@@ -421,7 +421,7 @@ static char *parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr)
/* special-case handling for (a)ppend, (i)nsert, and (c)hange */
else if (strchr("aic", cmdstr[idx])) {
if (sed_cmd->end_line || sed_cmd->end_match)
- fatalError("only a beginning address can be specified for edit commands\n");
+ error_msg_and_die("only a beginning address can be specified for edit commands\n");
idx += parse_edit_cmd(sed_cmd, &cmdstr[idx]);
}
/* 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)
for (i = optind; i < argc; i++) {
file = fopen(argv[i], "r");
if (file == NULL) {
- errorMsg("%s: %s\n", argv[i], strerror(errno));
+ error_msg("%s: %s\n", argv[i], strerror(errno));
} else {
process_file(file);
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)
a.keycode = atoi(argv[2]);
a.scancode = sc = strtol(argv[1], &ep, 16);
if (*ep) {
- fatalError("error reading SCANCODE: '%s'\n", argv[1]);
+ error_msg_and_die("error reading SCANCODE: '%s'\n", argv[1]);
}
if (a.scancode > 127) {
a.scancode -= 0xe000;
a.scancode += 128;
}
if (a.scancode > 255 || a.keycode > 127) {
- fatalError("SCANCODE or KEYCODE outside bounds\n");
+ error_msg_and_die("SCANCODE or KEYCODE outside bounds\n");
}
if (ioctl(fd,KDSETKEYCODE,&a)) {
perror("KDSETKEYCODE");
- fatalError("failed to set SCANCODE %x to KEYCODE %d\n", sc, a.keycode);
+ error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d\n", sc, a.keycode);
}
argc -= 2;
argv += 2;
diff --git a/sh.c b/sh.c
index bb8a456b7..4b1ae6d27 100644
--- a/sh.c
+++ b/sh.c
@@ -250,7 +250,7 @@ static int builtin_exec(struct job *cmd, struct jobSet *junk)
{
cmd->progs[0].argv++;
execvp(cmd->progs[0].argv[0], cmd->progs[0].argv);
- fatalError("Exec to %s failed: %s\n", cmd->progs[0].argv[0],
+ error_msg_and_die("Exec to %s failed: %s\n", cmd->progs[0].argv[0],
strerror(errno));
}
return EXIT_SUCCESS;
@@ -273,12 +273,12 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList)
if (!jobList->head) {
if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) {
- errorMsg("%s: exactly one argument is expected\n",
+ error_msg("%s: exactly one argument is expected\n",
cmd->progs[0].argv[0]);
return EXIT_FAILURE;
}
if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) {
- errorMsg("%s: bad argument '%s'\n",
+ error_msg("%s: bad argument '%s'\n",
cmd->progs[0].argv[0], cmd->progs[0].argv[1]);
return EXIT_FAILURE;
for (job = jobList->head; job; job = job->next) {
@@ -292,7 +292,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList)
}
if (!job) {
- errorMsg("%s: unknown job %d\n",
+ error_msg("%s: unknown job %d\n",
cmd->progs[0].argv[0], jobNum);
return EXIT_FAILURE;
}
@@ -444,7 +444,7 @@ static int builtin_then(struct job *cmd, struct jobSet *junk)
char* charptr1=cmd->text+5; /* skip over the leading 'then ' */
if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
- errorMsg("unexpected token `then'\n");
+ error_msg("unexpected token `then'\n");
return EXIT_FAILURE;
}
/* If the if result was FALSE, skip the 'then' stuff */
@@ -471,7 +471,7 @@ static int builtin_else(struct job *cmd, struct jobSet *junk)
char* charptr1=cmd->text+5; /* skip over the leading 'else ' */
if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
- errorMsg("unexpected token `else'\n");
+ error_msg("unexpected token `else'\n");
return EXIT_FAILURE;
}
/* If the if result was TRUE, skip the 'else' stuff */
@@ -495,7 +495,7 @@ static int builtin_else(struct job *cmd, struct jobSet *junk)
static int builtin_fi(struct job *cmd, struct jobSet *junk)
{
if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
- errorMsg("unexpected token `fi'\n");
+ error_msg("unexpected token `fi'\n");
return EXIT_FAILURE;
}
/* Clear out the if and then context bits */
@@ -646,7 +646,7 @@ static int setupRedirections(struct childProgram *prog)
if (openfd < 0) {
/* this could get lost if stderr has been redirected, but
bash and ash both lose it as well (though zsh doesn't!) */
- errorMsg("error opening %s: %s\n", redir->filename,
+ error_msg("error opening %s: %s\n", redir->filename,
strerror(errno));
return 1;
}
@@ -820,7 +820,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){
rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->globResult);
if (rc == GLOB_NOSPACE) {
- errorMsg("out of space during glob operation\n");
+ error_msg("out of space during glob operation\n");
return;
} else if (rc == GLOB_NOMATCH ||
(!rc && (prog->globResult.gl_pathc - i) == 1 &&
@@ -927,7 +927,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
if (*src == '\\') {
src++;
if (!*src) {
- errorMsg("character expected after \\\n");
+ error_msg("character expected after \\\n");
freeJob(job);
return 1;
}
@@ -1009,7 +1009,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
chptr++;
if (!*chptr) {
- errorMsg("file name expected after %c\n", *src);
+ error_msg("file name expected after %c\n", *src);
freeJob(job);
job->numProgs=0;
return 1;
@@ -1028,7 +1028,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
if (*prog->argv[argc_l])
argc_l++;
if (!argc_l) {
- errorMsg("empty command in pipe\n");
+ error_msg("empty command in pipe\n");
freeJob(job);
job->numProgs=0;
return 1;
@@ -1055,7 +1055,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
src++;
if (!*src) {
- errorMsg("empty command in pipe\n");
+ error_msg("empty command in pipe\n");
freeJob(job);
job->numProgs=0;
return 1;
@@ -1114,7 +1114,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
* command line, making extra room as needed */
--src;
charptr1 = xmalloc(BUFSIZ);
- while ( (size=fullRead(pipefd[0], charptr1, BUFSIZ-1)) >0) {
+ while ( (size=full_read(pipefd[0], charptr1, BUFSIZ-1)) >0) {
int newSize=src - *commandPtr + size + 1 + strlen(charptr2);
if (newSize > BUFSIZ) {
*commandPtr=xrealloc(*commandPtr, src - *commandPtr +
@@ -1145,7 +1145,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
case '\\':
src++;
if (!*src) {
- errorMsg("character expected after \\\n");
+ error_msg("character expected after \\\n");
freeJob(job);
return 1;
}
@@ -1291,7 +1291,7 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int
#endif
execvp(newJob->progs[i].argv[0], newJob->progs[i].argv);
- fatalError("%s: %s\n", newJob->progs[i].argv[0],
+ error_msg_and_die("%s: %s\n", newJob->progs[i].argv[0],
strerror(errno));
}
if (outPipe[1]!=-1) {
@@ -1495,7 +1495,7 @@ int shell_main(int argc_l, char **argv_l)
case 'c':
input = NULL;
if (local_pending_command != 0)
- fatalError("multiple -c arguments\n");
+ error_msg_and_die("multiple -c arguments\n");
local_pending_command = xstrdup(argv[optind]);
optind++;
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)
cmdedit_termw = w;
cmdedit_scroll = w / 3;
} else {
- errorMsg("\n*** Error: minimum screen width is 21\n");
+ error_msg("\n*** Error: minimum screen width is 21\n");
}
}
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)
{
cmd->progs[0].argv++;
execvp(cmd->progs[0].argv[0], cmd->progs[0].argv);
- fatalError("Exec to %s failed: %s\n", cmd->progs[0].argv[0],
+ error_msg_and_die("Exec to %s failed: %s\n", cmd->progs[0].argv[0],
strerror(errno));
}
return EXIT_SUCCESS;
@@ -273,12 +273,12 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList)
if (!jobList->head) {
if (!cmd->progs[0].argv[1] || cmd->progs[0].argv[2]) {
- errorMsg("%s: exactly one argument is expected\n",
+ error_msg("%s: exactly one argument is expected\n",
cmd->progs[0].argv[0]);
return EXIT_FAILURE;
}
if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) {
- errorMsg("%s: bad argument '%s'\n",
+ error_msg("%s: bad argument '%s'\n",
cmd->progs[0].argv[0], cmd->progs[0].argv[1]);
return EXIT_FAILURE;
for (job = jobList->head; job; job = job->next) {
@@ -292,7 +292,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList)
}
if (!job) {
- errorMsg("%s: unknown job %d\n",
+ error_msg("%s: unknown job %d\n",
cmd->progs[0].argv[0], jobNum);
return EXIT_FAILURE;
}
@@ -444,7 +444,7 @@ static int builtin_then(struct job *cmd, struct jobSet *junk)
char* charptr1=cmd->text+5; /* skip over the leading 'then ' */
if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
- errorMsg("unexpected token `then'\n");
+ error_msg("unexpected token `then'\n");
return EXIT_FAILURE;
}
/* If the if result was FALSE, skip the 'then' stuff */
@@ -471,7 +471,7 @@ static int builtin_else(struct job *cmd, struct jobSet *junk)
char* charptr1=cmd->text+5; /* skip over the leading 'else ' */
if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
- errorMsg("unexpected token `else'\n");
+ error_msg("unexpected token `else'\n");
return EXIT_FAILURE;
}
/* If the if result was TRUE, skip the 'else' stuff */
@@ -495,7 +495,7 @@ static int builtin_else(struct job *cmd, struct jobSet *junk)
static int builtin_fi(struct job *cmd, struct jobSet *junk)
{
if (! (cmd->jobContext & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
- errorMsg("unexpected token `fi'\n");
+ error_msg("unexpected token `fi'\n");
return EXIT_FAILURE;
}
/* Clear out the if and then context bits */
@@ -646,7 +646,7 @@ static int setupRedirections(struct childProgram *prog)
if (openfd < 0) {
/* this could get lost if stderr has been redirected, but
bash and ash both lose it as well (though zsh doesn't!) */
- errorMsg("error opening %s: %s\n", redir->filename,
+ error_msg("error opening %s: %s\n", redir->filename,
strerror(errno));
return 1;
}
@@ -820,7 +820,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){
rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->globResult);
if (rc == GLOB_NOSPACE) {
- errorMsg("out of space during glob operation\n");
+ error_msg("out of space during glob operation\n");
return;
} else if (rc == GLOB_NOMATCH ||
(!rc && (prog->globResult.gl_pathc - i) == 1 &&
@@ -927,7 +927,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
if (*src == '\\') {
src++;
if (!*src) {
- errorMsg("character expected after \\\n");
+ error_msg("character expected after \\\n");
freeJob(job);
return 1;
}
@@ -1009,7 +1009,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
chptr++;
if (!*chptr) {
- errorMsg("file name expected after %c\n", *src);
+ error_msg("file name expected after %c\n", *src);
freeJob(job);
job->numProgs=0;
return 1;
@@ -1028,7 +1028,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
if (*prog->argv[argc_l])
argc_l++;
if (!argc_l) {
- errorMsg("empty command in pipe\n");
+ error_msg("empty command in pipe\n");
freeJob(job);
job->numProgs=0;
return 1;
@@ -1055,7 +1055,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
src++;
if (!*src) {
- errorMsg("empty command in pipe\n");
+ error_msg("empty command in pipe\n");
freeJob(job);
job->numProgs=0;
return 1;
@@ -1114,7 +1114,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
* command line, making extra room as needed */
--src;
charptr1 = xmalloc(BUFSIZ);
- while ( (size=fullRead(pipefd[0], charptr1, BUFSIZ-1)) >0) {
+ while ( (size=full_read(pipefd[0], charptr1, BUFSIZ-1)) >0) {
int newSize=src - *commandPtr + size + 1 + strlen(charptr2);
if (newSize > BUFSIZ) {
*commandPtr=xrealloc(*commandPtr, src - *commandPtr +
@@ -1145,7 +1145,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
case '\\':
src++;
if (!*src) {
- errorMsg("character expected after \\\n");
+ error_msg("character expected after \\\n");
freeJob(job);
return 1;
}
@@ -1291,7 +1291,7 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int
#endif
execvp(newJob->progs[i].argv[0], newJob->progs[i].argv);
- fatalError("%s: %s\n", newJob->progs[i].argv[0],
+ error_msg_and_die("%s: %s\n", newJob->progs[i].argv[0],
strerror(errno));
}
if (outPipe[1]!=-1) {
@@ -1495,7 +1495,7 @@ int shell_main(int argc_l, char **argv_l)
case 'c':
input = NULL;
if (local_pending_command != 0)
- fatalError("multiple -c arguments\n");
+ error_msg_and_die("multiple -c arguments\n");
local_pending_command = xstrdup(argv[optind]);
optind++;
argv = argv+optind;
diff --git a/sort.c b/sort.c
index d6c3e9a5b..b0bf6e494 100644
--- a/sort.c
+++ b/sort.c
@@ -247,7 +247,7 @@ int sort_main(int argc, char **argv)
break;
#endif
default:
- errorMsg("invalid option -- %c\n", opt);
+ error_msg("invalid option -- %c\n", opt);
usage(sort_usage);
}
} else {
@@ -286,4 +286,4 @@ int sort_main(int argc, char **argv)
return(0);
}
-/* $Id: sort.c,v 1.23 2000/09/28 17:49:59 beppu Exp $ */
+/* $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)
struct stat statBuf;
if (stat("/etc/fstab", &statBuf) < 0)
- fatalError("/etc/fstab file missing\n");
+ error_msg_and_die("/etc/fstab file missing\n");
}
do_em_all();
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)
*s = '\0';
fac = decode(save, facilitynames);
if (fac < 0)
- fatalError("unknown facility name: %s\n", save);
+ error_msg_and_die("unknown facility name: %s\n", save);
*s++ = '.';
} else {
s = save;
}
lev = decode(s, prioritynames);
if (lev < 0)
- fatalError("unknown priority name: %s\n", save);
+ error_msg_and_die("unknown priority name: %s\n", save);
return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK));
}
@@ -152,7 +152,7 @@ extern int logger_main(int argc, char **argv)
if (argc >= 1)
message = *argv;
else
- fatalError("No message\n");
+ error_msg_and_die("No message\n");
}
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)
v->iov_len = strlen(msg);
if ( -1 == writev(remotefd,iov, IOV_COUNT)){
- fatalError("syslogd: cannot write to remote file handle on"
+ error_msg_and_die("syslogd: cannot write to remote file handle on"
"%s:%d\n",RemoteHost,RemotePort);
}
}
@@ -260,13 +260,13 @@ static void init_RemoteLog (void){
remotefd = socket(AF_INET, SOCK_DGRAM, 0);
if (remotefd < 0) {
- fatalError("syslogd: cannot create socket\n");
+ error_msg_and_die("syslogd: cannot create socket\n");
}
hostinfo = (struct hostent *) gethostbyname(RemoteHost);
if (!hostinfo) {
- fatalError("syslogd: cannot resolve remote host name [%s]\n", RemoteHost);
+ error_msg_and_die("syslogd: cannot resolve remote host name [%s]\n", RemoteHost);
}
remoteaddr.sin_family = AF_INET;
@@ -278,7 +278,7 @@ static void init_RemoteLog (void){
for future operations
*/
if ( 0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))){
- fatalError("syslogd: cannot connect to remote host %s:%d\n", RemoteHost, RemotePort);
+ error_msg_and_die("syslogd: cannot connect to remote host %s:%d\n", RemoteHost, RemotePort);
}
}
@@ -311,7 +311,7 @@ static void doSyslogd (void)
/* Create the syslog file so realpath() can work. */
close (open (_PATH_LOG, O_RDWR | O_CREAT, 0644));
if (realpath (_PATH_LOG, lfile) == NULL)
- fatalError ("Could not resolve path to " _PATH_LOG ": %s\n", strerror (errno));
+ error_msg_and_die ("Could not resolve path to " _PATH_LOG ": %s\n", strerror (errno));
unlink (lfile);
@@ -319,14 +319,14 @@ static void doSyslogd (void)
sunx.sun_family = AF_UNIX;
strncpy (sunx.sun_path, lfile, sizeof (sunx.sun_path));
if ((sock_fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
- fatalError ("Couldn't obtain descriptor for socket " _PATH_LOG ": %s\n", strerror (errno));
+ error_msg_and_die ("Couldn't obtain descriptor for socket " _PATH_LOG ": %s\n", strerror (errno));
addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path);
if ((bind (sock_fd, (struct sockaddr *) &sunx, addrLength)) || (listen (sock_fd, 5)))
- fatalError ("Could not connect to socket " _PATH_LOG ": %s\n", strerror (errno));
+ error_msg_and_die ("Could not connect to socket " _PATH_LOG ": %s\n", strerror (errno));
if (chmod (lfile, 0666) < 0)
- fatalError ("Could not set permission on " _PATH_LOG ": %s\n", strerror (errno));
+ error_msg_and_die ("Could not set permission on " _PATH_LOG ": %s\n", strerror (errno));
FD_ZERO (&fds);
FD_SET (sock_fd, &fds);
@@ -349,7 +349,7 @@ static void doSyslogd (void)
if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) {
if (errno == EINTR) continue; /* alarm may have happened. */
- fatalError ("select error: %s\n", strerror (errno));
+ error_msg_and_die ("select error: %s\n", strerror (errno));
}
for (fd = 0; (n_ready > 0) && (fd < FD_SETSIZE); fd++) {
@@ -363,7 +363,7 @@ static void doSyslogd (void)
pid_t pid;
if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) {
- fatalError ("accept error: %s\n", strerror (errno));
+ error_msg_and_die ("accept error: %s\n", strerror (errno));
}
pid = fork();
diff --git a/syslogd.c b/syslogd.c
index a5071583d..d82aa63fd 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -181,7 +181,7 @@ static void logMessage (int pri, char *msg)
v->iov_len = strlen(msg);
if ( -1 == writev(remotefd,iov, IOV_COUNT)){
- fatalError("syslogd: cannot write to remote file handle on"
+ error_msg_and_die("syslogd: cannot write to remote file handle on"
"%s:%d\n",RemoteHost,RemotePort);
}
}
@@ -260,13 +260,13 @@ static void init_RemoteLog (void){
remotefd = socket(AF_INET, SOCK_DGRAM, 0);
if (remotefd < 0) {
- fatalError("syslogd: cannot create socket\n");
+ error_msg_and_die("syslogd: cannot create socket\n");
}
hostinfo = (struct hostent *) gethostbyname(RemoteHost);
if (!hostinfo) {
- fatalError("syslogd: cannot resolve remote host name [%s]\n", RemoteHost);
+ error_msg_and_die("syslogd: cannot resolve remote host name [%s]\n", RemoteHost);
}
remoteaddr.sin_family = AF_INET;
@@ -278,7 +278,7 @@ static void init_RemoteLog (void){
for future operations
*/
if ( 0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))){
- fatalError("syslogd: cannot connect to remote host %s:%d\n", RemoteHost, RemotePort);
+ error_msg_and_die("syslogd: cannot connect to remote host %s:%d\n", RemoteHost, RemotePort);
}
}
@@ -311,7 +311,7 @@ static void doSyslogd (void)
/* Create the syslog file so realpath() can work. */
close (open (_PATH_LOG, O_RDWR | O_CREAT, 0644));
if (realpath (_PATH_LOG, lfile) == NULL)
- fatalError ("Could not resolve path to " _PATH_LOG ": %s\n", strerror (errno));
+ error_msg_and_die ("Could not resolve path to " _PATH_LOG ": %s\n", strerror (errno));
unlink (lfile);
@@ -319,14 +319,14 @@ static void doSyslogd (void)
sunx.sun_family = AF_UNIX;
strncpy (sunx.sun_path, lfile, sizeof (sunx.sun_path));
if ((sock_fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
- fatalError ("Couldn't obtain descriptor for socket " _PATH_LOG ": %s\n", strerror (errno));
+ error_msg_and_die ("Couldn't obtain descriptor for socket " _PATH_LOG ": %s\n", strerror (errno));
addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path);
if ((bind (sock_fd, (struct sockaddr *) &sunx, addrLength)) || (listen (sock_fd, 5)))
- fatalError ("Could not connect to socket " _PATH_LOG ": %s\n", strerror (errno));
+ error_msg_and_die ("Could not connect to socket " _PATH_LOG ": %s\n", strerror (errno));
if (chmod (lfile, 0666) < 0)
- fatalError ("Could not set permission on " _PATH_LOG ": %s\n", strerror (errno));
+ error_msg_and_die ("Could not set permission on " _PATH_LOG ": %s\n", strerror (errno));
FD_ZERO (&fds);
FD_SET (sock_fd, &fds);
@@ -349,7 +349,7 @@ static void doSyslogd (void)
if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) {
if (errno == EINTR) continue; /* alarm may have happened. */
- fatalError ("select error: %s\n", strerror (errno));
+ error_msg_and_die ("select error: %s\n", strerror (errno));
}
for (fd = 0; (n_ready > 0) && (fd < FD_SETSIZE); fd++) {
@@ -363,7 +363,7 @@ static void doSyslogd (void)
pid_t pid;
if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) {
- fatalError ("accept error: %s\n", strerror (errno));
+ error_msg_and_die ("accept error: %s\n", strerror (errno));
}
pid = fork();
diff --git a/tail.c b/tail.c
index a9da95462..308bb3085 100644
--- a/tail.c
+++ b/tail.c
@@ -225,7 +225,7 @@ int tail_main(int argc, char **argv)
usage(tail_usage);
break;
default:
- errorMsg("\nUnknown arg: %c.\n\n",optopt);
+ error_msg("\nUnknown arg: %c.\n\n",optopt);
usage(tail_usage);
}
}
@@ -263,7 +263,7 @@ int tail_main(int argc, char **argv)
else
fd[test] = open(files[test], O_RDONLY);
if (fd[test] == -1)
- fatalError("Unable to open file %s.\n", files[test]);
+ error_msg_and_die("Unable to open file %s.\n", files[test]);
tail_stream(fd[test]);
bs=BUFSIZ;
diff --git a/tar.c b/tar.c
index 906fd7eda..cc7ba3b80 100644
--- a/tar.c
+++ b/tar.c
@@ -193,10 +193,10 @@ extern int tar_main(int argc, char **argv)
break;
case 'f':
if (*tarName != '-')
- fatalError( "Only one 'f' option allowed\n");
+ error_msg_and_die( "Only one 'f' option allowed\n");
tarName = *(++argv);
if (tarName == NULL)
- fatalError( "Option requires an argument: No file specified\n");
+ error_msg_and_die( "Option requires an argument: No file specified\n");
stopIt=TRUE;
break;
#if defined BB_FEATURE_TAR_EXCLUDE
@@ -205,7 +205,7 @@ extern int tar_main(int argc, char **argv)
excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2));
excludeList[excludeListSize] = *(++argv);
if (excludeList[excludeListSize] == NULL)
- fatalError( "Option requires an argument: No file specified\n");
+ error_msg_and_die( "Option requires an argument: No file specified\n");
/* Remove leading "/"s */
if (*excludeList[excludeListSize] =='/')
excludeList[excludeListSize] = (excludeList[excludeListSize])+1;
@@ -216,13 +216,13 @@ extern int tar_main(int argc, char **argv)
}
case 'X':
if (*excludeFileName != '-')
- fatalError("Only one 'X' option allowed\n");
+ error_msg_and_die("Only one 'X' option allowed\n");
excludeFileName = *(++argv);
if (excludeFileName == NULL)
- fatalError("Option requires an argument: No file specified\n");
+ error_msg_and_die("Option requires an argument: No file specified\n");
fileList = fopen (excludeFileName, "rt");
if (! fileList)
- fatalError("Exclude file: file not found\n");
+ error_msg_and_die("Exclude file: file not found\n");
while (!feof(fileList)) {
fscanf(fileList, "%s", file);
excludeList=xrealloc( excludeList, sizeof(char**) * (excludeListSize+2));
@@ -253,7 +253,7 @@ extern int tar_main(int argc, char **argv)
*/
if (createFlag == TRUE) {
#ifndef BB_FEATURE_TAR_CREATE
- fatalError( "This version of tar was not compiled with tar creation support.\n");
+ error_msg_and_die( "This version of tar was not compiled with tar creation support.\n");
#else
status = writeTarFile(tarName, verboseFlag, argv, excludeList);
#endif
@@ -271,7 +271,7 @@ extern int tar_main(int argc, char **argv)
return EXIT_FAILURE;
flagError:
- fatalError( "Exactly one of 'c', 'x' or 't' must be specified\n");
+ error_msg_and_die( "Exactly one of 'c', 'x' or 't' must be specified\n");
}
static void
@@ -301,10 +301,10 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
if (extractFlag==TRUE && tostdoutFlag==FALSE) {
/* Create the path to the file, just in case it isn't there...
* This should not screw up path permissions or anything. */
- createPath(header->name, 0777);
+ create_path(header->name, 0777);
if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY,
header->mode & ~S_IFMT)) < 0) {
- errorMsg(io_error, header->name, strerror(errno));
+ error_msg(io_error, header->name, strerror(errno));
return( FALSE);
}
}
@@ -322,9 +322,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
readSize = size;
writeSize = size;
}
- if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) {
+ if ( (readSize = full_read(header->tarFd, buffer, readSize)) <= 0 ) {
/* Tarball seems to have a problem */
- errorMsg("Unexpected EOF in archive\n");
+ error_msg("Unexpected EOF in archive\n");
return( FALSE);
}
if ( readSize < writeSize )
@@ -333,9 +333,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
/* Write out the file, if we are supposed to be doing that */
if (extractFlag==TRUE) {
- if ((actualWriteSz=fullWrite(outFd, buffer, writeSize)) != writeSize ) {
+ if ((actualWriteSz=full_write(outFd, buffer, writeSize)) != writeSize ) {
/* Output file seems to have a problem */
- errorMsg(io_error, header->name, strerror(errno));
+ error_msg(io_error, header->name, strerror(errno));
return( FALSE);
}
} else {
@@ -361,13 +361,13 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag)
if (extractFlag==FALSE || tostdoutFlag==TRUE)
return( TRUE);
- if (createPath(header->name, header->mode) != TRUE) {
- errorMsg("%s: Cannot mkdir: %s\n",
+ if (create_path(header->name, header->mode) != TRUE) {
+ error_msg("%s: Cannot mkdir: %s\n",
header->name, strerror(errno));
return( FALSE);
}
/* make the final component, just in case it was
- * omitted by createPath() (which will skip the
+ * omitted by create_path() (which will skip the
* directory if it doesn't have a terminating '/') */
if (mkdir(header->name, header->mode) == 0) {
fixUpPermissions(header);
@@ -382,7 +382,7 @@ tarExtractHardLink(TarInfo *header, int extractFlag, int tostdoutFlag)
return( TRUE);
if (link(header->linkname, header->name) < 0) {
- errorMsg("%s: Cannot create hard link to '%s': %s\n",
+ error_msg("%s: Cannot create hard link to '%s': %s\n",
header->name, header->linkname, strerror(errno));
return( FALSE);
}
@@ -400,7 +400,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag)
#ifdef S_ISLNK
if (symlink(header->linkname, header->name) < 0) {
- errorMsg("%s: Cannot create symlink to '%s': %s\n",
+ error_msg("%s: Cannot create symlink to '%s': %s\n",
header->name, header->linkname, strerror(errno));
return( FALSE);
}
@@ -415,7 +415,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag)
/* Do not change permissions or date on symlink,
* since it changes the pointed to file instead. duh. */
#else
- errorMsg("%s: Cannot create symlink to '%s': %s\n",
+ error_msg("%s: Cannot create symlink to '%s': %s\n",
header->name, header->linkname,
"symlinks not supported");
#endif
@@ -430,13 +430,13 @@ tarExtractSpecial(TarInfo *header, int extractFlag, int tostdoutFlag)
if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) {
if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) {
- errorMsg("%s: Cannot mknod: %s\n",
+ error_msg("%s: Cannot mknod: %s\n",
header->name, strerror(errno));
return( FALSE);
}
} else if (S_ISFIFO(header->mode)) {
if (mkfifo(header->name, header->mode) < 0) {
- errorMsg("%s: Cannot mkfifo: %s\n",
+ error_msg("%s: Cannot mkfifo: %s\n",
header->name, strerror(errno));
return( FALSE);
}
@@ -455,9 +455,9 @@ static long getOctal(const char *cp, int size)
long val = 0;
for(;(size > 0) && (*cp == ' '); cp++, size--);
- if ((size == 0) || !isOctal(*cp))
+ if ((size == 0) || !is_octal(*cp))
return -1;
- for(; (size > 0) && isOctal(*cp); size--) {
+ for(; (size > 0) && is_octal(*cp); size--) {
val = val * 8 + *cp++ - '0';
}
for (;(size > 0) && (*cp == ' '); cp++, size--);
@@ -484,7 +484,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header)
++*(header->name);
if (alreadyWarned == FALSE) {
- errorMsg("Removing leading '/' from member names\n");
+ error_msg("Removing leading '/' from member names\n");
alreadyWarned = TRUE;
}
}
@@ -538,7 +538,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
else
tarFd = open(tarName, O_RDONLY);
if (tarFd < 0) {
- errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno));
+ error_msg( "Error opening '%s': %s\n", tarName, strerror(errno));
return ( FALSE);
}
@@ -547,7 +547,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
umask(0);
/* Read the tar file, and iterate over it one file at a time */
- while ( (status = fullRead(tarFd, (char*)&rawHeader, TAR_BLOCK_SIZE)) == TAR_BLOCK_SIZE ) {
+ while ( (status = full_read(tarFd, (char*)&rawHeader, TAR_BLOCK_SIZE)) == TAR_BLOCK_SIZE ) {
/* Try to read the header */
if ( readTarHeader(&rawHeader, &header) == FALSE ) {
@@ -555,7 +555,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
goto endgame;
} else {
errorFlag=TRUE;
- errorMsg("Bad tar header, skipping\n");
+ error_msg("Bad tar header, skipping\n");
continue;
}
}
@@ -572,7 +572,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
}
if ( skipNextHeaderFlag == TRUE ) {
skipNextHeaderFlag=FALSE;
- errorMsg(name_longer_than_foo, NAME_SIZE);
+ error_msg(name_longer_than_foo, NAME_SIZE);
if (tarExtractRegularFile(&header, FALSE, FALSE) == FALSE)
errorFlag = TRUE;
continue;
@@ -638,7 +638,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
char buf[35];
struct tm *tm = localtime (&(header.mtime));
- len=printf("%s ", modeString(header.mode));
+ len=printf("%s ", mode_string(header.mode));
memset(buf, 0, 8*sizeof(char));
my_getpwuid(buf, header.uid);
if (! *buf)
@@ -731,7 +731,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
break;
#endif
default:
- errorMsg("Unknown file type '%c' in tar file\n", header.type);
+ error_msg("Unknown file type '%c' in tar file\n", header.type);
close( tarFd);
return( FALSE);
}
@@ -739,11 +739,11 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
close(tarFd);
if (status > 0) {
/* Bummer - we read a partial header */
- errorMsg( "Error reading '%s': %s\n", tarName, strerror(errno));
+ error_msg( "Error reading '%s': %s\n", tarName, strerror(errno));
return ( FALSE);
}
else if (errorFlag==TRUE) {
- errorMsg( "Error exit delayed from previous errors\n");
+ error_msg( "Error exit delayed from previous errors\n");
return( FALSE);
} else
return( status);
@@ -753,13 +753,13 @@ endgame:
close( tarFd);
if (extractList != NULL) {
for (; *extractList != NULL; extractList++) {
- errorMsg("%s: Not found in archive\n", *extractList);
+ error_msg("%s: Not found in archive\n", *extractList);
errorFlag = TRUE;
}
}
if ( *(header.name) == '\0' ) {
if (errorFlag==TRUE)
- errorMsg( "Error exit delayed from previous errors\n");
+ error_msg( "Error exit delayed from previous errors\n");
else
return( TRUE);
}
@@ -903,7 +903,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
if (*fileName=='/') {
static int alreadyWarned=FALSE;
if (alreadyWarned==FALSE) {
- errorMsg("Removing leading '/' from member names\n");
+ error_msg("Removing leading '/' from member names\n");
alreadyWarned=TRUE;
}
strncpy(header.name, fileName+1, sizeof(header.name));
@@ -956,7 +956,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
header.typeflag = SYMTYPE;
link_size = readlink(fileName, buffer, sizeof(buffer) - 1);
if ( link_size < 0) {
- errorMsg("Error reading symlink '%s': %s\n", header.name, strerror(errno));
+ error_msg("Error reading symlink '%s': %s\n", header.name, strerror(errno));
return ( FALSE);
}
buffer[link_size] = '\0';
@@ -978,7 +978,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
header.typeflag = REGTYPE;
putOctal(header.size, sizeof(header.size), statbuf->st_size);
} else {
- errorMsg("%s: Unknown file type\n", fileName);
+ error_msg("%s: Unknown file type\n", fileName);
return ( FALSE);
}
@@ -994,8 +994,8 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st
putOctal(header.chksum, 7, chksum);
/* Now write the header out to disk */
- if ((size=fullWrite(tbInfo->tarFd, (char*)&header, sizeof(struct TarHeader))) < 0) {
- errorMsg(io_error, fileName, strerror(errno));
+ if ((size=full_write(tbInfo->tarFd, (char*)&header, sizeof(struct TarHeader))) < 0) {
+ error_msg(io_error, fileName, strerror(errno));
return ( FALSE);
}
/* Pad the header up to the tar block size */
@@ -1036,7 +1036,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
/* It is against the rules to archive a socket */
if (S_ISSOCK(statbuf->st_mode)) {
- errorMsg("%s: socket ignored\n", fileName);
+ error_msg("%s: socket ignored\n", fileName);
return( TRUE);
}
@@ -1045,12 +1045,12 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
* the new tarball */
if (tbInfo->statBuf.st_dev == statbuf->st_dev &&
tbInfo->statBuf.st_ino == statbuf->st_ino) {
- errorMsg("%s: file is the archive; skipping\n", fileName);
+ error_msg("%s: file is the archive; skipping\n", fileName);
return( TRUE);
}
if (strlen(fileName) >= NAME_SIZE) {
- errorMsg(name_longer_than_foo, NAME_SIZE);
+ error_msg(name_longer_than_foo, NAME_SIZE);
return ( TRUE);
}
@@ -1067,21 +1067,21 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
/* open the file we want to archive, and make sure all is well */
if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
- errorMsg("%s: Cannot open: %s\n", fileName, strerror(errno));
+ error_msg("%s: Cannot open: %s\n", fileName, strerror(errno));
return( FALSE);
}
/* write the file to the archive */
- while ( (size = fullRead(inputFileFd, buffer, sizeof(buffer))) > 0 ) {
- if (fullWrite(tbInfo->tarFd, buffer, size) != size ) {
+ while ( (size = full_read(inputFileFd, buffer, sizeof(buffer))) > 0 ) {
+ if (full_write(tbInfo->tarFd, buffer, size) != size ) {
/* Output file seems to have a problem */
- errorMsg(io_error, fileName, strerror(errno));
+ error_msg(io_error, fileName, strerror(errno));
return( FALSE);
}
readSize+=size;
}
if (size == -1) {
- errorMsg(io_error, fileName, strerror(errno));
+ error_msg(io_error, fileName, strerror(errno));
return( FALSE);
}
/* Pad the file up to the tar block size */
@@ -1106,7 +1106,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
/* Make sure there is at least one file to tar up. */
if (*argv == NULL)
- fatalError("Cowardly refusing to create an empty archive\n");
+ error_msg_and_die("Cowardly refusing to create an empty archive\n");
/* Open the tar file for writing. */
if (!strcmp(tarName, "-"))
@@ -1114,7 +1114,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
else
tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (tbInfo.tarFd < 0) {
- errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno));
+ error_msg( "Error opening '%s': %s\n", tarName, strerror(errno));
freeHardLinkInfo(&tbInfo.hlInfoHead);
return ( FALSE);
}
@@ -1122,7 +1122,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
/* Store the stat info for the tarball's file, so
* can avoid including the tarball into itself.... */
if (fstat(tbInfo.tarFd, &tbInfo.statBuf) < 0)
- fatalError(io_error, tarName, strerror(errno));
+ error_msg_and_die(io_error, tarName, strerror(errno));
/* Set the umask for this process so it doesn't
* screw up permission setting for us later. */
@@ -1130,7 +1130,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
/* Read the directory/files and iterate over them one at a time */
while (*argv != NULL) {
- if (recursiveAction(*argv++, TRUE, FALSE, FALSE,
+ if (recursive_action(*argv++, TRUE, FALSE, FALSE,
writeFileToTarball, writeFileToTarball,
(void*) &tbInfo) == FALSE) {
errorFlag = TRUE;
@@ -1149,7 +1149,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
/* Hang up the tools, close up shop, head home */
close(tarFd);
if (errorFlag == TRUE) {
- errorMsg("Error exit delayed from previous errors\n");
+ error_msg("Error exit delayed from previous errors\n");
freeHardLinkInfo(&tbInfo.hlInfoHead);
return(FALSE);
}
diff --git a/tee.c b/tee.c
index 621801336..347684a28 100644
--- a/tee.c
+++ b/tee.c
@@ -47,7 +47,7 @@ tee_main(int argc, char **argv)
while (optind < argc) {
if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) {
nfiles--;
- errorMsg("%s: %s\n", argv[optind-1], strerror(errno));
+ error_msg("%s: %s\n", argv[optind-1], strerror(errno));
status = 1;
}
}
diff --git a/telnet.c b/telnet.c
index bfa964460..7a7bcfb9f 100644
--- a/telnet.c
+++ b/telnet.c
@@ -583,7 +583,7 @@ static int getport(char * p)
if ((unsigned)(port - 1 ) > 65534)
{
- fatalError("%s: bad port number\n", p);
+ error_msg_and_die("%s: bad port number\n", p);
}
return port;
}
@@ -595,7 +595,7 @@ static struct in_addr getserver(char * host)
struct hostent * he;
if ((he = gethostbyname(host)) == NULL)
{
- fatalError("%s: Unknown host\n", host);
+ error_msg_and_die("%s: Unknown host\n", host);
}
memcpy(&addr, he->h_addr, sizeof addr);
@@ -650,7 +650,7 @@ static int remote_connect(struct in_addr addr, int port)
if (connect(s, (struct sockaddr *)&s_addr, sizeof s_addr) < 0)
{
- fatalError("Unable to connect to remote host: %s\n", strerror(errno));
+ error_msg_and_die("Unable to connect to remote host: %s\n", strerror(errno));
}
return s;
}
diff --git a/test.c b/test.c
index acd6947d9..d1a0b6025 100644
--- a/test.c
+++ b/test.c
@@ -184,7 +184,7 @@ test_main(int argc, char** argv)
if (strcmp(applet_name, "[") == 0) {
if (strcmp(argv[--argc], "]"))
- fatalError("missing ]\n");
+ error_msg_and_die("missing ]\n");
argv[argc] = NULL;
}
/* Implement special cases from POSIX.2, section 4.62.4 */
@@ -233,9 +233,9 @@ syntax(op, msg)
char *msg;
{
if (op && *op)
- fatalError("%s: %s\n", op, msg);
+ error_msg_and_die("%s: %s\n", op, msg);
else
- fatalError("%s\n", msg);
+ error_msg_and_die("%s\n", msg);
}
static int
@@ -470,13 +470,13 @@ getn(s)
r = strtol(s, &p, 10);
if (errno != 0)
- fatalError("%s: out of range\n", s);
+ error_msg_and_die("%s: out of range\n", s);
while (isspace(*p))
p++;
if (*p)
- fatalError("%s: bad number\n", s);
+ error_msg_and_die("%s: bad number\n", s);
return (int) r;
}
diff --git a/touch.c b/touch.c
index 5537fb63b..59800b2a0 100644
--- a/touch.c
+++ b/touch.c
@@ -58,12 +58,12 @@ extern int touch_main(int argc, char **argv)
if (create == FALSE && errno == ENOENT)
return EXIT_SUCCESS;
else {
- fatalError("%s", strerror(errno));
+ error_msg_and_die("%s", strerror(errno));
}
}
close(fd);
if (utime(*argv, NULL)) {
- fatalError("%s", strerror(errno));
+ error_msg_and_die("%s", strerror(errno));
}
argc--;
argv++;
diff --git a/tr.c b/tr.c
index 3e34e68fa..fd547b87d 100644
--- a/tr.c
+++ b/tr.c
@@ -173,7 +173,7 @@ extern int tr_main(int argc, char **argv)
input_length = complement(input, input_length);
if (argv[index] != NULL) {
if (*argv[index] == '\0')
- fatalError("STRING2 cannot be empty\n");
+ error_msg_and_die("STRING2 cannot be empty\n");
output_length = expand(argv[index], output);
map(input, input_length, output, output_length);
}
diff --git a/umount.c b/umount.c
index eff080463..e76e0521f 100644
--- a/umount.c
+++ b/umount.c
@@ -79,7 +79,7 @@ void mtab_read(void)
return;
if ((fp = setmntent(mtab_file, "r")) == NULL) {
- errorMsg("Cannot open %s\n", mtab_file);
+ error_msg("Cannot open %s\n", mtab_file);
return;
}
while ((e = getmntent(fp))) {
@@ -179,7 +179,7 @@ static int do_umount(const char *name, int useMtab)
if (status != 0 && doForce == TRUE) {
status = umount2(blockDevice, MNT_FORCE);
if (status != 0) {
- fatalError("forced umount of %s failed!\n", blockDevice);
+ error_msg_and_die("forced umount of %s failed!\n", blockDevice);
}
}
#endif
@@ -187,9 +187,9 @@ static int do_umount(const char *name, int useMtab)
status = mount(blockDevice, name, NULL,
MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL);
if (status == 0) {
- errorMsg("%s busy - remounted read-only\n", blockDevice);
+ error_msg("%s busy - remounted read-only\n", blockDevice);
} else {
- errorMsg("Cannot remount %s read-only\n", blockDevice);
+ error_msg("Cannot remount %s read-only\n", blockDevice);
}
}
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,
}
}
#else
- errorMsg( "mode reading not compiled in\n");
+ error_msg( "mode reading not compiled in\n");
#endif
return 0;
}
@@ -433,7 +433,7 @@ extern int fbset_main(int argc, char **argv)
PERROR("fbset(ioctl)");
if (g_options & OPT_READMODE) {
if (!readmode(&var, modefile, mode)) {
- errorMsg("Unknown video mode `%s'\n", mode);
+ error_msg("Unknown video mode `%s'\n", mode);
return EXIT_FAILURE;
}
}
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)
}
if ((f = open(argv[1], O_RDWR)) == -1) {
- fatalError( "cannot open %s: %s\n", argv[1], strerror(errno));
+ error_msg_and_die( "cannot open %s: %s\n", argv[1], strerror(errno));
}
if (ioctl(f, BLKFLSBUF) < 0) {
- fatalError( "failed ioctl on %s: %s\n", argv[1], strerror(errno));
+ error_msg_and_die( "failed ioctl on %s: %s\n", argv[1], strerror(errno));
}
/* Don't bother closing. Exit does
* 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)
static void die(const char *str)
{
- errorMsg("%s\n", str);
+ error_msg("%s\n", str);
leave(8);
}
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 @@
* <misiek@misiek.eu.org>)
* Ported to Busybox - Alfred M. Szmidt <ams@trillian.itslinux.org>
* Removed --version/-V and --help/-h in
- * Removed prase_error(), using errorMsg() from Busybox instead
+ * Removed prase_error(), using error_msg() from Busybox instead
* Replaced our_malloc with xmalloc and our_realloc with xrealloc
*
*/
@@ -258,7 +258,7 @@ void add_long_options(char *options)
arg_opt=required_argument;
}
if (strlen(tokptr) == 0)
- errorMsg("empty long option after -l or --long argument\n");
+ error_msg("empty long option after -l or --long argument\n");
}
add_longopt(tokptr,arg_opt);
}
@@ -277,7 +277,7 @@ void set_shell(const char *new_shell)
else if (!strcmp(new_shell,"csh"))
shell=TCSH;
else
- errorMsg("unknown shell after -s or --shell argument\n");
+ error_msg("unknown shell after -s or --shell argument\n");
}
@@ -326,7 +326,7 @@ int getopt_main(int argc, char *argv[])
printf(" --\n");
exit(0);
} else
- fatalError("missing optstring argument\n");
+ error_msg_and_die("missing optstring argument\n");
}
if (argv[1][0] != '-' || compatible) {
@@ -377,7 +377,7 @@ int getopt_main(int argc, char *argv[])
if (!optstr) {
if (optind >= argc)
- fatalError("missing optstring argument\n");
+ error_msg_and_die("missing optstring argument\n");
else {
optstr=xmalloc(strlen(argv[optind])+1);
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)
*/
static volatile void die(char *str)
{
- errorMsg("%s\n", str);
+ error_msg("%s\n", str);
exit(8);
}
@@ -796,7 +796,7 @@ extern int mkfs_minix_main(int argc, char **argv)
#ifdef BB_FEATURE_MINIX2
version2 = 1;
#else
- errorMsg("%s: not compiled with minix v2 support\n",
+ error_msg("%s: not compiled with minix v2 support\n",
device_name);
exit(-1);
#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()
#ifdef PAGE_SIZE
if (pagesize != PAGE_SIZE)
- errorMsg("Assuming pages of size %d\n", pagesize);
+ error_msg("Assuming pages of size %d\n", pagesize);
#endif
signature_page = (int *) xmalloc(pagesize);
memset(signature_page, 0, pagesize);
@@ -175,7 +175,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr)
void die(const char *str)
{
- errorMsg("%s\n", str);
+ error_msg("%s\n", str);
exit(EXIT_FAILURE);
}
@@ -316,14 +316,14 @@ int mkswap_main(int argc, char **argv)
}
}
if (!device_name) {
- errorMsg("error: Nowhere to set up swap on?\n");
+ error_msg("error: Nowhere to set up swap on?\n");
usage(mkswap_usage);
}
sz = get_size(device_name);
if (!PAGES) {
PAGES = sz;
} else if (PAGES > sz && !force) {
- errorMsg("error: size %ld is larger than device size %d\n",
+ error_msg("error: size %ld is larger than device size %d\n",
PAGES * (pagesize / 1024), sz * (pagesize / 1024));
return EXIT_FAILURE;
}
@@ -339,11 +339,11 @@ int mkswap_main(int argc, char **argv)
version = 1;
}
if (version != 0 && version != 1) {
- errorMsg("error: unknown version %d\n", version);
+ error_msg("error: unknown version %d\n", version);
usage(mkswap_usage);
}
if (PAGES < 10) {
- errorMsg("error: swap area needs to be at least %ldkB\n",
+ error_msg("error: swap area needs to be at least %ldkB\n",
(long) (10 * pagesize / 1024));
usage(mkswap_usage);
}
@@ -362,7 +362,7 @@ int mkswap_main(int argc, char **argv)
#endif
if (PAGES > maxpages) {
PAGES = maxpages;
- errorMsg("warning: truncating swap area to %ldkB\n",
+ error_msg("warning: truncating swap area to %ldkB\n",
PAGES * pagesize / 1024);
}
@@ -389,7 +389,7 @@ int mkswap_main(int argc, char **argv)
for (sum = 0; q >= (unsigned short *) buffer;)
sum ^= *q--;
if (!sum) {
- errorMsg("Device '%s' contains a valid Sun disklabel.\n"
+ error_msg("Device '%s' contains a valid Sun disklabel.\n"
"This probably means creating v0 swap would destroy your partition table\n"
"No swap created. If you really want to create swap v0 on that device, use\n"
"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,
specialfile = find_unused_loop_device();
if (specialfile == NULL) {
- errorMsg("Could not find a spare loop device\n");
+ error_msg("Could not find a spare loop device\n");
return (FALSE);
}
if (set_loop(specialfile, lofile, 0, &loro)) {
- errorMsg("Could not setup loop device\n");
+ error_msg("Could not setup loop device\n");
return (FALSE);
}
if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */
- errorMsg("WARNING: loop device is read-only\n");
+ error_msg("WARNING: loop device is read-only\n");
flags &= ~MS_RDONLY;
}
}
#endif
status = mount(specialfile, dir, filesystemtype, flags, string_flags);
if (errno == EROFS) {
- errorMsg("%s is write-protected, mounting read-only\n", specialfile);
+ error_msg("%s is write-protected, mounting read-only\n", specialfile);
status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags);
}
}
@@ -173,7 +173,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
#endif
if (errno == EPERM) {
- fatalError("permission denied. Are you root?\n");
+ error_msg_and_die("permission denied. Are you root?\n");
}
return (FALSE);
@@ -273,18 +273,18 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- fatalError("open failed for `%s': %s\n", device, strerror (errno));
+ error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno));
/* How many filesystems? We need to know to allocate enough space */
numfilesystems = ioctl (fd, DEVMTAB_COUNT_FILESYSTEMS);
if (numfilesystems<0)
- fatalError("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno));
+ error_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno));
fslist = (struct k_fstype *) xcalloc ( numfilesystems, sizeof(struct k_fstype));
/* Grab the list of available filesystems */
status = ioctl (fd, DEVMTAB_GET_FILESYSTEMS, fslist);
if (status<0)
- fatalError("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno));
+ error_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno));
/* Walk the list trying to mount filesystems
* that do not claim to be nodev filesystems */
@@ -309,7 +309,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
if (status == FALSE) {
if (whineOnErrors == TRUE) {
- errorMsg("Mounting %s on %s failed: %s\n",
+ error_msg("Mounting %s on %s failed: %s\n",
blockDevice, directory, strerror(errno));
}
return (FALSE);
@@ -342,18 +342,18 @@ extern int mount_main(int argc, char **argv)
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- fatalError("open failed for `%s': %s\n", device, strerror (errno));
+ error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno));
/* How many mounted filesystems? We need to know to
* allocate enough space for later... */
numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS);
if (numfilesystems<0)
- fatalError( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno));
+ error_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno));
mntentlist = (struct k_mntent *) xcalloc ( numfilesystems, sizeof(struct k_mntent));
/* Grab the list of mounted filesystems */
if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0)
- fatalError( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno));
+ error_msg_and_die( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno));
for( i = 0 ; i < numfilesystems ; i++) {
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)
fstabmount = TRUE;
if (f == NULL)
- fatalError( "\nCannot read /etc/fstab: %s\n", strerror (errno));
+ error_msg_and_die( "\nCannot read /etc/fstab: %s\n", strerror (errno));
while ((m = getmntent(f)) != NULL) {
if (all == FALSE && directory == NULL && (
@@ -488,7 +488,7 @@ singlemount:
rc = nfsmount (device, directory, &flags,
&extra_opts, &string_flags, 1);
if ( rc != 0) {
- fatalError("nfsmount failed: %s\n", strerror(errno));
+ error_msg_and_die("nfsmount failed: %s\n", strerror(errno));
rc = EXIT_FAILURE;
}
}
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,
msock = fsock = -1;
mclient = NULL;
if (strlen(spec) >= sizeof(hostdir)) {
- errorMsg("excessively long host:dir argument\n");
+ error_msg("excessively long host:dir argument\n");
goto fail;
}
strcpy(hostdir, spec);
@@ -312,10 +312,10 @@ int nfsmount(const char *spec, const char *node, int *flags,
until they can be fully supported. (mack@sgi.com) */
if ((s = strchr(hostdir, ','))) {
*s = '\0';
- errorMsg("warning: multiple hostnames not supported\n");
+ error_msg("warning: multiple hostnames not supported\n");
}
} else {
- errorMsg("directory to mount not in host:dir format\n");
+ error_msg("directory to mount not in host:dir format\n");
goto fail;
}
@@ -325,11 +325,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
#endif
{
if ((hp = gethostbyname(hostname)) == NULL) {
- errorMsg("can't get address for %s\n", hostname);
+ error_msg("can't get address for %s\n", hostname);
goto fail;
} else {
if (hp->h_length > sizeof(struct in_addr)) {
- errorMsg("got bad hp->h_length\n");
+ error_msg("got bad hp->h_length\n");
hp->h_length = sizeof(struct in_addr);
}
memcpy(&server_addr.sin_addr,
@@ -346,7 +346,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
if (!old_opts)
old_opts = "";
if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
- errorMsg("excessively long option argument\n");
+ error_msg("excessively long option argument\n");
goto fail;
}
sprintf(new_opts, "%s%saddr=%s",
@@ -506,11 +506,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
data.flags |= (nolock ? NFS_MOUNT_NONLM : 0);
#endif
if (nfsvers > MAX_NFSPROT) {
- errorMsg("NFSv%d not supported!\n", nfsvers);
+ error_msg("NFSv%d not supported!\n", nfsvers);
return 0;
}
if (mountvers > MAX_NFSPROT) {
- errorMsg("NFSv%d not supported!\n", nfsvers);
+ error_msg("NFSv%d not supported!\n", nfsvers);
return 0;
}
if (nfsvers && !mountvers)
@@ -570,11 +570,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
mount_server_addr.sin_addr.s_addr = inet_addr(hostname);
} else {
if ((hp = gethostbyname(mounthost)) == NULL) {
- errorMsg("can't get address for %s\n", hostname);
+ error_msg("can't get address for %s\n", hostname);
goto fail;
} else {
if (hp->h_length > sizeof(struct in_addr)) {
- errorMsg("got bad hp->h_length?\n");
+ error_msg("got bad hp->h_length?\n");
hp->h_length = sizeof(struct in_addr);
}
mount_server_addr.sin_family = AF_INET;
@@ -709,7 +709,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
if (nfsvers == 2) {
if (status.nfsv2.fhs_status != 0) {
- errorMsg("%s:%s failed, reason given by server: %s\n",
+ error_msg("%s:%s failed, reason given by server: %s\n",
hostname, dirname,
nfs_strerror(status.nfsv2.fhs_status));
goto fail;
@@ -727,7 +727,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
#if NFS_MOUNT_VERSION >= 4
fhandle3 *fhandle;
if (status.nfsv3.fhs_status != 0) {
- errorMsg("%s:%s failed, reason given by server: %s\n",
+ error_msg("%s:%s failed, reason given by server: %s\n",
hostname, dirname,
nfs_strerror(status.nfsv3.fhs_status));
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)
int fd;
if (!(h = gethostbyname(host))) { /* get the IP addr */
- errorMsg("%s: %s\n", host, strerror(errno));
+ error_msg("%s: %s\n", host, strerror(errno));
return(-1);
}
if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */
- errorMsg("%s: %s\n", "time", strerror(errno));
+ error_msg("%s: %s\n", "time", strerror(errno));
return(-1);
}
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { /* get net connection */
- errorMsg("%s: %s\n", "socket", strerror(errno));
+ error_msg("%s: %s\n", "socket", strerror(errno));
return(-1);
}
@@ -64,13 +64,13 @@ time_t askremotedate(char *host)
sin.sin_family = AF_INET;
if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { /* connect to time server */
- errorMsg("%s: %s\n", host, strerror(errno));
+ error_msg("%s: %s\n", host, strerror(errno));
close(fd);
return(-1);
}
if (read(fd, (void *)&nett, 4) != 4) { /* read time from server */
close(fd);
- errorMsg("%s did not send the complete time\n", host);
+ error_msg("%s did not send the complete time\n", host);
}
close(fd);
@@ -123,7 +123,7 @@ int rdate_main(int argc, char **argv)
}
if (setdate) {
if (stime(&time) < 0)
- fatalError("Could not set time of day: %s\n", strerror(errno));
+ error_msg_and_die("Could not set time of day: %s\n", strerror(errno));
}
if (printdate) {
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)
struct stat statBuf;
if (stat("/etc/fstab", &statBuf) < 0)
- fatalError("/etc/fstab file missing\n");
+ error_msg_and_die("/etc/fstab file missing\n");
}
do_em_all();
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)
return;
if ((fp = setmntent(mtab_file, "r")) == NULL) {
- errorMsg("Cannot open %s\n", mtab_file);
+ error_msg("Cannot open %s\n", mtab_file);
return;
}
while ((e = getmntent(fp))) {
@@ -179,7 +179,7 @@ static int do_umount(const char *name, int useMtab)
if (status != 0 && doForce == TRUE) {
status = umount2(blockDevice, MNT_FORCE);
if (status != 0) {
- fatalError("forced umount of %s failed!\n", blockDevice);
+ error_msg_and_die("forced umount of %s failed!\n", blockDevice);
}
}
#endif
@@ -187,9 +187,9 @@ static int do_umount(const char *name, int useMtab)
status = mount(blockDevice, name, NULL,
MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL);
if (status == 0) {
- errorMsg("%s busy - remounted read-only\n", blockDevice);
+ error_msg("%s busy - remounted read-only\n", blockDevice);
} else {
- errorMsg("Cannot remount %s read-only\n", blockDevice);
+ error_msg("Cannot remount %s read-only\n", blockDevice);
}
}
if (status == 0) {
diff --git a/utility.c b/utility.c
index 554ad1b88..2f3486c13 100644
--- a/utility.c
+++ b/utility.c
@@ -33,7 +33,7 @@
|| defined (BB_LS) \
|| defined (BB_RM) \
|| defined (BB_TAR)
-/* same conditions as recursiveAction */
+/* same conditions as recursive_action */
#define bb_need_name_too_long
#endif
#define bb_need_memory_exhausted
@@ -84,7 +84,7 @@ extern void usage(const char *usage)
exit(EXIT_FAILURE);
}
-static void verrorMsg(const char *s, va_list p)
+static void verror_msg(const char *s, va_list p)
{
fflush(stdout);
fprintf(stderr, "%s: ", applet_name);
@@ -92,26 +92,26 @@ static void verrorMsg(const char *s, va_list p)
fflush(stderr);
}
-extern void errorMsg(const char *s, ...)
+extern void error_msg(const char *s, ...)
{
va_list p;
va_start(p, s);
- verrorMsg(s, p);
+ verror_msg(s, p);
va_end(p);
}
-extern void fatalError(const char *s, ...)
+extern void error_msg_and_die(const char *s, ...)
{
va_list p;
va_start(p, s);
- verrorMsg(s, p);
+ verror_msg(s, p);
va_end(p);
exit(EXIT_FAILURE);
}
-static void vperrorMsg(const char *s, va_list p)
+static void vperror_msg(const char *s, va_list p)
{
fflush(stdout);
fprintf(stderr, "%s: ", applet_name);
@@ -123,21 +123,21 @@ static void vperrorMsg(const char *s, va_list p)
fflush(stderr);
}
-extern void perrorMsg(const char *s, ...)
+extern void perror_msg(const char *s, ...)
{
va_list p;
va_start(p, s);
- vperrorMsg(s, p);
+ vperror_msg(s, p);
va_end(p);
}
-extern void fatalPerror(const char *s, ...)
+extern void perror_msg_and_die(const char *s, ...)
{
va_list p;
va_start(p, s);
- vperrorMsg(s, p);
+ vperror_msg(s, p);
va_end(p);
exit(EXIT_FAILURE);
}
@@ -266,7 +266,7 @@ void reset_ino_dev_hashtable(void)
* Return TRUE if a fileName is a directory.
* Nonexistant files return FALSE.
*/
-int isDirectory(const char *fileName, const int followLinks, struct stat *statBuf)
+int is_directory(const char *fileName, const int followLinks, struct stat *statBuf)
{
int status;
int didMalloc = 0;
@@ -308,7 +308,7 @@ int copy_file_chunk(int srcfd, int dstfd, size_t chunksize)
size = BUFSIZ;
else
size = chunksize;
- if (fullWrite(dstfd, buffer, fullRead(srcfd, buffer, size)) < size)
+ if (full_write(dstfd, buffer, full_read(srcfd, buffer, size)) < size)
return(FALSE);
chunksize -= size;
}
@@ -325,7 +325,7 @@ int copy_file_chunk(int srcfd, int dstfd, size_t chunksize)
* -Erik Andersen
*/
int
-copyFile(const char *srcName, const char *destName,
+copy_file(const char *srcName, const char *destName,
int setModes, int followLinks, int forceFlag)
{
int rfd;
@@ -358,7 +358,7 @@ copyFile(const char *srcName, const char *destName,
if ((srcStatBuf.st_dev == dstStatBuf.st_dev) &&
(srcStatBuf.st_ino == dstStatBuf.st_ino)) {
- errorMsg("Copying file \"%s\" to itself\n", srcName);
+ error_msg("Copying file \"%s\" to itself\n", srcName);
return FALSE;
}
@@ -491,7 +491,7 @@ static const char SMODE0[] = "..S..S..T";
* Return the standard ls-like mode string from a file mode.
* This is static and so is overwritten on each call.
*/
-const char *modeString(int mode)
+const char *mode_string(int mode)
{
static char buf[12];
@@ -514,7 +514,7 @@ const char *modeString(int mode)
* Return the standard ls-like time string from a time_t
* This is static and so is overwritten on each call.
*/
-const char *timeString(time_t timeVal)
+const char *time_string(time_t timeVal)
{
time_t now;
char *str;
@@ -542,7 +542,7 @@ const char *timeString(time_t timeVal)
* This does multiple writes as necessary.
* Returns the amount written, or -1 on an error.
*/
-int fullWrite(int fd, const char *buf, int len)
+int full_write(int fd, const char *buf, int len)
{
int cc;
int total;
@@ -572,7 +572,7 @@ int fullWrite(int fd, const char *buf, int len)
* Returns the amount read, or -1 on an error.
* A short read is returned on an end of file.
*/
-int fullRead(int fd, char *buf, int len)
+int full_read(int fd, char *buf, int len)
{
int cc;
int total;
@@ -616,7 +616,7 @@ int fullRead(int fd, char *buf, int len)
* and so isn't sufficiently portable to take over since glibc2.1
* is so stinking huge.
*/
-int recursiveAction(const char *fileName,
+int recursive_action(const char *fileName,
int recurse, int followLinks, int depthFirst,
int (*fileAction) (const char *fileName,
struct stat * statbuf,
@@ -641,7 +641,7 @@ int recursiveAction(const char *fileName,
"status=%d followLinks=%d TRUE=%d\n",
status, followLinks, TRUE);
#endif
- perrorMsg("%s", fileName);
+ perror_msg("%s", fileName);
return FALSE;
}
@@ -666,13 +666,13 @@ int recursiveAction(const char *fileName,
dir = opendir(fileName);
if (!dir) {
- perrorMsg("%s", fileName);
+ perror_msg("%s", fileName);
return FALSE;
}
if (dirAction != NULL && depthFirst == FALSE) {
status = dirAction(fileName, &statbuf, userData);
if (status == FALSE) {
- perrorMsg("%s", fileName);
+ perror_msg("%s", fileName);
return FALSE;
}
}
@@ -684,13 +684,13 @@ int recursiveAction(const char *fileName,
continue;
}
if (strlen(fileName) + strlen(next->d_name) + 1 > BUFSIZ) {
- errorMsg(name_too_long);
+ error_msg(name_too_long);
return FALSE;
}
memset(nextFile, 0, sizeof(nextFile));
sprintf(nextFile, "%s/%s", fileName, next->d_name);
status =
- recursiveAction(nextFile, TRUE, followLinks, depthFirst,
+ recursive_action(nextFile, TRUE, followLinks, depthFirst,
fileAction, dirAction, userData);
if (status == FALSE) {
closedir(dir);
@@ -699,13 +699,13 @@ int recursiveAction(const char *fileName,
}
status = closedir(dir);
if (status < 0) {
- perrorMsg("%s", fileName);
+ perror_msg("%s", fileName);
return FALSE;
}
if (dirAction != NULL && depthFirst == TRUE) {
status = dirAction(fileName, &statbuf, userData);
if (status == FALSE) {
- perrorMsg("%s", fileName);
+ perror_msg("%s", fileName);
return FALSE;
}
}
@@ -729,7 +729,7 @@ int recursiveAction(const char *fileName,
* while all previous ones get default protections. Errors are not reported
* here, as failures to restore files can be reported later.
*/
-extern int createPath(const char *name, int mode)
+extern int create_path(const char *name, int mode)
{
char *cp;
char *cpOld;
@@ -1058,7 +1058,7 @@ int get_console_fd(char *tty_name)
if (is_a_console(fd))
return fd;
- errorMsg("Couldnt get a file descriptor referring to the console\n");
+ error_msg("Couldnt get a file descriptor referring to the console\n");
return -1; /* total failure */
}
@@ -1179,7 +1179,7 @@ extern int check_wildcard_match(const char *text, const char *pattern)
* Given any other file (or directory), find the mount table entry for its
* filesystem.
*/
-extern struct mntent *findMountPoint(const char *name, const char *table)
+extern struct mntent *find_mount_point(const char *name, const char *table)
{
struct stat s;
dev_t mountDevice;
@@ -1219,16 +1219,16 @@ extern struct mntent *findMountPoint(const char *name, const char *table)
* Read a number with a possible multiplier.
* Returns -1 if the number format is illegal.
*/
-extern long getNum(const char *cp)
+extern long atoi_w_units(const char *cp)
{
long value;
- if (!isDecimal(*cp))
+ if (!is_decimal(*cp))
return -1;
value = 0;
- while (isDecimal(*cp))
+ while (is_decimal(*cp))
value = value * 10 + *cp++ - '0';
switch (*cp++) {
@@ -1292,14 +1292,14 @@ extern int device_open(char *device, int mode)
#endif
#if defined BB_FEATURE_USE_DEVPS_PATCH
-/* findPidByName()
+/* find_pid_by_name()
*
* This finds the pid of the specified process,
* by using the /dev/ps device driver.
*
* Returns a list of all matching PIDs
*/
-extern pid_t* findPidByName( char* pidName)
+extern pid_t* find_pid_by_name( char* pidName)
{
int fd, i, j;
char device[] = "/dev/ps";
@@ -1310,11 +1310,11 @@ extern pid_t* findPidByName( char* pidName)
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- fatalError( "open failed for `%s': %s\n", device, strerror (errno));
+ error_msg_and_die( "open failed for `%s': %s\n", device, strerror (errno));
/* Find out how many processes there are */
if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0)
- fatalError( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
+ error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
/* Allocate some memory -- grab a few extras just in case
* some new processes start up while we wait. The kernel will
@@ -1325,7 +1325,7 @@ extern pid_t* findPidByName( char* pidName)
/* Now grab the pid list */
if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0)
- fatalError( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
+ error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
/* Now search for a match */
for (i=1, j=0; i<pid_array[0] ; i++) {
@@ -1334,7 +1334,7 @@ extern pid_t* findPidByName( char* pidName)
info.pid = pid_array[i];
if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)
- fatalError( "\nDEVPS_GET_PID_INFO: %s\n", strerror (errno));
+ error_msg_and_die( "\nDEVPS_GET_PID_INFO: %s\n", strerror (errno));
/* Make sure we only match on the process name */
p=info.command_line+1;
@@ -1358,7 +1358,7 @@ extern pid_t* findPidByName( char* pidName)
/* close device */
if (close (fd) != 0)
- fatalError( "close failed for `%s': %s\n",device, strerror (errno));
+ error_msg_and_die( "close failed for `%s': %s\n",device, strerror (errno));
return pidList;
}
@@ -1367,7 +1367,7 @@ extern pid_t* findPidByName( char* pidName)
#error Sorry, I depend on the /proc filesystem right now.
#endif
-/* findPidByName()
+/* find_pid_by_name()
*
* This finds the pid of the specified process.
* Currently, it's implemented by rummaging through
@@ -1375,7 +1375,7 @@ extern pid_t* findPidByName( char* pidName)
*
* Returns a list of all matching PIDs
*/
-extern pid_t* findPidByName( char* pidName)
+extern pid_t* find_pid_by_name( char* pidName)
{
DIR *dir;
struct dirent *next;
@@ -1384,7 +1384,7 @@ extern pid_t* findPidByName( char* pidName)
dir = opendir("/proc");
if (!dir)
- fatalError( "Cannot open /proc: %s\n", strerror (errno));
+ error_msg_and_die( "Cannot open /proc: %s\n", strerror (errno));
while ((next = readdir(dir)) != NULL) {
FILE *status;
@@ -1423,7 +1423,7 @@ extern void *xmalloc(size_t size)
void *ptr = malloc(size);
if (!ptr)
- fatalError(memory_exhausted);
+ error_msg_and_die(memory_exhausted);
return ptr;
}
@@ -1431,7 +1431,7 @@ extern void *xrealloc(void *old, size_t size)
{
void *ptr = realloc(old, size);
if (!ptr)
- fatalError(memory_exhausted);
+ error_msg_and_die(memory_exhausted);
return ptr;
}
@@ -1439,7 +1439,7 @@ extern void *xcalloc(size_t nmemb, size_t size)
{
void *ptr = calloc(nmemb, size);
if (!ptr)
- fatalError(memory_exhausted);
+ error_msg_and_die(memory_exhausted);
return ptr;
}
#endif
@@ -1455,7 +1455,7 @@ extern char * xstrdup (const char *s) {
t = strdup (s);
if (t == NULL)
- fatalError(memory_exhausted);
+ error_msg_and_die(memory_exhausted);
return t;
}
@@ -1467,7 +1467,7 @@ extern char * xstrndup (const char *s, int n) {
char *t;
if (s == NULL)
- fatalError("xstrndup bug");
+ error_msg_and_die("xstrndup bug");
t = xmalloc(n+1);
strncpy(t,s,n);
@@ -1588,13 +1588,13 @@ extern int find_real_root_device_name(char* name)
char fileName[BUFSIZ];
if (stat("/", &rootStat) != 0) {
- errorMsg("could not stat '/'\n");
+ error_msg("could not stat '/'\n");
return( FALSE);
}
dir = opendir("/dev");
if (!dir) {
- errorMsg("could not open '/dev'\n");
+ error_msg("could not open '/dev'\n");
return( FALSE);
}
@@ -1749,7 +1749,7 @@ void xregcomp(regex_t *preg, const char *regex, int cflags)
int errmsgsz = regerror(ret, preg, NULL, 0);
char *errmsg = xmalloc(errmsgsz);
regerror(ret, preg, errmsg, errmsgsz);
- fatalError("xregcomp: %s\n", errmsg);
+ error_msg_and_die("xregcomp: %s\n", errmsg);
}
}
#endif
@@ -1759,7 +1759,7 @@ FILE *wfopen(const char *path, const char *mode)
{
FILE *fp;
if ((fp = fopen(path, mode)) == NULL) {
- errorMsg("%s: %s\n", path, strerror(errno));
+ error_msg("%s: %s\n", path, strerror(errno));
errno = 0;
}
return fp;
@@ -1773,7 +1773,7 @@ FILE *xfopen(const char *path, const char *mode)
{
FILE *fp;
if ((fp = fopen(path, mode)) == NULL)
- fatalError("%s: %s\n", path, strerror(errno));
+ error_msg_and_die("%s: %s\n", path, strerror(errno));
return fp;
}
#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)
char *p;
if (fgets (buf, sizeof(buf), stdin) == NULL) {
- errorMsg("%s: Short file\n", inname);
+ error_msg("%s: Short file\n", inname);
return FALSE;
}
p = buf;
@@ -78,7 +78,7 @@ static int read_stduu (const char *inname)
if (fgets (buf, sizeof(buf), stdin) == NULL
|| strcmp (buf, "end\n")) {
- errorMsg("%s: No `end' line\n", inname);
+ error_msg("%s: No `end' line\n", inname);
return FALSE;
}
@@ -128,7 +128,7 @@ static int read_base64 (const char *inname)
unsigned char *p;
if (fgets (buf, sizeof(buf), stdin) == NULL) {
- errorMsg("%s: Short file\n", inname);
+ error_msg("%s: Short file\n", inname);
return FALSE;
}
p = buf;
@@ -136,7 +136,7 @@ static int read_base64 (const char *inname)
if (memcmp (buf, "====", 4) == 0)
break;
if (last_data != 0) {
- errorMsg("%s: data following `=' padding character\n", inname);
+ error_msg("%s: data following `=' padding character\n", inname);
return FALSE;
}
@@ -158,14 +158,14 @@ static int read_base64 (const char *inname)
while ((b64_tab[*p] & '\100') != 0)
if (*p == '\n' || *p++ == '=') {
- errorMsg("%s: illegal line\n", inname);
+ error_msg("%s: illegal line\n", inname);
return FALSE;
}
c2 = b64_tab[*p++];
while (b64_tab[*p] == '\177')
if (*p++ == '\n') {
- errorMsg("%s: illegal line\n", inname);
+ error_msg("%s: illegal line\n", inname);
return FALSE;
}
if (*p == '=') {
@@ -177,7 +177,7 @@ static int read_base64 (const char *inname)
while (b64_tab[*p] == '\177')
if (*p++ == '\n') {
- errorMsg("%s: illegal line\n", inname);
+ error_msg("%s: illegal line\n", inname);
return FALSE;
}
putchar (c1 << 2 | c2 >> 4);
@@ -209,7 +209,7 @@ static int decode (const char *inname,
while (1) {
if (fgets (buf, sizeof (buf), stdin) == NULL) {
- errorMsg("%s: No `begin' line\n", inname);
+ error_msg("%s: No `begin' line\n", inname);
return FALSE;
}
@@ -234,13 +234,13 @@ static int decode (const char *inname,
while (*p != '/')
++p;
if (*p == '\0') {
- errorMsg("%s: Illegal ~user\n", inname);
+ error_msg("%s: Illegal ~user\n", inname);
return FALSE;
}
*p++ = '\0';
pw = getpwnam (buf + 1);
if (pw == NULL) {
- errorMsg("%s: No user `%s'\n", inname, buf + 1);
+ error_msg("%s: No user `%s'\n", inname, buf + 1);
return FALSE;
}
n = strlen (pw->pw_dir);
@@ -257,7 +257,7 @@ static int decode (const char *inname,
&& (freopen (outname, "w", stdout) == NULL
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
)) {
- errorMsg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
+ error_msg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
return FALSE;
}
@@ -302,7 +302,7 @@ int uudecode_main (int argc,
if (decode (argv[optind], outname) != 0)
exit_status = FALSE;
} else {
- errorMsg("%s: %s\n", argv[optind], strerror(errno));
+ error_msg("%s: %s\n", argv[optind], strerror(errno));
exit_status = EXIT_FAILURE;
}
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()
}
if (ferror (stdin))
- errorMsg("Read error\n");
+ error_msg("Read error\n");
if (trans_ptr == uu_std) {
putchar (ENC ('\0'));
@@ -178,7 +178,7 @@ int uuencode_main (int argc,
case 2:
/* Optional first argument is input file. */
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
- errorMsg("%s: %s\n", argv[optind], strerror(errno));
+ error_msg("%s: %s\n", argv[optind], strerror(errno));
return EXIT_FAILURE;
}
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
@@ -199,7 +199,7 @@ int uuencode_main (int argc,
encode();
printf(trans_ptr == uu_std ? "end\n" : "====\n");
if (ferror (stdout)) {
- errorMsg("Write error\n");
+ error_msg("Write error\n");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
diff --git a/wget.c b/wget.c
index b43bbad62..0ec4dff19 100644
--- a/wget.c
+++ b/wget.c
@@ -100,7 +100,7 @@ int wget_main(int argc, char **argv)
if (do_continue && !fname_out)
- fatalError("cannot specify continue (-c) without a filename (-O)\n");
+ error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n");
/*
* Parse url into components.
*/
@@ -117,7 +117,7 @@ int wget_main(int argc, char **argv)
if (fname_out != (char *)1) {
if ( (output=fopen(fname_out, (do_continue ? "a" : "w")))
== NULL)
- fatalPerror("fopen(%s)", fname_out);
+ perror_msg_and_die("fopen(%s)", fname_out);
} else {
output = stdout;
}
@@ -128,7 +128,7 @@ int wget_main(int argc, char **argv)
if (do_continue) {
struct stat sbuf;
if (fstat(fileno(output), &sbuf) < 0)
- fatalError("fstat()");
+ error_msg_and_die("fstat()");
if (sbuf.st_size > 0)
beg_range = sbuf.st_size;
else
@@ -147,7 +147,7 @@ int wget_main(int argc, char **argv)
* Retrieve HTTP response line and check for "200" status code.
*/
if (fgets(buf, sizeof(buf), sfp) == NULL)
- fatalError("no response from server\n");
+ error_msg_and_die("no response from server\n");
for (s = buf ; *s != '\0' && !isspace(*s) ; ++s)
;
for ( ; isspace(*s) ; ++s)
@@ -156,13 +156,13 @@ int wget_main(int argc, char **argv)
case 200:
if (!do_continue)
break;
- fatalError("server does not support ranges\n");
+ error_msg_and_die("server does not support ranges\n");
case 206:
if (do_continue)
break;
/*FALLTHRU*/
default:
- fatalError("server returned error: %s", buf);
+ error_msg_and_die("server returned error: %s", buf);
}
/*
@@ -175,7 +175,7 @@ int wget_main(int argc, char **argv)
continue;
}
if (strcmp(buf, "transfer-encoding") == 0) {
- fatalError("server wants to do %s transfer encoding\n", s);
+ error_msg_and_die("server wants to do %s transfer encoding\n", s);
continue;
}
}
@@ -197,7 +197,7 @@ int wget_main(int argc, char **argv)
filesize -= n;
}
if (n == 0 && ferror(sfp))
- fatalPerror("network read error");
+ perror_msg_and_die("network read error");
exit(0);
}
@@ -211,7 +211,7 @@ void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path)
*uri_port = 80;
if (strncmp(url, "http://", 7) != 0)
- fatalError("not an http url: %s\n", url);
+ error_msg_and_die("not an http url: %s\n", url);
/* pull the host portion to the front of the buffer */
for (s = url, h = url+7 ; *h != '/' && *h != 0; ++h) {
@@ -240,7 +240,7 @@ FILE *open_socket(char *host, int port)
memzero(&sin, sizeof(sin));
sin.sin_family = AF_INET;
if ((hp = (struct hostent *) gethostbyname(host)) == NULL)
- fatalError("cannot resolve %s\n", host);
+ error_msg_and_die("cannot resolve %s\n", host);
memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length);
sin.sin_port = htons(port);
@@ -248,11 +248,11 @@ FILE *open_socket(char *host, int port)
* Get the server onto a stdio stream.
*/
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
- fatalPerror("socket()");
+ perror_msg_and_die("socket()");
if (connect(fd, (struct sockaddr *) &sin, sizeof(sin)) < 0)
- fatalPerror("connect(%s)", host);
+ perror_msg_and_die("connect(%s)", host);
if ((fp = fdopen(fd, "r+")) == NULL)
- fatalPerror("fdopen()");
+ perror_msg_and_die("fdopen()");
return fp;
}
@@ -281,7 +281,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc)
/* verify we are at the end of the header name */
if (*s != ':')
- fatalError("bad header line: %s\n", buf);
+ error_msg_and_die("bad header line: %s\n", buf);
/* locate the start of the header value */
for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s)
@@ -475,7 +475,7 @@ progressmeter(int flag)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: wget.c,v 1.9 2000/12/07 03:55:35 tausq Exp $
+ * $Id: wget.c,v 1.10 2000/12/07 19:56:48 markw Exp $
*/
diff --git a/whoami.c b/whoami.c
index 44fbc950b..6a5dd2c04 100644
--- a/whoami.c
+++ b/whoami.c
@@ -37,5 +37,5 @@ extern int whoami_main(int argc, char **argv)
puts(user);
return EXIT_SUCCESS;
}
- fatalError("cannot find username for UID %u\n", (unsigned) uid);
+ error_msg_and_die("cannot find username for UID %u\n", (unsigned) uid);
}