Use errorMsg rather than fprintf.
authorMatt Kraai <kraai@debian.org>
Fri, 14 Jul 2000 01:51:25 +0000 (01:51 -0000)
committerMatt Kraai <kraai@debian.org>
Fri, 14 Jul 2000 01:51:25 +0000 (01:51 -0000)
81 files changed:
applets/busybox.c
archival/gunzip.c
busybox.c
chmod_chown_chgrp.c
console-tools/deallocvt.c
console-tools/dumpkmap.c
console-tools/loadacm.c
console-tools/loadfont.c
console-tools/loadkmap.c
coreutils/cut.c
coreutils/dd.c
coreutils/df.c
coreutils/du.c
coreutils/head.c
coreutils/ln.c
coreutils/logname.c
coreutils/mkdir.c
coreutils/rmdir.c
coreutils/sort.c
coreutils/tail.c
coreutils/tee.c
coreutils/uniq.c
coreutils/whoami.c
cp_mv.c
cut.c
dc.c
dd.c
deallocvt.c
df.c
du.c
dumpkmap.c
editors/sed.c
fbset.c
findutils/grep.c
fsck_minix.c
grep.c
gunzip.c
head.c
hostname.c
insmod.c
lash.c
ln.c
loadacm.c
loadfont.c
loadkmap.c
logger.c
logname.c
messages.c
miscutils/dc.c
miscutils/mt.c
mkdir.c
mkfs_minix.c
mkswap.c
modutils/insmod.c
mount.c
mt.c
networking/hostname.c
networking/ping.c
nfsmount.c
ping.c
procps/ps.c
ps.c
rmdir.c
sed.c
sh.c
shell/lash.c
sort.c
sysklogd/logger.c
tail.c
tee.c
umount.c
uniq.c
util-linux/fbset.c
util-linux/fsck_minix.c
util-linux/mkfs_minix.c
util-linux/mkswap.c
util-linux/mount.c
util-linux/nfsmount.c
util-linux/umount.c
utility.c
whoami.c

index a355cdd1dded107afdcdff4a1b16a20bef409351..15f8e3f24a61913ef37287b6989fcb4c3bd73831 100644 (file)
@@ -392,7 +392,7 @@ static char *busybox_fullpath()
        if (len != -1) {
                path[len] = 0;
        } else {
-               fprintf(stderr, "busybox : %s : %s\n", proc, strerror(errno));
+               errorMsg("%s: %s\n", proc, strerror(errno));
                return NULL;
        }
        return strdup(path);
@@ -422,7 +422,7 @@ static int install_links(const char *busybox, int use_symbolic_links)
                puts(command);
 #endif
                if (rc) {
-                       fprintf(stderr,"busybox : %s : %s\n", command, strerror(errno));
+                       errorMsg("%s: %s\n", command, strerror(errno));
                }
        }
        return rc;
@@ -438,6 +438,7 @@ int main(int argc, char **argv)
 {
        char                            *s;
        const struct BB_applet  *a              = applets;
+       applet_name = "busybox";
 
 #ifdef BB_FEATURE_INSTALLER    
        /* 
index 89e46a68620dda7786be64b4a3af7b5145222317..de68bd19b41195035755305fe38bd772242a53f3 100644 (file)
@@ -659,7 +659,7 @@ int gunzip_main(int argc, char **argv)
                if (*argv == '\0')
                        usage(gunzip_usage);
                if (strlen(*argv) > MAX_PATH_LEN) {
-                       fprintf(stderr, name_too_long, "gunzip");
+                       errorMsg(name_too_long);
                        exit(WARNING);
                }
                strcpy(ifname, *argv);
@@ -698,7 +698,7 @@ int gunzip_main(int argc, char **argv)
 
                /* And get to work */
                if (strlen(ifname) > MAX_PATH_LEN - 4) {
-                       fprintf(stderr, name_too_long, "gunzip");
+                       errorMsg(name_too_long);
                        exit(WARNING);
                }
                strcpy(ofname, ifname);
@@ -780,8 +780,7 @@ int in;                                                     /* input file descriptor */
 
                method = (int) get_byte();
                if (method != DEFLATED) {
-                       fprintf(stderr,
-                                       "unknown method %d -- get newer version of gzip\n",
+                       errorMsg("unknown method %d -- get newer version of gzip\n",
                                        method);
                        exit_code = ERROR;
                        return -1;
index a355cdd1dded107afdcdff4a1b16a20bef409351..15f8e3f24a61913ef37287b6989fcb4c3bd73831 100644 (file)
--- a/busybox.c
+++ b/busybox.c
@@ -392,7 +392,7 @@ static char *busybox_fullpath()
        if (len != -1) {
                path[len] = 0;
        } else {
-               fprintf(stderr, "busybox : %s : %s\n", proc, strerror(errno));
+               errorMsg("%s: %s\n", proc, strerror(errno));
                return NULL;
        }
        return strdup(path);
@@ -422,7 +422,7 @@ static int install_links(const char *busybox, int use_symbolic_links)
                puts(command);
 #endif
                if (rc) {
-                       fprintf(stderr,"busybox : %s : %s\n", command, strerror(errno));
+                       errorMsg("%s: %s\n", command, strerror(errno));
                }
        }
        return rc;
@@ -438,6 +438,7 @@ int main(int argc, char **argv)
 {
        char                            *s;
        const struct BB_applet  *a              = applets;
+       applet_name = "busybox";
 
 #ifdef BB_FEATURE_INSTALLER    
        /* 
index 98b292568cdfc8cff4a2f434d43da44fbabe84c2..cf6a508950a3bb13ed9cc312163a9f73d4925ec0 100644 (file)
@@ -123,7 +123,7 @@ int chmod_chown_chgrp_main(int argc, char **argv)
                                        recursiveFlag = TRUE;
                                        break;
                                default:
-                                       fprintf(stderr, invalid_option, applet_name, **argv);
+                                       errorMsg(invalid_option, **argv);
                                        usage(appUsage);
                        }
                }
@@ -131,7 +131,7 @@ int chmod_chown_chgrp_main(int argc, char **argv)
        }
 
        if (argc == 0 || *argv == NULL) {
-               fprintf(stderr, too_few_args, applet_name);
+               errorMsg(too_few_args);
                usage(appUsage);
        }
 
@@ -176,7 +176,7 @@ int chmod_chown_chgrp_main(int argc, char **argv)
 
        /* Ok, ready to do the deed now */
        if (argc <= 1) {
-               fatalError( "too few arguments\n");
+               fatalError(too_few_args);
        }
        while (argc-- > 1) {
                if (recursiveAction (*(++argv), recursiveFlag, FALSE, FALSE, 
index 53d4d9a7cb67438047f54a8cfe32fa042af18e60..906f3a9fa99c1540c04b3e136c5e621dc16f554c 100644 (file)
@@ -39,14 +39,12 @@ int deallocvt_main(int argc, char *argv[])
                for (i = 1; i < argc; i++) {
                        num = atoi(argv[i]);
                        if (num == 0)
-                               fprintf(stderr, "%s: 0: illegal VT number\n", applet_name);
+                               errorMsg("0: illegal VT number\n");
                        else if (num == 1)
-                               fprintf(stderr, "%s: VT 1 cannot be deallocated\n",
-                                               applet_name);
+                               errorMsg("VT 1 cannot be deallocated\n");
                        else if (ioctl(fd, VT_DISALLOCATE, num)) {
                                perror("VT_DISALLOCATE");
-                               fprintf(stderr, "%s: could not deallocate console %d\n",
-                                               applet_name, num);
+                               errorMsg("could not deallocate console %d\n", num);
                                exit( FALSE);
                        }
                }
index a497a07d108101dddde62447124057a3c9a8c724..f1805052960f1f0e33446b433be8f21e027550c8 100644 (file)
@@ -58,7 +58,7 @@ int dumpkmap_main(int argc, char **argv)
 
        fd = open("/dev/tty0", O_RDWR);
        if (fd < 0) {
-               fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
+               errorMsg("Error opening /dev/tty0: %s\n", strerror(errno));
                return 1;
        }
 
@@ -86,7 +86,7 @@ int dumpkmap_main(int argc, char **argv)
                                ke.kb_table = i;
                                if (ioctl(fd, KDGKBENT, &ke) < 0) {
                                
-                                       fprintf(stderr, "ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
+                                       errorMsg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
                                        }
                                else {
                                        write(1,&ke.kb_value,2);        
index a64c691d284ea5f5717b5d9acdf72c0b0d6d0152..9eebf3bb57964cd585e03714a990ea6c35b6e689 100644 (file)
@@ -46,12 +46,12 @@ int loadacm_main(int argc, char **argv)
 
        fd = open("/dev/tty", O_RDWR);
        if (fd < 0) {
-               fprintf(stderr, "Error opening /dev/tty1: %s\n", strerror(errno));
+               errorMsg("Error opening /dev/tty1: %s\n", strerror(errno));
                return( FALSE);
        }
 
        if (screen_map_load(fd, stdin)) {
-               fprintf(stderr, "Error loading acm: %s\n", strerror(errno));
+               errorMsg("Error loading acm: %s\n", strerror(errno));
                return( FALSE);
        }
 
@@ -79,8 +79,7 @@ int screen_map_load(int fd, FILE * fp)
                if (parse_failed) {
                        if (-1 == fseek(fp, 0, SEEK_SET)) {
                                if (errno == ESPIPE)
-                                       fprintf(stderr,
-                                                       "16bit screen-map MUST be a regular file.\n"),
+                                       errorMsg("16bit screen-map MUST be a regular file.\n"),
                                                exit(1);
                                else
                                        perror("fseek failed reading binary 16bit screen-map"),
@@ -91,7 +90,7 @@ int screen_map_load(int fd, FILE * fp)
                                perror("Cannot read [new] map from file"), exit(1);
 #if 0
                        else
-                               fprintf(stderr, "Input screen-map is binary.\n");
+                               errorMsg("Input screen-map is binary.\n");
 #endif
                }
 
@@ -108,8 +107,7 @@ int screen_map_load(int fd, FILE * fp)
        /* rewind... */
        if (-1 == fseek(fp, 0, SEEK_SET)) {
                if (errno == ESPIPE)
-                       fprintf(stderr,
-                                       "Assuming 8bit screen-map - MUST be a regular file.\n"),
+                       errorMsg("Assuming 8bit screen-map - MUST be a regular file.\n"),
                                exit(1);
                else
                        perror("fseek failed assuming 8bit screen-map"), exit(1);
@@ -122,7 +120,7 @@ int screen_map_load(int fd, FILE * fp)
                        if (-1 == fseek(fp, 0, SEEK_SET)) {
                                if (errno == ESPIPE)
                                        /* should not - it succedeed above */
-                                       fprintf(stderr, "fseek() returned ESPIPE !\n"),
+                                       errorMsg("fseek() returned ESPIPE !\n"),
                                                exit(1);
                                else
                                        perror("fseek for binary 8bit screen-map"), exit(1);
@@ -132,7 +130,7 @@ int screen_map_load(int fd, FILE * fp)
                                perror("Cannot read [old] map from file"), exit(1);
 #if 0
                        else
-                               fprintf(stderr, "Input screen-map is binary.\n");
+                               errorMsg("Input screen-map is binary.\n");
 #endif
                }
 
@@ -141,7 +139,7 @@ int screen_map_load(int fd, FILE * fp)
                else
                        return 0;
        }
-       fprintf(stderr, "Error parsing symbolic map\n");
+       errorMsg("Error parsing symbolic map\n");
        return(1);
 }
 
index 7eaf40e82715b75621921fbe82b6b5c4055a3e4b..b3f9f4f1189f3279354c0603c1c572deccf7aba0 100644 (file)
@@ -56,7 +56,7 @@ extern int loadfont_main(int argc, char **argv)
 
        fd = open("/dev/tty0", O_RDWR);
        if (fd < 0) {
-               fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
+               errorMsg("Error opening /dev/tty0: %s\n", strerror(errno));
                return( FALSE);
        }
        loadnewfont(fd);
@@ -72,7 +72,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
        memset(buf, 0, sizeof(buf));
 
        if (unit < 1 || unit > 32) {
-               fprintf(stderr, "Bad character size %d\n", unit);
+               errorMsg("Bad character size %d\n", unit);
                exit(1);
        }
 
@@ -112,7 +112,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
        up = (struct unipair *) malloc(maxct * sizeof(struct unipair));
 
        if (!up) {
-               fprintf(stderr, "Out of memory?\n");
+               errorMsg("Out of memory?\n");
                exit(1);
        }
        for (glyph = 0; glyph < fontsize; glyph++) {
@@ -137,8 +137,8 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
        if (ioctl(fd, PIO_UNIMAPCLR, &advice)) {
 #ifdef ENOIOCTLCMD
                if (errno == ENOIOCTLCMD) {
-                       fprintf(stderr, "It seems this kernel is older than 1.1.92\n");
-                       fprintf(stderr, "No Unicode mapping table loaded.\n");
+                       errorMsg("It seems this kernel is older than 1.1.92\n");
+                       errorMsg("No Unicode mapping table loaded.\n");
                } else
 #endif
                        perror("PIO_UNIMAPCLR");
@@ -198,13 +198,13 @@ static void loadnewfont(int fd)
                        goto no_psf;
 
                if (psfhdr.mode > PSF_MAXMODE) {
-                       fprintf(stderr, "Unsupported psf file mode\n");
+                       errorMsg("Unsupported psf file mode\n");
                        exit(1);
                }
                fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256);
 #if !defined( PIO_FONTX ) || defined( __sparc__ )
                if (fontsize != 256) {
-                       fprintf(stderr, "Only fontsize 256 supported\n");
+                       errorMsg("Only fontsize 256 supported\n");
                        exit(1);
                }
 #endif
@@ -214,7 +214,7 @@ static void loadnewfont(int fd)
 
                head = head0 + fontsize * unit;
                if (head > inputlth || (!hastable && head != inputlth)) {
-                       fprintf(stderr, "Input file: bad length\n");
+                       errorMsg("Input file: bad length\n");
                        exit(1);
                }
                do_loadfont(fd, inbuf + head0, unit, fontsize);
@@ -231,7 +231,7 @@ static void loadnewfont(int fd)
        } else {
                /* bare font */
                if (inputlth & 0377) {
-                       fprintf(stderr, "Bad input file size\n");
+                       errorMsg("Bad input file size\n");
                        exit(1);
                }
                offset = 0;
index c2e4c94ed215cf7c137965737f3c8b1a7e8d9148..72247a6e4b6c49d5274a5fdc1f417317ef33c408 100644 (file)
@@ -59,25 +59,25 @@ int loadkmap_main(int argc, char **argv)
 
        fd = open("/dev/tty0", O_RDWR);
        if (fd < 0) {
-               fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
+               errorMsg("Error opening /dev/tty0: %s\n", strerror(errno));
                exit(FALSE);
        }
 
        read(0, buff, 7);
        if (0 != strncmp(buff, magic, 7)) {
-               fprintf(stderr, "This is not a valid binary keymap.\n");
+               errorMsg("This is not a valid binary keymap.\n");
                exit(FALSE);
        }
 
        if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) {
-               fprintf(stderr, "Error reading keymap flags: %s\n",
+               errorMsg("Error reading keymap flags: %s\n",
                                strerror(errno));
                exit(FALSE);
        }
 
        ibuff = (u_short *) malloc(ibuffsz);
        if (!ibuff) {
-               fprintf(stderr, "Out of memory.\n");
+               errorMsg("Out of memory.\n");
                exit(FALSE);
        }
 
@@ -87,7 +87,7 @@ int loadkmap_main(int argc, char **argv)
                        while (pos < ibuffsz) {
                                if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos))
                                        < 0) {
-                                       fprintf(stderr, "Error reading keymap: %s\n",
+                                       errorMsg("Error reading keymap: %s\n",
                                                        strerror(errno));
                                        exit(FALSE);
                                }
index 820074e605d03bc86838f513cd2f973b71088bbe..783d526a5981323f7f8f453644bb04099f72ceca 100644 (file)
@@ -84,13 +84,13 @@ void cut(void);
 void warn(int warn_number, char *option)
 {
        static char *warn_msg[] = {
-               "%s: Option -%s allowed only with -f\n",
-               "%s: -%s overrides earlier option\n",
-               "%s: -%s not allowed in current mode\n",
-               "%s: Cannot open %s\n"
+               "Option -%s allowed only with -f\n",
+               "-%s overrides earlier option\n",
+               "-%s not allowed in current mode\n",
+               "Cannot open %s\n"
        };
 
-       fprintf(stderr, warn_msg[warn_number], applet_name, option);
+       errorMsg(warn_msg[warn_number], option);
        exit_status = warn_number + 1;
 
 }
@@ -98,15 +98,15 @@ void warn(int warn_number, char *option)
 void cuterror(int err)
 {
        static char *err_mes[] = {
-               "%s: syntax error\n",
-               "%s: position must be >0\n",
-               "%s: line longer than BUFSIZ\n",
-               "%s: range must not decrease from left to right\n",
-               "%s: MAX_FIELD exceeded\n",
-               "%s: MAX_ARGS exceeded\n"
+               "syntax error\n",
+               "position must be >0\n",
+               "line longer than BUFSIZ\n",
+               "range must not decrease from left to right\n",
+               "MAX_FIELD exceeded\n",
+               "MAX_ARGS exceeded\n"
        };
 
-       fprintf(stderr, err_mes[err - 101], applet_name);
+       errorMsg(err_mes[err - 101]);
        exit(err);
 }
 
index 5d9993d8b1ef644a51ff6f95d0b444ee1859303f..6261dfef57dc48f529f4ce4bcab478599557b7c0 100644 (file)
@@ -86,26 +86,26 @@ extern int dd_main(int argc, char **argv)
                else if (strncmp("count", *argv, 5) == 0) {
                        count = getNum((strchr(*argv, '=')) + 1);
                        if (count <= 0) {
-                               fprintf(stderr, "Bad count value %s\n", *argv);
+                               errorMsg("Bad count value %s\n", *argv);
                                goto usage;
                        }
                } else if (strncmp(*argv, "bs", 2) == 0) {
                        blockSize = getNum((strchr(*argv, '=')) + 1);
                        if (blockSize <= 0) {
-                               fprintf(stderr, "Bad block size value %s\n", *argv);
+                               errorMsg("Bad block size value %s\n", *argv);
                                goto usage;
                        }
                } else if (strncmp(*argv, "skip", 4) == 0) {
                        skipBlocks = getNum((strchr(*argv, '=')) + 1);
                        if (skipBlocks <= 0) {
-                               fprintf(stderr, "Bad skip value %s\n", *argv);
+                               errorMsg("Bad skip value %s\n", *argv);
                                goto usage;
                        }
 
                } else if (strncmp(*argv, "seek", 4) == 0) {
                        seekBlocks = getNum((strchr(*argv, '=')) + 1);
                        if (seekBlocks <= 0) {
-                               fprintf(stderr, "Bad seek value %s\n", *argv);
+                               errorMsg("Bad seek value %s\n", *argv);
                                goto usage;
                        }
 
index ba3227f304ee771b828be0257717312ef5fe0afe..62226ceb8016964ac1483b350114a2b499a93fc5 100644 (file)
@@ -82,7 +82,7 @@ extern int df_main(int argc, char **argv)
                }
                while (argc > 1) {
                        if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) {
-                               fprintf(stderr, "%s: can't find mount point.\n", argv[1]);
+                               errorMsg("%s: can't find mount point.\n", argv[1]);
                                exit(FALSE);
                        }
                        status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir);
index b8e296ddd20f3bea2a1f761c2ebc8a38baf1ea76..b1ca954366159d6b6738fae05761b8428cd853a5 100644 (file)
@@ -108,7 +108,7 @@ static long du(char *filename)
                        }
 
                        if (len + strlen(name) + 1 > BUFSIZ) {
-                               fprintf(stderr, name_too_long, "du");
+                               errorMsg(name_too_long);
                                du_depth--;
                                return 0;
                        }
@@ -158,7 +158,7 @@ int du_main(int argc, char **argv)
                                usage(du_usage);
                                break;
                        default:
-                               fprintf(stderr, "du: invalid option -- %c\n", opt);
+                               errorMsg("invalid option -- %c\n", opt);
                                usage(du_usage);
                        }
                } else {
@@ -184,7 +184,7 @@ int du_main(int argc, char **argv)
        return(0);
 }
 
-/* $Id: du.c,v 1.20 2000/06/19 17:25:39 andersen Exp $ */
+/* $Id: du.c,v 1.21 2000/07/14 01:51:25 kraai Exp $ */
 /*
 Local Variables:
 c-file-style: "linux"
index f42f4837d323a6bddad94ea6cc6cd41a7a7675ea..b82678dc23da622baf00ec5d17c86cc0964b9c91 100644 (file)
@@ -75,7 +75,7 @@ int head_main(int argc, char **argv)
                        case 'h':
                                usage(head_usage);
                        default:
-                               fprintf(stderr, "head: invalid option -- %c\n", opt);
+                               errorMsg("invalid option -- %c\n", opt);
                                usage(head_usage);
                        }
                } else {
@@ -95,8 +95,7 @@ int head_main(int argc, char **argv)
 
                        src = fopen(argv[i], "r");
                        if (!src) {
-                               fprintf(stderr, "head: %s: %s\n", argv[i],
-                                               strerror(errno));
+                               errorMsg("%s: %s\n", argv[i], strerror(errno));
                        } else {
                                /* emulating GNU behaviour */
                                if (need_headers) {
@@ -112,4 +111,4 @@ int head_main(int argc, char **argv)
        return(0);
 }
 
-/* $Id: head.c,v 1.11 2000/06/19 17:25:39 andersen Exp $ */
+/* $Id: head.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */
index ac1f68e0024034e84a0ad6ee17f9b1d97107f04c..9f7774380be7d0d053b2a28034b41b3f59cee2c4 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "internal.h"
 #define BB_DECLARE_EXTERN
-#define bb_need_name_too_long
 #define bb_need_not_a_directory
 #include "messages.c"
 
@@ -92,7 +91,7 @@ extern int ln_main(int argc, char **argv)
 
        linkIntoDirFlag = isDirectory(linkName, followLinks, NULL);
        if ((argc >= 3) && linkIntoDirFlag == FALSE) {
-               fprintf(stderr, not_a_directory, "ln", linkName);
+               errorMsg(not_a_directory, linkName);
                exit FALSE;
        }
 
index 4b4483cc166cd276fcb27b1041dc236d0b27bac7..12ebfbde69c9eeffa83ffb4ff75ac49fa77b915f 100644 (file)
@@ -41,6 +41,6 @@ extern int logname_main(int argc, char **argv)
                puts(user);
                exit(TRUE);
        }
-       fprintf(stderr, "no login name\n");
+       errorMsg("no login name\n");
        return(FALSE);
 }
index b18c949b844d68c19903852b2e0c438d849eeb3d..f6e08cadc076dae316354da7eeedc3bded56d37c 100644 (file)
@@ -62,7 +62,7 @@ extern int mkdir_main(int argc, char **argv)
                                /* Find the specified modes */
                                mode = 0;
                                if (parse_mode(*(++argv), &mode) == FALSE) {
-                                       fprintf(stderr, "Unknown mode: %s\n", *argv);
+                                       errorMsg("Unknown mode: %s\n", *argv);
                                        exit FALSE;
                                }
                                /* Set the umask for this process so it doesn't 
@@ -91,13 +91,13 @@ extern int mkdir_main(int argc, char **argv)
                char buf[BUFSIZ + 1];
 
                if (strlen(*argv) > BUFSIZ - 1) {
-                       fprintf(stderr, name_too_long, "mkdir");
+                       errorMsg(name_too_long);
                        exit FALSE;
                }
                strcpy(buf, *argv);
                status = stat(buf, &statBuf);
                if (parentFlag == FALSE && status != -1 && errno != ENOENT) {
-                       fprintf(stderr, "%s: File exists\n", buf);
+                       errorMsg("%s: File exists\n", buf);
                        exit FALSE;
                }
                if (parentFlag == TRUE) {
index c88f42cf54f35791b079fed384c2d6e732164491..4edb9b6b3988f392bec624c3098acb57ea0edf09 100644 (file)
@@ -40,7 +40,7 @@ extern int rmdir_main(int argc, char **argv)
 
        while (--argc > 0) {
                if (rmdir(*(++argv)) == -1) {
-                       fprintf(stderr, "%s: %s\n", applet_name, strerror(errno));
+                       errorMsg("%s\n", strerror(errno));
                        exit(FALSE);
                }
        }
index a28122d510d420bc8bc525dd6092f6e5873b9860..c754989eafdb2f154611ceace21a56621ff097a1 100644 (file)
@@ -263,7 +263,7 @@ int sort_main(int argc, char **argv)
                                break;
 #endif
                        default:
-                               fprintf(stderr, "sort: invalid option -- %c\n", opt);
+                               errorMsg("invalid option -- %c\n", opt);
                                usage(sort_usage);
                        }
                } else {
@@ -304,4 +304,4 @@ int sort_main(int argc, char **argv)
        return(0);
 }
 
-/* $Id: sort.c,v 1.18 2000/06/28 22:15:26 markw Exp $ */
+/* $Id: sort.c,v 1.19 2000/07/14 01:51:25 kraai Exp $ */
index 3189d204f47c8c0061337d586099c8feda6d2d25..601f0873d42079d250b54ac2e495ea421a81b4ce 100644 (file)
@@ -375,7 +375,7 @@ extern int tail_main(int argc, char **argv)
                                usage(tail_usage);
                        default:
                                if ((n_units = atoi(&argv[i][1])) < 1) {
-                                       fprintf(stderr, "tail: invalid option -- %c\n", opt);
+                                       errorMsg("invalid option -- %c\n", opt);
                                        usage(tail_usage);
                                }
                        }
@@ -386,8 +386,7 @@ extern int tail_main(int argc, char **argv)
 
        if (i + 1 < argc) {
                if (forever) {
-                       fprintf(stderr,
-                                       "tail: option -f is invalid with multiple files\n");
+                       errorMsg("option -f is invalid with multiple files\n");
                        usage(tail_usage);
                }
                print_headers = 1;
index c9b5410d312347d59e200b6497bb5566844d941c..67b42a24d55e10276c2f552c0a5e816324b33ac9 100644 (file)
@@ -104,7 +104,7 @@ int tee_main(int argc, char **argv)
        /* init FILE pointers */
        FileList = calloc(FL_MAX, sizeof(FILE*));
        if (!FileList) {
-               fprintf(stderr, "tee: %s\n", strerror(errno));
+               errorMsg("%s\n", strerror(errno));
                exit(1);
        }
        FL_end = 0;
@@ -133,4 +133,4 @@ int tee_main(int argc, char **argv)
        return(0);
 }
 
-/* $Id: tee.c,v 1.11 2000/06/19 17:25:40 andersen Exp $ */
+/* $Id: tee.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */
index 64acf046ad0088fe7a73a495f113e74de69fc947..16b25767049071714eda66327bf872000f66585e 100644 (file)
@@ -127,11 +127,11 @@ set_file_pointers(int schema, FILE ** in, FILE ** out, char **argv)
                break;
        }
        if (*in == NULL) {
-               fprintf(stderr, "uniq: %s: %s\n", argv[0], strerror(errno));
+               errorMsg("%s: %s\n", argv[0], strerror(errno));
                return errno;
        }
        if (*out == NULL) {
-               fprintf(stderr, "uniq: %s: %s\n", argv[1], strerror(errno));
+               errorMsg("%s: %s\n", argv[1], strerror(errno));
                return errno;
        }
        return 0;
@@ -187,4 +187,4 @@ int uniq_main(int argc, char **argv)
        return(0);
 }
 
-/* $Id: uniq.c,v 1.11 2000/06/19 17:25:40 andersen Exp $ */
+/* $Id: uniq.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */
index 983c6725d4617e35d548eb34d8ec9c4c10694cb8..01dff81f919b8b41be7be720f1177e5ba303adcf 100644 (file)
@@ -43,7 +43,6 @@ extern int whoami_main(int argc, char **argv)
                puts(user);
                exit(TRUE);
        }
-       fprintf(stderr, "%s: cannot find username for UID %u\n", applet_name,
-                       (unsigned) uid);
+       errorMsg("cannot find username for UID %u\n", (unsigned) uid);
        return(FALSE);
 }
diff --git a/cp_mv.c b/cp_mv.c
index cd061befb281e4738efc776c496f8d56cac83bf1..6550e1c39b73942c998ed173e073ad98ca7dd3e8 100644 (file)
--- a/cp_mv.c
+++ b/cp_mv.c
@@ -89,8 +89,7 @@ static void name_too_long__exit (void) __attribute__((noreturn));
 static
 void name_too_long__exit (void)
 {
-       fprintf(stderr, name_too_long, applet_name);
-       exit(FALSE);
+       fatalError(name_too_long);
 }
 
 static void
@@ -124,14 +123,14 @@ cp_mv_Action(const char *fileName, struct stat *statbuf, void* junk)
 
        if (srcDirFlag == TRUE) {
                if (recursiveFlag == FALSE) {
-                       fprintf(stderr, omitting_directory, applet_name, baseSrcName);
+                       errorMsg(omitting_directory, baseSrcName);
                        return TRUE;
                }
                srcBasename = (strstr(fileName, baseSrcName)
                                           + strlen(baseSrcName));
 
                if (destLen + strlen(srcBasename) > BUFSIZ) {
-                       fprintf(stderr, name_too_long, applet_name);
+                       errorMsg(name_too_long);
                        return FALSE;
                }
                strcat(destName, srcBasename);
@@ -145,8 +144,8 @@ 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) {
-                       fprintf(stderr, "%s: rename(%s, %s): %s\n",
-                                       applet_name, fileName, destName, strerror(errno));
+                       errorMsg("rename(%s, %s): %s\n", fileName, destName, 
+                                       strerror(errno));
                        goto do_copyFile;       /* Try anyway... */
                }
                else if (errno == EXDEV)
@@ -158,8 +157,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) {
-                               fprintf(stderr, "%s: link(%s, %s): %s\n",
-                                               applet_name, name, destName, strerror(errno));
+                               errorMsg("link(%s, %s): %s\n", name, destName, strerror(errno));
                                return FALSE;
                        }
                        return TRUE;
@@ -178,11 +176,11 @@ rm_Action(const char *fileName, struct stat *statbuf, void* junk)
 
        if (S_ISDIR(statbuf->st_mode)) {
                if (rmdir(fileName) < 0) {
-                       fprintf(stderr, "%s: rmdir(%s): %s\n", applet_name, fileName, strerror(errno));
+                       errorMsg("rmdir(%s): %s\n", fileName, strerror(errno));
                        status = FALSE;
                }
        } else if (unlink(fileName) < 0) {
-               fprintf(stderr, "%s: unlink(%s): %s\n", applet_name, fileName, strerror(errno));
+               errorMsg("unlink(%s): %s\n", fileName, strerror(errno));
                status = FALSE;
        }
        return status;
@@ -236,7 +234,7 @@ extern int cp_mv_main(int argc, char **argv)
        
 
        if (strlen(argv[argc - 1]) > BUFSIZ) {
-               fprintf(stderr, name_too_long, "cp");
+               errorMsg(name_too_long);
                goto exit_false;
        }
        strcpy(baseDestName, argv[argc - 1]);
@@ -246,7 +244,7 @@ extern int cp_mv_main(int argc, char **argv)
 
        destDirFlag = isDirectory(baseDestName, TRUE, &destStatBuf);
        if ((argc > 3) && destDirFlag == FALSE) {
-               fprintf(stderr, not_a_directory, "cp", baseDestName);
+               errorMsg(not_a_directory, baseDestName);
                goto exit_false;
        }
 
@@ -272,29 +270,28 @@ extern int cp_mv_main(int argc, char **argv)
                        char            *pushd, *d, *p;
 
                        if ((pushd = getcwd(NULL, BUFSIZ + 1)) == NULL) {
-                               fprintf(stderr, "%s: getcwd(): %s\n", applet_name, strerror(errno));
+                               errorMsg("getcwd(): %s\n", strerror(errno));
                                continue;
                        }
                        if (chdir(baseDestName) < 0) {
-                               fprintf(stderr, "%s: chdir(%s): %s\n", applet_name, baseSrcName, strerror(errno));
+                               errorMsg("chdir(%s): %s\n", baseSrcName, strerror(errno));
                                continue;
                        }
                        if ((d = getcwd(NULL, BUFSIZ + 1)) == NULL) {
-                               fprintf(stderr, "%s: getcwd(): %s\n", applet_name, strerror(errno));
+                               errorMsg("getcwd(): %s\n", strerror(errno));
                                continue;
                        }
                        while (!state && *d != '\0') {
                                if (stat(d, &sb) < 0) { /* stat not lstat - always dereference targets */
-                                       fprintf(stderr, "%s: stat(%s) :%s\n", applet_name, d, strerror(errno));
+                                       errorMsg("stat(%s): %s\n", d, strerror(errno));
                                        state = -1;
                                        continue;
                                }
                                if ((sb.st_ino == srcStatBuf.st_ino) &&
                                        (sb.st_dev == srcStatBuf.st_dev)) {
-                                       fprintf(stderr,
-                                                       "%s: Cannot %s `%s' "
-                                                       "into a subdirectory of itself, `%s/%s'\n",
-                                                       applet_name, applet_name, baseSrcName, baseDestName, baseSrcName);
+                                       errorMsg("Cannot %s `%s' into a subdirectory of itself, "
+                                                       "`%s/%s'\n", applet_name, baseSrcName,
+                                                       baseDestName, baseSrcName);
                                        state = -1;
                                        continue;
                                }
@@ -303,7 +300,7 @@ extern int cp_mv_main(int argc, char **argv)
                                }
                        }
                        if (chdir(pushd) < 0) {
-                               fprintf(stderr, "%s: chdir(%s): %s\n", applet_name, pushd, strerror(errno));
+                               errorMsg("chdir(%s): %s\n", pushd, strerror(errno));
                                free(pushd);
                                free(d);
                                continue;
diff --git a/cut.c b/cut.c
index 820074e605d03bc86838f513cd2f973b71088bbe..783d526a5981323f7f8f453644bb04099f72ceca 100644 (file)
--- a/cut.c
+++ b/cut.c
@@ -84,13 +84,13 @@ void cut(void);
 void warn(int warn_number, char *option)
 {
        static char *warn_msg[] = {
-               "%s: Option -%s allowed only with -f\n",
-               "%s: -%s overrides earlier option\n",
-               "%s: -%s not allowed in current mode\n",
-               "%s: Cannot open %s\n"
+               "Option -%s allowed only with -f\n",
+               "-%s overrides earlier option\n",
+               "-%s not allowed in current mode\n",
+               "Cannot open %s\n"
        };
 
-       fprintf(stderr, warn_msg[warn_number], applet_name, option);
+       errorMsg(warn_msg[warn_number], option);
        exit_status = warn_number + 1;
 
 }
@@ -98,15 +98,15 @@ void warn(int warn_number, char *option)
 void cuterror(int err)
 {
        static char *err_mes[] = {
-               "%s: syntax error\n",
-               "%s: position must be >0\n",
-               "%s: line longer than BUFSIZ\n",
-               "%s: range must not decrease from left to right\n",
-               "%s: MAX_FIELD exceeded\n",
-               "%s: MAX_ARGS exceeded\n"
+               "syntax error\n",
+               "position must be >0\n",
+               "line longer than BUFSIZ\n",
+               "range must not decrease from left to right\n",
+               "MAX_FIELD exceeded\n",
+               "MAX_ARGS exceeded\n"
        };
 
-       fprintf(stderr, err_mes[err - 101], applet_name);
+       errorMsg(err_mes[err - 101]);
        exit(err);
 }
 
diff --git a/dc.c b/dc.c
index 5bf3bc984684171c9f95f6b19819d2ecb3f2ba3a..7b13cb943698636d4840b3b64354cb89400516df 100644 (file)
--- a/dc.c
+++ b/dc.c
@@ -22,7 +22,7 @@ static unsigned int pointer;
 static void push(double a)
 {
        if (pointer >= (sizeof(stack) / sizeof(*stack))) {
-               fprintf(stderr, "dc: stack overflow\n");
+               errorMsg("stack overflow\n");
                exit(-1);
        } else
                stack[pointer++] = a;
@@ -31,7 +31,7 @@ static void push(double a)
 static double pop()
 {
        if (pointer == 0) {
-               fprintf(stderr, "dc: stack underflow\n");
+               errorMsg("stack underflow\n");
                exit(-1);
        }
        return stack[--pointer];
@@ -132,7 +132,7 @@ static void stack_machine(const char *argument)
                }
                o++;
        }
-       fprintf(stderr, "dc: %s: syntax error.\n", argument);
+       errorMsg("%s: syntax error.\n", argument);
        exit(-1);
 }
 
diff --git a/dd.c b/dd.c
index 5d9993d8b1ef644a51ff6f95d0b444ee1859303f..6261dfef57dc48f529f4ce4bcab478599557b7c0 100644 (file)
--- a/dd.c
+++ b/dd.c
@@ -86,26 +86,26 @@ extern int dd_main(int argc, char **argv)
                else if (strncmp("count", *argv, 5) == 0) {
                        count = getNum((strchr(*argv, '=')) + 1);
                        if (count <= 0) {
-                               fprintf(stderr, "Bad count value %s\n", *argv);
+                               errorMsg("Bad count value %s\n", *argv);
                                goto usage;
                        }
                } else if (strncmp(*argv, "bs", 2) == 0) {
                        blockSize = getNum((strchr(*argv, '=')) + 1);
                        if (blockSize <= 0) {
-                               fprintf(stderr, "Bad block size value %s\n", *argv);
+                               errorMsg("Bad block size value %s\n", *argv);
                                goto usage;
                        }
                } else if (strncmp(*argv, "skip", 4) == 0) {
                        skipBlocks = getNum((strchr(*argv, '=')) + 1);
                        if (skipBlocks <= 0) {
-                               fprintf(stderr, "Bad skip value %s\n", *argv);
+                               errorMsg("Bad skip value %s\n", *argv);
                                goto usage;
                        }
 
                } else if (strncmp(*argv, "seek", 4) == 0) {
                        seekBlocks = getNum((strchr(*argv, '=')) + 1);
                        if (seekBlocks <= 0) {
-                               fprintf(stderr, "Bad seek value %s\n", *argv);
+                               errorMsg("Bad seek value %s\n", *argv);
                                goto usage;
                        }
 
index 53d4d9a7cb67438047f54a8cfe32fa042af18e60..906f3a9fa99c1540c04b3e136c5e621dc16f554c 100644 (file)
@@ -39,14 +39,12 @@ int deallocvt_main(int argc, char *argv[])
                for (i = 1; i < argc; i++) {
                        num = atoi(argv[i]);
                        if (num == 0)
-                               fprintf(stderr, "%s: 0: illegal VT number\n", applet_name);
+                               errorMsg("0: illegal VT number\n");
                        else if (num == 1)
-                               fprintf(stderr, "%s: VT 1 cannot be deallocated\n",
-                                               applet_name);
+                               errorMsg("VT 1 cannot be deallocated\n");
                        else if (ioctl(fd, VT_DISALLOCATE, num)) {
                                perror("VT_DISALLOCATE");
-                               fprintf(stderr, "%s: could not deallocate console %d\n",
-                                               applet_name, num);
+                               errorMsg("could not deallocate console %d\n", num);
                                exit( FALSE);
                        }
                }
diff --git a/df.c b/df.c
index ba3227f304ee771b828be0257717312ef5fe0afe..62226ceb8016964ac1483b350114a2b499a93fc5 100644 (file)
--- a/df.c
+++ b/df.c
@@ -82,7 +82,7 @@ extern int df_main(int argc, char **argv)
                }
                while (argc > 1) {
                        if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) {
-                               fprintf(stderr, "%s: can't find mount point.\n", argv[1]);
+                               errorMsg("%s: can't find mount point.\n", argv[1]);
                                exit(FALSE);
                        }
                        status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir);
diff --git a/du.c b/du.c
index b8e296ddd20f3bea2a1f761c2ebc8a38baf1ea76..b1ca954366159d6b6738fae05761b8428cd853a5 100644 (file)
--- a/du.c
+++ b/du.c
@@ -108,7 +108,7 @@ static long du(char *filename)
                        }
 
                        if (len + strlen(name) + 1 > BUFSIZ) {
-                               fprintf(stderr, name_too_long, "du");
+                               errorMsg(name_too_long);
                                du_depth--;
                                return 0;
                        }
@@ -158,7 +158,7 @@ int du_main(int argc, char **argv)
                                usage(du_usage);
                                break;
                        default:
-                               fprintf(stderr, "du: invalid option -- %c\n", opt);
+                               errorMsg("invalid option -- %c\n", opt);
                                usage(du_usage);
                        }
                } else {
@@ -184,7 +184,7 @@ int du_main(int argc, char **argv)
        return(0);
 }
 
-/* $Id: du.c,v 1.20 2000/06/19 17:25:39 andersen Exp $ */
+/* $Id: du.c,v 1.21 2000/07/14 01:51:25 kraai Exp $ */
 /*
 Local Variables:
 c-file-style: "linux"
index a497a07d108101dddde62447124057a3c9a8c724..f1805052960f1f0e33446b433be8f21e027550c8 100644 (file)
@@ -58,7 +58,7 @@ int dumpkmap_main(int argc, char **argv)
 
        fd = open("/dev/tty0", O_RDWR);
        if (fd < 0) {
-               fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
+               errorMsg("Error opening /dev/tty0: %s\n", strerror(errno));
                return 1;
        }
 
@@ -86,7 +86,7 @@ int dumpkmap_main(int argc, char **argv)
                                ke.kb_table = i;
                                if (ioctl(fd, KDGKBENT, &ke) < 0) {
                                
-                                       fprintf(stderr, "ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
+                                       errorMsg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
                                        }
                                else {
                                        write(1,&ke.kb_value,2);        
index 770a56eeb98ac65fe729f56d2468e5d61a9b0b5b..3a7360fc59980b30dc9965ccef8a36263b6e691b 100644 (file)
@@ -207,8 +207,8 @@ static int get_address(const char *str, int *line, regex_t **regex)
                idx++; /* so it points to the next character after the last '/' */
        }
        else {
-               fprintf(stderr, "sed.c:get_address: no address found in string\n");
-               fprintf(stderr, "\t(you probably didn't check the string you passed me)\n");
+               errorMsg("get_address: no address found in string\n"
+                               "\t(you probably didn't check the string you passed me)\n");
                idx = -1;
        }
 
@@ -612,7 +612,7 @@ extern int sed_main(int argc, char **argv)
                for (i = optind; i < argc; i++) {
                        file = fopen(argv[i], "r");
                        if (file == NULL) {
-                               fprintf(stderr, "sed: %s: %s\n", argv[i], strerror(errno));
+                               errorMsg("%s: %s\n", argv[i], strerror(errno));
                        } else {
                                process_file(file);
                                fclose(file);
diff --git a/fbset.c b/fbset.c
index 9fde6a19d988d4ab224efcccf2fc96991fc82a8c..2fcc7c2945237e3c5a0e279e3e160bef4dc6d986 100644 (file)
--- a/fbset.c
+++ b/fbset.c
@@ -387,7 +387,7 @@ extern int fbset_main(int argc, char **argv)
                PERROR("fbset(ioctl)");
        if (g_options & OPT_READMODE) {
                if (!readmode(&var, modefile, mode)) {
-                       fprintf(stderr, "Unknown video mode `%s'\n", mode);
+                       errorMsg("Unknown video mode `%s'\n", mode);
                        exit(1);
                }
        }
index 77b510002d9bcb04d0b41de036b08890e2c6a019..03945fa2574ba671153595f6e0a0cf1c89353fc3 100644 (file)
@@ -165,7 +165,7 @@ extern int grep_main(int argc, char **argv)
                        file = fopen(cur_file, "r");
                        if (file == NULL) {
                                if (!suppress_err_msgs)
-                                       fprintf(stderr, "grep: %s: %s\n", cur_file, strerror(errno));
+                                       errorMsg("%s: %s\n", cur_file, strerror(errno));
                        } else {
                                grep_file(file);
                                fclose(file);
index 685e0ee6c818f1d7a0c5a32815e853c9938a6070..74281a71efaef917adbe1af1fc629935aa4fe1b1 100644 (file)
@@ -311,7 +311,7 @@ static void show_usage(void)
 
 static void die(const char *str)
 {
-       fprintf(stderr, "%s: %s\n", applet_name, str);
+       errorMsg("%s\n", str);
        leave(8);
 }
 
diff --git a/grep.c b/grep.c
index 77b510002d9bcb04d0b41de036b08890e2c6a019..03945fa2574ba671153595f6e0a0cf1c89353fc3 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -165,7 +165,7 @@ extern int grep_main(int argc, char **argv)
                        file = fopen(cur_file, "r");
                        if (file == NULL) {
                                if (!suppress_err_msgs)
-                                       fprintf(stderr, "grep: %s: %s\n", cur_file, strerror(errno));
+                                       errorMsg("%s: %s\n", cur_file, strerror(errno));
                        } else {
                                grep_file(file);
                                fclose(file);
index 89e46a68620dda7786be64b4a3af7b5145222317..de68bd19b41195035755305fe38bd772242a53f3 100644 (file)
--- a/gunzip.c
+++ b/gunzip.c
@@ -659,7 +659,7 @@ int gunzip_main(int argc, char **argv)
                if (*argv == '\0')
                        usage(gunzip_usage);
                if (strlen(*argv) > MAX_PATH_LEN) {
-                       fprintf(stderr, name_too_long, "gunzip");
+                       errorMsg(name_too_long);
                        exit(WARNING);
                }
                strcpy(ifname, *argv);
@@ -698,7 +698,7 @@ int gunzip_main(int argc, char **argv)
 
                /* And get to work */
                if (strlen(ifname) > MAX_PATH_LEN - 4) {
-                       fprintf(stderr, name_too_long, "gunzip");
+                       errorMsg(name_too_long);
                        exit(WARNING);
                }
                strcpy(ofname, ifname);
@@ -780,8 +780,7 @@ int in;                                                     /* input file descriptor */
 
                method = (int) get_byte();
                if (method != DEFLATED) {
-                       fprintf(stderr,
-                                       "unknown method %d -- get newer version of gzip\n",
+                       errorMsg("unknown method %d -- get newer version of gzip\n",
                                        method);
                        exit_code = ERROR;
                        return -1;
diff --git a/head.c b/head.c
index f42f4837d323a6bddad94ea6cc6cd41a7a7675ea..b82678dc23da622baf00ec5d17c86cc0964b9c91 100644 (file)
--- a/head.c
+++ b/head.c
@@ -75,7 +75,7 @@ int head_main(int argc, char **argv)
                        case 'h':
                                usage(head_usage);
                        default:
-                               fprintf(stderr, "head: invalid option -- %c\n", opt);
+                               errorMsg("invalid option -- %c\n", opt);
                                usage(head_usage);
                        }
                } else {
@@ -95,8 +95,7 @@ int head_main(int argc, char **argv)
 
                        src = fopen(argv[i], "r");
                        if (!src) {
-                               fprintf(stderr, "head: %s: %s\n", argv[i],
-                                               strerror(errno));
+                               errorMsg("%s: %s\n", argv[i], strerror(errno));
                        } else {
                                /* emulating GNU behaviour */
                                if (need_headers) {
@@ -112,4 +111,4 @@ int head_main(int argc, char **argv)
        return(0);
 }
 
-/* $Id: head.c,v 1.11 2000/06/19 17:25:39 andersen Exp $ */
+/* $Id: head.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */
index e909138e49fb2a80a0092559d6576ac0996a881b..60f66c0736f75e041f07f582b2f44685362b5bc4 100644 (file)
@@ -1,6 +1,6 @@
 /* vi: set sw=4 ts=4: */
 /*
- * $Id: hostname.c,v 1.10 2000/06/19 17:25:39 andersen Exp $
+ * $Id: hostname.c,v 1.11 2000/07/14 01:51:25 kraai Exp $
  * Mini hostname implementation for busybox
  *
  * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -55,8 +55,7 @@ void do_sethostname(char *s, int isfile)
        if (!isfile) {
                if (sethostname(s, strlen(s)) < 0) {
                        if (errno == EPERM)
-                               fprintf(stderr,
-                                               "hostname: you must be root to change the hostname\n");
+                               errorMsg("you must be root to change the hostname\n");
                        else
                                perror("sethostname");
                        exit(1);
index 7e90dfbd9bfe9fc0b9bdb9ed5be943b08d82f1b4..b3d5ac83728275e6640b4aec774dcdd80cf8f156 100644 (file)
--- a/insmod.c
+++ b/insmod.c
@@ -70,7 +70,7 @@
 #ifndef MODUTILS_MODULE_H
 #define MODUTILS_MODULE_H 1
 
-#ident "$Id: insmod.c,v 1.15 2000/07/11 17:52:22 andersen Exp $"
+#ident "$Id: insmod.c,v 1.16 2000/07/14 01:51:25 kraai 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
@@ -276,7 +276,7 @@ int delete_module(const char *);
 #ifndef MODUTILS_OBJ_H
 #define MODUTILS_OBJ_H 1
 
-#ident "$Id: insmod.c,v 1.15 2000/07/11 17:52:22 andersen Exp $"
+#ident "$Id: insmod.c,v 1.16 2000/07/14 01:51:25 kraai Exp $"
 
 /* The relocatable object is manipulated using elfin types.  */
 
@@ -938,7 +938,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)
-                                       fprintf(stderr, "%s multiply defined\n", name);
+                                       errorMsg("%s multiply defined\n", name);
                                return sym;
                        }
                }
@@ -1201,7 +1201,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) {
-                       fprintf(stderr, "symbol for parameter %s not found\n", p);
+                       errorMsg("symbol for parameter %s not found\n", p);
                        return 0;
                }
 
@@ -1214,7 +1214,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') {
-                                       fprintf(stderr, "improperly terminated string argument for %s\n", p);
+                                       errorMsg("improperly terminated string argument for %s\n", p);
                                        return 0;
                                } else if (*q == '\\')
                                        switch (*++q) {
@@ -1567,7 +1567,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
                p = get_modinfo_value(f, key);
                key += 5;
                if (p == NULL) {
-                       fprintf(stderr, "invalid parameter %s\n", key);
+                       errorMsg("invalid parameter %s\n", key);
                        return 0;
                }
 
@@ -1575,7 +1575,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) {
-                       fprintf(stderr, "symbol for parameter %s not found\n", key);
+                       errorMsg("symbol for parameter %s not found\n", key);
                        return 0;
                }
 
@@ -1603,8 +1603,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') {
-                                                       fprintf(stderr,
-                                                                       "improperly terminated string argument for %s\n",
+                                                       errorMsg("improperly terminated string argument for %s\n",
                                                                        key);
                                                        return 0;
                                                } else if (*q == '\\')
@@ -1698,8 +1697,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))) {
-                                               fprintf(stderr,
-                                                               "parameter type 'c' for %s must be followed by"
+                                               errorMsg("parameter type 'c' for %s must be followed by"
                                                                " the maximum size\n", key);
                                                return 0;
                                        }
@@ -1707,8 +1705,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
 
                                        /* Check length */
                                        if (strlen(str) >= charssize) {
-                                               fprintf(stderr,
-                                                               "string too long for %s (max %ld)\n", key,
+                                               errorMsg("string too long for %s (max %ld)\n", key,
                                                                charssize - 1);
                                                return 0;
                                        }
@@ -1737,8 +1734,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
                                        break;
 
                                default:
-                                       fprintf(stderr, "unknown parameter type '%c' for %s\n",
-                                                       *p, key);
+                                       errorMsg("unknown parameter type '%c' for %s\n", *p, key);
                                        return 0;
                                }
                        }
@@ -1757,22 +1753,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
 
                        case ',':
                                if (++n > max) {
-                                       fprintf(stderr, "too many values for %s (max %d)\n",
-                                                       key, max);
+                                       errorMsg("too many values for %s (max %d)\n", key, max);
                                        return 0;
                                }
                                ++q;
                                break;
 
                        default:
-                               fprintf(stderr, "invalid argument syntax for %s\n", key);
+                               errorMsg("invalid argument syntax for %s\n", key);
                                return 0;
                        }
                }
 
          end_of_arg:
                if (n < min) {
-                       fprintf(stderr, "too few values for %s (min %d)\n", key, min);
+                       errorMsg("too few values for %s (min %d)\n", key, min);
                        return 0;
                }
 
@@ -2157,7 +2152,7 @@ int obj_check_undefineds(struct obj_file *f)
                                        sym->secidx = SHN_ABS;
                                        sym->value = 0;
                                } else {
-                                       fprintf(stderr, "unresolved symbol %s\n", sym->name);
+                                       errorMsg("unresolved symbol %s\n", sym->name);
                                        ret = 0;
                                }
                        }
@@ -2380,11 +2375,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base)
                                errmsg = "Unhandled relocation";
                          bad_reloc:
                                if (extsym) {
-                                       fprintf(stderr, "%s of type %ld for %s\n", errmsg,
+                                       errorMsg("%s of type %ld for %s\n", errmsg,
                                                        (long) ELFW(R_TYPE) (rel->r_info),
                                                        strtab + extsym->st_name);
                                } else {
-                                       fprintf(stderr, "%s of type %ld\n", errmsg,
+                                       errorMsg("%s of type %ld\n", errmsg,
                                                        (long) ELFW(R_TYPE) (rel->r_info));
                                }
                                ret = 0;
@@ -2469,25 +2464,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) {
-               fprintf(stderr, "not an ELF file\n");
+               errorMsg("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)) {
-               fprintf(stderr, "ELF file not for this architecture\n");
+               errorMsg("ELF file not for this architecture\n");
                return NULL;
        }
        if (f->header.e_type != ET_REL) {
-               fprintf(stderr, "ELF file not a relocatable object\n");
+               errorMsg("ELF file not a relocatable object\n");
                return NULL;
        }
 
        /* Read the section headers.  */
 
        if (f->header.e_shentsize != sizeof(ElfW(Shdr))) {
-               fprintf(stderr, "section header size mismatch: %lu != %lu\n",
+               errorMsg("section header size mismatch: %lu != %lu\n",
                                (unsigned long) f->header.e_shentsize,
                                (unsigned long) sizeof(ElfW(Shdr)));
                return NULL;
@@ -2540,13 +2535,11 @@ struct obj_file *obj_load(FILE * fp)
 
 #if SHT_RELM == SHT_REL
                case SHT_RELA:
-                       fprintf(stderr,
-                                       "RELA relocations not supported on this architecture\n");
+                       errorMsg("RELA relocations not supported on this architecture\n");
                        return NULL;
 #else
                case SHT_REL:
-                       fprintf(stderr,
-                                       "REL relocations not supported on this architecture\n");
+                       errorMsg("REL relocations not supported on this architecture\n");
                        return NULL;
 #endif
 
@@ -2559,7 +2552,7 @@ struct obj_file *obj_load(FILE * fp)
                                break;
                        }
 
-                       fprintf(stderr, "can't handle sections of type %ld\n",
+                       errorMsg("can't handle sections of type %ld\n",
                                        (long) sec->header.sh_type);
                        return NULL;
                }
@@ -2588,7 +2581,7 @@ struct obj_file *obj_load(FILE * fp)
                                ElfW(Sym) * sym;
 
                                if (sec->header.sh_entsize != sizeof(ElfW(Sym))) {
-                                       fprintf(stderr, "symbol size mismatch: %lu != %lu\n",
+                                       errorMsg("symbol size mismatch: %lu != %lu\n",
                                                        (unsigned long) sec->header.sh_entsize,
                                                        (unsigned long) sizeof(ElfW(Sym)));
                                        return NULL;
@@ -2620,8 +2613,7 @@ struct obj_file *obj_load(FILE * fp)
 
                case SHT_RELM:
                        if (sec->header.sh_entsize != sizeof(ElfW(RelM))) {
-                               fprintf(stderr,
-                                               "relocation entry size mismatch: %lu != %lu\n",
+                               errorMsg("relocation entry size mismatch: %lu != %lu\n",
                                                (unsigned long) sec->header.sh_entsize,
                                                (unsigned long) sizeof(ElfW(RelM)));
                                return NULL;
@@ -2754,20 +2746,20 @@ extern int insmod_main( int argc, char **argv)
        } else {
                m_version = old_get_module_version(f, m_strversion);
                if (m_version == -1) {
-                       fprintf(stderr,
-                                       "couldn't find the kernel version the module was compiled for\n");
+                       errorMsg("couldn't find the kernel version the module was "
+                                       "compiled for\n");
                        goto out;
                }
        }
 
        if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) {
                if (flag_force_load) {
-                       fprintf(stderr, "Warning: kernel-module version mismatch\n"
+                       errorMsg("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 {
-                       fprintf(stderr, "kernel-module version mismatch\n"
+                       errorMsg("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);
@@ -2785,7 +2777,7 @@ extern int insmod_main( int argc, char **argv)
                        goto out;
                k_crcs = new_is_kernel_checksummed();
 #else
-               fprintf(stderr, "Not configured to support new kernels\n");
+               errorMsg("Not configured to support new kernels\n");
                goto out;
 #endif
        } else {
@@ -2794,7 +2786,7 @@ extern int insmod_main( int argc, char **argv)
                        goto out;
                k_crcs = old_is_kernel_checksummed();
 #else
-               fprintf(stderr, "Not configured to support old kernels\n");
+               errorMsg("Not configured to support old kernels\n");
                goto out;
 #endif
        }
@@ -2851,11 +2843,10 @@ extern int insmod_main( int argc, char **argv)
        case 0:
                break;
        case EEXIST:
-               fprintf(stderr, "A module named %s already exists\n", m_name);
+               errorMsg("A module named %s already exists\n", m_name);
                goto out;
        case ENOMEM:
-               fprintf(stderr,
-                               "Can't allocate kernel memory for module; needed %lu bytes\n",
+               errorMsg("Can't allocate kernel memory for module; needed %lu bytes\n",
                                m_size);
                goto out;
        default:
diff --git a/lash.c b/lash.c
index f4564f7f7d35f261f6dbcdd5c3ce44c19494a7d8..048394ab67d9fdecd517b1771a785d91633e7cd4 100644 (file)
--- a/lash.c
+++ b/lash.c
@@ -207,12 +207,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]) {
-                       fprintf(stderr, "%s: exactly one argument is expected\n",
+                       errorMsg("%s: exactly one argument is expected\n",
                                        cmd->progs[0].argv[0]);
                        return FALSE;
                }
                if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) {
-                       fprintf(stderr, "%s: bad argument '%s'\n",
+                       errorMsg("%s: bad argument '%s'\n",
                                        cmd->progs[0].argv[0], cmd->progs[0].argv[1]);
                        return FALSE;
                        for (job = jobList->head; job; job = job->next) {
@@ -226,7 +226,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList)
        }
 
        if (!job) {
-               fprintf(stderr, "%s: unknown job %d\n",
+               errorMsg("%s: unknown job %d\n",
                                cmd->progs[0].argv[0], jobNum);
                return FALSE;
        }
@@ -519,7 +519,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
 
        rc = glob(prog->argv[argc - 1], flags, NULL, &prog->globResult);
        if (rc == GLOB_NOSPACE) {
-               fprintf(stderr, "out of space during glob operation\n");
+               errorMsg("out of space during glob operation\n");
                return;
        } else if (rc == GLOB_NOMATCH ||
                           (!rc && (prog->globResult.gl_pathc - i) == 1 &&
@@ -607,7 +607,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                        if (*src == '\\') {
                                src++;
                                if (!*src) {
-                                       fprintf(stderr, "character expected after \\\n");
+                                       errorMsg("character expected after \\\n");
                                        freeJob(job);
                                        return 1;
                                }
@@ -686,7 +686,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                                        chptr++;
 
                                if (!*chptr) {
-                                       fprintf(stderr, "file name expected after %c\n", *src);
+                                       errorMsg("file name expected after %c\n", *src);
                                        freeJob(job);
                                        job->numProgs=0;
                                        return 1;
@@ -705,7 +705,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                                if (*prog->argv[argc])
                                        argc++;
                                if (!argc) {
-                                       fprintf(stderr, "empty command in pipe1.\n");
+                                       errorMsg("empty command in pipe1\n");
                                        freeJob(job);
                                        job->numProgs=0;
                                        return 1;
@@ -731,7 +731,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                                        src++;
 
                                if (!*src) {
-                                       fprintf(stderr, "empty command in pipe2\n");
+                                       errorMsg("empty command in pipe2\n");
                                        freeJob(job);
                                        job->numProgs=0;
                                        return 1;
@@ -750,7 +750,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                        case '\\':
                                src++;
                                if (!*src) {
-                                       fprintf(stderr, "character expected after \\\n");
+                                       errorMsg("character expected after \\\n");
                                        freeJob(job);
                                        return 1;
                                }
@@ -965,7 +965,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!) */
-                       fprintf(stderr, "error opening %s: %s\n", redir->filename,
+                       errorMsg("error opening %s: %s\n", redir->filename,
                                        strerror(errno));
                        return 1;
                }
diff --git a/ln.c b/ln.c
index ac1f68e0024034e84a0ad6ee17f9b1d97107f04c..9f7774380be7d0d053b2a28034b41b3f59cee2c4 100644 (file)
--- a/ln.c
+++ b/ln.c
@@ -23,7 +23,6 @@
 
 #include "internal.h"
 #define BB_DECLARE_EXTERN
-#define bb_need_name_too_long
 #define bb_need_not_a_directory
 #include "messages.c"
 
@@ -92,7 +91,7 @@ extern int ln_main(int argc, char **argv)
 
        linkIntoDirFlag = isDirectory(linkName, followLinks, NULL);
        if ((argc >= 3) && linkIntoDirFlag == FALSE) {
-               fprintf(stderr, not_a_directory, "ln", linkName);
+               errorMsg(not_a_directory, linkName);
                exit FALSE;
        }
 
index a64c691d284ea5f5717b5d9acdf72c0b0d6d0152..9eebf3bb57964cd585e03714a990ea6c35b6e689 100644 (file)
--- a/loadacm.c
+++ b/loadacm.c
@@ -46,12 +46,12 @@ int loadacm_main(int argc, char **argv)
 
        fd = open("/dev/tty", O_RDWR);
        if (fd < 0) {
-               fprintf(stderr, "Error opening /dev/tty1: %s\n", strerror(errno));
+               errorMsg("Error opening /dev/tty1: %s\n", strerror(errno));
                return( FALSE);
        }
 
        if (screen_map_load(fd, stdin)) {
-               fprintf(stderr, "Error loading acm: %s\n", strerror(errno));
+               errorMsg("Error loading acm: %s\n", strerror(errno));
                return( FALSE);
        }
 
@@ -79,8 +79,7 @@ int screen_map_load(int fd, FILE * fp)
                if (parse_failed) {
                        if (-1 == fseek(fp, 0, SEEK_SET)) {
                                if (errno == ESPIPE)
-                                       fprintf(stderr,
-                                                       "16bit screen-map MUST be a regular file.\n"),
+                                       errorMsg("16bit screen-map MUST be a regular file.\n"),
                                                exit(1);
                                else
                                        perror("fseek failed reading binary 16bit screen-map"),
@@ -91,7 +90,7 @@ int screen_map_load(int fd, FILE * fp)
                                perror("Cannot read [new] map from file"), exit(1);
 #if 0
                        else
-                               fprintf(stderr, "Input screen-map is binary.\n");
+                               errorMsg("Input screen-map is binary.\n");
 #endif
                }
 
@@ -108,8 +107,7 @@ int screen_map_load(int fd, FILE * fp)
        /* rewind... */
        if (-1 == fseek(fp, 0, SEEK_SET)) {
                if (errno == ESPIPE)
-                       fprintf(stderr,
-                                       "Assuming 8bit screen-map - MUST be a regular file.\n"),
+                       errorMsg("Assuming 8bit screen-map - MUST be a regular file.\n"),
                                exit(1);
                else
                        perror("fseek failed assuming 8bit screen-map"), exit(1);
@@ -122,7 +120,7 @@ int screen_map_load(int fd, FILE * fp)
                        if (-1 == fseek(fp, 0, SEEK_SET)) {
                                if (errno == ESPIPE)
                                        /* should not - it succedeed above */
-                                       fprintf(stderr, "fseek() returned ESPIPE !\n"),
+                                       errorMsg("fseek() returned ESPIPE !\n"),
                                                exit(1);
                                else
                                        perror("fseek for binary 8bit screen-map"), exit(1);
@@ -132,7 +130,7 @@ int screen_map_load(int fd, FILE * fp)
                                perror("Cannot read [old] map from file"), exit(1);
 #if 0
                        else
-                               fprintf(stderr, "Input screen-map is binary.\n");
+                               errorMsg("Input screen-map is binary.\n");
 #endif
                }
 
@@ -141,7 +139,7 @@ int screen_map_load(int fd, FILE * fp)
                else
                        return 0;
        }
-       fprintf(stderr, "Error parsing symbolic map\n");
+       errorMsg("Error parsing symbolic map\n");
        return(1);
 }
 
index 7eaf40e82715b75621921fbe82b6b5c4055a3e4b..b3f9f4f1189f3279354c0603c1c572deccf7aba0 100644 (file)
@@ -56,7 +56,7 @@ extern int loadfont_main(int argc, char **argv)
 
        fd = open("/dev/tty0", O_RDWR);
        if (fd < 0) {
-               fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
+               errorMsg("Error opening /dev/tty0: %s\n", strerror(errno));
                return( FALSE);
        }
        loadnewfont(fd);
@@ -72,7 +72,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
        memset(buf, 0, sizeof(buf));
 
        if (unit < 1 || unit > 32) {
-               fprintf(stderr, "Bad character size %d\n", unit);
+               errorMsg("Bad character size %d\n", unit);
                exit(1);
        }
 
@@ -112,7 +112,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
        up = (struct unipair *) malloc(maxct * sizeof(struct unipair));
 
        if (!up) {
-               fprintf(stderr, "Out of memory?\n");
+               errorMsg("Out of memory?\n");
                exit(1);
        }
        for (glyph = 0; glyph < fontsize; glyph++) {
@@ -137,8 +137,8 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
        if (ioctl(fd, PIO_UNIMAPCLR, &advice)) {
 #ifdef ENOIOCTLCMD
                if (errno == ENOIOCTLCMD) {
-                       fprintf(stderr, "It seems this kernel is older than 1.1.92\n");
-                       fprintf(stderr, "No Unicode mapping table loaded.\n");
+                       errorMsg("It seems this kernel is older than 1.1.92\n");
+                       errorMsg("No Unicode mapping table loaded.\n");
                } else
 #endif
                        perror("PIO_UNIMAPCLR");
@@ -198,13 +198,13 @@ static void loadnewfont(int fd)
                        goto no_psf;
 
                if (psfhdr.mode > PSF_MAXMODE) {
-                       fprintf(stderr, "Unsupported psf file mode\n");
+                       errorMsg("Unsupported psf file mode\n");
                        exit(1);
                }
                fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256);
 #if !defined( PIO_FONTX ) || defined( __sparc__ )
                if (fontsize != 256) {
-                       fprintf(stderr, "Only fontsize 256 supported\n");
+                       errorMsg("Only fontsize 256 supported\n");
                        exit(1);
                }
 #endif
@@ -214,7 +214,7 @@ static void loadnewfont(int fd)
 
                head = head0 + fontsize * unit;
                if (head > inputlth || (!hastable && head != inputlth)) {
-                       fprintf(stderr, "Input file: bad length\n");
+                       errorMsg("Input file: bad length\n");
                        exit(1);
                }
                do_loadfont(fd, inbuf + head0, unit, fontsize);
@@ -231,7 +231,7 @@ static void loadnewfont(int fd)
        } else {
                /* bare font */
                if (inputlth & 0377) {
-                       fprintf(stderr, "Bad input file size\n");
+                       errorMsg("Bad input file size\n");
                        exit(1);
                }
                offset = 0;
index c2e4c94ed215cf7c137965737f3c8b1a7e8d9148..72247a6e4b6c49d5274a5fdc1f417317ef33c408 100644 (file)
@@ -59,25 +59,25 @@ int loadkmap_main(int argc, char **argv)
 
        fd = open("/dev/tty0", O_RDWR);
        if (fd < 0) {
-               fprintf(stderr, "Error opening /dev/tty0: %s\n", strerror(errno));
+               errorMsg("Error opening /dev/tty0: %s\n", strerror(errno));
                exit(FALSE);
        }
 
        read(0, buff, 7);
        if (0 != strncmp(buff, magic, 7)) {
-               fprintf(stderr, "This is not a valid binary keymap.\n");
+               errorMsg("This is not a valid binary keymap.\n");
                exit(FALSE);
        }
 
        if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) {
-               fprintf(stderr, "Error reading keymap flags: %s\n",
+               errorMsg("Error reading keymap flags: %s\n",
                                strerror(errno));
                exit(FALSE);
        }
 
        ibuff = (u_short *) malloc(ibuffsz);
        if (!ibuff) {
-               fprintf(stderr, "Out of memory.\n");
+               errorMsg("Out of memory.\n");
                exit(FALSE);
        }
 
@@ -87,7 +87,7 @@ int loadkmap_main(int argc, char **argv)
                        while (pos < ibuffsz) {
                                if ((readsz = read(0, (char *) ibuff + pos, ibuffsz - pos))
                                        < 0) {
-                                       fprintf(stderr, "Error reading keymap: %s\n",
+                                       errorMsg("Error reading keymap: %s\n",
                                                        strerror(errno));
                                        exit(FALSE);
                                }
index d32ccaaf34e936213dd3a9dcb8469dc1538d43b8..71d7030854a52a2f064b0dbd33f8cc658bfddcbc 100644 (file)
--- a/logger.c
+++ b/logger.c
@@ -96,7 +96,7 @@ static int pencode(char *s)
                *s = '\0';
                fac = decode(save, facilitynames);
                if (fac < 0) {
-                       fprintf(stderr, "unknown facility name: %s\n", save);
+                       errorMsg("unknown facility name: %s\n", save);
                        exit(FALSE);
                }
                *s++ = '.';
@@ -105,7 +105,7 @@ static int pencode(char *s)
        }
        lev = decode(s, prioritynames);
        if (lev < 0) {
-               fprintf(stderr, "unknown priority name: %s\n", save);
+               errorMsg("unknown priority name: %s\n", save);
                exit(FALSE);
        }
        return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK));
@@ -166,7 +166,7 @@ extern int logger_main(int argc, char **argv)
                if (argc >= 1) {
                        message = *argv;
                } else {
-                       fprintf(stderr, "No message\n");
+                       errorMsg("No message\n");
                        exit(FALSE);
                }
        }
index 4b4483cc166cd276fcb27b1041dc236d0b27bac7..12ebfbde69c9eeffa83ffb4ff75ac49fa77b915f 100644 (file)
--- a/logname.c
+++ b/logname.c
@@ -41,6 +41,6 @@ extern int logname_main(int argc, char **argv)
                puts(user);
                exit(TRUE);
        }
-       fprintf(stderr, "no login name\n");
+       errorMsg("no login name\n");
        return(FALSE);
 }
index f2374eeb5f475b7a8db2b6dd8df3baa209fa8d16..428db9eaaa49a03ed2f2133f266727b417afe4cf 100644 (file)
 
 
 #if defined bb_need_name_too_long || ! defined BB_DECLARE_EXTERN
-       BB_DEF_MESSAGE(name_too_long, "%s: file name too long\n")
+       BB_DEF_MESSAGE(name_too_long, "file name too long\n")
 #endif
 #if defined bb_need_omitting_directory || ! defined BB_DECLARE_EXTERN
-       BB_DEF_MESSAGE(omitting_directory, "%s: %s: omitting directory\n")
+       BB_DEF_MESSAGE(omitting_directory, "%s: omitting directory\n")
 #endif
 #if defined bb_need_not_a_directory || ! defined BB_DECLARE_EXTERN
-       BB_DEF_MESSAGE(not_a_directory, "%s: %s: not a directory\n")
+       BB_DEF_MESSAGE(not_a_directory, "%s: not a directory\n")
 #endif
 #if defined bb_need_memory_exhausted || ! defined BB_DECLARE_EXTERN
        BB_DEF_MESSAGE(memory_exhausted, "memory exhausted\n")
@@ -63,7 +63,7 @@
        BB_DEF_MESSAGE(invalid_date, "invalid date `%s'\n")
 #endif
 #if defined bb_need_invalid_option || ! defined BB_DECLARE_EXTERN
-       BB_DEF_MESSAGE(invalid_option, "%s: invalid option -- %c\n")
+       BB_DEF_MESSAGE(invalid_option, "invalid option -- %c\n")
 #endif
 #if defined bb_need_io_error || ! defined BB_DECLARE_EXTERN
        BB_DEF_MESSAGE(io_error, "%s: input/output error -- %s\n")
@@ -75,7 +75,7 @@
        BB_DEF_MESSAGE(write_error, "Write Error\n")
 #endif
 #if defined bb_need_too_few_args || ! defined BB_DECLARE_EXTERN
-       BB_DEF_MESSAGE(too_few_args, "%s: too few arguments\n")
+       BB_DEF_MESSAGE(too_few_args, "too few arguments\n")
 #endif
 
 
index 5bf3bc984684171c9f95f6b19819d2ecb3f2ba3a..7b13cb943698636d4840b3b64354cb89400516df 100644 (file)
@@ -22,7 +22,7 @@ static unsigned int pointer;
 static void push(double a)
 {
        if (pointer >= (sizeof(stack) / sizeof(*stack))) {
-               fprintf(stderr, "dc: stack overflow\n");
+               errorMsg("stack overflow\n");
                exit(-1);
        } else
                stack[pointer++] = a;
@@ -31,7 +31,7 @@ static void push(double a)
 static double pop()
 {
        if (pointer == 0) {
-               fprintf(stderr, "dc: stack underflow\n");
+               errorMsg("stack underflow\n");
                exit(-1);
        }
        return stack[--pointer];
@@ -132,7 +132,7 @@ static void stack_machine(const char *argument)
                }
                o++;
        }
-       fprintf(stderr, "dc: %s: syntax error.\n", argument);
+       errorMsg("%s: syntax error.\n", argument);
        exit(-1);
 }
 
index 304d664853953d21ac32a44c82a2ddbead68728f..4ab4782703551363cb73088ab76a6a5ba04e13ac 100644 (file)
@@ -81,7 +81,7 @@ extern int mt_main(int argc, char **argv)
        }
 
        if (code->name == 0) {
-               fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]);
+               errorMsg("unrecognized opcode %s.\n", argv[1]);
                exit (FALSE);
        }
 
diff --git a/mkdir.c b/mkdir.c
index b18c949b844d68c19903852b2e0c438d849eeb3d..f6e08cadc076dae316354da7eeedc3bded56d37c 100644 (file)
--- a/mkdir.c
+++ b/mkdir.c
@@ -62,7 +62,7 @@ extern int mkdir_main(int argc, char **argv)
                                /* Find the specified modes */
                                mode = 0;
                                if (parse_mode(*(++argv), &mode) == FALSE) {
-                                       fprintf(stderr, "Unknown mode: %s\n", *argv);
+                                       errorMsg("Unknown mode: %s\n", *argv);
                                        exit FALSE;
                                }
                                /* Set the umask for this process so it doesn't 
@@ -91,13 +91,13 @@ extern int mkdir_main(int argc, char **argv)
                char buf[BUFSIZ + 1];
 
                if (strlen(*argv) > BUFSIZ - 1) {
-                       fprintf(stderr, name_too_long, "mkdir");
+                       errorMsg(name_too_long);
                        exit FALSE;
                }
                strcpy(buf, *argv);
                status = stat(buf, &statBuf);
                if (parentFlag == FALSE && status != -1 && errno != ENOENT) {
-                       fprintf(stderr, "%s: File exists\n", buf);
+                       errorMsg("%s: File exists\n", buf);
                        exit FALSE;
                }
                if (parentFlag == TRUE) {
index b6f958f46b599cdd60c5219c5ef23fd5fe0d0fc1..e4dedaf8221166dd92e73e48695224accb88e495 100644 (file)
@@ -263,7 +263,7 @@ static unsigned long req_nr_inodes = 0;
  */
 static volatile void die(char *str)
 {
-       fprintf(stderr, "%s: %s\n", applet_name, str);
+       errorMsg("%s\n", str);
        exit(8);
 }
 
@@ -814,8 +814,8 @@ extern int mkfs_minix_main(int argc, char **argv)
 #ifdef HAVE_MINIX2
                                                version2 = 1;
 #else
-                                               fprintf(stderr, "%s: not compiled with minix v2 support\n",
-                                                               applet_name, device_name);
+                                               errorMsg("%s: not compiled with minix v2 support\n",
+                                                               device_name);
                                                exit(-1);
 #endif
                                                break;
index 20096361f9df283e377454c6c7fe9b13b7178b6b..5a33945c838f7b1b76ed6c571b483503260ecdfd 100644 (file)
--- a/mkswap.c
+++ b/mkswap.c
@@ -116,7 +116,7 @@ static void init_signature_page()
 
 #ifdef PAGE_SIZE
        if (pagesize != PAGE_SIZE)
-               fprintf(stderr, "Assuming pages of size %d\n", pagesize);
+               errorMsg("Assuming pages of size %d\n", pagesize);
 #endif
        signature_page = (int *) xmalloc(pagesize);
        memset(signature_page, 0, pagesize);
@@ -204,7 +204,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr)
 
 void die(const char *str)
 {
-       fprintf(stderr, "%s: %s\n", applet_name, str);
+       errorMsg("%s\n", str);
        exit(FALSE);
 }
 
@@ -345,18 +345,14 @@ int mkswap_main(int argc, char **argv)
                }
        }
        if (!device_name) {
-               fprintf(stderr,
-                               "%s: error: Nowhere to set up swap on?\n", applet_name);
+               errorMsg("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) {
-               fprintf(stderr,
-                               "%s: error: "
-                               "size %ld is larger than device size %d\n",
-                               applet_name,
+               errorMsg("error: size %ld is larger than device size %d\n",
                                PAGES * (pagesize / 1024), sz * (pagesize / 1024));
                exit(FALSE);
        }
@@ -372,14 +368,12 @@ int mkswap_main(int argc, char **argv)
                        version = 1;
        }
        if (version != 0 && version != 1) {
-               fprintf(stderr, "%s: error: unknown version %d\n",
-                               applet_name, version);
+               errorMsg("error: unknown version %d\n", version);
                usage(mkswap_usage);
        }
        if (PAGES < 10) {
-               fprintf(stderr,
-                               "%s: error: swap area needs to be at least %ldkB\n",
-                               applet_name, (long) (10 * pagesize / 1024));
+               errorMsg("error: swap area needs to be at least %ldkB\n",
+                               (long) (10 * pagesize / 1024));
                usage(mkswap_usage);
        }
 #if 0
@@ -397,8 +391,8 @@ int mkswap_main(int argc, char **argv)
 #endif
        if (PAGES > maxpages) {
                PAGES = maxpages;
-               fprintf(stderr, "%s: warning: truncating swap area to %ldkB\n",
-                               applet_name, PAGES * pagesize / 1024);
+               errorMsg("warning: truncating swap area to %ldkB\n",
+                               PAGES * pagesize / 1024);
        }
 
        DEV = open(device_name, O_RDWR);
@@ -424,11 +418,10 @@ int mkswap_main(int argc, char **argv)
                        for (sum = 0; q >= (unsigned short *) buffer;)
                                sum ^= *q--;
                        if (!sum) {
-                               fprintf(stderr, "\
-%s: 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", applet_name, device_name);
+                               errorMsg("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);
                                exit(FALSE);
                        }
                }
index 7e90dfbd9bfe9fc0b9bdb9ed5be943b08d82f1b4..b3d5ac83728275e6640b4aec774dcdd80cf8f156 100644 (file)
@@ -70,7 +70,7 @@
 #ifndef MODUTILS_MODULE_H
 #define MODUTILS_MODULE_H 1
 
-#ident "$Id: insmod.c,v 1.15 2000/07/11 17:52:22 andersen Exp $"
+#ident "$Id: insmod.c,v 1.16 2000/07/14 01:51:25 kraai 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
@@ -276,7 +276,7 @@ int delete_module(const char *);
 #ifndef MODUTILS_OBJ_H
 #define MODUTILS_OBJ_H 1
 
-#ident "$Id: insmod.c,v 1.15 2000/07/11 17:52:22 andersen Exp $"
+#ident "$Id: insmod.c,v 1.16 2000/07/14 01:51:25 kraai Exp $"
 
 /* The relocatable object is manipulated using elfin types.  */
 
@@ -938,7 +938,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)
-                                       fprintf(stderr, "%s multiply defined\n", name);
+                                       errorMsg("%s multiply defined\n", name);
                                return sym;
                        }
                }
@@ -1201,7 +1201,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) {
-                       fprintf(stderr, "symbol for parameter %s not found\n", p);
+                       errorMsg("symbol for parameter %s not found\n", p);
                        return 0;
                }
 
@@ -1214,7 +1214,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') {
-                                       fprintf(stderr, "improperly terminated string argument for %s\n", p);
+                                       errorMsg("improperly terminated string argument for %s\n", p);
                                        return 0;
                                } else if (*q == '\\')
                                        switch (*++q) {
@@ -1567,7 +1567,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
                p = get_modinfo_value(f, key);
                key += 5;
                if (p == NULL) {
-                       fprintf(stderr, "invalid parameter %s\n", key);
+                       errorMsg("invalid parameter %s\n", key);
                        return 0;
                }
 
@@ -1575,7 +1575,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) {
-                       fprintf(stderr, "symbol for parameter %s not found\n", key);
+                       errorMsg("symbol for parameter %s not found\n", key);
                        return 0;
                }
 
@@ -1603,8 +1603,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') {
-                                                       fprintf(stderr,
-                                                                       "improperly terminated string argument for %s\n",
+                                                       errorMsg("improperly terminated string argument for %s\n",
                                                                        key);
                                                        return 0;
                                                } else if (*q == '\\')
@@ -1698,8 +1697,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))) {
-                                               fprintf(stderr,
-                                                               "parameter type 'c' for %s must be followed by"
+                                               errorMsg("parameter type 'c' for %s must be followed by"
                                                                " the maximum size\n", key);
                                                return 0;
                                        }
@@ -1707,8 +1705,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
 
                                        /* Check length */
                                        if (strlen(str) >= charssize) {
-                                               fprintf(stderr,
-                                                               "string too long for %s (max %ld)\n", key,
+                                               errorMsg("string too long for %s (max %ld)\n", key,
                                                                charssize - 1);
                                                return 0;
                                        }
@@ -1737,8 +1734,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
                                        break;
 
                                default:
-                                       fprintf(stderr, "unknown parameter type '%c' for %s\n",
-                                                       *p, key);
+                                       errorMsg("unknown parameter type '%c' for %s\n", *p, key);
                                        return 0;
                                }
                        }
@@ -1757,22 +1753,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
 
                        case ',':
                                if (++n > max) {
-                                       fprintf(stderr, "too many values for %s (max %d)\n",
-                                                       key, max);
+                                       errorMsg("too many values for %s (max %d)\n", key, max);
                                        return 0;
                                }
                                ++q;
                                break;
 
                        default:
-                               fprintf(stderr, "invalid argument syntax for %s\n", key);
+                               errorMsg("invalid argument syntax for %s\n", key);
                                return 0;
                        }
                }
 
          end_of_arg:
                if (n < min) {
-                       fprintf(stderr, "too few values for %s (min %d)\n", key, min);
+                       errorMsg("too few values for %s (min %d)\n", key, min);
                        return 0;
                }
 
@@ -2157,7 +2152,7 @@ int obj_check_undefineds(struct obj_file *f)
                                        sym->secidx = SHN_ABS;
                                        sym->value = 0;
                                } else {
-                                       fprintf(stderr, "unresolved symbol %s\n", sym->name);
+                                       errorMsg("unresolved symbol %s\n", sym->name);
                                        ret = 0;
                                }
                        }
@@ -2380,11 +2375,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base)
                                errmsg = "Unhandled relocation";
                          bad_reloc:
                                if (extsym) {
-                                       fprintf(stderr, "%s of type %ld for %s\n", errmsg,
+                                       errorMsg("%s of type %ld for %s\n", errmsg,
                                                        (long) ELFW(R_TYPE) (rel->r_info),
                                                        strtab + extsym->st_name);
                                } else {
-                                       fprintf(stderr, "%s of type %ld\n", errmsg,
+                                       errorMsg("%s of type %ld\n", errmsg,
                                                        (long) ELFW(R_TYPE) (rel->r_info));
                                }
                                ret = 0;
@@ -2469,25 +2464,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) {
-               fprintf(stderr, "not an ELF file\n");
+               errorMsg("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)) {
-               fprintf(stderr, "ELF file not for this architecture\n");
+               errorMsg("ELF file not for this architecture\n");
                return NULL;
        }
        if (f->header.e_type != ET_REL) {
-               fprintf(stderr, "ELF file not a relocatable object\n");
+               errorMsg("ELF file not a relocatable object\n");
                return NULL;
        }
 
        /* Read the section headers.  */
 
        if (f->header.e_shentsize != sizeof(ElfW(Shdr))) {
-               fprintf(stderr, "section header size mismatch: %lu != %lu\n",
+               errorMsg("section header size mismatch: %lu != %lu\n",
                                (unsigned long) f->header.e_shentsize,
                                (unsigned long) sizeof(ElfW(Shdr)));
                return NULL;
@@ -2540,13 +2535,11 @@ struct obj_file *obj_load(FILE * fp)
 
 #if SHT_RELM == SHT_REL
                case SHT_RELA:
-                       fprintf(stderr,
-                                       "RELA relocations not supported on this architecture\n");
+                       errorMsg("RELA relocations not supported on this architecture\n");
                        return NULL;
 #else
                case SHT_REL:
-                       fprintf(stderr,
-                                       "REL relocations not supported on this architecture\n");
+                       errorMsg("REL relocations not supported on this architecture\n");
                        return NULL;
 #endif
 
@@ -2559,7 +2552,7 @@ struct obj_file *obj_load(FILE * fp)
                                break;
                        }
 
-                       fprintf(stderr, "can't handle sections of type %ld\n",
+                       errorMsg("can't handle sections of type %ld\n",
                                        (long) sec->header.sh_type);
                        return NULL;
                }
@@ -2588,7 +2581,7 @@ struct obj_file *obj_load(FILE * fp)
                                ElfW(Sym) * sym;
 
                                if (sec->header.sh_entsize != sizeof(ElfW(Sym))) {
-                                       fprintf(stderr, "symbol size mismatch: %lu != %lu\n",
+                                       errorMsg("symbol size mismatch: %lu != %lu\n",
                                                        (unsigned long) sec->header.sh_entsize,
                                                        (unsigned long) sizeof(ElfW(Sym)));
                                        return NULL;
@@ -2620,8 +2613,7 @@ struct obj_file *obj_load(FILE * fp)
 
                case SHT_RELM:
                        if (sec->header.sh_entsize != sizeof(ElfW(RelM))) {
-                               fprintf(stderr,
-                                               "relocation entry size mismatch: %lu != %lu\n",
+                               errorMsg("relocation entry size mismatch: %lu != %lu\n",
                                                (unsigned long) sec->header.sh_entsize,
                                                (unsigned long) sizeof(ElfW(RelM)));
                                return NULL;
@@ -2754,20 +2746,20 @@ extern int insmod_main( int argc, char **argv)
        } else {
                m_version = old_get_module_version(f, m_strversion);
                if (m_version == -1) {
-                       fprintf(stderr,
-                                       "couldn't find the kernel version the module was compiled for\n");
+                       errorMsg("couldn't find the kernel version the module was "
+                                       "compiled for\n");
                        goto out;
                }
        }
 
        if (strncmp(k_strversion, m_strversion, STRVERSIONLEN) != 0) {
                if (flag_force_load) {
-                       fprintf(stderr, "Warning: kernel-module version mismatch\n"
+                       errorMsg("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 {
-                       fprintf(stderr, "kernel-module version mismatch\n"
+                       errorMsg("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);
@@ -2785,7 +2777,7 @@ extern int insmod_main( int argc, char **argv)
                        goto out;
                k_crcs = new_is_kernel_checksummed();
 #else
-               fprintf(stderr, "Not configured to support new kernels\n");
+               errorMsg("Not configured to support new kernels\n");
                goto out;
 #endif
        } else {
@@ -2794,7 +2786,7 @@ extern int insmod_main( int argc, char **argv)
                        goto out;
                k_crcs = old_is_kernel_checksummed();
 #else
-               fprintf(stderr, "Not configured to support old kernels\n");
+               errorMsg("Not configured to support old kernels\n");
                goto out;
 #endif
        }
@@ -2851,11 +2843,10 @@ extern int insmod_main( int argc, char **argv)
        case 0:
                break;
        case EEXIST:
-               fprintf(stderr, "A module named %s already exists\n", m_name);
+               errorMsg("A module named %s already exists\n", m_name);
                goto out;
        case ENOMEM:
-               fprintf(stderr,
-                               "Can't allocate kernel memory for module; needed %lu bytes\n",
+               errorMsg("Can't allocate kernel memory for module; needed %lu bytes\n",
                                m_size);
                goto out;
        default:
diff --git a/mount.c b/mount.c
index 900ab30a7cda643de2078d454f92cb658e64cfdb..455e4a1c1c54a7d3545993ec7e86c343b7a2ef3b 100644 (file)
--- a/mount.c
+++ b/mount.c
@@ -157,15 +157,15 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
 
                        specialfile = find_unused_loop_device();
                        if (specialfile == NULL) {
-                               fprintf(stderr, "Could not find a spare loop device\n");
+                               errorMsg("Could not find a spare loop device\n");
                                return (FALSE);
                        }
                        if (set_loop(specialfile, lofile, 0, &loro)) {
-                               fprintf(stderr, "Could not setup loop device\n");
+                               errorMsg("Could not setup loop device\n");
                                return (FALSE);
                        }
                        if (!(flags & MS_RDONLY) && loro) {     /* loop is ro, but wanted rw */
-                               fprintf(stderr, "WARNING: loop device is read-only\n");
+                               errorMsg("WARNING: loop device is read-only\n");
                                flags &= ~MS_RDONLY;
                        }
                }
@@ -329,7 +329,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
 
        if (status == FALSE) {
                if (whineOnErrors == TRUE) {
-                       fprintf(stderr, "Mounting %s on %s failed: %s\n",
+                       errorMsg("Mounting %s on %s failed: %s\n",
                                        blockDevice, directory, strerror(errno));
                }
                return (FALSE);
diff --git a/mt.c b/mt.c
index 304d664853953d21ac32a44c82a2ddbead68728f..4ab4782703551363cb73088ab76a6a5ba04e13ac 100644 (file)
--- a/mt.c
+++ b/mt.c
@@ -81,7 +81,7 @@ extern int mt_main(int argc, char **argv)
        }
 
        if (code->name == 0) {
-               fprintf(stderr, "mt: unrecognized opcode %s.\n", argv[1]);
+               errorMsg("unrecognized opcode %s.\n", argv[1]);
                exit (FALSE);
        }
 
index e909138e49fb2a80a0092559d6576ac0996a881b..60f66c0736f75e041f07f582b2f44685362b5bc4 100644 (file)
@@ -1,6 +1,6 @@
 /* vi: set sw=4 ts=4: */
 /*
- * $Id: hostname.c,v 1.10 2000/06/19 17:25:39 andersen Exp $
+ * $Id: hostname.c,v 1.11 2000/07/14 01:51:25 kraai Exp $
  * Mini hostname implementation for busybox
  *
  * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -55,8 +55,7 @@ void do_sethostname(char *s, int isfile)
        if (!isfile) {
                if (sethostname(s, strlen(s)) < 0) {
                        if (errno == EPERM)
-                               fprintf(stderr,
-                                               "hostname: you must be root to change the hostname\n");
+                               errorMsg("you must be root to change the hostname\n");
                        else
                                perror("sethostname");
                        exit(1);
index 0359abbd1ded51ba662b00a956dd34c7fe6f5325..52cb07be74b9e37b1d9893a03f11f4d914ab52ce 100644 (file)
@@ -1,6 +1,6 @@
 /* vi: set sw=4 ts=4: */
 /*
- * $Id: ping.c,v 1.20 2000/07/12 17:02:35 kraai Exp $
+ * $Id: ping.c,v 1.21 2000/07/14 01:51:25 kraai Exp $
  * Mini ping implementation for busybox
  *
  * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -208,7 +208,7 @@ static void ping(const char *host)
 
        pingaddr.sin_family = AF_INET;
        if (!(h = gethostbyname(host))) {
-               fprintf(stderr, "ping: unknown host %s\n", host);
+               errorMsg("unknown host %s\n", host);
                exit(1);
        }
        memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr));
@@ -225,7 +225,7 @@ static void ping(const char *host)
        if (c < 0 || c != sizeof(packet)) {
                if (c < 0)
                        perror("ping: sendto");
-               fprintf(stderr, "ping: write incomplete\n");
+               errorMsg("write incomplete\n");
                exit(1);
        }
 
@@ -433,8 +433,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from)
                printf("\n");
        } else 
                if (icmppkt->icmp_type != ICMP_ECHO)
-                       fprintf(stderr,
-                                       "Warning: Got ICMP %d (%s)\n",
+                       errorMsg("Warning: Got ICMP %d (%s)\n",
                                        icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type));
 }
 
@@ -452,7 +451,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) {
-                       fprintf(stderr, "ping: permission denied. (are you root?)\n");
+                       errorMsg("permission denied. (are you root?)\n");
                } else {
                        perror("ping: creating a raw socket");
                }
@@ -466,13 +465,12 @@ static void ping(const char *host)
 
        pingaddr.sin_family = AF_INET;
        if (!(h = gethostbyname(host))) {
-               fprintf(stderr, "ping: unknown host %s\n", host);
+               errorMsg("unknown host %s\n", host);
                exit(1);
        }
 
        if (h->h_addrtype != AF_INET) {
-               fprintf(stderr,
-                               "ping: unknown address type; only AF_INET is currently supported.\n");
+               errorMsg("unknown address type; only AF_INET is currently supported.\n");
                exit(1);
        }
 
index 8cdfebfce6d80bc4f1044ce121c4e10a5017d03d..ad0b5842d6fe4375a5179c31d927ca217689094a 100644 (file)
@@ -312,8 +312,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
        msock = fsock = -1;
        mclient = NULL;
        if (strlen(spec) >= sizeof(hostdir)) {
-               fprintf(stderr, _("mount: "
-                       "excessively long host:dir argument\n"));
+               errorMsg("excessively long host:dir argument\n");
                goto fail;
        }
        strcpy(hostdir, spec);
@@ -325,12 +324,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';
-                       fprintf(stderr, _("mount: warning: "
-                               "multiple hostnames not supported\n"));
+                       errorMsg("warning: multiple hostnames not supported\n");
                }
        } else {
-               fprintf(stderr, _("mount: "
-                       "directory to mount not in host:dir format\n"));
+               errorMsg("directory to mount not in host:dir format\n");
                goto fail;
        }
 
@@ -340,13 +337,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
 #endif
        {
                if ((hp = gethostbyname(hostname)) == NULL) {
-                       fprintf(stderr, _("mount: can't get address for %s\n"),
-                               hostname);
+                       errorMsg("can't get address for %s\n", hostname);
                        goto fail;
                } else {
                        if (hp->h_length > sizeof(struct in_addr)) {
-                               fprintf(stderr,
-                                       _("mount: got bad hp->h_length\n"));
+                               errorMsg("got bad hp->h_length\n");
                                hp->h_length = sizeof(struct in_addr);
                        }
                        memcpy(&server_addr.sin_addr,
@@ -363,8 +358,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)) {
-               fprintf(stderr, _("mount: "
-                       "excessively long option argument\n"));
+               errorMsg("excessively long option argument\n");
                goto fail;
        }
        sprintf(new_opts, "%s%saddr=%s",
@@ -524,11 +518,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
                data.flags |= (nolock ? NFS_MOUNT_NONLM : 0);
 #endif
        if (nfsvers > MAX_NFSPROT) {
-               fprintf(stderr, "NFSv%d not supported!\n", nfsvers);
+               errorMsg("NFSv%d not supported!\n", nfsvers);
                return 0;
        }
        if (mountvers > MAX_NFSPROT) {
-               fprintf(stderr, "NFSv%d not supported!\n", nfsvers);
+               errorMsg("NFSv%d not supported!\n", nfsvers);
                return 0;
        }
        if (nfsvers && !mountvers)
@@ -588,13 +582,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) {
-                         fprintf(stderr, _("mount: can't get address for %s\n"),
-                                 hostname);
+                         errorMsg("can't get address for %s\n", hostname);
                          goto fail;
                  } else {
                          if (hp->h_length > sizeof(struct in_addr)) {
-                                 fprintf(stderr,
-                                         _("mount: got bad hp->h_length?\n"));
+                                 errorMsg("got bad hp->h_length?\n");
                                  hp->h_length = sizeof(struct in_addr);
                          }
                          mount_server_addr.sin_family = AF_INET;
@@ -729,8 +721,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
 
        if (nfsvers == 2) {
                if (status.nfsv2.fhs_status != 0) {
-                       fprintf(stderr,
-                               "mount: %s:%s failed, reason given by server: %s\n",
+                       errorMsg("%s:%s failed, reason given by server: %s\n",
                                hostname, dirname,
                                nfs_strerror(status.nfsv2.fhs_status));
                        goto fail;
@@ -748,8 +739,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
 #if NFS_MOUNT_VERSION >= 4
                fhandle3 *fhandle;
                if (status.nfsv3.fhs_status != 0) {
-                       fprintf(stderr,
-                               "mount: %s:%s failed, reason given by server: %s\n",
+                       errorMsg("%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 0359abbd1ded51ba662b00a956dd34c7fe6f5325..52cb07be74b9e37b1d9893a03f11f4d914ab52ce 100644 (file)
--- a/ping.c
+++ b/ping.c
@@ -1,6 +1,6 @@
 /* vi: set sw=4 ts=4: */
 /*
- * $Id: ping.c,v 1.20 2000/07/12 17:02:35 kraai Exp $
+ * $Id: ping.c,v 1.21 2000/07/14 01:51:25 kraai Exp $
  * Mini ping implementation for busybox
  *
  * Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
@@ -208,7 +208,7 @@ static void ping(const char *host)
 
        pingaddr.sin_family = AF_INET;
        if (!(h = gethostbyname(host))) {
-               fprintf(stderr, "ping: unknown host %s\n", host);
+               errorMsg("unknown host %s\n", host);
                exit(1);
        }
        memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr));
@@ -225,7 +225,7 @@ static void ping(const char *host)
        if (c < 0 || c != sizeof(packet)) {
                if (c < 0)
                        perror("ping: sendto");
-               fprintf(stderr, "ping: write incomplete\n");
+               errorMsg("write incomplete\n");
                exit(1);
        }
 
@@ -433,8 +433,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from)
                printf("\n");
        } else 
                if (icmppkt->icmp_type != ICMP_ECHO)
-                       fprintf(stderr,
-                                       "Warning: Got ICMP %d (%s)\n",
+                       errorMsg("Warning: Got ICMP %d (%s)\n",
                                        icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type));
 }
 
@@ -452,7 +451,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) {
-                       fprintf(stderr, "ping: permission denied. (are you root?)\n");
+                       errorMsg("permission denied. (are you root?)\n");
                } else {
                        perror("ping: creating a raw socket");
                }
@@ -466,13 +465,12 @@ static void ping(const char *host)
 
        pingaddr.sin_family = AF_INET;
        if (!(h = gethostbyname(host))) {
-               fprintf(stderr, "ping: unknown host %s\n", host);
+               errorMsg("unknown host %s\n", host);
                exit(1);
        }
 
        if (h->h_addrtype != AF_INET) {
-               fprintf(stderr,
-                               "ping: unknown address type; only AF_INET is currently supported.\n");
+               errorMsg("unknown address type; only AF_INET is currently supported.\n");
                exit(1);
        }
 
index a8d0005467732c8baaa356d108191a169b635c2d..68213594460fc2e94563406fb4a7f767b7359193 100644 (file)
@@ -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
-               fprintf(stderr, "Internal error!\n");
+               errorMsg("Internal error!\n");
 
        /* For busybox, ignoring effective, saved, etc */
        tmp = strstr(S, "Uid:");
        if (tmp)
                sscanf(tmp, "Uid:\t%d", &P->ruid);
        else
-               fprintf(stderr, "Internal error!\n");
+               errorMsg("Internal error!\n");
 
        tmp = strstr(S, "Gid:");
        if (tmp)
                sscanf(tmp, "Gid:\t%d", &P->rgid);
        else
-               fprintf(stderr, "Internal error!\n");
+               errorMsg("Internal error!\n");
 
 }
 
diff --git a/ps.c b/ps.c
index a8d0005467732c8baaa356d108191a169b635c2d..68213594460fc2e94563406fb4a7f767b7359193 100644 (file)
--- 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
-               fprintf(stderr, "Internal error!\n");
+               errorMsg("Internal error!\n");
 
        /* For busybox, ignoring effective, saved, etc */
        tmp = strstr(S, "Uid:");
        if (tmp)
                sscanf(tmp, "Uid:\t%d", &P->ruid);
        else
-               fprintf(stderr, "Internal error!\n");
+               errorMsg("Internal error!\n");
 
        tmp = strstr(S, "Gid:");
        if (tmp)
                sscanf(tmp, "Gid:\t%d", &P->rgid);
        else
-               fprintf(stderr, "Internal error!\n");
+               errorMsg("Internal error!\n");
 
 }
 
diff --git a/rmdir.c b/rmdir.c
index c88f42cf54f35791b079fed384c2d6e732164491..4edb9b6b3988f392bec624c3098acb57ea0edf09 100644 (file)
--- a/rmdir.c
+++ b/rmdir.c
@@ -40,7 +40,7 @@ extern int rmdir_main(int argc, char **argv)
 
        while (--argc > 0) {
                if (rmdir(*(++argv)) == -1) {
-                       fprintf(stderr, "%s: %s\n", applet_name, strerror(errno));
+                       errorMsg("%s\n", strerror(errno));
                        exit(FALSE);
                }
        }
diff --git a/sed.c b/sed.c
index 770a56eeb98ac65fe729f56d2468e5d61a9b0b5b..3a7360fc59980b30dc9965ccef8a36263b6e691b 100644 (file)
--- a/sed.c
+++ b/sed.c
@@ -207,8 +207,8 @@ static int get_address(const char *str, int *line, regex_t **regex)
                idx++; /* so it points to the next character after the last '/' */
        }
        else {
-               fprintf(stderr, "sed.c:get_address: no address found in string\n");
-               fprintf(stderr, "\t(you probably didn't check the string you passed me)\n");
+               errorMsg("get_address: no address found in string\n"
+                               "\t(you probably didn't check the string you passed me)\n");
                idx = -1;
        }
 
@@ -612,7 +612,7 @@ extern int sed_main(int argc, char **argv)
                for (i = optind; i < argc; i++) {
                        file = fopen(argv[i], "r");
                        if (file == NULL) {
-                               fprintf(stderr, "sed: %s: %s\n", argv[i], strerror(errno));
+                               errorMsg("%s: %s\n", argv[i], strerror(errno));
                        } else {
                                process_file(file);
                                fclose(file);
diff --git a/sh.c b/sh.c
index f4564f7f7d35f261f6dbcdd5c3ce44c19494a7d8..048394ab67d9fdecd517b1771a785d91633e7cd4 100644 (file)
--- a/sh.c
+++ b/sh.c
@@ -207,12 +207,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]) {
-                       fprintf(stderr, "%s: exactly one argument is expected\n",
+                       errorMsg("%s: exactly one argument is expected\n",
                                        cmd->progs[0].argv[0]);
                        return FALSE;
                }
                if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) {
-                       fprintf(stderr, "%s: bad argument '%s'\n",
+                       errorMsg("%s: bad argument '%s'\n",
                                        cmd->progs[0].argv[0], cmd->progs[0].argv[1]);
                        return FALSE;
                        for (job = jobList->head; job; job = job->next) {
@@ -226,7 +226,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList)
        }
 
        if (!job) {
-               fprintf(stderr, "%s: unknown job %d\n",
+               errorMsg("%s: unknown job %d\n",
                                cmd->progs[0].argv[0], jobNum);
                return FALSE;
        }
@@ -519,7 +519,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
 
        rc = glob(prog->argv[argc - 1], flags, NULL, &prog->globResult);
        if (rc == GLOB_NOSPACE) {
-               fprintf(stderr, "out of space during glob operation\n");
+               errorMsg("out of space during glob operation\n");
                return;
        } else if (rc == GLOB_NOMATCH ||
                           (!rc && (prog->globResult.gl_pathc - i) == 1 &&
@@ -607,7 +607,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                        if (*src == '\\') {
                                src++;
                                if (!*src) {
-                                       fprintf(stderr, "character expected after \\\n");
+                                       errorMsg("character expected after \\\n");
                                        freeJob(job);
                                        return 1;
                                }
@@ -686,7 +686,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                                        chptr++;
 
                                if (!*chptr) {
-                                       fprintf(stderr, "file name expected after %c\n", *src);
+                                       errorMsg("file name expected after %c\n", *src);
                                        freeJob(job);
                                        job->numProgs=0;
                                        return 1;
@@ -705,7 +705,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                                if (*prog->argv[argc])
                                        argc++;
                                if (!argc) {
-                                       fprintf(stderr, "empty command in pipe1.\n");
+                                       errorMsg("empty command in pipe1\n");
                                        freeJob(job);
                                        job->numProgs=0;
                                        return 1;
@@ -731,7 +731,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                                        src++;
 
                                if (!*src) {
-                                       fprintf(stderr, "empty command in pipe2\n");
+                                       errorMsg("empty command in pipe2\n");
                                        freeJob(job);
                                        job->numProgs=0;
                                        return 1;
@@ -750,7 +750,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                        case '\\':
                                src++;
                                if (!*src) {
-                                       fprintf(stderr, "character expected after \\\n");
+                                       errorMsg("character expected after \\\n");
                                        freeJob(job);
                                        return 1;
                                }
@@ -965,7 +965,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!) */
-                       fprintf(stderr, "error opening %s: %s\n", redir->filename,
+                       errorMsg("error opening %s: %s\n", redir->filename,
                                        strerror(errno));
                        return 1;
                }
index f4564f7f7d35f261f6dbcdd5c3ce44c19494a7d8..048394ab67d9fdecd517b1771a785d91633e7cd4 100644 (file)
@@ -207,12 +207,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]) {
-                       fprintf(stderr, "%s: exactly one argument is expected\n",
+                       errorMsg("%s: exactly one argument is expected\n",
                                        cmd->progs[0].argv[0]);
                        return FALSE;
                }
                if (sscanf(cmd->progs[0].argv[1], "%%%d", &jobNum) != 1) {
-                       fprintf(stderr, "%s: bad argument '%s'\n",
+                       errorMsg("%s: bad argument '%s'\n",
                                        cmd->progs[0].argv[0], cmd->progs[0].argv[1]);
                        return FALSE;
                        for (job = jobList->head; job; job = job->next) {
@@ -226,7 +226,7 @@ static int builtin_fg_bg(struct job *cmd, struct jobSet *jobList)
        }
 
        if (!job) {
-               fprintf(stderr, "%s: unknown job %d\n",
+               errorMsg("%s: unknown job %d\n",
                                cmd->progs[0].argv[0], jobNum);
                return FALSE;
        }
@@ -519,7 +519,7 @@ static void globLastArgument(struct childProgram *prog, int *argcPtr,
 
        rc = glob(prog->argv[argc - 1], flags, NULL, &prog->globResult);
        if (rc == GLOB_NOSPACE) {
-               fprintf(stderr, "out of space during glob operation\n");
+               errorMsg("out of space during glob operation\n");
                return;
        } else if (rc == GLOB_NOMATCH ||
                           (!rc && (prog->globResult.gl_pathc - i) == 1 &&
@@ -607,7 +607,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                        if (*src == '\\') {
                                src++;
                                if (!*src) {
-                                       fprintf(stderr, "character expected after \\\n");
+                                       errorMsg("character expected after \\\n");
                                        freeJob(job);
                                        return 1;
                                }
@@ -686,7 +686,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                                        chptr++;
 
                                if (!*chptr) {
-                                       fprintf(stderr, "file name expected after %c\n", *src);
+                                       errorMsg("file name expected after %c\n", *src);
                                        freeJob(job);
                                        job->numProgs=0;
                                        return 1;
@@ -705,7 +705,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                                if (*prog->argv[argc])
                                        argc++;
                                if (!argc) {
-                                       fprintf(stderr, "empty command in pipe1.\n");
+                                       errorMsg("empty command in pipe1\n");
                                        freeJob(job);
                                        job->numProgs=0;
                                        return 1;
@@ -731,7 +731,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                                        src++;
 
                                if (!*src) {
-                                       fprintf(stderr, "empty command in pipe2\n");
+                                       errorMsg("empty command in pipe2\n");
                                        freeJob(job);
                                        job->numProgs=0;
                                        return 1;
@@ -750,7 +750,7 @@ static int parseCommand(char **commandPtr, struct job *job, struct jobSet *jobLi
                        case '\\':
                                src++;
                                if (!*src) {
-                                       fprintf(stderr, "character expected after \\\n");
+                                       errorMsg("character expected after \\\n");
                                        freeJob(job);
                                        return 1;
                                }
@@ -965,7 +965,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!) */
-                       fprintf(stderr, "error opening %s: %s\n", redir->filename,
+                       errorMsg("error opening %s: %s\n", redir->filename,
                                        strerror(errno));
                        return 1;
                }
diff --git a/sort.c b/sort.c
index a28122d510d420bc8bc525dd6092f6e5873b9860..c754989eafdb2f154611ceace21a56621ff097a1 100644 (file)
--- a/sort.c
+++ b/sort.c
@@ -263,7 +263,7 @@ int sort_main(int argc, char **argv)
                                break;
 #endif
                        default:
-                               fprintf(stderr, "sort: invalid option -- %c\n", opt);
+                               errorMsg("invalid option -- %c\n", opt);
                                usage(sort_usage);
                        }
                } else {
@@ -304,4 +304,4 @@ int sort_main(int argc, char **argv)
        return(0);
 }
 
-/* $Id: sort.c,v 1.18 2000/06/28 22:15:26 markw Exp $ */
+/* $Id: sort.c,v 1.19 2000/07/14 01:51:25 kraai Exp $ */
index d32ccaaf34e936213dd3a9dcb8469dc1538d43b8..71d7030854a52a2f064b0dbd33f8cc658bfddcbc 100644 (file)
@@ -96,7 +96,7 @@ static int pencode(char *s)
                *s = '\0';
                fac = decode(save, facilitynames);
                if (fac < 0) {
-                       fprintf(stderr, "unknown facility name: %s\n", save);
+                       errorMsg("unknown facility name: %s\n", save);
                        exit(FALSE);
                }
                *s++ = '.';
@@ -105,7 +105,7 @@ static int pencode(char *s)
        }
        lev = decode(s, prioritynames);
        if (lev < 0) {
-               fprintf(stderr, "unknown priority name: %s\n", save);
+               errorMsg("unknown priority name: %s\n", save);
                exit(FALSE);
        }
        return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK));
@@ -166,7 +166,7 @@ extern int logger_main(int argc, char **argv)
                if (argc >= 1) {
                        message = *argv;
                } else {
-                       fprintf(stderr, "No message\n");
+                       errorMsg("No message\n");
                        exit(FALSE);
                }
        }
diff --git a/tail.c b/tail.c
index 3189d204f47c8c0061337d586099c8feda6d2d25..601f0873d42079d250b54ac2e495ea421a81b4ce 100644 (file)
--- a/tail.c
+++ b/tail.c
@@ -375,7 +375,7 @@ extern int tail_main(int argc, char **argv)
                                usage(tail_usage);
                        default:
                                if ((n_units = atoi(&argv[i][1])) < 1) {
-                                       fprintf(stderr, "tail: invalid option -- %c\n", opt);
+                                       errorMsg("invalid option -- %c\n", opt);
                                        usage(tail_usage);
                                }
                        }
@@ -386,8 +386,7 @@ extern int tail_main(int argc, char **argv)
 
        if (i + 1 < argc) {
                if (forever) {
-                       fprintf(stderr,
-                                       "tail: option -f is invalid with multiple files\n");
+                       errorMsg("option -f is invalid with multiple files\n");
                        usage(tail_usage);
                }
                print_headers = 1;
diff --git a/tee.c b/tee.c
index c9b5410d312347d59e200b6497bb5566844d941c..67b42a24d55e10276c2f552c0a5e816324b33ac9 100644 (file)
--- a/tee.c
+++ b/tee.c
@@ -104,7 +104,7 @@ int tee_main(int argc, char **argv)
        /* init FILE pointers */
        FileList = calloc(FL_MAX, sizeof(FILE*));
        if (!FileList) {
-               fprintf(stderr, "tee: %s\n", strerror(errno));
+               errorMsg("%s\n", strerror(errno));
                exit(1);
        }
        FL_end = 0;
@@ -133,4 +133,4 @@ int tee_main(int argc, char **argv)
        return(0);
 }
 
-/* $Id: tee.c,v 1.11 2000/06/19 17:25:40 andersen Exp $ */
+/* $Id: tee.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */
index 59dcb6651b9589e929dd9336934a601d7dc6b068..1b250fd3a3ddbc7bd2267e1a8ea8d48afea57d11 100644 (file)
--- a/umount.c
+++ b/umount.c
@@ -101,7 +101,7 @@ void mtab_read(void)
                return;
 
        if ((fp = setmntent(mtab_file, "r")) == NULL) {
-               fprintf(stderr, "Cannot open %s\n", mtab_file);
+               errorMsg("Cannot open %s\n", mtab_file);
                return;
        }
        while ((e = getmntent(fp))) {
@@ -209,11 +209,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) {
-                       fprintf(stderr, "umount: %s busy - remounted read-only\n",
-                                       blockDevice);
+                       errorMsg("%s busy - remounted read-only\n", blockDevice);
                } else {
-                       fprintf(stderr, "umount: Cannot remount %s read-only\n",
-                                       blockDevice);
+                       errorMsg("Cannot remount %s read-only\n", blockDevice);
                }
        }
        if (status == 0) {
diff --git a/uniq.c b/uniq.c
index 64acf046ad0088fe7a73a495f113e74de69fc947..16b25767049071714eda66327bf872000f66585e 100644 (file)
--- a/uniq.c
+++ b/uniq.c
@@ -127,11 +127,11 @@ set_file_pointers(int schema, FILE ** in, FILE ** out, char **argv)
                break;
        }
        if (*in == NULL) {
-               fprintf(stderr, "uniq: %s: %s\n", argv[0], strerror(errno));
+               errorMsg("%s: %s\n", argv[0], strerror(errno));
                return errno;
        }
        if (*out == NULL) {
-               fprintf(stderr, "uniq: %s: %s\n", argv[1], strerror(errno));
+               errorMsg("%s: %s\n", argv[1], strerror(errno));
                return errno;
        }
        return 0;
@@ -187,4 +187,4 @@ int uniq_main(int argc, char **argv)
        return(0);
 }
 
-/* $Id: uniq.c,v 1.11 2000/06/19 17:25:40 andersen Exp $ */
+/* $Id: uniq.c,v 1.12 2000/07/14 01:51:25 kraai Exp $ */
index 9fde6a19d988d4ab224efcccf2fc96991fc82a8c..2fcc7c2945237e3c5a0e279e3e160bef4dc6d986 100644 (file)
@@ -387,7 +387,7 @@ extern int fbset_main(int argc, char **argv)
                PERROR("fbset(ioctl)");
        if (g_options & OPT_READMODE) {
                if (!readmode(&var, modefile, mode)) {
-                       fprintf(stderr, "Unknown video mode `%s'\n", mode);
+                       errorMsg("Unknown video mode `%s'\n", mode);
                        exit(1);
                }
        }
index 685e0ee6c818f1d7a0c5a32815e853c9938a6070..74281a71efaef917adbe1af1fc629935aa4fe1b1 100644 (file)
@@ -311,7 +311,7 @@ static void show_usage(void)
 
 static void die(const char *str)
 {
-       fprintf(stderr, "%s: %s\n", applet_name, str);
+       errorMsg("%s\n", str);
        leave(8);
 }
 
index b6f958f46b599cdd60c5219c5ef23fd5fe0d0fc1..e4dedaf8221166dd92e73e48695224accb88e495 100644 (file)
@@ -263,7 +263,7 @@ static unsigned long req_nr_inodes = 0;
  */
 static volatile void die(char *str)
 {
-       fprintf(stderr, "%s: %s\n", applet_name, str);
+       errorMsg("%s\n", str);
        exit(8);
 }
 
@@ -814,8 +814,8 @@ extern int mkfs_minix_main(int argc, char **argv)
 #ifdef HAVE_MINIX2
                                                version2 = 1;
 #else
-                                               fprintf(stderr, "%s: not compiled with minix v2 support\n",
-                                                               applet_name, device_name);
+                                               errorMsg("%s: not compiled with minix v2 support\n",
+                                                               device_name);
                                                exit(-1);
 #endif
                                                break;
index 20096361f9df283e377454c6c7fe9b13b7178b6b..5a33945c838f7b1b76ed6c571b483503260ecdfd 100644 (file)
@@ -116,7 +116,7 @@ static void init_signature_page()
 
 #ifdef PAGE_SIZE
        if (pagesize != PAGE_SIZE)
-               fprintf(stderr, "Assuming pages of size %d\n", pagesize);
+               errorMsg("Assuming pages of size %d\n", pagesize);
 #endif
        signature_page = (int *) xmalloc(pagesize);
        memset(signature_page, 0, pagesize);
@@ -204,7 +204,7 @@ static int bit_test_and_clear(unsigned int *addr, unsigned int nr)
 
 void die(const char *str)
 {
-       fprintf(stderr, "%s: %s\n", applet_name, str);
+       errorMsg("%s\n", str);
        exit(FALSE);
 }
 
@@ -345,18 +345,14 @@ int mkswap_main(int argc, char **argv)
                }
        }
        if (!device_name) {
-               fprintf(stderr,
-                               "%s: error: Nowhere to set up swap on?\n", applet_name);
+               errorMsg("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) {
-               fprintf(stderr,
-                               "%s: error: "
-                               "size %ld is larger than device size %d\n",
-                               applet_name,
+               errorMsg("error: size %ld is larger than device size %d\n",
                                PAGES * (pagesize / 1024), sz * (pagesize / 1024));
                exit(FALSE);
        }
@@ -372,14 +368,12 @@ int mkswap_main(int argc, char **argv)
                        version = 1;
        }
        if (version != 0 && version != 1) {
-               fprintf(stderr, "%s: error: unknown version %d\n",
-                               applet_name, version);
+               errorMsg("error: unknown version %d\n", version);
                usage(mkswap_usage);
        }
        if (PAGES < 10) {
-               fprintf(stderr,
-                               "%s: error: swap area needs to be at least %ldkB\n",
-                               applet_name, (long) (10 * pagesize / 1024));
+               errorMsg("error: swap area needs to be at least %ldkB\n",
+                               (long) (10 * pagesize / 1024));
                usage(mkswap_usage);
        }
 #if 0
@@ -397,8 +391,8 @@ int mkswap_main(int argc, char **argv)
 #endif
        if (PAGES > maxpages) {
                PAGES = maxpages;
-               fprintf(stderr, "%s: warning: truncating swap area to %ldkB\n",
-                               applet_name, PAGES * pagesize / 1024);
+               errorMsg("warning: truncating swap area to %ldkB\n",
+                               PAGES * pagesize / 1024);
        }
 
        DEV = open(device_name, O_RDWR);
@@ -424,11 +418,10 @@ int mkswap_main(int argc, char **argv)
                        for (sum = 0; q >= (unsigned short *) buffer;)
                                sum ^= *q--;
                        if (!sum) {
-                               fprintf(stderr, "\
-%s: 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", applet_name, device_name);
+                               errorMsg("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);
                                exit(FALSE);
                        }
                }
index 900ab30a7cda643de2078d454f92cb658e64cfdb..455e4a1c1c54a7d3545993ec7e86c343b7a2ef3b 100644 (file)
@@ -157,15 +157,15 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
 
                        specialfile = find_unused_loop_device();
                        if (specialfile == NULL) {
-                               fprintf(stderr, "Could not find a spare loop device\n");
+                               errorMsg("Could not find a spare loop device\n");
                                return (FALSE);
                        }
                        if (set_loop(specialfile, lofile, 0, &loro)) {
-                               fprintf(stderr, "Could not setup loop device\n");
+                               errorMsg("Could not setup loop device\n");
                                return (FALSE);
                        }
                        if (!(flags & MS_RDONLY) && loro) {     /* loop is ro, but wanted rw */
-                               fprintf(stderr, "WARNING: loop device is read-only\n");
+                               errorMsg("WARNING: loop device is read-only\n");
                                flags &= ~MS_RDONLY;
                        }
                }
@@ -329,7 +329,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
 
        if (status == FALSE) {
                if (whineOnErrors == TRUE) {
-                       fprintf(stderr, "Mounting %s on %s failed: %s\n",
+                       errorMsg("Mounting %s on %s failed: %s\n",
                                        blockDevice, directory, strerror(errno));
                }
                return (FALSE);
index 8cdfebfce6d80bc4f1044ce121c4e10a5017d03d..ad0b5842d6fe4375a5179c31d927ca217689094a 100644 (file)
@@ -312,8 +312,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
        msock = fsock = -1;
        mclient = NULL;
        if (strlen(spec) >= sizeof(hostdir)) {
-               fprintf(stderr, _("mount: "
-                       "excessively long host:dir argument\n"));
+               errorMsg("excessively long host:dir argument\n");
                goto fail;
        }
        strcpy(hostdir, spec);
@@ -325,12 +324,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';
-                       fprintf(stderr, _("mount: warning: "
-                               "multiple hostnames not supported\n"));
+                       errorMsg("warning: multiple hostnames not supported\n");
                }
        } else {
-               fprintf(stderr, _("mount: "
-                       "directory to mount not in host:dir format\n"));
+               errorMsg("directory to mount not in host:dir format\n");
                goto fail;
        }
 
@@ -340,13 +337,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
 #endif
        {
                if ((hp = gethostbyname(hostname)) == NULL) {
-                       fprintf(stderr, _("mount: can't get address for %s\n"),
-                               hostname);
+                       errorMsg("can't get address for %s\n", hostname);
                        goto fail;
                } else {
                        if (hp->h_length > sizeof(struct in_addr)) {
-                               fprintf(stderr,
-                                       _("mount: got bad hp->h_length\n"));
+                               errorMsg("got bad hp->h_length\n");
                                hp->h_length = sizeof(struct in_addr);
                        }
                        memcpy(&server_addr.sin_addr,
@@ -363,8 +358,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)) {
-               fprintf(stderr, _("mount: "
-                       "excessively long option argument\n"));
+               errorMsg("excessively long option argument\n");
                goto fail;
        }
        sprintf(new_opts, "%s%saddr=%s",
@@ -524,11 +518,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
                data.flags |= (nolock ? NFS_MOUNT_NONLM : 0);
 #endif
        if (nfsvers > MAX_NFSPROT) {
-               fprintf(stderr, "NFSv%d not supported!\n", nfsvers);
+               errorMsg("NFSv%d not supported!\n", nfsvers);
                return 0;
        }
        if (mountvers > MAX_NFSPROT) {
-               fprintf(stderr, "NFSv%d not supported!\n", nfsvers);
+               errorMsg("NFSv%d not supported!\n", nfsvers);
                return 0;
        }
        if (nfsvers && !mountvers)
@@ -588,13 +582,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) {
-                         fprintf(stderr, _("mount: can't get address for %s\n"),
-                                 hostname);
+                         errorMsg("can't get address for %s\n", hostname);
                          goto fail;
                  } else {
                          if (hp->h_length > sizeof(struct in_addr)) {
-                                 fprintf(stderr,
-                                         _("mount: got bad hp->h_length?\n"));
+                                 errorMsg("got bad hp->h_length?\n");
                                  hp->h_length = sizeof(struct in_addr);
                          }
                          mount_server_addr.sin_family = AF_INET;
@@ -729,8 +721,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
 
        if (nfsvers == 2) {
                if (status.nfsv2.fhs_status != 0) {
-                       fprintf(stderr,
-                               "mount: %s:%s failed, reason given by server: %s\n",
+                       errorMsg("%s:%s failed, reason given by server: %s\n",
                                hostname, dirname,
                                nfs_strerror(status.nfsv2.fhs_status));
                        goto fail;
@@ -748,8 +739,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
 #if NFS_MOUNT_VERSION >= 4
                fhandle3 *fhandle;
                if (status.nfsv3.fhs_status != 0) {
-                       fprintf(stderr,
-                               "mount: %s:%s failed, reason given by server: %s\n",
+                       errorMsg("%s:%s failed, reason given by server: %s\n",
                                hostname, dirname,
                                nfs_strerror(status.nfsv3.fhs_status));
                        goto fail;
index 59dcb6651b9589e929dd9336934a601d7dc6b068..1b250fd3a3ddbc7bd2267e1a8ea8d48afea57d11 100644 (file)
@@ -101,7 +101,7 @@ void mtab_read(void)
                return;
 
        if ((fp = setmntent(mtab_file, "r")) == NULL) {
-               fprintf(stderr, "Cannot open %s\n", mtab_file);
+               errorMsg("Cannot open %s\n", mtab_file);
                return;
        }
        while ((e = getmntent(fp))) {
@@ -209,11 +209,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) {
-                       fprintf(stderr, "umount: %s busy - remounted read-only\n",
-                                       blockDevice);
+                       errorMsg("%s busy - remounted read-only\n", blockDevice);
                } else {
-                       fprintf(stderr, "umount: Cannot remount %s read-only\n",
-                                       blockDevice);
+                       errorMsg("Cannot remount %s read-only\n", blockDevice);
                }
        }
        if (status == 0) {
index 61f67618d80cad705bd1a84636b2b613b3bb0b26..2b2156624088b8488a139adbf9c02c55743f85e3 100644 (file)
--- a/utility.c
+++ b/utility.c
@@ -299,7 +299,7 @@ copyFile(const char *srcName, const char *destName,
 
        if ((srcStatBuf.st_dev == dstStatBuf.st_dev) &&
                (srcStatBuf.st_ino == dstStatBuf.st_ino)) {
-               fprintf(stderr, "Copying file \"%s\" to itself\n", srcName);
+               errorMsg("Copying file \"%s\" to itself\n", srcName);
                return FALSE;
        }
 
@@ -630,7 +630,7 @@ int recursiveAction(const char *fileName,
                                continue;
                        }
                        if (strlen(fileName) + strlen(next->d_name) + 1 > BUFSIZ) {
-                               fprintf(stderr, name_too_long, "ftw");
+                               errorMsg(name_too_long);
                                return FALSE;
                        }
                        memset(nextFile, 0, sizeof(nextFile));
@@ -995,8 +995,7 @@ int get_console_fd(char *tty_name)
                if (is_a_console(fd))
                        return fd;
 
-       fprintf(stderr,
-                       "Couldnt get a file descriptor referring to the console\n");
+       errorMsg("Couldnt get a file descriptor referring to the console\n");
        return -1;                                      /* total failure */
 }
 
index 983c6725d4617e35d548eb34d8ec9c4c10694cb8..01dff81f919b8b41be7be720f1177e5ba303adcf 100644 (file)
--- a/whoami.c
+++ b/whoami.c
@@ -43,7 +43,6 @@ extern int whoami_main(int argc, char **argv)
                puts(user);
                exit(TRUE);
        }
-       fprintf(stderr, "%s: cannot find username for UID %u\n", applet_name,
-                       (unsigned) uid);
+       errorMsg("cannot find username for UID %u\n", (unsigned) uid);
        return(FALSE);
 }