diff options
author | Matt Kraai <kraai@debian.org> | 2001-01-31 19:00:21 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2001-01-31 19:00:21 +0000 |
commit | dd19c6990496023fe23fefef8f1798740f7d39c6 (patch) | |
tree | 3933adefa4171173db78fa2389146ac89f4edb86 | |
parent | 63ec2732454a0c973305794e185e488106f6b282 (diff) |
Removed trailing \n from error_msg{,_and_die} messages.
106 files changed, 612 insertions, 610 deletions
diff --git a/applets/busybox.c b/applets/busybox.c index e56d2a4ed..f10467a3b 100644 --- a/applets/busybox.c +++ b/applets/busybox.c @@ -113,7 +113,7 @@ int main(int argc, char **argv) exit((*(applet->main)) (argc, argv)); } - error_msg_and_die("applet not found\n"); + error_msg_and_die("applet not found"); } @@ -65,9 +65,9 @@ extern ar_headers_t get_headers(int srcFd) /* check ar magic */ if (full_read(srcFd, ar_magic, 8) != 8) - error_msg_and_die("cannot read magic\n"); + error_msg_and_die("cannot read magic"); if (strncmp(ar_magic,"!<arch>",7) != 0) - error_msg_and_die("invalid magic\n"); + error_msg_and_die("invalid magic"); while (full_read(srcFd, (char *) &raw_ar_header, 60)==60) { /* check the end of header markers are valid */ @@ -168,7 +168,7 @@ extern int ar_main(int argc, char **argv) usage(ar_usage); if ( (srcFd = open(argv[optind], O_RDONLY)) < 0) - error_msg_and_die("Cannot read %s\n", argv[optind]); + error_msg_and_die("Cannot read %s", argv[optind]); optind++; head = get_headers(srcFd); diff --git a/archival/ar.c b/archival/ar.c index 550b2a1c4..5aba30de0 100644 --- a/archival/ar.c +++ b/archival/ar.c @@ -65,9 +65,9 @@ extern ar_headers_t get_headers(int srcFd) /* check ar magic */ if (full_read(srcFd, ar_magic, 8) != 8) - error_msg_and_die("cannot read magic\n"); + error_msg_and_die("cannot read magic"); if (strncmp(ar_magic,"!<arch>",7) != 0) - error_msg_and_die("invalid magic\n"); + error_msg_and_die("invalid magic"); while (full_read(srcFd, (char *) &raw_ar_header, 60)==60) { /* check the end of header markers are valid */ @@ -168,7 +168,7 @@ extern int ar_main(int argc, char **argv) usage(ar_usage); if ( (srcFd = open(argv[optind], O_RDONLY)) < 0) - error_msg_and_die("Cannot read %s\n", argv[optind]); + error_msg_and_die("Cannot read %s", argv[optind]); optind++; head = get_headers(srcFd); diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index 3a789379b..3345c273f 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c @@ -118,7 +118,7 @@ extern int dpkg_deb_main(int argc, char **argv) extract_flag = TRUE; strcpy(ar_filename, "data.tar.gz"); if ( (optind + 2) > argc ) { - error_msg_and_die("No directory specified\n"); + error_msg_and_die("No directory specified"); } target_dir = (char *) xmalloc(strlen(argv[optind+1])); strcpy(target_dir, argv[optind+1]); @@ -128,7 +128,7 @@ extern int dpkg_deb_main(int argc, char **argv) list_flag = TRUE; strcpy(ar_filename, "data.tar.gz"); if ( (optind + 2) > argc ) { - error_msg_and_die("No directory specified\n"); + error_msg_and_die("No directory specified"); } target_dir = (char *) xmalloc(strlen(argv[optind+1])); strcpy(target_dir, argv[optind+1]); @@ -139,7 +139,7 @@ extern int dpkg_deb_main(int argc, char **argv) *ar_headers = get_headers(srcFd); if (ar_headers->next==NULL) - error_msg_and_die("Couldnt find %s in %s\n",ar_filename, argv[optind]); + error_msg_and_die("Couldnt find %s in %s", ar_filename, argv[optind]); while (ar_headers->next != NULL) { if (strcmp(ar_headers->name, ar_filename)==0) @@ -154,7 +154,7 @@ extern int dpkg_deb_main(int argc, char **argv) mkdir(target_dir, 0755); } if (chdir(target_dir)==-1) { - error_msg_and_die("Cannot change to dir %s\n",argv[optind+1]); + error_msg_and_die("Cannot change to dir %s", argv[optind+1]); } } status = readTarFile(srcFd, extract_flag, list_flag, extract_to_stdout, verbose_flag, NULL, extract_list); diff --git a/archival/gunzip.c b/archival/gunzip.c index 09571f91c..48a46083b 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c @@ -297,7 +297,7 @@ int in; /* input file descriptor */ method = (int) get_byte(); if (method != DEFLATED) { - error_msg("unknown method %d -- get newer version of gzip\n", method); + error_msg("unknown method %d -- get newer version of gzip", method); exit_code = ERROR; return -1; } @@ -1116,11 +1116,11 @@ int in, out; /* input and output file descriptors */ if (res == 3) { error_msg(memory_exhausted); } else if (res != 0) { - error_msg("invalid compressed data--format violated\n"); + error_msg("invalid compressed data--format violated"); } } else { - error_msg("internal error, invalid method\n"); + error_msg("internal error, invalid method"); } /* Get the crc and original length */ @@ -1149,15 +1149,15 @@ int in, out; /* input and output file descriptors */ /* Validate decompression */ if (orig_crc != updcrc(outbuf, 0)) { - error_msg("invalid compressed data--crc error\n"); + error_msg("invalid compressed data--crc error"); } if (orig_len != (ulg) bytes_out) { - error_msg("invalid compressed data--length error\n"); + error_msg("invalid compressed data--length error"); } /* Check if there are more entries in a pkzip file */ if (pkzip && inptr + 4 < insize && LG(inbuf + inptr) == LOCSIG) { - fprintf(stderr, "has more than one entry--rest ignored\n"); + error_msg("has more than one entry--rest ignored"); if (exit_code == OK) exit_code = WARNING; } @@ -1261,9 +1261,9 @@ int gunzip_main(int argc, char **argv) } if (isatty(fileno(stdin)) && fromstdin==1 && force==0) - error_msg_and_die( "data not read from terminal. Use -f to force it.\n"); + error_msg_and_die( "data not read from terminal. Use -f to force it."); if (isatty(fileno(stdout)) && tostdout==1 && force==0) - error_msg_and_die( "data not written to terminal. Use -f to force it.\n"); + error_msg_and_die( "data not written to terminal. Use -f to force it."); gunzip_init(); diff --git a/archival/gzip.c b/archival/gzip.c index 5a74868c1..75f3caa35 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -1382,7 +1382,7 @@ int length; (char *) window + start, length) != EQUAL) { fprintf(stderr, " start %d, match %d, length %d\n", start, match, length); - error_msg("invalid match\n"); + error_msg("invalid match"); } if (verbose > 1) { fprintf(stderr, "\\[%d,%d]", start - match, length); @@ -1822,9 +1822,9 @@ int gzip_main(int argc, char **argv) } if (isatty(fileno(stdin)) && fromstdin==1 && force==0) - error_msg_and_die( "data not read from terminal. Use -f to force it.\n"); + error_msg_and_die( "data not read from terminal. Use -f to force it."); if (isatty(fileno(stdout)) && tostdout==1 && force==0) - error_msg_and_die( "data not written to terminal. Use -f to force it.\n"); + error_msg_and_die( "data not written to terminal. Use -f to force it."); foreground = signal(SIGINT, SIG_IGN) != SIG_IGN; if (foreground) { @@ -2894,7 +2894,7 @@ int eof; /* true if this is the last block for a file */ #endif /* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */ if (buf == (char *) 0) - error_msg("block vanished\n"); + error_msg("block vanished"); copy_block(buf, (unsigned) stored_len, 0); /* without header */ compressed_len = stored_len << 3; @@ -3077,7 +3077,7 @@ local void set_file_type() bin_freq += dyn_ltree[n++].Freq; *file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII; if (*file_type == BINARY && translate_eol) { - error_msg("-l used on binary file\n"); + error_msg("-l used on binary file"); } } @@ -3239,7 +3239,7 @@ char *env; /* name of environment variable */ /* Copy the program name first */ if (oargc-- < 0) - error_msg("argc<=0\n"); + error_msg("argc<=0"); *(nargv++) = *(oargv++); /* Then copy the environment args */ diff --git a/archival/tar.c b/archival/tar.c index 308291455..60744e8db 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -165,10 +165,10 @@ extern int tar_unzip_init(int tarFd) signal(SIGCHLD, child_died); if (pipe(unzip_pipe)!=0) - error_msg_and_die("pipe error\n"); + error_msg_and_die("pipe error"); if ( (child_pid = fork()) == -1) - error_msg_and_die("fork failure\n"); + error_msg_and_die("fork failure"); if (child_pid==0) { /* child process */ @@ -259,7 +259,7 @@ extern int tar_main(int argc, char **argv) break; case 'f': if (*tarName != '-') - error_msg_and_die( "Only one 'f' option allowed\n"); + error_msg_and_die( "Only one 'f' option allowed"); tarName = optarg; break; #if defined BB_FEATURE_TAR_EXCLUDE @@ -294,11 +294,11 @@ extern int tar_main(int argc, char **argv) */ if (createFlag == TRUE) { #ifndef BB_FEATURE_TAR_CREATE - error_msg_and_die( "This version of tar was not compiled with tar creation support.\n"); + error_msg_and_die( "This version of tar was not compiled with tar creation support."); #else #ifdef BB_FEATURE_TAR_GZIP if (unzipFlag==TRUE) - error_msg_and_die("Creation of compressed not internally support by tar, pipe to busybox gunzip\n"); + error_msg_and_die("Creation of compressed not internally support by tar, pipe to busybox gunzip"); #endif status = writeTarFile(tarName, verboseFlag, argv + optind, excludeList); #endif @@ -330,7 +330,7 @@ extern int tar_main(int argc, char **argv) return EXIT_FAILURE; flagError: - error_msg_and_die( "Exactly one of 'c', 'x' or 't' must be specified\n"); + error_msg_and_die( "Exactly one of 'c', 'x' or 't' must be specified"); } static void @@ -383,7 +383,7 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) } if ( (readSize = full_read(header->tarFd, buffer, readSize)) <= 0 ) { /* Tarball seems to have a problem */ - error_msg("Unexpected EOF in archive\n"); + error_msg("Unexpected EOF in archive"); return( FALSE); } if ( readSize < writeSize ) @@ -476,7 +476,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag) /* Do not change permissions or date on symlink, * since it changes the pointed to file instead. duh. */ #else - error_msg("%s: Cannot create symlink to '%s': %s\n", + error_msg("%s: Cannot create symlink to '%s': %s", header->name, header->linkname, "symlinks not supported"); #endif @@ -543,7 +543,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header) ++*(header->name); if (alreadyWarned == FALSE) { - error_msg("Removing leading '/' from member names\n"); + error_msg("Removing leading '/' from member names"); alreadyWarned = TRUE; } } @@ -644,7 +644,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag, goto endgame; } else { errorFlag=TRUE; - error_msg("Bad tar header, skipping\n"); + error_msg("Bad tar header, skipping"); continue; } } @@ -791,7 +791,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag, break; #endif default: - error_msg("Unknown file type '%c' in tar file\n", header.type); + error_msg("Unknown file type '%c' in tar file", header.type); close( tarFd); return( FALSE); } @@ -803,7 +803,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag, return ( FALSE); } else if (errorFlag==TRUE) { - error_msg( "Error exit delayed from previous errors\n"); + error_msg( "Error exit delayed from previous errors"); return( FALSE); } else return( status); @@ -813,7 +813,7 @@ endgame: close( tarFd); if ( *(header.name) == '\0' ) { if (errorFlag==TRUE) - error_msg( "Error exit delayed from previous errors\n"); + error_msg( "Error exit delayed from previous errors"); else return( TRUE); } @@ -1002,7 +1002,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *header_name, header.typeflag = REGTYPE; putOctal(header.size, sizeof(header.size), statbuf->st_size); } else { - error_msg("%s: Unknown file type\n", real_name); + error_msg("%s: Unknown file type", real_name); return ( FALSE); } @@ -1061,7 +1061,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* /* It is against the rules to archive a socket */ if (S_ISSOCK(statbuf->st_mode)) { - error_msg("%s: socket ignored\n", fileName); + error_msg("%s: socket ignored", fileName); return( TRUE); } @@ -1070,7 +1070,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* * the new tarball */ if (tbInfo->statBuf.st_dev == statbuf->st_dev && tbInfo->statBuf.st_ino == statbuf->st_ino) { - error_msg("%s: file is the archive; skipping\n", fileName); + error_msg("%s: file is the archive; skipping", fileName); return( TRUE); } @@ -1078,7 +1078,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* while (header_name[0] == '/') { static int alreadyWarned=FALSE; if (alreadyWarned==FALSE) { - error_msg("Removing leading '/' from member names\n"); + error_msg("Removing leading '/' from member names"); alreadyWarned=TRUE; } header_name++; @@ -1111,7 +1111,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* /* open the file we want to archive, and make sure all is well */ if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { - error_msg("%s: Cannot open: %s\n", fileName, strerror(errno)); + error_msg("%s: Cannot open: %s", fileName, strerror(errno)); return( FALSE); } @@ -1150,7 +1150,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, /* Make sure there is at least one file to tar up. */ if (*argv == NULL) - error_msg_and_die("Cowardly refusing to create an empty archive\n"); + error_msg_and_die("Cowardly refusing to create an empty archive"); /* Open the tar file for writing. */ if (!strcmp(tarName, "-")) @@ -1193,7 +1193,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, /* Hang up the tools, close up shop, head home */ close(tarFd); if (errorFlag == TRUE) { - error_msg("Error exit delayed from previous errors\n"); + error_msg("Error exit delayed from previous errors"); freeHardLinkInfo(&tbInfo.hlInfoHead); return(FALSE); } @@ -113,7 +113,7 @@ int main(int argc, char **argv) exit((*(applet->main)) (argc, argv)); } - error_msg_and_die("applet not found\n"); + error_msg_and_die("applet not found"); } diff --git a/chmod_chown_chgrp.c b/chmod_chown_chgrp.c index 178138a3b..81db10151 100644 --- a/chmod_chown_chgrp.c +++ b/chmod_chown_chgrp.c @@ -65,7 +65,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk) case CHMOD_APP: /* Parse the specified modes */ if (parse_mode(theMode, &(statbuf->st_mode)) == FALSE) { - error_msg_and_die( "unknown mode: %s\n", theMode); + error_msg_and_die( "unknown mode: %s", theMode); } if (chmod(fileName, statbuf->st_mode) == 0) return (TRUE); @@ -150,7 +150,7 @@ int chmod_chown_chgrp_main(int argc, char **argv) if (*argv == p) uid = my_getpwnam(*argv); if (uid == -1) { - error_msg_and_die( "unknown user name: %s\n", *argv); + error_msg_and_die( "unknown user name: %s", *argv); } } } @@ -167,7 +167,7 @@ int chmod_chown_chgrp_main(int argc, char **argv) return EXIT_SUCCESS; bad_group: - error_msg_and_die( "unknown group name: %s\n", groupName); + error_msg_and_die( "unknown group name: %s", groupName); } /* @@ -318,7 +318,7 @@ static void cmdedit_setwidth(int w, int redraw_flg) input_backward(); } } else { - error_msg("\n*** Error: minimum screen width is %d\n", cmdedit_termw); + error_msg("\n*** Error: minimum screen width is %d", cmdedit_termw); } } diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index fad7a2bb2..b51fbaef4 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c @@ -31,9 +31,9 @@ int deallocvt_main(int argc, char *argv[]) for (i = 1; i < argc; i++) { num = atoi(argv[i]); if (num == 0) - error_msg("0: illegal VT number\n"); + error_msg("0: illegal VT number"); else if (num == 1) - error_msg("VT 1 cannot be deallocated\n"); + error_msg("VT 1 cannot be deallocated"); else if (ioctl(fd, VT_DISALLOCATE, num)) perror_msg_and_die("VT_DISALLOCATE"); } diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c index b2067b30c..4ab711e55 100644 --- a/console-tools/dumpkmap.c +++ b/console-tools/dumpkmap.c @@ -81,7 +81,7 @@ int dumpkmap_main(int argc, char **argv) ke.kb_table = i; if (ioctl(fd, KDGKBENT, &ke) < 0) { - error_msg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); + error_msg("ioctl returned: %s, %s, %s, %xqq", strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); } else { write(1,(void*)&ke.kb_value,2); diff --git a/console-tools/loadacm.c b/console-tools/loadacm.c index 040062cf8..345a2773c 100644 --- a/console-tools/loadacm.c +++ b/console-tools/loadacm.c @@ -70,7 +70,7 @@ int screen_map_load(int fd, FILE * fp) if (parse_failed) { if (-1 == fseek(fp, 0, SEEK_SET)) { if (errno == ESPIPE) - error_msg_and_die("16bit screen-map MUST be a regular file.\n"); + error_msg_and_die("16bit screen-map MUST be a regular file."); else perror_msg_and_die("fseek failed reading binary 16bit screen-map"); } @@ -79,7 +79,7 @@ int screen_map_load(int fd, FILE * fp) perror_msg_and_die("Cannot read [new] map from file"); #if 0 else - error_msg("Input screen-map is binary.\n"); + error_msg("Input screen-map is binary."); #endif } @@ -96,7 +96,7 @@ int screen_map_load(int fd, FILE * fp) /* rewind... */ if (-1 == fseek(fp, 0, SEEK_SET)) { if (errno == ESPIPE) - error_msg("Assuming 8bit screen-map - MUST be a regular file.\n"), + error_msg("Assuming 8bit screen-map - MUST be a regular file."), exit(1); else perror_msg_and_die("fseek failed assuming 8bit screen-map"); @@ -109,7 +109,7 @@ int screen_map_load(int fd, FILE * fp) if (-1 == fseek(fp, 0, SEEK_SET)) { if (errno == ESPIPE) /* should not - it succedeed above */ - error_msg_and_die("fseek() returned ESPIPE !\n"); + error_msg_and_die("fseek() returned ESPIPE !"); else perror_msg_and_die("fseek for binary 8bit screen-map"); } @@ -118,7 +118,7 @@ int screen_map_load(int fd, FILE * fp) perror_msg_and_die("Cannot read [old] map from file"); #if 0 else - error_msg("Input screen-map is binary.\n"); + error_msg("Input screen-map is binary."); #endif } @@ -127,7 +127,7 @@ int screen_map_load(int fd, FILE * fp) else return 0; } - error_msg("Error parsing symbolic map\n"); + error_msg("Error parsing symbolic map"); return(1); } diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index 08e07618e..ec3e50560 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c @@ -62,7 +62,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize) memset(buf, 0, sizeof(buf)); if (unit < 1 || unit > 32) - error_msg_and_die("Bad character size %d\n", unit); + error_msg_and_die("Bad character size %d", unit); for (i = 0; i < fontsize; i++) memcpy(buf + (32 * i), inbuf + (unit * i), unit); @@ -119,8 +119,8 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize) if (ioctl(fd, PIO_UNIMAPCLR, &advice)) { #ifdef ENOIOCTLCMD if (errno == ENOIOCTLCMD) { - error_msg("It seems this kernel is older than 1.1.92\n"); - error_msg_and_die("No Unicode mapping table loaded.\n"); + error_msg("It seems this kernel is older than 1.1.92"); + error_msg_and_die("No Unicode mapping table loaded."); } else #endif perror_msg_and_die("PIO_UNIMAPCLR"); @@ -174,11 +174,11 @@ static void loadnewfont(int fd) goto no_psf; if (psfhdr.mode > PSF_MAXMODE) - error_msg_and_die("Unsupported psf file mode\n"); + error_msg_and_die("Unsupported psf file mode"); fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256); #if !defined( PIO_FONTX ) || defined( __sparc__ ) if (fontsize != 256) - error_msg_and_die("Only fontsize 256 supported\n"); + error_msg_and_die("Only fontsize 256 supported"); #endif hastable = (psfhdr.mode & PSF_MODEHASTAB); unit = psfhdr.charsize; @@ -186,7 +186,7 @@ static void loadnewfont(int fd) head = head0 + fontsize * unit; if (head > inputlth || (!hastable && head != inputlth)) - error_msg_and_die("Input file: bad length\n"); + error_msg_and_die("Input file: bad length"); do_loadfont(fd, inbuf + head0, unit, fontsize); if (hastable) do_loadtable(fd, inbuf + head, inputlth - head, fontsize); @@ -201,7 +201,7 @@ static void loadnewfont(int fd) } else { /* bare font */ if (inputlth & 0377) - error_msg_and_die("Bad input file size\n"); + error_msg_and_die("Bad input file size"); offset = 0; unit = inputlth / 256; } diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c index 75b40da9a..a98601aec 100644 --- a/console-tools/loadkmap.c +++ b/console-tools/loadkmap.c @@ -59,7 +59,7 @@ int loadkmap_main(int argc, char **argv) read(0, buff, 7); if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7)) - error_msg_and_die("This is not a valid binary keymap.\n"); + error_msg_and_die("This is not a valid binary keymap."); if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) perror_msg_and_die("Error reading keymap flags"); diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c index be9b1b797..3e511ad00 100644 --- a/console-tools/setkeycodes.c +++ b/console-tools/setkeycodes.c @@ -52,18 +52,18 @@ setkeycodes_main(int argc, char** argv) a.keycode = atoi(argv[2]); a.scancode = sc = strtol(argv[1], &ep, 16); if (*ep) { - error_msg_and_die("error reading SCANCODE: '%s'\n", argv[1]); + error_msg_and_die("error reading SCANCODE: '%s'", argv[1]); } if (a.scancode > 127) { a.scancode -= 0xe000; a.scancode += 128; } if (a.scancode > 255 || a.keycode > 127) { - error_msg_and_die("SCANCODE or KEYCODE outside bounds\n"); + error_msg_and_die("SCANCODE or KEYCODE outside bounds"); } if (ioctl(fd,KDSETKEYCODE,&a)) { perror("KDSETKEYCODE"); - error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d\n", sc, a.keycode); + error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d", sc, a.keycode); } argc -= 2; argv += 2; diff --git a/coreutils/cut.c b/coreutils/cut.c index ed68657df..7e9a72e3f 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c @@ -54,12 +54,12 @@ static void decompose_list(const char *list) /* the list must contain only digits and no more than one minus sign */ for (ptr = (char *)list; *ptr; ptr++) { if (!isdigit(*ptr) && *ptr != '-') { - error_msg_and_die("invalid byte or field list\n"); + error_msg_and_die("invalid byte or field list"); } if (*ptr == '-') { nminus++; if (nminus > 1) { - error_msg_and_die("invalid byte or field list\n"); + error_msg_and_die("invalid byte or field list"); } } } @@ -68,7 +68,7 @@ static void decompose_list(const char *list) if (nminus == 0) { startpos = strtol(list, &ptr, 10); if (startpos == 0) { - error_msg_and_die("missing list of fields\n"); + error_msg_and_die("missing list of fields"); } endpos = startpos; } @@ -188,14 +188,14 @@ extern int cut_main(int argc, char **argv) case 'f': /* make sure they didn't ask for two types of lists */ if (part != 0) { - error_msg_and_die("only one type of list may be specified\n"); + error_msg_and_die("only one type of list may be specified"); } part = (char)opt; decompose_list(optarg); break; case 'd': if (strlen(optarg) > 1) { - error_msg_and_die("the delimiter must be a single character\n"); + error_msg_and_die("the delimiter must be a single character"); } delim = optarg[0]; break; @@ -209,17 +209,17 @@ extern int cut_main(int argc, char **argv) } if (part == 0) { - error_msg_and_die("you must specify a list of bytes, characters, or fields\n"); + error_msg_and_die("you must specify a list of bytes, characters, or fields"); } if (supress_non_delimited_lines && part != 'f') { error_msg_and_die("suppressing non-delimited lines makes sense" - " only when operating on fields\n"); + " only when operating on fields"); } if (delim != '\t' && part != 'f') { - error_msg_and_die("a delimiter may be specified only when operating on fields\n"); + error_msg_and_die("a delimiter may be specified only when operating on fields"); } /* argv[(optind)..(argc-1)] should be names of file to process. If no diff --git a/coreutils/dd.c b/coreutils/dd.c index dac9ccdf3..582310681 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c @@ -76,7 +76,7 @@ int dd_main(int argc, char **argv) sync = TRUE; buf += 4; } else { - error_msg_and_die("invalid conversion `%s'\n", argv[i]+5); + error_msg_and_die("invalid conversion `%s'", argv[i]+5); } if (buf[0] == '\0') break; diff --git a/coreutils/df.c b/coreutils/df.c index 7a24fedd0..55919793c 100644 --- a/coreutils/df.c +++ b/coreutils/df.c @@ -118,7 +118,7 @@ extern int df_main(int argc, char **argv) for(i = optind; i < argc; i++) { if ((mountEntry = find_mount_point(argv[i], mtab_file)) == 0) { - error_msg("%s: can't find mount point.\n", argv[i]); + error_msg("%s: can't find mount point.", argv[i]); status = EXIT_FAILURE; } else if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir)) status = EXIT_FAILURE; diff --git a/coreutils/expr.c b/coreutils/expr.c index 71bd22417..8ef5293c1 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c @@ -76,14 +76,14 @@ int expr_main (int argc, char **argv) VALUE *v; if (argc == 1) { - error_msg_and_die("too few arguments\n"); + error_msg_and_die("too few arguments"); } args = argv + 1; v = eval (); if (*args) - error_msg_and_die ("syntax error\n"); + error_msg_and_die ("syntax error"); if (v->type == integer) printf ("%d\n", v->u.i); @@ -218,7 +218,7 @@ static \ int name (l, r) VALUE *l; VALUE *r; \ { \ if (!toarith (l) || !toarith (r)) \ - error_msg_and_die ("non-numeric argument\n"); \ + error_msg_and_die ("non-numeric argument"); \ return l->u.i op r->u.i; \ } @@ -226,9 +226,9 @@ int name (l, r) VALUE *l; VALUE *r; \ int name (l, r) VALUE *l; VALUE *r; \ { \ if (!toarith (l) || !toarith (r)) \ - error_msg_and_die ( "non-numeric argument\n"); \ + error_msg_and_die ( "non-numeric argument"); \ if (r->u.i == 0) \ - error_msg_and_die ( "division by zero\n"); \ + error_msg_and_die ( "division by zero"); \ return l->u.i op r->u.i; \ } @@ -272,7 +272,7 @@ of a basic regular expression is not portable; it is being ignored", re_syntax_options = RE_SYNTAX_POSIX_BASIC; errmsg = re_compile_pattern (pv->u.s, len, &re_buffer); if (errmsg) { - error_msg_and_die("%s\n", errmsg); + error_msg_and_die("%s", errmsg); } len = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs); @@ -303,19 +303,19 @@ static VALUE *eval7 (void) VALUE *v; if (!*args) - error_msg_and_die ( "syntax error\n"); + error_msg_and_die ( "syntax error"); if (nextarg ("(")) { args++; v = eval (); if (!nextarg (")")) - error_msg_and_die ( "syntax error\n"); + error_msg_and_die ( "syntax error"); args++; return v; } if (nextarg (")")) - error_msg_and_die ( "syntax error\n"); + error_msg_and_die ( "syntax error"); return str_value (*args++); } @@ -329,7 +329,7 @@ static VALUE *eval6 (void) if (nextarg ("quote")) { args++; if (!*args) - error_msg_and_die ( "syntax error\n"); + error_msg_and_die ( "syntax error"); return str_value (*args++); } else if (nextarg ("length")) { diff --git a/coreutils/id.c b/coreutils/id.c index e91ac7585..650e3db20 100644 --- a/coreutils/id.c +++ b/coreutils/id.c @@ -77,7 +77,7 @@ extern int id_main(int argc, char **argv) pwnam=my_getpwnam(user); grnam=my_getgrnam(group); if (gid == -1 || pwnam==-1 || grnam==-1) { - error_msg_and_die("%s: No such user\n", user); + error_msg_and_die("%s: No such user", user); } if (no_group) { diff --git a/coreutils/logname.c b/coreutils/logname.c index edec016e6..d9056c69d 100644 --- a/coreutils/logname.c +++ b/coreutils/logname.c @@ -37,5 +37,5 @@ extern int logname_main(int argc, char **argv) puts(user); return EXIT_SUCCESS; } - error_msg_and_die("no login name\n"); + error_msg_and_die("no login name"); } diff --git a/coreutils/md5sum.c b/coreutils/md5sum.c index ad4078040..97a940059 100644 --- a/coreutils/md5sum.c +++ b/coreutils/md5sum.c @@ -719,7 +719,7 @@ static int md5_check(const char *checkfile_name) if (split_3(line, line_length, &md5num, &binary, &filename) || !hex_digits(md5num)) { if (warn) { - error_msg("%s: %lu: improperly formatted MD5 checksum line\n", + error_msg("%s: %lu: improperly formatted MD5 checksum line", checkfile_name, (unsigned long) line_number); } } else { @@ -764,7 +764,7 @@ static int md5_check(const char *checkfile_name) while (!feof(checkfile_stream) && !ferror(checkfile_stream)); if (ferror(checkfile_stream)) { - error_msg("%s: read error\n", checkfile_name); /* */ + error_msg("%s: read error", checkfile_name); return FALSE; } @@ -775,7 +775,7 @@ static int md5_check(const char *checkfile_name) if (n_properly_formated_lines == 0) { /* Warn if no tests are found. */ - error_msg("%s: no properly formatted MD5 checksum lines found\n", + error_msg("%s: no properly formatted MD5 checksum lines found", checkfile_name); return FALSE; } else { @@ -784,13 +784,13 @@ static int md5_check(const char *checkfile_name) - n_open_or_read_failures); if (n_open_or_read_failures > 0) { - error_msg("WARNING: %d of %d listed files could not be read\n", + error_msg("WARNING: %d of %d listed files could not be read", n_open_or_read_failures, n_properly_formated_lines); return FALSE; } if (n_mismatched_checksums > 0) { - error_msg("WARNING: %d of %d computed checksums did NOT match\n", + error_msg("WARNING: %d of %d computed checksums did NOT match", n_mismatched_checksums, n_computed_checkums); return FALSE; } @@ -855,26 +855,26 @@ int md5sum_main(int argc, } if (file_type_specified && do_check) { - error_msg_and_die("the -b and -t options are meaningless when verifying checksums\n"); + error_msg_and_die("the -b and -t options are meaningless when verifying checksums"); } if (n_strings > 0 && do_check) { - error_msg_and_die("the -g and -c options are mutually exclusive\n"); + error_msg_and_die("the -g and -c options are mutually exclusive"); } if (status_only && !do_check) { - error_msg_and_die("the -s option is meaningful only when verifying checksums\n"); + error_msg_and_die("the -s option is meaningful only when verifying checksums"); } if (warn && !do_check) { - error_msg_and_die("the -w option is meaningful only when verifying checksums\n"); + error_msg_and_die("the -w option is meaningful only when verifying checksums"); } if (n_strings > 0) { size_t i; if (optind < argc) { - error_msg_and_die("no files may be specified when using -g\n"); + error_msg_and_die("no files may be specified when using -g"); } for (i = 0; i < n_strings; ++i) { size_t cnt; @@ -887,7 +887,7 @@ int md5sum_main(int argc, } } else if (do_check) { if (optind + 1 < argc) { - error_msg("only one argument may be specified when using -c\n"); + error_msg("only one argument may be specified when using -c"); } err = md5_check ((optind == argc) ? "-" : argv[optind]); @@ -940,11 +940,11 @@ int md5sum_main(int argc, } if (fclose (stdout) == EOF) { - error_msg_and_die("write error\n"); + error_msg_and_die("write error"); } if (have_read_stdin && fclose (stdin) == EOF) { - error_msg_and_die("standard input\n"); + error_msg_and_die("standard input"); } if (err == 0) diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index 07b18713a..299f29806 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c @@ -52,7 +52,7 @@ extern int mkdir_main(int argc, char **argv) /* Find the specified modes */ mode = 0; if (parse_mode(*(++argv), &mode) == FALSE) { - error_msg_and_die("Unknown mode: %s\n", *argv); + error_msg_and_die("Unknown mode: %s", *argv); } /* Set the umask for this process so it doesn't * screw up whatever the user just entered. */ @@ -85,7 +85,7 @@ extern int mkdir_main(int argc, char **argv) strcpy(buf, *argv); status = stat(buf, &statBuf); if (parentFlag == FALSE && status != -1 && errno != ENOENT) { - error_msg_and_die("%s: File exists\n", buf); + error_msg_and_die("%s: File exists", buf); } if (parentFlag == TRUE) { strcat(buf, "/"); diff --git a/coreutils/test.c b/coreutils/test.c index ba6feb033..6439e3a8a 100644 --- a/coreutils/test.c +++ b/coreutils/test.c @@ -184,7 +184,7 @@ test_main(int argc, char** argv) if (strcmp(applet_name, "[") == 0) { if (strcmp(argv[--argc], "]")) - error_msg_and_die("missing ]\n"); + error_msg_and_die("missing ]"); argv[argc] = NULL; } /* Implement special cases from POSIX.2, section 4.62.4 */ @@ -233,9 +233,9 @@ syntax(op, msg) char *msg; { if (op && *op) - error_msg_and_die("%s: %s\n", op, msg); + error_msg_and_die("%s: %s", op, msg); else - error_msg_and_die("%s\n", msg); + error_msg_and_die("%s", msg); } static int @@ -470,13 +470,13 @@ getn(s) r = strtol(s, &p, 10); if (errno != 0) - error_msg_and_die("%s: out of range\n", s); + error_msg_and_die("%s: out of range", s); while (isspace(*p)) p++; if (*p) - error_msg_and_die("%s: bad number\n", s); + error_msg_and_die("%s: bad number", s); return (int) r; } diff --git a/coreutils/tr.c b/coreutils/tr.c index 2717a92db..36f29de44 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c @@ -186,7 +186,7 @@ extern int tr_main(int argc, char **argv) input_length = complement(input, input_length); if (argv[index] != NULL) { if (*argv[index] == '\0') - error_msg_and_die("STRING2 cannot be empty\n"); + error_msg_and_die("STRING2 cannot be empty"); output_length = expand(argv[index], output); map(input, input_length, output, output_length); } diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index fcfcfd903..cccc52872 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c @@ -46,7 +46,7 @@ static int read_stduu (const char *inname) char *p; if (fgets (buf, sizeof(buf), stdin) == NULL) { - error_msg("%s: Short file\n", inname); + error_msg("%s: Short file", inname); return FALSE; } p = buf; @@ -81,7 +81,7 @@ static int read_stduu (const char *inname) if (fgets (buf, sizeof(buf), stdin) == NULL || strcmp (buf, "end\n")) { - error_msg("%s: No `end' line\n", inname); + error_msg("%s: No `end' line", inname); return FALSE; } @@ -131,7 +131,7 @@ static int read_base64 (const char *inname) unsigned char *p; if (fgets (buf, sizeof(buf), stdin) == NULL) { - error_msg("%s: Short file\n", inname); + error_msg("%s: Short file", inname); return FALSE; } p = buf; @@ -139,7 +139,7 @@ static int read_base64 (const char *inname) if (memcmp (buf, "====", 4) == 0) break; if (last_data != 0) { - error_msg("%s: data following `=' padding character\n", inname); + error_msg("%s: data following `=' padding character", inname); return FALSE; } @@ -161,14 +161,14 @@ static int read_base64 (const char *inname) while ((b64_tab[*p] & '\100') != 0) if (*p == '\n' || *p++ == '=') { - error_msg("%s: illegal line\n", inname); + error_msg("%s: illegal line", inname); return FALSE; } c2 = b64_tab[*p++]; while (b64_tab[*p] == '\177') if (*p++ == '\n') { - error_msg("%s: illegal line\n", inname); + error_msg("%s: illegal line", inname); return FALSE; } if (*p == '=') { @@ -180,7 +180,7 @@ static int read_base64 (const char *inname) while (b64_tab[*p] == '\177') if (*p++ == '\n') { - error_msg("%s: illegal line\n", inname); + error_msg("%s: illegal line", inname); return FALSE; } putchar (c1 << 2 | c2 >> 4); @@ -212,7 +212,7 @@ static int decode (const char *inname, while (1) { if (fgets (buf, sizeof (buf), stdin) == NULL) { - error_msg("%s: No `begin' line\n", inname); + error_msg("%s: No `begin' line", inname); return FALSE; } @@ -237,13 +237,13 @@ static int decode (const char *inname, while (*p != '/') ++p; if (*p == '\0') { - error_msg("%s: Illegal ~user\n", inname); + error_msg("%s: Illegal ~user", inname); return FALSE; } *p++ = '\0'; pw = getpwnam (buf + 1); if (pw == NULL) { - error_msg("%s: No user `%s'\n", inname, buf + 1); + error_msg("%s: No user `%s'", inname, buf + 1); return FALSE; } n = strlen (pw->pw_dir); diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index 5df49026b..73098ba26 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c @@ -142,7 +142,7 @@ static void encode() } if (ferror (stdin)) - error_msg("Read error\n"); + error_msg("Read error"); if (trans_ptr == uu_std) { putchar (ENC ('\0')); @@ -196,7 +196,7 @@ int uuencode_main (int argc, encode(); printf(trans_ptr == uu_std ? "end\n" : "====\n"); if (ferror (stdout)) { - error_msg("Write error\n"); + error_msg("Write error"); return EXIT_FAILURE; } return EXIT_SUCCESS; diff --git a/coreutils/whoami.c b/coreutils/whoami.c index 870ede43e..398e37315 100644 --- a/coreutils/whoami.c +++ b/coreutils/whoami.c @@ -38,5 +38,5 @@ extern int whoami_main(int argc, char **argv) puts(user); return EXIT_SUCCESS; } - error_msg_and_die("cannot find username for UID %u\n", (unsigned) uid); + error_msg_and_die("cannot find username for UID %u", (unsigned) uid); } @@ -282,7 +282,7 @@ extern int cp_mv_main(int argc, char **argv) if ((sb.st_ino == srcStatBuf.st_ino) && (sb.st_dev == srcStatBuf.st_dev)) { error_msg("Cannot %s `%s' into a subdirectory of itself, " - "`%s/%s'\n", applet_name, baseSrcName, + "`%s/%s'", applet_name, baseSrcName, baseDestName, baseSrcName); state = -1; continue; @@ -54,12 +54,12 @@ static void decompose_list(const char *list) /* the list must contain only digits and no more than one minus sign */ for (ptr = (char *)list; *ptr; ptr++) { if (!isdigit(*ptr) && *ptr != '-') { - error_msg_and_die("invalid byte or field list\n"); + error_msg_and_die("invalid byte or field list"); } if (*ptr == '-') { nminus++; if (nminus > 1) { - error_msg_and_die("invalid byte or field list\n"); + error_msg_and_die("invalid byte or field list"); } } } @@ -68,7 +68,7 @@ static void decompose_list(const char *list) if (nminus == 0) { startpos = strtol(list, &ptr, 10); if (startpos == 0) { - error_msg_and_die("missing list of fields\n"); + error_msg_and_die("missing list of fields"); } endpos = startpos; } @@ -188,14 +188,14 @@ extern int cut_main(int argc, char **argv) case 'f': /* make sure they didn't ask for two types of lists */ if (part != 0) { - error_msg_and_die("only one type of list may be specified\n"); + error_msg_and_die("only one type of list may be specified"); } part = (char)opt; decompose_list(optarg); break; case 'd': if (strlen(optarg) > 1) { - error_msg_and_die("the delimiter must be a single character\n"); + error_msg_and_die("the delimiter must be a single character"); } delim = optarg[0]; break; @@ -209,17 +209,17 @@ extern int cut_main(int argc, char **argv) } if (part == 0) { - error_msg_and_die("you must specify a list of bytes, characters, or fields\n"); + error_msg_and_die("you must specify a list of bytes, characters, or fields"); } if (supress_non_delimited_lines && part != 'f') { error_msg_and_die("suppressing non-delimited lines makes sense" - " only when operating on fields\n"); + " only when operating on fields"); } if (delim != '\t' && part != 'f') { - error_msg_and_die("a delimiter may be specified only when operating on fields\n"); + error_msg_and_die("a delimiter may be specified only when operating on fields"); } /* argv[(optind)..(argc-1)] should be names of file to process. If no @@ -14,14 +14,14 @@ static unsigned int pointer; static void push(double a) { if (pointer >= (sizeof(stack) / sizeof(*stack))) - error_msg_and_die("stack overflow\n"); + error_msg_and_die("stack overflow"); stack[pointer++] = a; } static double pop() { if (pointer == 0) - error_msg_and_die("stack underflow\n"); + error_msg_and_die("stack underflow"); return stack[--pointer]; } @@ -120,7 +120,7 @@ static void stack_machine(const char *argument) } o++; } - error_msg_and_die("%s: syntax error.\n", argument); + error_msg_and_die("%s: syntax error.", argument); } /* return pointer to next token in buffer and set *buffer to one char @@ -76,7 +76,7 @@ int dd_main(int argc, char **argv) sync = TRUE; buf += 4; } else { - error_msg_and_die("invalid conversion `%s'\n", argv[i]+5); + error_msg_and_die("invalid conversion `%s'", argv[i]+5); } if (buf[0] == '\0') break; diff --git a/deallocvt.c b/deallocvt.c index fad7a2bb2..b51fbaef4 100644 --- a/deallocvt.c +++ b/deallocvt.c @@ -31,9 +31,9 @@ int deallocvt_main(int argc, char *argv[]) for (i = 1; i < argc; i++) { num = atoi(argv[i]); if (num == 0) - error_msg("0: illegal VT number\n"); + error_msg("0: illegal VT number"); else if (num == 1) - error_msg("VT 1 cannot be deallocated\n"); + error_msg("VT 1 cannot be deallocated"); else if (ioctl(fd, VT_DISALLOCATE, num)) perror_msg_and_die("VT_DISALLOCATE"); } @@ -118,7 +118,7 @@ extern int df_main(int argc, char **argv) for(i = optind; i < argc; i++) { if ((mountEntry = find_mount_point(argv[i], mtab_file)) == 0) { - error_msg("%s: can't find mount point.\n", argv[i]); + error_msg("%s: can't find mount point.", argv[i]); status = EXIT_FAILURE; } else if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir)) status = EXIT_FAILURE; diff --git a/dpkg_deb.c b/dpkg_deb.c index 3a789379b..3345c273f 100644 --- a/dpkg_deb.c +++ b/dpkg_deb.c @@ -118,7 +118,7 @@ extern int dpkg_deb_main(int argc, char **argv) extract_flag = TRUE; strcpy(ar_filename, "data.tar.gz"); if ( (optind + 2) > argc ) { - error_msg_and_die("No directory specified\n"); + error_msg_and_die("No directory specified"); } target_dir = (char *) xmalloc(strlen(argv[optind+1])); strcpy(target_dir, argv[optind+1]); @@ -128,7 +128,7 @@ extern int dpkg_deb_main(int argc, char **argv) list_flag = TRUE; strcpy(ar_filename, "data.tar.gz"); if ( (optind + 2) > argc ) { - error_msg_and_die("No directory specified\n"); + error_msg_and_die("No directory specified"); } target_dir = (char *) xmalloc(strlen(argv[optind+1])); strcpy(target_dir, argv[optind+1]); @@ -139,7 +139,7 @@ extern int dpkg_deb_main(int argc, char **argv) *ar_headers = get_headers(srcFd); if (ar_headers->next==NULL) - error_msg_and_die("Couldnt find %s in %s\n",ar_filename, argv[optind]); + error_msg_and_die("Couldnt find %s in %s", ar_filename, argv[optind]); while (ar_headers->next != NULL) { if (strcmp(ar_headers->name, ar_filename)==0) @@ -154,7 +154,7 @@ extern int dpkg_deb_main(int argc, char **argv) mkdir(target_dir, 0755); } if (chdir(target_dir)==-1) { - error_msg_and_die("Cannot change to dir %s\n",argv[optind+1]); + error_msg_and_die("Cannot change to dir %s", argv[optind+1]); } } status = readTarFile(srcFd, extract_flag, list_flag, extract_to_stdout, verbose_flag, NULL, extract_list); diff --git a/dumpkmap.c b/dumpkmap.c index b2067b30c..4ab711e55 100644 --- a/dumpkmap.c +++ b/dumpkmap.c @@ -81,7 +81,7 @@ int dumpkmap_main(int argc, char **argv) ke.kb_table = i; if (ioctl(fd, KDGKBENT, &ke) < 0) { - error_msg("ioctl returned: %s, %s, %s, %xqq\n",strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); + error_msg("ioctl returned: %s, %s, %s, %xqq", strerror(errno),(char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value); } else { write(1,(void*)&ke.kb_value,2); diff --git a/editors/sed.c b/editors/sed.c index 73a9ad3ec..e0351c3b8 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -169,7 +169,7 @@ static int get_address(struct sed_cmd *sed_cmd, const char *str, int *line, rege else if (my_str[idx] == '/') { idx = index_of_next_unescaped_regexp_delim(sed_cmd, my_str, ++idx); if (idx == -1) - error_msg_and_die("unterminated match expression\n"); + error_msg_and_die("unterminated match expression"); my_str[idx] = '\0'; *regex = (regex_t *)xmalloc(sizeof(regex_t)); xregcomp(*regex, my_str+1, 0); @@ -177,7 +177,7 @@ static int get_address(struct sed_cmd *sed_cmd, const char *str, int *line, rege } else { error_msg("get_address: no address found in string\n" - "\t(you probably didn't check the string you passed me)\n"); + "\t(you probably didn't check the string you passed me)"); idx = -1; } @@ -213,7 +213,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr) /* verify that the 's' is followed by something. That something * (typically a 'slash') is now our regexp delimiter... */ if (!substr[++idx]) - error_msg_and_die("bad format in substitution expression\n"); + error_msg_and_die("bad format in substitution expression"); else sed_cmd->delimiter=substr[idx]; @@ -221,7 +221,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr) oldidx = idx+1; idx = index_of_next_unescaped_regexp_delim(sed_cmd, substr, ++idx); if (idx == -1) - error_msg_and_die("bad format in substitution expression\n"); + error_msg_and_die("bad format in substitution expression"); match = strdup_substr(substr, oldidx, idx); /* determine the number of back references in the match string */ @@ -240,7 +240,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr) oldidx = idx+1; idx = index_of_next_unescaped_regexp_delim(sed_cmd, substr, ++idx); if (idx == -1) - error_msg_and_die("bad format in substitution expression\n"); + error_msg_and_die("bad format in substitution expression"); sed_cmd->replace = strdup_substr(substr, oldidx, idx); /* process the flags */ @@ -260,7 +260,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr) if (strchr("; \t\v\n\r", substr[idx])) goto out; /* else */ - error_msg_and_die("bad option in substitution expression\n"); + error_msg_and_die("bad option in substitution expression"); } } @@ -302,7 +302,7 @@ static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr) */ if (editstr[1] != '\\' && (editstr[2] != '\n' || editstr[2] != '\r')) - error_msg_and_die("bad format in edit expression\n"); + error_msg_and_die("bad format in edit expression"); /* store the edit line text */ /* make editline big enough to accomodate the extra '\n' we will tack on @@ -366,9 +366,9 @@ static char *parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) /* last part (mandatory) will be a command */ if (cmdstr[idx] == '\0') - error_msg_and_die("missing command\n"); + error_msg_and_die("missing command"); if (!strchr("pdsaic", cmdstr[idx])) /* <-- XXX add new commands here */ - error_msg_and_die("invalid command\n"); + error_msg_and_die("invalid command"); sed_cmd->cmd = cmdstr[idx]; /* special-case handling for (s)ubstitution */ @@ -378,7 +378,7 @@ static char *parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) /* special-case handling for (a)ppend, (i)nsert, and (c)hange */ else if (strchr("aic", cmdstr[idx])) { if (sed_cmd->end_line || sed_cmd->end_match) - error_msg_and_die("only a beginning address can be specified for edit commands\n"); + error_msg_and_die("only a beginning address can be specified for edit commands"); idx += parse_edit_cmd(sed_cmd, &cmdstr[idx]); } /* if it was a single-letter command (such as 'p' or 'd') we need to @@ -76,14 +76,14 @@ int expr_main (int argc, char **argv) VALUE *v; if (argc == 1) { - error_msg_and_die("too few arguments\n"); + error_msg_and_die("too few arguments"); } args = argv + 1; v = eval (); if (*args) - error_msg_and_die ("syntax error\n"); + error_msg_and_die ("syntax error"); if (v->type == integer) printf ("%d\n", v->u.i); @@ -218,7 +218,7 @@ static \ int name (l, r) VALUE *l; VALUE *r; \ { \ if (!toarith (l) || !toarith (r)) \ - error_msg_and_die ("non-numeric argument\n"); \ + error_msg_and_die ("non-numeric argument"); \ return l->u.i op r->u.i; \ } @@ -226,9 +226,9 @@ int name (l, r) VALUE *l; VALUE *r; \ int name (l, r) VALUE *l; VALUE *r; \ { \ if (!toarith (l) || !toarith (r)) \ - error_msg_and_die ( "non-numeric argument\n"); \ + error_msg_and_die ( "non-numeric argument"); \ if (r->u.i == 0) \ - error_msg_and_die ( "division by zero\n"); \ + error_msg_and_die ( "division by zero"); \ return l->u.i op r->u.i; \ } @@ -272,7 +272,7 @@ of a basic regular expression is not portable; it is being ignored", re_syntax_options = RE_SYNTAX_POSIX_BASIC; errmsg = re_compile_pattern (pv->u.s, len, &re_buffer); if (errmsg) { - error_msg_and_die("%s\n", errmsg); + error_msg_and_die("%s", errmsg); } len = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs); @@ -303,19 +303,19 @@ static VALUE *eval7 (void) VALUE *v; if (!*args) - error_msg_and_die ( "syntax error\n"); + error_msg_and_die ( "syntax error"); if (nextarg ("(")) { args++; v = eval (); if (!nextarg (")")) - error_msg_and_die ( "syntax error\n"); + error_msg_and_die ( "syntax error"); args++; return v; } if (nextarg (")")) - error_msg_and_die ( "syntax error\n"); + error_msg_and_die ( "syntax error"); return str_value (*args++); } @@ -329,7 +329,7 @@ static VALUE *eval6 (void) if (nextarg ("quote")) { args++; if (!*args) - error_msg_and_die ( "syntax error\n"); + error_msg_and_die ( "syntax error"); return str_value (*args++); } else if (nextarg ("length")) { @@ -284,7 +284,7 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn, } } #else - error_msg( "mode reading not compiled in\n"); + error_msg( "mode reading not compiled in"); #endif return 0; } @@ -434,7 +434,7 @@ extern int fbset_main(int argc, char **argv) perror_msg_and_die("fbset(ioctl)"); if (g_options & OPT_READMODE) { if (!readmode(&var, modefile, mode)) { - error_msg("Unknown video mode `%s'\n", mode); + error_msg("Unknown video mode `%s'", mode); return EXIT_FAILURE; } } diff --git a/fsck_minix.c b/fsck_minix.c index 18841ec56..9d7622006 100644 --- a/fsck_minix.c +++ b/fsck_minix.c @@ -290,7 +290,7 @@ static void show_usage(void) static void die(const char *str) { - error_msg("%s\n", str); + error_msg("%s", str); leave(8); } @@ -258,7 +258,7 @@ void add_long_options(char *options) arg_opt=required_argument; } if (strlen(tokptr) == 0) - error_msg("empty long option after -l or --long argument\n"); + error_msg("empty long option after -l or --long argument"); } add_longopt(tokptr,arg_opt); } @@ -277,7 +277,7 @@ void set_shell(const char *new_shell) else if (!strcmp(new_shell,"csh")) shell=TCSH; else - error_msg("unknown shell after -s or --shell argument\n"); + error_msg("unknown shell after -s or --shell argument"); } @@ -326,7 +326,7 @@ int getopt_main(int argc, char *argv[]) printf(" --\n"); exit(0); } else - error_msg_and_die("missing optstring argument\n"); + error_msg_and_die("missing optstring argument"); } if (argv[1][0] != '-' || compatible) { @@ -377,7 +377,7 @@ int getopt_main(int argc, char *argv[]) if (!optstr) { if (optind >= argc) - error_msg_and_die("missing optstring argument\n"); + error_msg_and_die("missing optstring argument"); else { optstr=xmalloc(strlen(argv[optind])+1); strcpy(optstr,argv[optind]); @@ -297,7 +297,7 @@ int in; /* input file descriptor */ method = (int) get_byte(); if (method != DEFLATED) { - error_msg("unknown method %d -- get newer version of gzip\n", method); + error_msg("unknown method %d -- get newer version of gzip", method); exit_code = ERROR; return -1; } @@ -1116,11 +1116,11 @@ int in, out; /* input and output file descriptors */ if (res == 3) { error_msg(memory_exhausted); } else if (res != 0) { - error_msg("invalid compressed data--format violated\n"); + error_msg("invalid compressed data--format violated"); } } else { - error_msg("internal error, invalid method\n"); + error_msg("internal error, invalid method"); } /* Get the crc and original length */ @@ -1149,15 +1149,15 @@ int in, out; /* input and output file descriptors */ /* Validate decompression */ if (orig_crc != updcrc(outbuf, 0)) { - error_msg("invalid compressed data--crc error\n"); + error_msg("invalid compressed data--crc error"); } if (orig_len != (ulg) bytes_out) { - error_msg("invalid compressed data--length error\n"); + error_msg("invalid compressed data--length error"); } /* Check if there are more entries in a pkzip file */ if (pkzip && inptr + 4 < insize && LG(inbuf + inptr) == LOCSIG) { - fprintf(stderr, "has more than one entry--rest ignored\n"); + error_msg("has more than one entry--rest ignored"); if (exit_code == OK) exit_code = WARNING; } @@ -1261,9 +1261,9 @@ int gunzip_main(int argc, char **argv) } if (isatty(fileno(stdin)) && fromstdin==1 && force==0) - error_msg_and_die( "data not read from terminal. Use -f to force it.\n"); + error_msg_and_die( "data not read from terminal. Use -f to force it."); if (isatty(fileno(stdout)) && tostdout==1 && force==0) - error_msg_and_die( "data not written to terminal. Use -f to force it.\n"); + error_msg_and_die( "data not written to terminal. Use -f to force it."); gunzip_init(); @@ -1382,7 +1382,7 @@ int length; (char *) window + start, length) != EQUAL) { fprintf(stderr, " start %d, match %d, length %d\n", start, match, length); - error_msg("invalid match\n"); + error_msg("invalid match"); } if (verbose > 1) { fprintf(stderr, "\\[%d,%d]", start - match, length); @@ -1822,9 +1822,9 @@ int gzip_main(int argc, char **argv) } if (isatty(fileno(stdin)) && fromstdin==1 && force==0) - error_msg_and_die( "data not read from terminal. Use -f to force it.\n"); + error_msg_and_die( "data not read from terminal. Use -f to force it."); if (isatty(fileno(stdout)) && tostdout==1 && force==0) - error_msg_and_die( "data not written to terminal. Use -f to force it.\n"); + error_msg_and_die( "data not written to terminal. Use -f to force it."); foreground = signal(SIGINT, SIG_IGN) != SIG_IGN; if (foreground) { @@ -2894,7 +2894,7 @@ int eof; /* true if this is the last block for a file */ #endif /* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */ if (buf == (char *) 0) - error_msg("block vanished\n"); + error_msg("block vanished"); copy_block(buf, (unsigned) stored_len, 0); /* without header */ compressed_len = stored_len << 3; @@ -3077,7 +3077,7 @@ local void set_file_type() bin_freq += dyn_ltree[n++].Freq; *file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII; if (*file_type == BINARY && translate_eol) { - error_msg("-l used on binary file\n"); + error_msg("-l used on binary file"); } } @@ -3239,7 +3239,7 @@ char *env; /* name of environment variable */ /* Copy the program name first */ if (oargc-- < 0) - error_msg("argc<=0\n"); + error_msg("argc<=0"); *(nargv++) = *(oargv++); /* Then copy the environment args */ diff --git a/hostname.c b/hostname.c index a789fa0f1..3dba64154 100644 --- a/hostname.c +++ b/hostname.c @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * $Id: hostname.c,v 1.21 2001/01/27 08:24:37 andersen Exp $ + * $Id: hostname.c,v 1.22 2001/01/31 19:00:20 kraai Exp $ * Mini hostname implementation for busybox * * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> @@ -41,7 +41,7 @@ void do_sethostname(char *s, int isfile) if (!isfile) { if (sethostname(s, strlen(s)) < 0) { if (errno == EPERM) - error_msg_and_die("you must be root to change the hostname\n"); + error_msg_and_die("you must be root to change the hostname"); else perror_msg_and_die("sethostname"); } @@ -77,7 +77,7 @@ extern int id_main(int argc, char **argv) pwnam=my_getpwnam(user); grnam=my_getgrnam(group); if (gid == -1 || pwnam==-1 || grnam==-1) { - error_msg_and_die("%s: No such user\n", user); + error_msg_and_die("%s: No such user", user); } if (no_group) { @@ -81,7 +81,7 @@ #ifndef MODUTILS_MODULE_H static const int MODUTILS_MODULE_H = 1; -#ident "$Id: insmod.c,v 1.44 2001/01/27 09:33:38 andersen Exp $" +#ident "$Id: insmod.c,v 1.45 2001/01/31 19:00:21 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 @@ -287,7 +287,7 @@ int delete_module(const char *); #ifndef MODUTILS_OBJ_H static const int MODUTILS_OBJ_H = 1; -#ident "$Id: insmod.c,v 1.44 2001/01/27 09:33:38 andersen Exp $" +#ident "$Id: insmod.c,v 1.45 2001/01/31 19:00:21 kraai Exp $" /* The relocatable object is manipulated using elfin types. */ @@ -1156,7 +1156,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) - error_msg("%s multiply defined\n", name); + error_msg("%s multiply defined", name); return sym; } } @@ -1419,7 +1419,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) { - error_msg("symbol for parameter %s not found\n", p); + error_msg("symbol for parameter %s not found", p); return 0; } @@ -1432,7 +1432,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') { - error_msg("improperly terminated string argument for %s\n", p); + error_msg("improperly terminated string argument for %s", p); return 0; } else if (*q == '\\') switch (*++q) { @@ -1786,7 +1786,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) p = get_modinfo_value(f, key); key += 5; if (p == NULL) { - error_msg("invalid parameter %s\n", key); + error_msg("invalid parameter %s", key); return 0; } @@ -1794,7 +1794,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) /* Also check that the parameter was not resolved from the kernel. */ if (sym == NULL || sym->secidx > SHN_HIRESERVE) { - error_msg("symbol for parameter %s not found\n", key); + error_msg("symbol for parameter %s not found", key); return 0; } @@ -1822,7 +1822,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) str = alloca(strlen(q)); for (r = str, q++; *q != '"'; ++q, ++r) { if (*q == '\0') { - error_msg("improperly terminated string argument for %s\n", + error_msg("improperly terminated string argument for %s", key); return 0; } else if (*q == '\\') @@ -1917,14 +1917,14 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) /* Probably we should do that outside the loop ? */ if (!isdigit(*(p + 1))) { error_msg("parameter type 'c' for %s must be followed by" - " the maximum size\n", key); + " the maximum size", key); return 0; } charssize = strtoul(p + 1, (char **) NULL, 10); /* Check length */ if (strlen(str) >= charssize) { - error_msg("string too long for %s (max %ld)\n", key, + error_msg("string too long for %s (max %ld)", key, charssize - 1); return 0; } @@ -1953,7 +1953,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) break; default: - error_msg("unknown parameter type '%c' for %s\n", *p, key); + error_msg("unknown parameter type '%c' for %s", *p, key); return 0; } } @@ -1972,21 +1972,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) case ',': if (++n > max) { - error_msg("too many values for %s (max %d)\n", key, max); + error_msg("too many values for %s (max %d)", key, max); return 0; } ++q; break; default: - error_msg("invalid argument syntax for %s\n", key); + error_msg("invalid argument syntax for %s", key); return 0; } } end_of_arg: if (n < min) { - error_msg("too few values for %s (min %d)\n", key, min); + error_msg("too few values for %s (min %d)", key, min); return 0; } @@ -2372,7 +2372,7 @@ int obj_check_undefineds(struct obj_file *f) sym->secidx = SHN_ABS; sym->value = 0; } else { - error_msg("unresolved symbol %s\n", sym->name); + error_msg("unresolved symbol %s", sym->name); ret = 0; } } @@ -2599,11 +2599,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base) errmsg = "Unhandled relocation"; bad_reloc: if (extsym) { - error_msg("%s of type %ld for %s\n", errmsg, + error_msg("%s of type %ld for %s", errmsg, (long) ELFW(R_TYPE) (rel->r_info), strtab + extsym->st_name); } else { - error_msg("%s of type %ld\n", errmsg, + error_msg("%s of type %ld", errmsg, (long) ELFW(R_TYPE) (rel->r_info)); } ret = 0; @@ -2688,25 +2688,25 @@ struct obj_file *obj_load(FILE * fp) || f->header.e_ident[EI_MAG1] != ELFMAG1 || f->header.e_ident[EI_MAG2] != ELFMAG2 || f->header.e_ident[EI_MAG3] != ELFMAG3) { - error_msg("not an ELF file\n"); + error_msg("not an ELF file"); 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)) { - error_msg("ELF file not for this architecture\n"); + error_msg("ELF file not for this architecture"); return NULL; } if (f->header.e_type != ET_REL) { - error_msg("ELF file not a relocatable object\n"); + error_msg("ELF file not a relocatable object"); return NULL; } /* Read the section headers. */ if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { - error_msg("section header size mismatch: %lu != %lu\n", + error_msg("section header size mismatch: %lu != %lu", (unsigned long) f->header.e_shentsize, (unsigned long) sizeof(ElfW(Shdr))); return NULL; @@ -2759,11 +2759,11 @@ struct obj_file *obj_load(FILE * fp) #if SHT_RELM == SHT_REL case SHT_RELA: - error_msg("RELA relocations not supported on this architecture\n"); + error_msg("RELA relocations not supported on this architecture"); return NULL; #else case SHT_REL: - error_msg("REL relocations not supported on this architecture\n"); + error_msg("REL relocations not supported on this architecture"); return NULL; #endif @@ -2776,7 +2776,7 @@ struct obj_file *obj_load(FILE * fp) break; } - error_msg("can't handle sections of type %ld\n", + error_msg("can't handle sections of type %ld", (long) sec->header.sh_type); return NULL; } @@ -2805,7 +2805,7 @@ struct obj_file *obj_load(FILE * fp) ElfW(Sym) * sym; if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { - error_msg("symbol size mismatch: %lu != %lu\n", + error_msg("symbol size mismatch: %lu != %lu", (unsigned long) sec->header.sh_entsize, (unsigned long) sizeof(ElfW(Sym))); return NULL; @@ -2837,7 +2837,7 @@ struct obj_file *obj_load(FILE * fp) case SHT_RELM: if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { - error_msg("relocation entry size mismatch: %lu != %lu\n", + error_msg("relocation entry size mismatch: %lu != %lu", (unsigned long) sec->header.sh_entsize, (unsigned long) sizeof(ElfW(RelM))); return NULL; @@ -2949,11 +2949,11 @@ extern int insmod_main( int argc, char **argv) if (m_filename[0] == '\0' || ((fp = fopen(m_filename, "r")) == NULL)) { - error_msg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); + error_msg("No module named '%s' found in '%s'", m_fullName, _PATH_MODULES); return EXIT_FAILURE; } } else - error_msg_and_die("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); + error_msg_and_die("No module named '%s' found in '%s'", m_fullName, _PATH_MODULES); } else memcpy(m_filename, argv[optind], strlen(argv[optind])); @@ -2976,7 +2976,7 @@ extern int insmod_main( int argc, char **argv) m_version = old_get_module_version(f, m_strversion); if (m_version == -1) { error_msg("couldn't find the kernel version the module was " - "compiled for\n"); + "compiled for"); goto out; } } @@ -2985,12 +2985,12 @@ extern int insmod_main( int argc, char **argv) if (flag_force_load) { error_msg("Warning: kernel-module version mismatch\n" "\t%s was compiled for kernel version %s\n" - "\twhile this kernel is version %s\n", + "\twhile this kernel is version %s", m_filename, m_strversion, k_strversion); } else { error_msg("kernel-module version mismatch\n" "\t%s was compiled for kernel version %s\n" - "\twhile this kernel is version %s.\n", + "\twhile this kernel is version %s.", m_filename, m_strversion, k_strversion); goto out; } @@ -3006,7 +3006,7 @@ extern int insmod_main( int argc, char **argv) goto out; k_crcs = new_is_kernel_checksummed(); #else - error_msg("Not configured to support new kernels\n"); + error_msg("Not configured to support new kernels"); goto out; #endif } else { @@ -3015,7 +3015,7 @@ extern int insmod_main( int argc, char **argv) goto out; k_crcs = old_is_kernel_checksummed(); #else - error_msg("Not configured to support old kernels\n"); + error_msg("Not configured to support old kernels"); goto out; #endif } @@ -3072,10 +3072,10 @@ extern int insmod_main( int argc, char **argv) m_addr = create_module(m_name, m_size); if (m_addr==-1) switch (errno) { case EEXIST: - error_msg("A module named %s already exists\n", m_name); + error_msg("A module named %s already exists", m_name); goto out; case ENOMEM: - error_msg("Can't allocate kernel memory for module; needed %lu bytes\n", + error_msg("Can't allocate kernel memory for module; needed %lu bytes", m_size); goto out; default: @@ -223,7 +223,7 @@ extern int kill_main(int argc, char **argv) pidList = find_pid_by_name( *argv); if (!pidList) { all_found = FALSE; - error_msg( "%s: no process killed\n", *argv); + error_msg( "%s: no process killed", *argv); } for(; pidList && *pidList!=0; pidList++) { @@ -246,5 +246,5 @@ extern int kill_main(int argc, char **argv) end: - error_msg_and_die( "bad signal name: %s\n", *argv); + error_msg_and_die( "bad signal name: %s", *argv); } @@ -321,13 +321,13 @@ static int builtin_fg_bg(struct child_prog *child) struct job *job=NULL; if (!child->argv[1] || child->argv[2]) { - error_msg("%s: exactly one argument is expected\n", + error_msg("%s: exactly one argument is expected", child->argv[0]); return EXIT_FAILURE; } if (sscanf(child->argv[1], "%%%d", &jobNum) != 1) { - error_msg("%s: bad argument '%s'\n", + error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]); return EXIT_FAILURE; } @@ -339,7 +339,7 @@ static int builtin_fg_bg(struct child_prog *child) } if (!job) { - error_msg("%s: unknown job %d\n", + error_msg("%s: unknown job %d", child->argv[0], jobNum); return EXIT_FAILURE; } @@ -492,7 +492,7 @@ static int builtin_then(struct child_prog *child) debug_printf( "job=%p entering builtin_then ('%s')-- context=%d\n", cmd, charptr1, cmd->job_context); if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { shell_context = 0; /* Reset the shell's context on an error */ - error_msg("%s `then'\n", syntax_err); + error_msg("%s `then'", syntax_err); return EXIT_FAILURE; } @@ -520,7 +520,7 @@ static int builtin_else(struct child_prog *child) if (! (cmd->job_context & THEN_EXP_CONTEXT)) { shell_context = 0; /* Reset the shell's context on an error */ - error_msg("%s `else'\n", syntax_err); + error_msg("%s `else'", syntax_err); return EXIT_FAILURE; } /* If the if result was TRUE, skip the 'else' stuff */ @@ -543,7 +543,7 @@ static int builtin_fi(struct child_prog *child) debug_printf( "job=%p entering builtin_fi ('%s')-- context=%d\n", cmd, "", cmd->job_context); if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { shell_context = 0; /* Reset the shell's context on an error */ - error_msg("%s `fi'\n", syntax_err); + error_msg("%s `fi'", syntax_err); return EXIT_FAILURE; } /* Clear out the if and then context bits */ @@ -748,7 +748,7 @@ static int setup_redirects(struct child_prog *prog, int squirrel[]) 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!) */ - error_msg("error opening %s: %s\n", redir->filename, + error_msg("error opening %s: %s", redir->filename, strerror(errno)); return 1; } @@ -960,7 +960,7 @@ static void expand_argument(struct child_prog *prog, int *argcPtr, if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){ rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->glob_result); if (rc == GLOB_NOSPACE) { - error_msg("out of space during glob operation\n"); + error_msg("out of space during glob operation"); return; } else if (rc == GLOB_NOMATCH || (!rc && (prog->glob_result.gl_pathc - i) == 1 && @@ -1068,7 +1068,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) if (*src == '\\') { src++; if (!*src) { - error_msg("character expected after \\\n"); + error_msg("character expected after \\"); free_job(job); return 1; } @@ -1152,7 +1152,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) chptr++; if (!*chptr) { - error_msg("file name expected after %c\n", *src); + error_msg("file name expected after %c", *src); free_job(job); job->num_progs=0; return 1; @@ -1171,7 +1171,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) if (*prog->argv[argc_l]) argc_l++; if (!argc_l) { - error_msg("empty command in pipe\n"); + error_msg("empty command in pipe"); free_job(job); job->num_progs=0; return 1; @@ -1199,7 +1199,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) src++; if (!*src) { - error_msg("empty command in pipe\n"); + error_msg("empty command in pipe"); free_job(job); job->num_progs=0; return 1; @@ -1307,7 +1307,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) printf("erik: found a continue char at EOL...\n"); command = (char *) xcalloc(BUFSIZ, sizeof(char)); if (get_command(input, command)) { - error_msg("character expected after \\\n"); + error_msg("character expected after \\"); free(command); free_job(job); return 1; @@ -1323,7 +1323,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) free(command); break; #else - error_msg("character expected after \\\n"); + error_msg("character expected after \\"); free(command); free_job(job); return 1; @@ -1738,7 +1738,7 @@ int shell_main(int argc_l, char **argv_l) case 'c': input = NULL; if (local_pending_command != 0) - error_msg_and_die("multiple -c arguments\n"); + error_msg_and_die("multiple -c arguments"); local_pending_command = xstrdup(argv[optind]); optind++; argv = argv+optind; @@ -70,7 +70,7 @@ int screen_map_load(int fd, FILE * fp) if (parse_failed) { if (-1 == fseek(fp, 0, SEEK_SET)) { if (errno == ESPIPE) - error_msg_and_die("16bit screen-map MUST be a regular file.\n"); + error_msg_and_die("16bit screen-map MUST be a regular file."); else perror_msg_and_die("fseek failed reading binary 16bit screen-map"); } @@ -79,7 +79,7 @@ int screen_map_load(int fd, FILE * fp) perror_msg_and_die("Cannot read [new] map from file"); #if 0 else - error_msg("Input screen-map is binary.\n"); + error_msg("Input screen-map is binary."); #endif } @@ -96,7 +96,7 @@ int screen_map_load(int fd, FILE * fp) /* rewind... */ if (-1 == fseek(fp, 0, SEEK_SET)) { if (errno == ESPIPE) - error_msg("Assuming 8bit screen-map - MUST be a regular file.\n"), + error_msg("Assuming 8bit screen-map - MUST be a regular file."), exit(1); else perror_msg_and_die("fseek failed assuming 8bit screen-map"); @@ -109,7 +109,7 @@ int screen_map_load(int fd, FILE * fp) if (-1 == fseek(fp, 0, SEEK_SET)) { if (errno == ESPIPE) /* should not - it succedeed above */ - error_msg_and_die("fseek() returned ESPIPE !\n"); + error_msg_and_die("fseek() returned ESPIPE !"); else perror_msg_and_die("fseek for binary 8bit screen-map"); } @@ -118,7 +118,7 @@ int screen_map_load(int fd, FILE * fp) perror_msg_and_die("Cannot read [old] map from file"); #if 0 else - error_msg("Input screen-map is binary.\n"); + error_msg("Input screen-map is binary."); #endif } @@ -127,7 +127,7 @@ int screen_map_load(int fd, FILE * fp) else return 0; } - error_msg("Error parsing symbolic map\n"); + error_msg("Error parsing symbolic map"); return(1); } diff --git a/loadfont.c b/loadfont.c index 08e07618e..ec3e50560 100644 --- a/loadfont.c +++ b/loadfont.c @@ -62,7 +62,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize) memset(buf, 0, sizeof(buf)); if (unit < 1 || unit > 32) - error_msg_and_die("Bad character size %d\n", unit); + error_msg_and_die("Bad character size %d", unit); for (i = 0; i < fontsize; i++) memcpy(buf + (32 * i), inbuf + (unit * i), unit); @@ -119,8 +119,8 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize) if (ioctl(fd, PIO_UNIMAPCLR, &advice)) { #ifdef ENOIOCTLCMD if (errno == ENOIOCTLCMD) { - error_msg("It seems this kernel is older than 1.1.92\n"); - error_msg_and_die("No Unicode mapping table loaded.\n"); + error_msg("It seems this kernel is older than 1.1.92"); + error_msg_and_die("No Unicode mapping table loaded."); } else #endif perror_msg_and_die("PIO_UNIMAPCLR"); @@ -174,11 +174,11 @@ static void loadnewfont(int fd) goto no_psf; if (psfhdr.mode > PSF_MAXMODE) - error_msg_and_die("Unsupported psf file mode\n"); + error_msg_and_die("Unsupported psf file mode"); fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256); #if !defined( PIO_FONTX ) || defined( __sparc__ ) if (fontsize != 256) - error_msg_and_die("Only fontsize 256 supported\n"); + error_msg_and_die("Only fontsize 256 supported"); #endif hastable = (psfhdr.mode & PSF_MODEHASTAB); unit = psfhdr.charsize; @@ -186,7 +186,7 @@ static void loadnewfont(int fd) head = head0 + fontsize * unit; if (head > inputlth || (!hastable && head != inputlth)) - error_msg_and_die("Input file: bad length\n"); + error_msg_and_die("Input file: bad length"); do_loadfont(fd, inbuf + head0, unit, fontsize); if (hastable) do_loadtable(fd, inbuf + head, inputlth - head, fontsize); @@ -201,7 +201,7 @@ static void loadnewfont(int fd) } else { /* bare font */ if (inputlth & 0377) - error_msg_and_die("Bad input file size\n"); + error_msg_and_die("Bad input file size"); offset = 0; unit = inputlth / 256; } diff --git a/loadkmap.c b/loadkmap.c index 75b40da9a..a98601aec 100644 --- a/loadkmap.c +++ b/loadkmap.c @@ -59,7 +59,7 @@ int loadkmap_main(int argc, char **argv) read(0, buff, 7); if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7)) - error_msg_and_die("This is not a valid binary keymap.\n"); + error_msg_and_die("This is not a valid binary keymap."); if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS)) perror_msg_and_die("Error reading keymap flags"); @@ -87,14 +87,14 @@ static int pencode(char *s) *s = '\0'; fac = decode(save, facilitynames); if (fac < 0) - error_msg_and_die("unknown facility name: %s\n", save); + error_msg_and_die("unknown facility name: %s", save); *s++ = '.'; } else { s = save; } lev = decode(s, prioritynames); if (lev < 0) - error_msg_and_die("unknown priority name: %s\n", save); + error_msg_and_die("unknown priority name: %s", save); return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK)); } @@ -37,5 +37,5 @@ extern int logname_main(int argc, char **argv) puts(user); return EXIT_SUCCESS; } - error_msg_and_die("no login name\n"); + error_msg_and_die("no login name"); } @@ -719,7 +719,7 @@ static int md5_check(const char *checkfile_name) if (split_3(line, line_length, &md5num, &binary, &filename) || !hex_digits(md5num)) { if (warn) { - error_msg("%s: %lu: improperly formatted MD5 checksum line\n", + error_msg("%s: %lu: improperly formatted MD5 checksum line", checkfile_name, (unsigned long) line_number); } } else { @@ -764,7 +764,7 @@ static int md5_check(const char *checkfile_name) while (!feof(checkfile_stream) && !ferror(checkfile_stream)); if (ferror(checkfile_stream)) { - error_msg("%s: read error\n", checkfile_name); /* */ + error_msg("%s: read error", checkfile_name); return FALSE; } @@ -775,7 +775,7 @@ static int md5_check(const char *checkfile_name) if (n_properly_formated_lines == 0) { /* Warn if no tests are found. */ - error_msg("%s: no properly formatted MD5 checksum lines found\n", + error_msg("%s: no properly formatted MD5 checksum lines found", checkfile_name); return FALSE; } else { @@ -784,13 +784,13 @@ static int md5_check(const char *checkfile_name) - n_open_or_read_failures); if (n_open_or_read_failures > 0) { - error_msg("WARNING: %d of %d listed files could not be read\n", + error_msg("WARNING: %d of %d listed files could not be read", n_open_or_read_failures, n_properly_formated_lines); return FALSE; } if (n_mismatched_checksums > 0) { - error_msg("WARNING: %d of %d computed checksums did NOT match\n", + error_msg("WARNING: %d of %d computed checksums did NOT match", n_mismatched_checksums, n_computed_checkums); return FALSE; } @@ -855,26 +855,26 @@ int md5sum_main(int argc, } if (file_type_specified && do_check) { - error_msg_and_die("the -b and -t options are meaningless when verifying checksums\n"); + error_msg_and_die("the -b and -t options are meaningless when verifying checksums"); } if (n_strings > 0 && do_check) { - error_msg_and_die("the -g and -c options are mutually exclusive\n"); + error_msg_and_die("the -g and -c options are mutually exclusive"); } if (status_only && !do_check) { - error_msg_and_die("the -s option is meaningful only when verifying checksums\n"); + error_msg_and_die("the -s option is meaningful only when verifying checksums"); } if (warn && !do_check) { - error_msg_and_die("the -w option is meaningful only when verifying checksums\n"); + error_msg_and_die("the -w option is meaningful only when verifying checksums"); } if (n_strings > 0) { size_t i; if (optind < argc) { - error_msg_and_die("no files may be specified when using -g\n"); + error_msg_and_die("no files may be specified when using -g"); } for (i = 0; i < n_strings; ++i) { size_t cnt; @@ -887,7 +887,7 @@ int md5sum_main(int argc, } } else if (do_check) { if (optind + 1 < argc) { - error_msg("only one argument may be specified when using -c\n"); + error_msg("only one argument may be specified when using -c"); } err = md5_check ((optind == argc) ? "-" : argv[optind]); @@ -940,11 +940,11 @@ int md5sum_main(int argc, } if (fclose (stdout) == EOF) { - error_msg_and_die("write error\n"); + error_msg_and_die("write error"); } if (have_read_stdin && fclose (stdin) == EOF) { - error_msg_and_die("standard input\n"); + error_msg_and_die("standard input"); } if (err == 0) diff --git a/messages.c b/messages.c index c06a87f01..d9a134281 100644 --- a/messages.c +++ b/messages.c @@ -52,37 +52,37 @@ "BusyBox v" BB_VER " (" BB_BT ") multi-call binary -- GPL2") #endif #if defined bb_need_name_too_long || ! defined BB_DECLARE_EXTERN - BB_DEF_MESSAGE(name_too_long, "file name too long\n") + BB_DEF_MESSAGE(name_too_long, "file name too long") #endif #if defined bb_need_omitting_directory || ! defined BB_DECLARE_EXTERN - BB_DEF_MESSAGE(omitting_directory, "%s: omitting directory\n") + BB_DEF_MESSAGE(omitting_directory, "%s: omitting directory") #endif #if defined bb_need_not_a_directory || ! defined BB_DECLARE_EXTERN - BB_DEF_MESSAGE(not_a_directory, "%s: not a directory\n") + BB_DEF_MESSAGE(not_a_directory, "%s: not a directory") #endif #if defined bb_need_memory_exhausted || ! defined BB_DECLARE_EXTERN - BB_DEF_MESSAGE(memory_exhausted, "memory exhausted\n") + BB_DEF_MESSAGE(memory_exhausted, "memory exhausted") #endif #if defined bb_need_invalid_date || ! defined BB_DECLARE_EXTERN - BB_DEF_MESSAGE(invalid_date, "invalid date `%s'\n") + BB_DEF_MESSAGE(invalid_date, "invalid date `%s'") #endif #if defined bb_need_invalid_option || ! defined BB_DECLARE_EXTERN - BB_DEF_MESSAGE(invalid_option, "invalid option -- %c\n") + BB_DEF_MESSAGE(invalid_option, "invalid option -- %c") #endif #if defined bb_need_io_error || ! defined BB_DECLARE_EXTERN - BB_DEF_MESSAGE(io_error, "%s: input/output error -- %s\n") + BB_DEF_MESSAGE(io_error, "%s: input/output error -- %s") #endif #if defined bb_need_help || ! defined BB_DECLARE_EXTERN BB_DEF_MESSAGE(dash_dash_help, "--help") #endif #if defined bb_need_write_error || ! defined BB_DECLARE_EXTERN - BB_DEF_MESSAGE(write_error, "Write Error\n") + BB_DEF_MESSAGE(write_error, "Write Error") #endif #if defined bb_need_too_few_args || ! defined BB_DECLARE_EXTERN - BB_DEF_MESSAGE(too_few_args, "too few arguments\n") + BB_DEF_MESSAGE(too_few_args, "too few arguments") #endif #if defined bb_need_name_longer_than_foo || ! defined BB_DECLARE_EXTERN - BB_DEF_MESSAGE(name_longer_than_foo, "Names longer than %d chars not supported.\n") + BB_DEF_MESSAGE(name_longer_than_foo, "Names longer than %d chars not supported.") #endif diff --git a/miscutils/dc.c b/miscutils/dc.c index d462100a2..122673a95 100644 --- a/miscutils/dc.c +++ b/miscutils/dc.c @@ -14,14 +14,14 @@ static unsigned int pointer; static void push(double a) { if (pointer >= (sizeof(stack) / sizeof(*stack))) - error_msg_and_die("stack overflow\n"); + error_msg_and_die("stack overflow"); stack[pointer++] = a; } static double pop() { if (pointer == 0) - error_msg_and_die("stack underflow\n"); + error_msg_and_die("stack underflow"); return stack[--pointer]; } @@ -120,7 +120,7 @@ static void stack_machine(const char *argument) } o++; } - error_msg_and_die("%s: syntax error.\n", argument); + error_msg_and_die("%s: syntax error.", argument); } /* return pointer to next token in buffer and set *buffer to one char diff --git a/miscutils/mt.c b/miscutils/mt.c index 0d28339b9..683804b5a 100644 --- a/miscutils/mt.c +++ b/miscutils/mt.c @@ -76,7 +76,7 @@ extern int mt_main(int argc, char **argv) } if (code->name == 0) { - error_msg("unrecognized opcode %s.\n", argv[1]); + error_msg("unrecognized opcode %s.", argv[1]); return EXIT_FAILURE; } @@ -52,7 +52,7 @@ extern int mkdir_main(int argc, char **argv) /* Find the specified modes */ mode = 0; if (parse_mode(*(++argv), &mode) == FALSE) { - error_msg_and_die("Unknown mode: %s\n", *argv); + error_msg_and_die("Unknown mode: %s", *argv); } /* Set the umask for this process so it doesn't * screw up whatever the user just entered. */ @@ -85,7 +85,7 @@ extern int mkdir_main(int argc, char **argv) strcpy(buf, *argv); status = stat(buf, &statBuf); if (parentFlag == FALSE && status != -1 && errno != ENOENT) { - error_msg_and_die("%s: File exists\n", buf); + error_msg_and_die("%s: File exists", buf); } if (parentFlag == TRUE) { strcat(buf, "/"); diff --git a/mkfs_minix.c b/mkfs_minix.c index 21965d3b1..a2b6d8a6e 100644 --- a/mkfs_minix.c +++ b/mkfs_minix.c @@ -279,7 +279,7 @@ static void check_mount(void) if (!mnt) return; - error_msg_and_die("%s is mounted; will not make a filesystem here!\n", device_name); + error_msg_and_die("%s is mounted; will not make a filesystem here!", device_name); } static long valid_offset(int fd, int offset) @@ -336,28 +336,28 @@ static void write_tables(void) Super.s_state &= ~MINIX_ERROR_FS; if (lseek(DEV, 0, SEEK_SET)) - error_msg_and_die("seek to boot block failed in write_tables\n"); + error_msg_and_die("seek to boot block failed in write_tables"); if (512 != write(DEV, boot_block_buffer, 512)) - error_msg_and_die("unable to clear boot sector\n"); + error_msg_and_die("unable to clear boot sector"); if (BLOCK_SIZE != lseek(DEV, BLOCK_SIZE, SEEK_SET)) - error_msg_and_die("seek failed in write_tables\n"); + error_msg_and_die("seek failed in write_tables"); if (BLOCK_SIZE != write(DEV, super_block_buffer, BLOCK_SIZE)) - error_msg_and_die("unable to write super-block\n"); + error_msg_and_die("unable to write super-block"); if (IMAPS * BLOCK_SIZE != write(DEV, inode_map, IMAPS * BLOCK_SIZE)) - error_msg_and_die("unable to write inode map\n"); + error_msg_and_die("unable to write inode map"); if (ZMAPS * BLOCK_SIZE != write(DEV, zone_map, ZMAPS * BLOCK_SIZE)) - error_msg_and_die("unable to write zone map\n"); + error_msg_and_die("unable to write zone map"); if (INODE_BUFFER_SIZE != write(DEV, inode_buffer, INODE_BUFFER_SIZE)) - error_msg_and_die("unable to write inodes\n"); + error_msg_and_die("unable to write inodes"); } static void write_block(int blk, char *buffer) { if (blk * BLOCK_SIZE != lseek(DEV, blk * BLOCK_SIZE, SEEK_SET)) - error_msg_and_die("seek failed in write_block\n"); + error_msg_and_die("seek failed in write_block"); if (BLOCK_SIZE != write(DEV, buffer, BLOCK_SIZE)) - error_msg_and_die("write failed in write_block\n"); + error_msg_and_die("write failed in write_block"); } static int get_free_block(void) @@ -365,7 +365,7 @@ static int get_free_block(void) int blk; if (used_good_blocks + 1 >= MAX_GOOD_BLOCKS) - error_msg_and_die("too many bad blocks\n"); + error_msg_and_die("too many bad blocks"); if (used_good_blocks) blk = good_blocks_table[used_good_blocks - 1] + 1; else @@ -373,7 +373,7 @@ static int get_free_block(void) while (blk < ZONES && zone_in_use(blk)) blk++; if (blk >= ZONES) - error_msg_and_die("not enough good blocks\n"); + error_msg_and_die("not enough good blocks"); good_blocks_table[used_good_blocks] = blk; used_good_blocks++; return blk; @@ -439,7 +439,7 @@ static void make_bad_inode(void) goto end_bad; } } - error_msg_and_die("too many bad blocks\n"); + error_msg_and_die("too many bad blocks"); end_bad: if (ind) write_block(ind, (char *) ind_block); @@ -489,7 +489,7 @@ static void make_bad_inode2(void) } } /* Could make triple indirect block here */ - error_msg_and_die("too many bad blocks\n"); + error_msg_and_die("too many bad blocks"); end_bad: if (ind) write_block(ind, (char *) ind_block); @@ -590,7 +590,7 @@ static void setup_tables(void) * /sbin/mkfs.minix -i 200 test.fs * */ if (i >= 999) { - error_msg_and_die("unable to allocate buffers for maps\n"); + error_msg_and_die("unable to allocate buffers for maps"); } FIRSTZONE = NORM_FIRSTZONE; inode_map = xmalloc(IMAPS * BLOCK_SIZE); @@ -621,7 +621,7 @@ long do_check(char *buffer, int try, unsigned int current_block) /* Seek to the correct loc. */ if (lseek(DEV, current_block * BLOCK_SIZE, SEEK_SET) != current_block * BLOCK_SIZE) { - error_msg_and_die("seek failed during testing of blocks\n"); + error_msg_and_die("seek failed during testing of blocks"); } @@ -661,7 +661,7 @@ static void check_blocks(void) while (currently_testing < ZONES) { if (lseek(DEV, currently_testing * BLOCK_SIZE, SEEK_SET) != currently_testing * BLOCK_SIZE) - error_msg_and_die("seek failed in check_blocks\n"); + error_msg_and_die("seek failed in check_blocks"); try = TEST_BUFFER_BLOCKS; if (currently_testing + try > ZONES) try = ZONES - currently_testing; @@ -670,7 +670,7 @@ static void check_blocks(void) if (got == try) continue; if (currently_testing < FIRSTZONE) - error_msg_and_die("bad blocks before data-area: cannot make fs\n"); + error_msg_and_die("bad blocks before data-area: cannot make fs"); mark_zone(currently_testing); badblocks++; currently_testing++; @@ -690,7 +690,7 @@ char *filename; listfile = fopen(filename, "r"); if (listfile == (FILE *) NULL) { - error_msg_and_die("can't open file of bad blocks\n"); + error_msg_and_die("can't open file of bad blocks"); } while (!feof(listfile)) { fscanf(listfile, "%ld\n", &blockno); @@ -712,10 +712,10 @@ extern int mkfs_minix_main(int argc, char **argv) int stopIt=FALSE; if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE) - error_msg_and_die("bad inode size\n"); + error_msg_and_die("bad inode size"); #ifdef BB_FEATURE_MINIX2 if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE) - error_msg_and_die("bad inode size\n"); + error_msg_and_die("bad inode size"); #endif /* Parse options */ @@ -781,7 +781,7 @@ extern int mkfs_minix_main(int argc, char **argv) #ifdef BB_FEATURE_MINIX2 version2 = 1; #else - error_msg("%s: not compiled with minix v2 support\n", + error_msg("%s: not compiled with minix v2 support", device_name); exit(-1); #endif @@ -832,13 +832,13 @@ goodbye: strcpy(tmp + 2, ".badblocks"); DEV = open(device_name, O_RDWR); if (DEV < 0) - error_msg_and_die("unable to open %s\n", device_name); + error_msg_and_die("unable to open %s", device_name); if (fstat(DEV, &statbuf) < 0) - error_msg_and_die("unable to stat %s\n", device_name); + error_msg_and_die("unable to stat %s", device_name); if (!S_ISBLK(statbuf.st_mode)) check = 0; else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340) - error_msg_and_die("will not try to make filesystem on '%s'\n", device_name); + error_msg_and_die("will not try to make filesystem on '%s'", device_name); setup_tables(); if (check) check_blocks(); @@ -87,7 +87,7 @@ static void init_signature_page() #ifdef PAGE_SIZE if (pagesize != PAGE_SIZE) - error_msg("Assuming pages of size %d\n", pagesize); + error_msg("Assuming pages of size %d", pagesize); #endif signature_page = (int *) xmalloc(pagesize); memset(signature_page, 0, pagesize); @@ -185,7 +185,7 @@ static void page_bad(int page) bit_test_and_clear(signature_page, page); else { if (badpages == MAX_BADPAGES) - error_msg_and_die("too many bad pages\n"); + error_msg_and_die("too many bad pages"); p->badpages[badpages] = page; } badpages++; @@ -206,7 +206,7 @@ static void check_blocks(void) } if (do_seek && lseek(DEV, current_page * pagesize, SEEK_SET) != current_page * pagesize) - error_msg_and_die("seek failed in check_blocks\n"); + error_msg_and_die("seek failed in check_blocks"); if ((do_seek = (pagesize != read(DEV, buffer, pagesize)))) { page_bad(current_page++); continue; @@ -307,14 +307,14 @@ int mkswap_main(int argc, char **argv) } } if (!device_name) { - error_msg("error: Nowhere to set up swap on?\n"); + error_msg("error: Nowhere to set up swap on?"); usage(mkswap_usage); } sz = get_size(device_name); if (!PAGES) { PAGES = sz; } else if (PAGES > sz && !force) { - error_msg("error: size %ld is larger than device size %d\n", + error_msg("error: size %ld is larger than device size %d", PAGES * (pagesize / 1024), sz * (pagesize / 1024)); return EXIT_FAILURE; } @@ -330,11 +330,11 @@ int mkswap_main(int argc, char **argv) version = 1; } if (version != 0 && version != 1) { - error_msg("error: unknown version %d\n", version); + error_msg("error: unknown version %d", version); usage(mkswap_usage); } if (PAGES < 10) { - error_msg("error: swap area needs to be at least %ldkB\n", + error_msg("error: swap area needs to be at least %ldkB", (long) (10 * pagesize / 1024)); usage(mkswap_usage); } @@ -353,7 +353,7 @@ int mkswap_main(int argc, char **argv) #endif if (PAGES > maxpages) { PAGES = maxpages; - error_msg("warning: truncating swap area to %ldkB\n", + error_msg("warning: truncating swap area to %ldkB", PAGES * pagesize / 1024); } @@ -363,7 +363,7 @@ int mkswap_main(int argc, char **argv) if (!S_ISBLK(statbuf.st_mode)) check = 0; else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340) - error_msg_and_die("Will not try to make swapdevice on '%s'\n", device_name); + error_msg_and_die("Will not try to make swapdevice on '%s'", device_name); #ifdef __sparc__ if (!force && version == 0) { @@ -372,7 +372,7 @@ int mkswap_main(int argc, char **argv) unsigned short *q, sum; if (read(DEV, buffer, 512) != 512) - error_msg_and_die("fatal: first page unreadable\n"); + error_msg_and_die("fatal: first page unreadable"); if (buffer[508] == 0xDA && buffer[509] == 0xBE) { q = (unsigned short *) (buffer + 510); for (sum = 0; q >= (unsigned short *) buffer;) @@ -381,7 +381,7 @@ int mkswap_main(int argc, char **argv) error_msg("Device '%s' contains a valid Sun disklabel.\n" "This probably means creating v0 swap would destroy your partition table\n" "No swap created. If you really want to create swap v0 on that device, use\n" -"the -f option to force it.\n", device_name); +"the -f option to force it.", device_name); return EXIT_FAILURE; } } @@ -391,7 +391,7 @@ int mkswap_main(int argc, char **argv) if (version == 0 || check) check_blocks(); if (version == 0 && !bit_test_and_clear(signature_page, 0)) - error_msg_and_die("fatal: first page unreadable\n"); + error_msg_and_die("fatal: first page unreadable"); if (version == 1) { p->version = version; p->last_page = PAGES - 1; @@ -400,23 +400,23 @@ int mkswap_main(int argc, char **argv) goodpages = PAGES - badpages - 1; if (goodpages <= 0) - error_msg_and_die("Unable to set up swap-space: unreadable\n"); + error_msg_and_die("Unable to set up swap-space: unreadable"); printf("Setting up swapspace version %d, size = %ld bytes\n", version, (long) (goodpages * pagesize)); write_signature((version == 0) ? "SWAP-SPACE" : "SWAPSPACE2"); offset = ((version == 0) ? 0 : 1024); if (lseek(DEV, offset, SEEK_SET) != offset) - error_msg_and_die("unable to rewind swap-device\n"); + error_msg_and_die("unable to rewind swap-device"); if (write(DEV, (char *) signature_page + offset, pagesize - offset) != pagesize - offset) - error_msg_and_die("unable to write signature page\n"); + error_msg_and_die("unable to write signature page"); /* * A subsequent swapon() will fail if the signature * is not actually on disk. (This is a kernel bug.) */ if (fsync(DEV)) - error_msg_and_die("fsync failed\n"); + error_msg_and_die("fsync failed"); return EXIT_SUCCESS; } diff --git a/modutils/insmod.c b/modutils/insmod.c index 57a152c01..e55d9fafb 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c @@ -81,7 +81,7 @@ #ifndef MODUTILS_MODULE_H static const int MODUTILS_MODULE_H = 1; -#ident "$Id: insmod.c,v 1.44 2001/01/27 09:33:38 andersen Exp $" +#ident "$Id: insmod.c,v 1.45 2001/01/31 19:00:21 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 @@ -287,7 +287,7 @@ int delete_module(const char *); #ifndef MODUTILS_OBJ_H static const int MODUTILS_OBJ_H = 1; -#ident "$Id: insmod.c,v 1.44 2001/01/27 09:33:38 andersen Exp $" +#ident "$Id: insmod.c,v 1.45 2001/01/31 19:00:21 kraai Exp $" /* The relocatable object is manipulated using elfin types. */ @@ -1156,7 +1156,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) - error_msg("%s multiply defined\n", name); + error_msg("%s multiply defined", name); return sym; } } @@ -1419,7 +1419,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) { - error_msg("symbol for parameter %s not found\n", p); + error_msg("symbol for parameter %s not found", p); return 0; } @@ -1432,7 +1432,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') { - error_msg("improperly terminated string argument for %s\n", p); + error_msg("improperly terminated string argument for %s", p); return 0; } else if (*q == '\\') switch (*++q) { @@ -1786,7 +1786,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) p = get_modinfo_value(f, key); key += 5; if (p == NULL) { - error_msg("invalid parameter %s\n", key); + error_msg("invalid parameter %s", key); return 0; } @@ -1794,7 +1794,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) /* Also check that the parameter was not resolved from the kernel. */ if (sym == NULL || sym->secidx > SHN_HIRESERVE) { - error_msg("symbol for parameter %s not found\n", key); + error_msg("symbol for parameter %s not found", key); return 0; } @@ -1822,7 +1822,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) str = alloca(strlen(q)); for (r = str, q++; *q != '"'; ++q, ++r) { if (*q == '\0') { - error_msg("improperly terminated string argument for %s\n", + error_msg("improperly terminated string argument for %s", key); return 0; } else if (*q == '\\') @@ -1917,14 +1917,14 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) /* Probably we should do that outside the loop ? */ if (!isdigit(*(p + 1))) { error_msg("parameter type 'c' for %s must be followed by" - " the maximum size\n", key); + " the maximum size", key); return 0; } charssize = strtoul(p + 1, (char **) NULL, 10); /* Check length */ if (strlen(str) >= charssize) { - error_msg("string too long for %s (max %ld)\n", key, + error_msg("string too long for %s (max %ld)", key, charssize - 1); return 0; } @@ -1953,7 +1953,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) break; default: - error_msg("unknown parameter type '%c' for %s\n", *p, key); + error_msg("unknown parameter type '%c' for %s", *p, key); return 0; } } @@ -1972,21 +1972,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv) case ',': if (++n > max) { - error_msg("too many values for %s (max %d)\n", key, max); + error_msg("too many values for %s (max %d)", key, max); return 0; } ++q; break; default: - error_msg("invalid argument syntax for %s\n", key); + error_msg("invalid argument syntax for %s", key); return 0; } } end_of_arg: if (n < min) { - error_msg("too few values for %s (min %d)\n", key, min); + error_msg("too few values for %s (min %d)", key, min); return 0; } @@ -2372,7 +2372,7 @@ int obj_check_undefineds(struct obj_file *f) sym->secidx = SHN_ABS; sym->value = 0; } else { - error_msg("unresolved symbol %s\n", sym->name); + error_msg("unresolved symbol %s", sym->name); ret = 0; } } @@ -2599,11 +2599,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base) errmsg = "Unhandled relocation"; bad_reloc: if (extsym) { - error_msg("%s of type %ld for %s\n", errmsg, + error_msg("%s of type %ld for %s", errmsg, (long) ELFW(R_TYPE) (rel->r_info), strtab + extsym->st_name); } else { - error_msg("%s of type %ld\n", errmsg, + error_msg("%s of type %ld", errmsg, (long) ELFW(R_TYPE) (rel->r_info)); } ret = 0; @@ -2688,25 +2688,25 @@ struct obj_file *obj_load(FILE * fp) || f->header.e_ident[EI_MAG1] != ELFMAG1 || f->header.e_ident[EI_MAG2] != ELFMAG2 || f->header.e_ident[EI_MAG3] != ELFMAG3) { - error_msg("not an ELF file\n"); + error_msg("not an ELF file"); 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)) { - error_msg("ELF file not for this architecture\n"); + error_msg("ELF file not for this architecture"); return NULL; } if (f->header.e_type != ET_REL) { - error_msg("ELF file not a relocatable object\n"); + error_msg("ELF file not a relocatable object"); return NULL; } /* Read the section headers. */ if (f->header.e_shentsize != sizeof(ElfW(Shdr))) { - error_msg("section header size mismatch: %lu != %lu\n", + error_msg("section header size mismatch: %lu != %lu", (unsigned long) f->header.e_shentsize, (unsigned long) sizeof(ElfW(Shdr))); return NULL; @@ -2759,11 +2759,11 @@ struct obj_file *obj_load(FILE * fp) #if SHT_RELM == SHT_REL case SHT_RELA: - error_msg("RELA relocations not supported on this architecture\n"); + error_msg("RELA relocations not supported on this architecture"); return NULL; #else case SHT_REL: - error_msg("REL relocations not supported on this architecture\n"); + error_msg("REL relocations not supported on this architecture"); return NULL; #endif @@ -2776,7 +2776,7 @@ struct obj_file *obj_load(FILE * fp) break; } - error_msg("can't handle sections of type %ld\n", + error_msg("can't handle sections of type %ld", (long) sec->header.sh_type); return NULL; } @@ -2805,7 +2805,7 @@ struct obj_file *obj_load(FILE * fp) ElfW(Sym) * sym; if (sec->header.sh_entsize != sizeof(ElfW(Sym))) { - error_msg("symbol size mismatch: %lu != %lu\n", + error_msg("symbol size mismatch: %lu != %lu", (unsigned long) sec->header.sh_entsize, (unsigned long) sizeof(ElfW(Sym))); return NULL; @@ -2837,7 +2837,7 @@ struct obj_file *obj_load(FILE * fp) case SHT_RELM: if (sec->header.sh_entsize != sizeof(ElfW(RelM))) { - error_msg("relocation entry size mismatch: %lu != %lu\n", + error_msg("relocation entry size mismatch: %lu != %lu", (unsigned long) sec->header.sh_entsize, (unsigned long) sizeof(ElfW(RelM))); return NULL; @@ -2949,11 +2949,11 @@ extern int insmod_main( int argc, char **argv) if (m_filename[0] == '\0' || ((fp = fopen(m_filename, "r")) == NULL)) { - error_msg("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); + error_msg("No module named '%s' found in '%s'", m_fullName, _PATH_MODULES); return EXIT_FAILURE; } } else - error_msg_and_die("No module named '%s' found in '%s'\n", m_fullName, _PATH_MODULES); + error_msg_and_die("No module named '%s' found in '%s'", m_fullName, _PATH_MODULES); } else memcpy(m_filename, argv[optind], strlen(argv[optind])); @@ -2976,7 +2976,7 @@ extern int insmod_main( int argc, char **argv) m_version = old_get_module_version(f, m_strversion); if (m_version == -1) { error_msg("couldn't find the kernel version the module was " - "compiled for\n"); + "compiled for"); goto out; } } @@ -2985,12 +2985,12 @@ extern int insmod_main( int argc, char **argv) if (flag_force_load) { error_msg("Warning: kernel-module version mismatch\n" "\t%s was compiled for kernel version %s\n" - "\twhile this kernel is version %s\n", + "\twhile this kernel is version %s", m_filename, m_strversion, k_strversion); } else { error_msg("kernel-module version mismatch\n" "\t%s was compiled for kernel version %s\n" - "\twhile this kernel is version %s.\n", + "\twhile this kernel is version %s.", m_filename, m_strversion, k_strversion); goto out; } @@ -3006,7 +3006,7 @@ extern int insmod_main( int argc, char **argv) goto out; k_crcs = new_is_kernel_checksummed(); #else - error_msg("Not configured to support new kernels\n"); + error_msg("Not configured to support new kernels"); goto out; #endif } else { @@ -3015,7 +3015,7 @@ extern int insmod_main( int argc, char **argv) goto out; k_crcs = old_is_kernel_checksummed(); #else - error_msg("Not configured to support old kernels\n"); + error_msg("Not configured to support old kernels"); goto out; #endif } @@ -3072,10 +3072,10 @@ extern int insmod_main( int argc, char **argv) m_addr = create_module(m_name, m_size); if (m_addr==-1) switch (errno) { case EEXIST: - error_msg("A module named %s already exists\n", m_name); + error_msg("A module named %s already exists", m_name); goto out; case ENOMEM: - error_msg("Can't allocate kernel memory for module; needed %lu bytes\n", + error_msg("Can't allocate kernel memory for module; needed %lu bytes", m_size); goto out; default: @@ -132,20 +132,20 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, specialfile = find_unused_loop_device(); if (specialfile == NULL) { - error_msg_and_die("Could not find a spare loop device\n"); + error_msg_and_die("Could not find a spare loop device"); } if (set_loop(specialfile, lofile, 0, &loro)) { - error_msg_and_die("Could not setup loop device\n"); + error_msg_and_die("Could not setup loop device"); } if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ - error_msg("WARNING: loop device is read-only\n"); + error_msg("WARNING: loop device is read-only"); flags &= ~MS_RDONLY; } } #endif status = mount(specialfile, dir, filesystemtype, flags, string_flags); if (errno == EROFS) { - error_msg("%s is write-protected, mounting read-only\n", specialfile); + error_msg("%s is write-protected, mounting read-only", specialfile); status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags); } } @@ -171,7 +171,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, #endif if (errno == EPERM) { - error_msg_and_die("permission denied. Are you root?\n"); + error_msg_and_die("permission denied. Are you root?"); } return (FALSE); @@ -76,7 +76,7 @@ extern int mt_main(int argc, char **argv) } if (code->name == 0) { - error_msg("unrecognized opcode %s.\n", argv[1]); + error_msg("unrecognized opcode %s.", argv[1]); return EXIT_FAILURE; } @@ -59,7 +59,7 @@ int nc_main(int argc, char **argv) perror_msg_and_die("socket"); if ((hostinfo = gethostbyname(*argv)) == NULL) - error_msg_and_die("cannot resolve %s\n", *argv); + error_msg_and_die("cannot resolve %s", *argv); address.sin_family = AF_INET; address.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list; diff --git a/networking/hostname.c b/networking/hostname.c index a789fa0f1..3dba64154 100644 --- a/networking/hostname.c +++ b/networking/hostname.c @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * $Id: hostname.c,v 1.21 2001/01/27 08:24:37 andersen Exp $ + * $Id: hostname.c,v 1.22 2001/01/31 19:00:20 kraai Exp $ * Mini hostname implementation for busybox * * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> @@ -41,7 +41,7 @@ void do_sethostname(char *s, int isfile) if (!isfile) { if (sethostname(s, strlen(s)) < 0) { if (errno == EPERM) - error_msg_and_die("you must be root to change the hostname\n"); + error_msg_and_die("you must be root to change the hostname"); else perror_msg_and_die("sethostname"); } diff --git a/networking/nc.c b/networking/nc.c index 7de4015ac..682da82bf 100644 --- a/networking/nc.c +++ b/networking/nc.c @@ -59,7 +59,7 @@ int nc_main(int argc, char **argv) perror_msg_and_die("socket"); if ((hostinfo = gethostbyname(*argv)) == NULL) - error_msg_and_die("cannot resolve %s\n", *argv); + error_msg_and_die("cannot resolve %s", *argv); address.sin_family = AF_INET; address.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list; diff --git a/networking/ping.c b/networking/ping.c index a2e916362..15611babd 100644 --- a/networking/ping.c +++ b/networking/ping.c @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * $Id: ping.c,v 1.35 2001/01/27 08:24:37 andersen Exp $ + * $Id: ping.c,v 1.36 2001/01/31 19:00:21 kraai Exp $ * Mini ping implementation for busybox * * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> @@ -203,7 +203,7 @@ static void ping(const char *host) pingaddr.sin_family = AF_INET; if (!(h = gethostbyname(host))) { - error_msg("unknown host %s\n", host); + error_msg("unknown host %s", host); exit(1); } memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); @@ -324,7 +324,7 @@ static void sendping(int junk) if (i < 0) perror_msg_and_die("sendto"); else if ((size_t)i != sizeof(packet)) - error_msg_and_die("ping wrote %d chars; %d expected\n", i, + error_msg_and_die("ping wrote %d chars; %d expected", i, (int)sizeof(packet)); signal(SIGALRM, sendping); @@ -419,7 +419,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) printf("\n"); } else if (icmppkt->icmp_type != ICMP_ECHO) - error_msg("Warning: Got ICMP %d (%s)\n", + error_msg("Warning: Got ICMP %d (%s)", icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); } @@ -437,7 +437,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) - error_msg_and_die("permission denied. (are you root?)\n"); + error_msg_and_die("permission denied. (are you root?)"); else perror_msg_and_die("creating a raw socket"); } @@ -449,12 +449,12 @@ static void ping(const char *host) pingaddr.sin_family = AF_INET; if (!(h = gethostbyname(host))) { - error_msg("unknown host %s\n", host); + error_msg("unknown host %s", host); exit(1); } if (h->h_addrtype != AF_INET) { - error_msg("unknown address type; only AF_INET is currently supported.\n"); + error_msg("unknown address type; only AF_INET is currently supported."); exit(1); } diff --git a/networking/telnet.c b/networking/telnet.c index 8f7bbf29b..b08effed7 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -584,7 +584,7 @@ static int getport(char * p) if ((unsigned)(port - 1 ) > 65534) { - error_msg_and_die("%s: bad port number\n", p); + error_msg_and_die("%s: bad port number", p); } return port; } @@ -596,7 +596,7 @@ static struct in_addr getserver(char * host) struct hostent * he; if ((he = gethostbyname(host)) == NULL) { - error_msg_and_die("%s: Unknown host\n", host); + error_msg_and_die("%s: Unknown host", host); } memcpy(&addr, he->h_addr, sizeof addr); diff --git a/networking/wget.c b/networking/wget.c index 729c6fdc7..70f8d1b89 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -148,7 +148,7 @@ int wget_main(int argc, char **argv) #endif } if (do_continue && !fname_out) - error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n"); + error_msg_and_die("cannot specify continue (-c) without a filename (-O)"); /* @@ -200,7 +200,7 @@ int wget_main(int argc, char **argv) */ if (fgets(buf, sizeof(buf), sfp) == NULL) { close_and_delete_outfile(output, fname_out, do_continue); - error_msg_and_die("no response from server\n"); + error_msg_and_die("no response from server"); } for (s = buf ; *s != '\0' && !isspace(*s) ; ++s) ; @@ -230,7 +230,7 @@ int wget_main(int argc, char **argv) } if (strcasecmp(buf, "transfer-encoding") == 0) { close_and_delete_outfile(output, fname_out, do_continue); - error_msg_and_die("server wants to do %s transfer encoding\n", s); + error_msg_and_die("server wants to do %s transfer encoding", s); continue; } } @@ -267,7 +267,7 @@ void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path) *uri_port = 80; if (strncmp(url, "http://", 7) != 0) - error_msg_and_die("not an http url: %s\n", url); + error_msg_and_die("not an http url: %s", url); *uri_host = url + 7; @@ -297,7 +297,7 @@ FILE *open_socket(char *host, int port) memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; if ((hp = (struct hostent *) gethostbyname(host)) == NULL) - error_msg_and_die("cannot resolve %s\n", host); + error_msg_and_die("cannot resolve %s", host); memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length); sin.sin_port = htons(port); @@ -338,7 +338,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc) /* verify we are at the end of the header name */ if (*s != ':') - error_msg_and_die("bad header line: %s\n", buf); + error_msg_and_die("bad header line: %s", buf); /* locate the start of the header value */ for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s) @@ -532,7 +532,7 @@ progressmeter(int flag) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: wget.c,v 1.24 2001/01/31 17:49:47 andersen Exp $ + * $Id: wget.c,v 1.25 2001/01/31 19:00:21 kraai Exp $ */ diff --git a/nfsmount.c b/nfsmount.c index b260a885f..397858b71 100644 --- a/nfsmount.c +++ b/nfsmount.c @@ -307,7 +307,7 @@ int nfsmount(const char *spec, const char *node, int *flags, msock = fsock = -1; mclient = NULL; if (strlen(spec) >= sizeof(hostdir)) { - error_msg("excessively long host:dir argument\n"); + error_msg("excessively long host:dir argument"); goto fail; } strcpy(hostdir, spec); @@ -319,10 +319,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'; - error_msg("warning: multiple hostnames not supported\n"); + error_msg("warning: multiple hostnames not supported"); } } else { - error_msg("directory to mount not in host:dir format\n"); + error_msg("directory to mount not in host:dir format"); goto fail; } @@ -332,11 +332,11 @@ int nfsmount(const char *spec, const char *node, int *flags, #endif { if ((hp = gethostbyname(hostname)) == NULL) { - error_msg("can't get address for %s\n", hostname); + error_msg("can't get address for %s", hostname); goto fail; } else { if (hp->h_length > sizeof(struct in_addr)) { - error_msg("got bad hp->h_length\n"); + error_msg("got bad hp->h_length"); hp->h_length = sizeof(struct in_addr); } memcpy(&server_addr.sin_addr, @@ -353,7 +353,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)) { - error_msg("excessively long option argument\n"); + error_msg("excessively long option argument"); goto fail; } sprintf(new_opts, "%s%saddr=%s", @@ -513,11 +513,11 @@ int nfsmount(const char *spec, const char *node, int *flags, data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); #endif if (nfsvers > MAX_NFSPROT) { - error_msg("NFSv%d not supported!\n", nfsvers); + error_msg("NFSv%d not supported!", nfsvers); return 0; } if (mountvers > MAX_NFSPROT) { - error_msg("NFSv%d not supported!\n", nfsvers); + error_msg("NFSv%d not supported!", nfsvers); return 0; } if (nfsvers && !mountvers) @@ -577,11 +577,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) { - error_msg("can't get address for %s\n", hostname); + error_msg("can't get address for %s", hostname); goto fail; } else { if (hp->h_length > sizeof(struct in_addr)) { - error_msg("got bad hp->h_length?\n"); + error_msg("got bad hp->h_length?"); hp->h_length = sizeof(struct in_addr); } mount_server_addr.sin_family = AF_INET; @@ -716,7 +716,7 @@ int nfsmount(const char *spec, const char *node, int *flags, if (nfsvers == 2) { if (status.nfsv2.fhs_status != 0) { - error_msg("%s:%s failed, reason given by server: %s\n", + error_msg("%s:%s failed, reason given by server: %s", hostname, dirname, nfs_strerror(status.nfsv2.fhs_status)); goto fail; @@ -734,7 +734,7 @@ int nfsmount(const char *spec, const char *node, int *flags, #if NFS_MOUNT_VERSION >= 4 fhandle3 *fhandle; if (status.nfsv3.fhs_status != 0) { - error_msg("%s:%s failed, reason given by server: %s\n", + error_msg("%s:%s failed, reason given by server: %s", hostname, dirname, nfs_strerror(status.nfsv3.fhs_status)); goto fail; @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * $Id: ping.c,v 1.35 2001/01/27 08:24:37 andersen Exp $ + * $Id: ping.c,v 1.36 2001/01/31 19:00:21 kraai Exp $ * Mini ping implementation for busybox * * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> @@ -203,7 +203,7 @@ static void ping(const char *host) pingaddr.sin_family = AF_INET; if (!(h = gethostbyname(host))) { - error_msg("unknown host %s\n", host); + error_msg("unknown host %s", host); exit(1); } memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr)); @@ -324,7 +324,7 @@ static void sendping(int junk) if (i < 0) perror_msg_and_die("sendto"); else if ((size_t)i != sizeof(packet)) - error_msg_and_die("ping wrote %d chars; %d expected\n", i, + error_msg_and_die("ping wrote %d chars; %d expected", i, (int)sizeof(packet)); signal(SIGALRM, sendping); @@ -419,7 +419,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) printf("\n"); } else if (icmppkt->icmp_type != ICMP_ECHO) - error_msg("Warning: Got ICMP %d (%s)\n", + error_msg("Warning: Got ICMP %d (%s)", icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type)); } @@ -437,7 +437,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) - error_msg_and_die("permission denied. (are you root?)\n"); + error_msg_and_die("permission denied. (are you root?)"); else perror_msg_and_die("creating a raw socket"); } @@ -449,12 +449,12 @@ static void ping(const char *host) pingaddr.sin_family = AF_INET; if (!(h = gethostbyname(host))) { - error_msg("unknown host %s\n", host); + error_msg("unknown host %s", host); exit(1); } if (h->h_addrtype != AF_INET) { - error_msg("unknown address type; only AF_INET is currently supported.\n"); + error_msg("unknown address type; only AF_INET is currently supported."); exit(1); } diff --git a/procps/kill.c b/procps/kill.c index 3eb829abf..00a4d5c40 100644 --- a/procps/kill.c +++ b/procps/kill.c @@ -223,7 +223,7 @@ extern int kill_main(int argc, char **argv) pidList = find_pid_by_name( *argv); if (!pidList) { all_found = FALSE; - error_msg( "%s: no process killed\n", *argv); + error_msg( "%s: no process killed", *argv); } for(; pidList && *pidList!=0; pidList++) { @@ -246,5 +246,5 @@ extern int kill_main(int argc, char **argv) end: - error_msg_and_die( "bad signal name: %s\n", *argv); + error_msg_and_die( "bad signal name: %s", *argv); } diff --git a/procps/ps.c b/procps/ps.c index 08597fe3a..4ff7a8a58 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -99,20 +99,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 - error_msg("Internal error!\n"); + error_msg("Internal error!"); /* For busybox, ignoring effective, saved, etc */ tmp = strstr(S, "Uid:"); if (tmp) sscanf(tmp, "Uid:\t%d", &P->ruid); else - error_msg("Internal error!\n"); + error_msg("Internal error!"); tmp = strstr(S, "Gid:"); if (tmp) sscanf(tmp, "Gid:\t%d", &P->rgid); else - error_msg("Internal error!\n"); + error_msg("Internal error!"); } @@ -137,7 +137,7 @@ extern int ps_main(int argc, char **argv) dir = opendir("/proc"); if (!dir) - error_msg_and_die("Can't open /proc\n"); + error_msg_and_die("Can't open /proc"); #ifdef BB_FEATURE_AUTOWIDTH ioctl(fileno(stdout), TIOCGWINSZ, &win); @@ -99,20 +99,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 - error_msg("Internal error!\n"); + error_msg("Internal error!"); /* For busybox, ignoring effective, saved, etc */ tmp = strstr(S, "Uid:"); if (tmp) sscanf(tmp, "Uid:\t%d", &P->ruid); else - error_msg("Internal error!\n"); + error_msg("Internal error!"); tmp = strstr(S, "Gid:"); if (tmp) sscanf(tmp, "Gid:\t%d", &P->rgid); else - error_msg("Internal error!\n"); + error_msg("Internal error!"); } @@ -137,7 +137,7 @@ extern int ps_main(int argc, char **argv) dir = opendir("/proc"); if (!dir) - error_msg_and_die("Can't open /proc\n"); + error_msg_and_die("Can't open /proc"); #ifdef BB_FEATURE_AUTOWIDTH ioctl(fileno(stdout), TIOCGWINSZ, &win); @@ -72,7 +72,7 @@ time_t askremotedate(char *host) } if (read(fd, (void *)&nett, 4) != 4) { /* read time from server */ close(fd); - error_msg("%s did not send the complete time\n", host); + error_msg("%s did not send the complete time", host); } close(fd); diff --git a/rpmunpack.c b/rpmunpack.c index 85c7c9c1e..e37ac2cfa 100644 --- a/rpmunpack.c +++ b/rpmunpack.c @@ -44,7 +44,7 @@ static void myread(int num, char *buffer) if (err < 0) perror_msg_and_die(progname); else - error_msg_and_die("Unexpected end of input file!\n"); + error_msg_and_die("Unexpected end of input file!"); } } @@ -169,7 +169,7 @@ static int get_address(struct sed_cmd *sed_cmd, const char *str, int *line, rege else if (my_str[idx] == '/') { idx = index_of_next_unescaped_regexp_delim(sed_cmd, my_str, ++idx); if (idx == -1) - error_msg_and_die("unterminated match expression\n"); + error_msg_and_die("unterminated match expression"); my_str[idx] = '\0'; *regex = (regex_t *)xmalloc(sizeof(regex_t)); xregcomp(*regex, my_str+1, 0); @@ -177,7 +177,7 @@ static int get_address(struct sed_cmd *sed_cmd, const char *str, int *line, rege } else { error_msg("get_address: no address found in string\n" - "\t(you probably didn't check the string you passed me)\n"); + "\t(you probably didn't check the string you passed me)"); idx = -1; } @@ -213,7 +213,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr) /* verify that the 's' is followed by something. That something * (typically a 'slash') is now our regexp delimiter... */ if (!substr[++idx]) - error_msg_and_die("bad format in substitution expression\n"); + error_msg_and_die("bad format in substitution expression"); else sed_cmd->delimiter=substr[idx]; @@ -221,7 +221,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr) oldidx = idx+1; idx = index_of_next_unescaped_regexp_delim(sed_cmd, substr, ++idx); if (idx == -1) - error_msg_and_die("bad format in substitution expression\n"); + error_msg_and_die("bad format in substitution expression"); match = strdup_substr(substr, oldidx, idx); /* determine the number of back references in the match string */ @@ -240,7 +240,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr) oldidx = idx+1; idx = index_of_next_unescaped_regexp_delim(sed_cmd, substr, ++idx); if (idx == -1) - error_msg_and_die("bad format in substitution expression\n"); + error_msg_and_die("bad format in substitution expression"); sed_cmd->replace = strdup_substr(substr, oldidx, idx); /* process the flags */ @@ -260,7 +260,7 @@ static int parse_subst_cmd(struct sed_cmd *sed_cmd, const char *substr) if (strchr("; \t\v\n\r", substr[idx])) goto out; /* else */ - error_msg_and_die("bad option in substitution expression\n"); + error_msg_and_die("bad option in substitution expression"); } } @@ -302,7 +302,7 @@ static int parse_edit_cmd(struct sed_cmd *sed_cmd, const char *editstr) */ if (editstr[1] != '\\' && (editstr[2] != '\n' || editstr[2] != '\r')) - error_msg_and_die("bad format in edit expression\n"); + error_msg_and_die("bad format in edit expression"); /* store the edit line text */ /* make editline big enough to accomodate the extra '\n' we will tack on @@ -366,9 +366,9 @@ static char *parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) /* last part (mandatory) will be a command */ if (cmdstr[idx] == '\0') - error_msg_and_die("missing command\n"); + error_msg_and_die("missing command"); if (!strchr("pdsaic", cmdstr[idx])) /* <-- XXX add new commands here */ - error_msg_and_die("invalid command\n"); + error_msg_and_die("invalid command"); sed_cmd->cmd = cmdstr[idx]; /* special-case handling for (s)ubstitution */ @@ -378,7 +378,7 @@ static char *parse_cmd_str(struct sed_cmd *sed_cmd, const char *cmdstr) /* special-case handling for (a)ppend, (i)nsert, and (c)hange */ else if (strchr("aic", cmdstr[idx])) { if (sed_cmd->end_line || sed_cmd->end_match) - error_msg_and_die("only a beginning address can be specified for edit commands\n"); + error_msg_and_die("only a beginning address can be specified for edit commands"); idx += parse_edit_cmd(sed_cmd, &cmdstr[idx]); } /* if it was a single-letter command (such as 'p' or 'd') we need to diff --git a/setkeycodes.c b/setkeycodes.c index be9b1b797..3e511ad00 100644 --- a/setkeycodes.c +++ b/setkeycodes.c @@ -52,18 +52,18 @@ setkeycodes_main(int argc, char** argv) a.keycode = atoi(argv[2]); a.scancode = sc = strtol(argv[1], &ep, 16); if (*ep) { - error_msg_and_die("error reading SCANCODE: '%s'\n", argv[1]); + error_msg_and_die("error reading SCANCODE: '%s'", argv[1]); } if (a.scancode > 127) { a.scancode -= 0xe000; a.scancode += 128; } if (a.scancode > 255 || a.keycode > 127) { - error_msg_and_die("SCANCODE or KEYCODE outside bounds\n"); + error_msg_and_die("SCANCODE or KEYCODE outside bounds"); } if (ioctl(fd,KDSETKEYCODE,&a)) { perror("KDSETKEYCODE"); - error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d\n", sc, a.keycode); + error_msg_and_die("failed to set SCANCODE %x to KEYCODE %d", sc, a.keycode); } argc -= 2; argv += 2; @@ -321,13 +321,13 @@ static int builtin_fg_bg(struct child_prog *child) struct job *job=NULL; if (!child->argv[1] || child->argv[2]) { - error_msg("%s: exactly one argument is expected\n", + error_msg("%s: exactly one argument is expected", child->argv[0]); return EXIT_FAILURE; } if (sscanf(child->argv[1], "%%%d", &jobNum) != 1) { - error_msg("%s: bad argument '%s'\n", + error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]); return EXIT_FAILURE; } @@ -339,7 +339,7 @@ static int builtin_fg_bg(struct child_prog *child) } if (!job) { - error_msg("%s: unknown job %d\n", + error_msg("%s: unknown job %d", child->argv[0], jobNum); return EXIT_FAILURE; } @@ -492,7 +492,7 @@ static int builtin_then(struct child_prog *child) debug_printf( "job=%p entering builtin_then ('%s')-- context=%d\n", cmd, charptr1, cmd->job_context); if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { shell_context = 0; /* Reset the shell's context on an error */ - error_msg("%s `then'\n", syntax_err); + error_msg("%s `then'", syntax_err); return EXIT_FAILURE; } @@ -520,7 +520,7 @@ static int builtin_else(struct child_prog *child) if (! (cmd->job_context & THEN_EXP_CONTEXT)) { shell_context = 0; /* Reset the shell's context on an error */ - error_msg("%s `else'\n", syntax_err); + error_msg("%s `else'", syntax_err); return EXIT_FAILURE; } /* If the if result was TRUE, skip the 'else' stuff */ @@ -543,7 +543,7 @@ static int builtin_fi(struct child_prog *child) debug_printf( "job=%p entering builtin_fi ('%s')-- context=%d\n", cmd, "", cmd->job_context); if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { shell_context = 0; /* Reset the shell's context on an error */ - error_msg("%s `fi'\n", syntax_err); + error_msg("%s `fi'", syntax_err); return EXIT_FAILURE; } /* Clear out the if and then context bits */ @@ -748,7 +748,7 @@ static int setup_redirects(struct child_prog *prog, int squirrel[]) 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!) */ - error_msg("error opening %s: %s\n", redir->filename, + error_msg("error opening %s: %s", redir->filename, strerror(errno)); return 1; } @@ -960,7 +960,7 @@ static void expand_argument(struct child_prog *prog, int *argcPtr, if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){ rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->glob_result); if (rc == GLOB_NOSPACE) { - error_msg("out of space during glob operation\n"); + error_msg("out of space during glob operation"); return; } else if (rc == GLOB_NOMATCH || (!rc && (prog->glob_result.gl_pathc - i) == 1 && @@ -1068,7 +1068,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) if (*src == '\\') { src++; if (!*src) { - error_msg("character expected after \\\n"); + error_msg("character expected after \\"); free_job(job); return 1; } @@ -1152,7 +1152,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) chptr++; if (!*chptr) { - error_msg("file name expected after %c\n", *src); + error_msg("file name expected after %c", *src); free_job(job); job->num_progs=0; return 1; @@ -1171,7 +1171,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) if (*prog->argv[argc_l]) argc_l++; if (!argc_l) { - error_msg("empty command in pipe\n"); + error_msg("empty command in pipe"); free_job(job); job->num_progs=0; return 1; @@ -1199,7 +1199,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) src++; if (!*src) { - error_msg("empty command in pipe\n"); + error_msg("empty command in pipe"); free_job(job); job->num_progs=0; return 1; @@ -1307,7 +1307,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) printf("erik: found a continue char at EOL...\n"); command = (char *) xcalloc(BUFSIZ, sizeof(char)); if (get_command(input, command)) { - error_msg("character expected after \\\n"); + error_msg("character expected after \\"); free(command); free_job(job); return 1; @@ -1323,7 +1323,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) free(command); break; #else - error_msg("character expected after \\\n"); + error_msg("character expected after \\"); free(command); free_job(job); return 1; @@ -1738,7 +1738,7 @@ int shell_main(int argc_l, char **argv_l) case 'c': input = NULL; if (local_pending_command != 0) - error_msg_and_die("multiple -c arguments\n"); + error_msg_and_die("multiple -c arguments"); local_pending_command = xstrdup(argv[optind]); optind++; argv = argv+optind; diff --git a/shell/cmdedit.c b/shell/cmdedit.c index 169032697..ed441d394 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c @@ -318,7 +318,7 @@ static void cmdedit_setwidth(int w, int redraw_flg) input_backward(); } } else { - error_msg("\n*** Error: minimum screen width is %d\n", cmdedit_termw); + error_msg("\n*** Error: minimum screen width is %d", cmdedit_termw); } } diff --git a/shell/lash.c b/shell/lash.c index b3bdcc986..cc0d78687 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -321,13 +321,13 @@ static int builtin_fg_bg(struct child_prog *child) struct job *job=NULL; if (!child->argv[1] || child->argv[2]) { - error_msg("%s: exactly one argument is expected\n", + error_msg("%s: exactly one argument is expected", child->argv[0]); return EXIT_FAILURE; } if (sscanf(child->argv[1], "%%%d", &jobNum) != 1) { - error_msg("%s: bad argument '%s'\n", + error_msg("%s: bad argument '%s'", child->argv[0], child->argv[1]); return EXIT_FAILURE; } @@ -339,7 +339,7 @@ static int builtin_fg_bg(struct child_prog *child) } if (!job) { - error_msg("%s: unknown job %d\n", + error_msg("%s: unknown job %d", child->argv[0], jobNum); return EXIT_FAILURE; } @@ -492,7 +492,7 @@ static int builtin_then(struct child_prog *child) debug_printf( "job=%p entering builtin_then ('%s')-- context=%d\n", cmd, charptr1, cmd->job_context); if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { shell_context = 0; /* Reset the shell's context on an error */ - error_msg("%s `then'\n", syntax_err); + error_msg("%s `then'", syntax_err); return EXIT_FAILURE; } @@ -520,7 +520,7 @@ static int builtin_else(struct child_prog *child) if (! (cmd->job_context & THEN_EXP_CONTEXT)) { shell_context = 0; /* Reset the shell's context on an error */ - error_msg("%s `else'\n", syntax_err); + error_msg("%s `else'", syntax_err); return EXIT_FAILURE; } /* If the if result was TRUE, skip the 'else' stuff */ @@ -543,7 +543,7 @@ static int builtin_fi(struct child_prog *child) debug_printf( "job=%p entering builtin_fi ('%s')-- context=%d\n", cmd, "", cmd->job_context); if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) { shell_context = 0; /* Reset the shell's context on an error */ - error_msg("%s `fi'\n", syntax_err); + error_msg("%s `fi'", syntax_err); return EXIT_FAILURE; } /* Clear out the if and then context bits */ @@ -748,7 +748,7 @@ static int setup_redirects(struct child_prog *prog, int squirrel[]) 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!) */ - error_msg("error opening %s: %s\n", redir->filename, + error_msg("error opening %s: %s", redir->filename, strerror(errno)); return 1; } @@ -960,7 +960,7 @@ static void expand_argument(struct child_prog *prog, int *argcPtr, if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){ rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->glob_result); if (rc == GLOB_NOSPACE) { - error_msg("out of space during glob operation\n"); + error_msg("out of space during glob operation"); return; } else if (rc == GLOB_NOMATCH || (!rc && (prog->glob_result.gl_pathc - i) == 1 && @@ -1068,7 +1068,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) if (*src == '\\') { src++; if (!*src) { - error_msg("character expected after \\\n"); + error_msg("character expected after \\"); free_job(job); return 1; } @@ -1152,7 +1152,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) chptr++; if (!*chptr) { - error_msg("file name expected after %c\n", *src); + error_msg("file name expected after %c", *src); free_job(job); job->num_progs=0; return 1; @@ -1171,7 +1171,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) if (*prog->argv[argc_l]) argc_l++; if (!argc_l) { - error_msg("empty command in pipe\n"); + error_msg("empty command in pipe"); free_job(job); job->num_progs=0; return 1; @@ -1199,7 +1199,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) src++; if (!*src) { - error_msg("empty command in pipe\n"); + error_msg("empty command in pipe"); free_job(job); job->num_progs=0; return 1; @@ -1307,7 +1307,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) printf("erik: found a continue char at EOL...\n"); command = (char *) xcalloc(BUFSIZ, sizeof(char)); if (get_command(input, command)) { - error_msg("character expected after \\\n"); + error_msg("character expected after \\"); free(command); free_job(job); return 1; @@ -1323,7 +1323,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg) free(command); break; #else - error_msg("character expected after \\\n"); + error_msg("character expected after \\"); free(command); free_job(job); return 1; @@ -1738,7 +1738,7 @@ int shell_main(int argc_l, char **argv_l) case 'c': input = NULL; if (local_pending_command != 0) - error_msg_and_die("multiple -c arguments\n"); + error_msg_and_die("multiple -c arguments"); local_pending_command = xstrdup(argv[optind]); optind++; argv = argv+optind; diff --git a/swaponoff.c b/swaponoff.c index 8a9134ca0..74f6ec36e 100644 --- a/swaponoff.c +++ b/swaponoff.c @@ -95,7 +95,7 @@ extern int swap_on_off_main(int argc, char **argv) struct stat statBuf; if (stat("/etc/fstab", &statBuf) < 0) - error_msg_and_die("/etc/fstab file missing\n"); + error_msg_and_die("/etc/fstab file missing"); } do_em_all(); break; diff --git a/sysklogd/logger.c b/sysklogd/logger.c index 1ab868d75..85c63b8a5 100644 --- a/sysklogd/logger.c +++ b/sysklogd/logger.c @@ -87,14 +87,14 @@ static int pencode(char *s) *s = '\0'; fac = decode(save, facilitynames); if (fac < 0) - error_msg_and_die("unknown facility name: %s\n", save); + error_msg_and_die("unknown facility name: %s", save); *s++ = '.'; } else { s = save; } lev = decode(s, prioritynames); if (lev < 0) - error_msg_and_die("unknown priority name: %s\n", save); + error_msg_and_die("unknown priority name: %s", save); return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK)); } diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 8eb74c69f..7bd4bdcb2 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c @@ -182,7 +182,7 @@ static const int IOV_COUNT = 2; if ( -1 == writev(remotefd,iov, IOV_COUNT)){ error_msg_and_die("syslogd: cannot write to remote file handle on" - "%s:%d\n",RemoteHost,RemotePort); + "%s:%d",RemoteHost,RemotePort); } } if (local_logging == TRUE) @@ -264,13 +264,13 @@ static void init_RemoteLog (void){ remotefd = socket(AF_INET, SOCK_DGRAM, 0); if (remotefd < 0) { - error_msg_and_die("syslogd: cannot create socket\n"); + error_msg_and_die("syslogd: cannot create socket"); } hostinfo = (struct hostent *) gethostbyname(RemoteHost); if (!hostinfo) { - error_msg_and_die("syslogd: cannot resolve remote host name [%s]\n", RemoteHost); + error_msg_and_die("syslogd: cannot resolve remote host name [%s]", RemoteHost); } remoteaddr.sin_family = AF_INET; @@ -282,7 +282,7 @@ static void init_RemoteLog (void){ for future operations */ if ( 0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))){ - error_msg_and_die("syslogd: cannot connect to remote host %s:%d\n", RemoteHost, RemotePort); + error_msg_and_die("syslogd: cannot connect to remote host %s:%d", RemoteHost, RemotePort); } } @@ -182,7 +182,7 @@ static const int IOV_COUNT = 2; if ( -1 == writev(remotefd,iov, IOV_COUNT)){ error_msg_and_die("syslogd: cannot write to remote file handle on" - "%s:%d\n",RemoteHost,RemotePort); + "%s:%d",RemoteHost,RemotePort); } } if (local_logging == TRUE) @@ -264,13 +264,13 @@ static void init_RemoteLog (void){ remotefd = socket(AF_INET, SOCK_DGRAM, 0); if (remotefd < 0) { - error_msg_and_die("syslogd: cannot create socket\n"); + error_msg_and_die("syslogd: cannot create socket"); } hostinfo = (struct hostent *) gethostbyname(RemoteHost); if (!hostinfo) { - error_msg_and_die("syslogd: cannot resolve remote host name [%s]\n", RemoteHost); + error_msg_and_die("syslogd: cannot resolve remote host name [%s]", RemoteHost); } remoteaddr.sin_family = AF_INET; @@ -282,7 +282,7 @@ static void init_RemoteLog (void){ for future operations */ if ( 0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))){ - error_msg_and_die("syslogd: cannot connect to remote host %s:%d\n", RemoteHost, RemotePort); + error_msg_and_die("syslogd: cannot connect to remote host %s:%d", RemoteHost, RemotePort); } } @@ -165,10 +165,10 @@ extern int tar_unzip_init(int tarFd) signal(SIGCHLD, child_died); if (pipe(unzip_pipe)!=0) - error_msg_and_die("pipe error\n"); + error_msg_and_die("pipe error"); if ( (child_pid = fork()) == -1) - error_msg_and_die("fork failure\n"); + error_msg_and_die("fork failure"); if (child_pid==0) { /* child process */ @@ -259,7 +259,7 @@ extern int tar_main(int argc, char **argv) break; case 'f': if (*tarName != '-') - error_msg_and_die( "Only one 'f' option allowed\n"); + error_msg_and_die( "Only one 'f' option allowed"); tarName = optarg; break; #if defined BB_FEATURE_TAR_EXCLUDE @@ -294,11 +294,11 @@ extern int tar_main(int argc, char **argv) */ if (createFlag == TRUE) { #ifndef BB_FEATURE_TAR_CREATE - error_msg_and_die( "This version of tar was not compiled with tar creation support.\n"); + error_msg_and_die( "This version of tar was not compiled with tar creation support."); #else #ifdef BB_FEATURE_TAR_GZIP if (unzipFlag==TRUE) - error_msg_and_die("Creation of compressed not internally support by tar, pipe to busybox gunzip\n"); + error_msg_and_die("Creation of compressed not internally support by tar, pipe to busybox gunzip"); #endif status = writeTarFile(tarName, verboseFlag, argv + optind, excludeList); #endif @@ -330,7 +330,7 @@ extern int tar_main(int argc, char **argv) return EXIT_FAILURE; flagError: - error_msg_and_die( "Exactly one of 'c', 'x' or 't' must be specified\n"); + error_msg_and_die( "Exactly one of 'c', 'x' or 't' must be specified"); } static void @@ -383,7 +383,7 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) } if ( (readSize = full_read(header->tarFd, buffer, readSize)) <= 0 ) { /* Tarball seems to have a problem */ - error_msg("Unexpected EOF in archive\n"); + error_msg("Unexpected EOF in archive"); return( FALSE); } if ( readSize < writeSize ) @@ -476,7 +476,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag) /* Do not change permissions or date on symlink, * since it changes the pointed to file instead. duh. */ #else - error_msg("%s: Cannot create symlink to '%s': %s\n", + error_msg("%s: Cannot create symlink to '%s': %s", header->name, header->linkname, "symlinks not supported"); #endif @@ -543,7 +543,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header) ++*(header->name); if (alreadyWarned == FALSE) { - error_msg("Removing leading '/' from member names\n"); + error_msg("Removing leading '/' from member names"); alreadyWarned = TRUE; } } @@ -644,7 +644,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag, goto endgame; } else { errorFlag=TRUE; - error_msg("Bad tar header, skipping\n"); + error_msg("Bad tar header, skipping"); continue; } } @@ -791,7 +791,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag, break; #endif default: - error_msg("Unknown file type '%c' in tar file\n", header.type); + error_msg("Unknown file type '%c' in tar file", header.type); close( tarFd); return( FALSE); } @@ -803,7 +803,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag, return ( FALSE); } else if (errorFlag==TRUE) { - error_msg( "Error exit delayed from previous errors\n"); + error_msg( "Error exit delayed from previous errors"); return( FALSE); } else return( status); @@ -813,7 +813,7 @@ endgame: close( tarFd); if ( *(header.name) == '\0' ) { if (errorFlag==TRUE) - error_msg( "Error exit delayed from previous errors\n"); + error_msg( "Error exit delayed from previous errors"); else return( TRUE); } @@ -1002,7 +1002,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *header_name, header.typeflag = REGTYPE; putOctal(header.size, sizeof(header.size), statbuf->st_size); } else { - error_msg("%s: Unknown file type\n", real_name); + error_msg("%s: Unknown file type", real_name); return ( FALSE); } @@ -1061,7 +1061,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* /* It is against the rules to archive a socket */ if (S_ISSOCK(statbuf->st_mode)) { - error_msg("%s: socket ignored\n", fileName); + error_msg("%s: socket ignored", fileName); return( TRUE); } @@ -1070,7 +1070,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* * the new tarball */ if (tbInfo->statBuf.st_dev == statbuf->st_dev && tbInfo->statBuf.st_ino == statbuf->st_ino) { - error_msg("%s: file is the archive; skipping\n", fileName); + error_msg("%s: file is the archive; skipping", fileName); return( TRUE); } @@ -1078,7 +1078,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* while (header_name[0] == '/') { static int alreadyWarned=FALSE; if (alreadyWarned==FALSE) { - error_msg("Removing leading '/' from member names\n"); + error_msg("Removing leading '/' from member names"); alreadyWarned=TRUE; } header_name++; @@ -1111,7 +1111,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void* /* open the file we want to archive, and make sure all is well */ if ((inputFileFd = open(fileName, O_RDONLY)) < 0) { - error_msg("%s: Cannot open: %s\n", fileName, strerror(errno)); + error_msg("%s: Cannot open: %s", fileName, strerror(errno)); return( FALSE); } @@ -1150,7 +1150,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, /* Make sure there is at least one file to tar up. */ if (*argv == NULL) - error_msg_and_die("Cowardly refusing to create an empty archive\n"); + error_msg_and_die("Cowardly refusing to create an empty archive"); /* Open the tar file for writing. */ if (!strcmp(tarName, "-")) @@ -1193,7 +1193,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv, /* Hang up the tools, close up shop, head home */ close(tarFd); if (errorFlag == TRUE) { - error_msg("Error exit delayed from previous errors\n"); + error_msg("Error exit delayed from previous errors"); freeHardLinkInfo(&tbInfo.hlInfoHead); return(FALSE); } @@ -584,7 +584,7 @@ static int getport(char * p) if ((unsigned)(port - 1 ) > 65534) { - error_msg_and_die("%s: bad port number\n", p); + error_msg_and_die("%s: bad port number", p); } return port; } @@ -596,7 +596,7 @@ static struct in_addr getserver(char * host) struct hostent * he; if ((he = gethostbyname(host)) == NULL) { - error_msg_and_die("%s: Unknown host\n", host); + error_msg_and_die("%s: Unknown host", host); } memcpy(&addr, he->h_addr, sizeof addr); @@ -184,7 +184,7 @@ test_main(int argc, char** argv) if (strcmp(applet_name, "[") == 0) { if (strcmp(argv[--argc], "]")) - error_msg_and_die("missing ]\n"); + error_msg_and_die("missing ]"); argv[argc] = NULL; } /* Implement special cases from POSIX.2, section 4.62.4 */ @@ -233,9 +233,9 @@ syntax(op, msg) char *msg; { if (op && *op) - error_msg_and_die("%s: %s\n", op, msg); + error_msg_and_die("%s: %s", op, msg); else - error_msg_and_die("%s\n", msg); + error_msg_and_die("%s", msg); } static int @@ -470,13 +470,13 @@ getn(s) r = strtol(s, &p, 10); if (errno != 0) - error_msg_and_die("%s: out of range\n", s); + error_msg_and_die("%s: out of range", s); while (isspace(*p)) p++; if (*p) - error_msg_and_die("%s: bad number\n", s); + error_msg_and_die("%s: bad number", s); return (int) r; } @@ -186,7 +186,7 @@ extern int tr_main(int argc, char **argv) input_length = complement(input, input_length); if (argv[index] != NULL) { if (*argv[index] == '\0') - error_msg_and_die("STRING2 cannot be empty\n"); + error_msg_and_die("STRING2 cannot be empty"); output_length = expand(argv[index], output); map(input, input_length, output, output_length); } @@ -81,7 +81,7 @@ void mtab_read(void) return; if ((fp = setmntent(mtab_file, "r")) == NULL) { - error_msg("Cannot open %s\n", mtab_file); + error_msg("Cannot open %s", mtab_file); return; } while ((e = getmntent(fp))) { @@ -181,7 +181,7 @@ static int do_umount(const char *name, int useMtab) if (status != 0 && doForce == TRUE) { status = umount2(blockDevice, MNT_FORCE); if (status != 0) { - error_msg_and_die("forced umount of %s failed!\n", blockDevice); + error_msg_and_die("forced umount of %s failed!", blockDevice); } } #endif @@ -189,9 +189,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) { - error_msg("%s busy - remounted read-only\n", blockDevice); + error_msg("%s busy - remounted read-only", blockDevice); } else { - error_msg("Cannot remount %s read-only\n", blockDevice); + error_msg("Cannot remount %s read-only", blockDevice); } } if (status == 0) { diff --git a/util-linux/fbset.c b/util-linux/fbset.c index 637896bed..f20c284aa 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c @@ -284,7 +284,7 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn, } } #else - error_msg( "mode reading not compiled in\n"); + error_msg( "mode reading not compiled in"); #endif return 0; } @@ -434,7 +434,7 @@ extern int fbset_main(int argc, char **argv) perror_msg_and_die("fbset(ioctl)"); if (g_options & OPT_READMODE) { if (!readmode(&var, modefile, mode)) { - error_msg("Unknown video mode `%s'\n", mode); + error_msg("Unknown video mode `%s'", mode); return EXIT_FAILURE; } } diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 18841ec56..9d7622006 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c @@ -290,7 +290,7 @@ static void show_usage(void) static void die(const char *str) { - error_msg("%s\n", str); + error_msg("%s", str); leave(8); } diff --git a/util-linux/getopt.c b/util-linux/getopt.c index ff55a3e3c..625263184 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c @@ -258,7 +258,7 @@ void add_long_options(char *options) arg_opt=required_argument; } if (strlen(tokptr) == 0) - error_msg("empty long option after -l or --long argument\n"); + error_msg("empty long option after -l or --long argument"); } add_longopt(tokptr,arg_opt); } @@ -277,7 +277,7 @@ void set_shell(const char *new_shell) else if (!strcmp(new_shell,"csh")) shell=TCSH; else - error_msg("unknown shell after -s or --shell argument\n"); + error_msg("unknown shell after -s or --shell argument"); } @@ -326,7 +326,7 @@ int getopt_main(int argc, char *argv[]) printf(" --\n"); exit(0); } else - error_msg_and_die("missing optstring argument\n"); + error_msg_and_die("missing optstring argument"); } if (argv[1][0] != '-' || compatible) { @@ -377,7 +377,7 @@ int getopt_main(int argc, char *argv[]) if (!optstr) { if (optind >= argc) - error_msg_and_die("missing optstring argument\n"); + error_msg_and_die("missing optstring argument"); else { optstr=xmalloc(strlen(argv[optind])+1); strcpy(optstr,argv[optind]); diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 21965d3b1..a2b6d8a6e 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c @@ -279,7 +279,7 @@ static void check_mount(void) if (!mnt) return; - error_msg_and_die("%s is mounted; will not make a filesystem here!\n", device_name); + error_msg_and_die("%s is mounted; will not make a filesystem here!", device_name); } static long valid_offset(int fd, int offset) @@ -336,28 +336,28 @@ static void write_tables(void) Super.s_state &= ~MINIX_ERROR_FS; if (lseek(DEV, 0, SEEK_SET)) - error_msg_and_die("seek to boot block failed in write_tables\n"); + error_msg_and_die("seek to boot block failed in write_tables"); if (512 != write(DEV, boot_block_buffer, 512)) - error_msg_and_die("unable to clear boot sector\n"); + error_msg_and_die("unable to clear boot sector"); if (BLOCK_SIZE != lseek(DEV, BLOCK_SIZE, SEEK_SET)) - error_msg_and_die("seek failed in write_tables\n"); + error_msg_and_die("seek failed in write_tables"); if (BLOCK_SIZE != write(DEV, super_block_buffer, BLOCK_SIZE)) - error_msg_and_die("unable to write super-block\n"); + error_msg_and_die("unable to write super-block"); if (IMAPS * BLOCK_SIZE != write(DEV, inode_map, IMAPS * BLOCK_SIZE)) - error_msg_and_die("unable to write inode map\n"); + error_msg_and_die("unable to write inode map"); if (ZMAPS * BLOCK_SIZE != write(DEV, zone_map, ZMAPS * BLOCK_SIZE)) - error_msg_and_die("unable to write zone map\n"); + error_msg_and_die("unable to write zone map"); if (INODE_BUFFER_SIZE != write(DEV, inode_buffer, INODE_BUFFER_SIZE)) - error_msg_and_die("unable to write inodes\n"); + error_msg_and_die("unable to write inodes"); } static void write_block(int blk, char *buffer) { if (blk * BLOCK_SIZE != lseek(DEV, blk * BLOCK_SIZE, SEEK_SET)) - error_msg_and_die("seek failed in write_block\n"); + error_msg_and_die("seek failed in write_block"); if (BLOCK_SIZE != write(DEV, buffer, BLOCK_SIZE)) - error_msg_and_die("write failed in write_block\n"); + error_msg_and_die("write failed in write_block"); } static int get_free_block(void) @@ -365,7 +365,7 @@ static int get_free_block(void) int blk; if (used_good_blocks + 1 >= MAX_GOOD_BLOCKS) - error_msg_and_die("too many bad blocks\n"); + error_msg_and_die("too many bad blocks"); if (used_good_blocks) blk = good_blocks_table[used_good_blocks - 1] + 1; else @@ -373,7 +373,7 @@ static int get_free_block(void) while (blk < ZONES && zone_in_use(blk)) blk++; if (blk >= ZONES) - error_msg_and_die("not enough good blocks\n"); + error_msg_and_die("not enough good blocks"); good_blocks_table[used_good_blocks] = blk; used_good_blocks++; return blk; @@ -439,7 +439,7 @@ static void make_bad_inode(void) goto end_bad; } } - error_msg_and_die("too many bad blocks\n"); + error_msg_and_die("too many bad blocks"); end_bad: if (ind) write_block(ind, (char *) ind_block); @@ -489,7 +489,7 @@ static void make_bad_inode2(void) } } /* Could make triple indirect block here */ - error_msg_and_die("too many bad blocks\n"); + error_msg_and_die("too many bad blocks"); end_bad: if (ind) write_block(ind, (char *) ind_block); @@ -590,7 +590,7 @@ static void setup_tables(void) * /sbin/mkfs.minix -i 200 test.fs * */ if (i >= 999) { - error_msg_and_die("unable to allocate buffers for maps\n"); + error_msg_and_die("unable to allocate buffers for maps"); } FIRSTZONE = NORM_FIRSTZONE; inode_map = xmalloc(IMAPS * BLOCK_SIZE); @@ -621,7 +621,7 @@ long do_check(char *buffer, int try, unsigned int current_block) /* Seek to the correct loc. */ if (lseek(DEV, current_block * BLOCK_SIZE, SEEK_SET) != current_block * BLOCK_SIZE) { - error_msg_and_die("seek failed during testing of blocks\n"); + error_msg_and_die("seek failed during testing of blocks"); } @@ -661,7 +661,7 @@ static void check_blocks(void) while (currently_testing < ZONES) { if (lseek(DEV, currently_testing * BLOCK_SIZE, SEEK_SET) != currently_testing * BLOCK_SIZE) - error_msg_and_die("seek failed in check_blocks\n"); + error_msg_and_die("seek failed in check_blocks"); try = TEST_BUFFER_BLOCKS; if (currently_testing + try > ZONES) try = ZONES - currently_testing; @@ -670,7 +670,7 @@ static void check_blocks(void) if (got == try) continue; if (currently_testing < FIRSTZONE) - error_msg_and_die("bad blocks before data-area: cannot make fs\n"); + error_msg_and_die("bad blocks before data-area: cannot make fs"); mark_zone(currently_testing); badblocks++; currently_testing++; @@ -690,7 +690,7 @@ char *filename; listfile = fopen(filename, "r"); if (listfile == (FILE *) NULL) { - error_msg_and_die("can't open file of bad blocks\n"); + error_msg_and_die("can't open file of bad blocks"); } while (!feof(listfile)) { fscanf(listfile, "%ld\n", &blockno); @@ -712,10 +712,10 @@ extern int mkfs_minix_main(int argc, char **argv) int stopIt=FALSE; if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE) - error_msg_and_die("bad inode size\n"); + error_msg_and_die("bad inode size"); #ifdef BB_FEATURE_MINIX2 if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE) - error_msg_and_die("bad inode size\n"); + error_msg_and_die("bad inode size"); #endif /* Parse options */ @@ -781,7 +781,7 @@ extern int mkfs_minix_main(int argc, char **argv) #ifdef BB_FEATURE_MINIX2 version2 = 1; #else - error_msg("%s: not compiled with minix v2 support\n", + error_msg("%s: not compiled with minix v2 support", device_name); exit(-1); #endif @@ -832,13 +832,13 @@ goodbye: strcpy(tmp + 2, ".badblocks"); DEV = open(device_name, O_RDWR); if (DEV < 0) - error_msg_and_die("unable to open %s\n", device_name); + error_msg_and_die("unable to open %s", device_name); if (fstat(DEV, &statbuf) < 0) - error_msg_and_die("unable to stat %s\n", device_name); + error_msg_and_die("unable to stat %s", device_name); if (!S_ISBLK(statbuf.st_mode)) check = 0; else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340) - error_msg_and_die("will not try to make filesystem on '%s'\n", device_name); + error_msg_and_die("will not try to make filesystem on '%s'", device_name); setup_tables(); if (check) check_blocks(); diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index 8a3c900f3..7d690ad99 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c @@ -87,7 +87,7 @@ static void init_signature_page() #ifdef PAGE_SIZE if (pagesize != PAGE_SIZE) - error_msg("Assuming pages of size %d\n", pagesize); + error_msg("Assuming pages of size %d", pagesize); #endif signature_page = (int *) xmalloc(pagesize); memset(signature_page, 0, pagesize); @@ -185,7 +185,7 @@ static void page_bad(int page) bit_test_and_clear(signature_page, page); else { if (badpages == MAX_BADPAGES) - error_msg_and_die("too many bad pages\n"); + error_msg_and_die("too many bad pages"); p->badpages[badpages] = page; } badpages++; @@ -206,7 +206,7 @@ static void check_blocks(void) } if (do_seek && lseek(DEV, current_page * pagesize, SEEK_SET) != current_page * pagesize) - error_msg_and_die("seek failed in check_blocks\n"); + error_msg_and_die("seek failed in check_blocks"); if ((do_seek = (pagesize != read(DEV, buffer, pagesize)))) { page_bad(current_page++); continue; @@ -307,14 +307,14 @@ int mkswap_main(int argc, char **argv) } } if (!device_name) { - error_msg("error: Nowhere to set up swap on?\n"); + error_msg("error: Nowhere to set up swap on?"); usage(mkswap_usage); } sz = get_size(device_name); if (!PAGES) { PAGES = sz; } else if (PAGES > sz && !force) { - error_msg("error: size %ld is larger than device size %d\n", + error_msg("error: size %ld is larger than device size %d", PAGES * (pagesize / 1024), sz * (pagesize / 1024)); return EXIT_FAILURE; } @@ -330,11 +330,11 @@ int mkswap_main(int argc, char **argv) version = 1; } if (version != 0 && version != 1) { - error_msg("error: unknown version %d\n", version); + error_msg("error: unknown version %d", version); usage(mkswap_usage); } if (PAGES < 10) { - error_msg("error: swap area needs to be at least %ldkB\n", + error_msg("error: swap area needs to be at least %ldkB", (long) (10 * pagesize / 1024)); usage(mkswap_usage); } @@ -353,7 +353,7 @@ int mkswap_main(int argc, char **argv) #endif if (PAGES > maxpages) { PAGES = maxpages; - error_msg("warning: truncating swap area to %ldkB\n", + error_msg("warning: truncating swap area to %ldkB", PAGES * pagesize / 1024); } @@ -363,7 +363,7 @@ int mkswap_main(int argc, char **argv) if (!S_ISBLK(statbuf.st_mode)) check = 0; else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340) - error_msg_and_die("Will not try to make swapdevice on '%s'\n", device_name); + error_msg_and_die("Will not try to make swapdevice on '%s'", device_name); #ifdef __sparc__ if (!force && version == 0) { @@ -372,7 +372,7 @@ int mkswap_main(int argc, char **argv) unsigned short *q, sum; if (read(DEV, buffer, 512) != 512) - error_msg_and_die("fatal: first page unreadable\n"); + error_msg_and_die("fatal: first page unreadable"); if (buffer[508] == 0xDA && buffer[509] == 0xBE) { q = (unsigned short *) (buffer + 510); for (sum = 0; q >= (unsigned short *) buffer;) @@ -381,7 +381,7 @@ int mkswap_main(int argc, char **argv) error_msg("Device '%s' contains a valid Sun disklabel.\n" "This probably means creating v0 swap would destroy your partition table\n" "No swap created. If you really want to create swap v0 on that device, use\n" -"the -f option to force it.\n", device_name); +"the -f option to force it.", device_name); return EXIT_FAILURE; } } @@ -391,7 +391,7 @@ int mkswap_main(int argc, char **argv) if (version == 0 || check) check_blocks(); if (version == 0 && !bit_test_and_clear(signature_page, 0)) - error_msg_and_die("fatal: first page unreadable\n"); + error_msg_and_die("fatal: first page unreadable"); if (version == 1) { p->version = version; p->last_page = PAGES - 1; @@ -400,23 +400,23 @@ int mkswap_main(int argc, char **argv) goodpages = PAGES - badpages - 1; if (goodpages <= 0) - error_msg_and_die("Unable to set up swap-space: unreadable\n"); + error_msg_and_die("Unable to set up swap-space: unreadable"); printf("Setting up swapspace version %d, size = %ld bytes\n", version, (long) (goodpages * pagesize)); write_signature((version == 0) ? "SWAP-SPACE" : "SWAPSPACE2"); offset = ((version == 0) ? 0 : 1024); if (lseek(DEV, offset, SEEK_SET) != offset) - error_msg_and_die("unable to rewind swap-device\n"); + error_msg_and_die("unable to rewind swap-device"); if (write(DEV, (char *) signature_page + offset, pagesize - offset) != pagesize - offset) - error_msg_and_die("unable to write signature page\n"); + error_msg_and_die("unable to write signature page"); /* * A subsequent swapon() will fail if the signature * is not actually on disk. (This is a kernel bug.) */ if (fsync(DEV)) - error_msg_and_die("fsync failed\n"); + error_msg_and_die("fsync failed"); return EXIT_SUCCESS; } diff --git a/util-linux/mount.c b/util-linux/mount.c index f78786ebc..b571e5035 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -132,20 +132,20 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, specialfile = find_unused_loop_device(); if (specialfile == NULL) { - error_msg_and_die("Could not find a spare loop device\n"); + error_msg_and_die("Could not find a spare loop device"); } if (set_loop(specialfile, lofile, 0, &loro)) { - error_msg_and_die("Could not setup loop device\n"); + error_msg_and_die("Could not setup loop device"); } if (!(flags & MS_RDONLY) && loro) { /* loop is ro, but wanted rw */ - error_msg("WARNING: loop device is read-only\n"); + error_msg("WARNING: loop device is read-only"); flags &= ~MS_RDONLY; } } #endif status = mount(specialfile, dir, filesystemtype, flags, string_flags); if (errno == EROFS) { - error_msg("%s is write-protected, mounting read-only\n", specialfile); + error_msg("%s is write-protected, mounting read-only", specialfile); status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags); } } @@ -171,7 +171,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype, #endif if (errno == EPERM) { - error_msg_and_die("permission denied. Are you root?\n"); + error_msg_and_die("permission denied. Are you root?"); } return (FALSE); diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c index b260a885f..397858b71 100644 --- a/util-linux/nfsmount.c +++ b/util-linux/nfsmount.c @@ -307,7 +307,7 @@ int nfsmount(const char *spec, const char *node, int *flags, msock = fsock = -1; mclient = NULL; if (strlen(spec) >= sizeof(hostdir)) { - error_msg("excessively long host:dir argument\n"); + error_msg("excessively long host:dir argument"); goto fail; } strcpy(hostdir, spec); @@ -319,10 +319,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'; - error_msg("warning: multiple hostnames not supported\n"); + error_msg("warning: multiple hostnames not supported"); } } else { - error_msg("directory to mount not in host:dir format\n"); + error_msg("directory to mount not in host:dir format"); goto fail; } @@ -332,11 +332,11 @@ int nfsmount(const char *spec, const char *node, int *flags, #endif { if ((hp = gethostbyname(hostname)) == NULL) { - error_msg("can't get address for %s\n", hostname); + error_msg("can't get address for %s", hostname); goto fail; } else { if (hp->h_length > sizeof(struct in_addr)) { - error_msg("got bad hp->h_length\n"); + error_msg("got bad hp->h_length"); hp->h_length = sizeof(struct in_addr); } memcpy(&server_addr.sin_addr, @@ -353,7 +353,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)) { - error_msg("excessively long option argument\n"); + error_msg("excessively long option argument"); goto fail; } sprintf(new_opts, "%s%saddr=%s", @@ -513,11 +513,11 @@ int nfsmount(const char *spec, const char *node, int *flags, data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); #endif if (nfsvers > MAX_NFSPROT) { - error_msg("NFSv%d not supported!\n", nfsvers); + error_msg("NFSv%d not supported!", nfsvers); return 0; } if (mountvers > MAX_NFSPROT) { - error_msg("NFSv%d not supported!\n", nfsvers); + error_msg("NFSv%d not supported!", nfsvers); return 0; } if (nfsvers && !mountvers) @@ -577,11 +577,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) { - error_msg("can't get address for %s\n", hostname); + error_msg("can't get address for %s", hostname); goto fail; } else { if (hp->h_length > sizeof(struct in_addr)) { - error_msg("got bad hp->h_length?\n"); + error_msg("got bad hp->h_length?"); hp->h_length = sizeof(struct in_addr); } mount_server_addr.sin_family = AF_INET; @@ -716,7 +716,7 @@ int nfsmount(const char *spec, const char *node, int *flags, if (nfsvers == 2) { if (status.nfsv2.fhs_status != 0) { - error_msg("%s:%s failed, reason given by server: %s\n", + error_msg("%s:%s failed, reason given by server: %s", hostname, dirname, nfs_strerror(status.nfsv2.fhs_status)); goto fail; @@ -734,7 +734,7 @@ int nfsmount(const char *spec, const char *node, int *flags, #if NFS_MOUNT_VERSION >= 4 fhandle3 *fhandle; if (status.nfsv3.fhs_status != 0) { - error_msg("%s:%s failed, reason given by server: %s\n", + error_msg("%s:%s failed, reason given by server: %s", hostname, dirname, nfs_strerror(status.nfsv3.fhs_status)); goto fail; diff --git a/util-linux/rdate.c b/util-linux/rdate.c index 0ad339be8..d350be877 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c @@ -72,7 +72,7 @@ time_t askremotedate(char *host) } if (read(fd, (void *)&nett, 4) != 4) { /* read time from server */ close(fd); - error_msg("%s did not send the complete time\n", host); + error_msg("%s did not send the complete time", host); } close(fd); diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index 8a9134ca0..74f6ec36e 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c @@ -95,7 +95,7 @@ extern int swap_on_off_main(int argc, char **argv) struct stat statBuf; if (stat("/etc/fstab", &statBuf) < 0) - error_msg_and_die("/etc/fstab file missing\n"); + error_msg_and_die("/etc/fstab file missing"); } do_em_all(); break; diff --git a/util-linux/umount.c b/util-linux/umount.c index 3772d55f0..39842d232 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c @@ -81,7 +81,7 @@ void mtab_read(void) return; if ((fp = setmntent(mtab_file, "r")) == NULL) { - error_msg("Cannot open %s\n", mtab_file); + error_msg("Cannot open %s", mtab_file); return; } while ((e = getmntent(fp))) { @@ -181,7 +181,7 @@ static int do_umount(const char *name, int useMtab) if (status != 0 && doForce == TRUE) { status = umount2(blockDevice, MNT_FORCE); if (status != 0) { - error_msg_and_die("forced umount of %s failed!\n", blockDevice); + error_msg_and_die("forced umount of %s failed!", blockDevice); } } #endif @@ -189,9 +189,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) { - error_msg("%s busy - remounted read-only\n", blockDevice); + error_msg("%s busy - remounted read-only", blockDevice); } else { - error_msg("Cannot remount %s read-only\n", blockDevice); + error_msg("Cannot remount %s read-only", blockDevice); } } if (status == 0) { @@ -105,6 +105,7 @@ extern void error_msg(const char *s, ...) va_start(p, s); verror_msg(s, p); va_end(p); + putc('\n', stderr); } extern void error_msg_and_die(const char *s, ...) @@ -114,6 +115,7 @@ extern void error_msg_and_die(const char *s, ...) va_start(p, s); verror_msg(s, p); va_end(p); + putc('\n', stderr); exit(EXIT_FAILURE); } @@ -361,7 +363,7 @@ copy_file(const char *srcName, const char *destName, if ((srcStatBuf.st_dev == dstStatBuf.st_dev) && (srcStatBuf.st_ino == dstStatBuf.st_ino)) { - error_msg("Copying file \"%s\" to itself\n", srcName); + error_msg("Copying file \"%s\" to itself", srcName); return FALSE; } @@ -921,11 +923,11 @@ long my_getpwnamegid(char *name) myuser=getpwnam(name); if (myuser==NULL) - error_msg_and_die( "unknown user name: %s\n", name); + error_msg_and_die( "unknown user name: %s", name); mygroup = getgrgid(myuser->pw_gid); if (mygroup==NULL) - error_msg_and_die( "unknown gid %ld\n", (long)myuser->pw_gid); + error_msg_and_die( "unknown gid %ld", (long)myuser->pw_gid); return mygroup->gr_gid; } @@ -1015,7 +1017,7 @@ int get_console_fd(char *tty_name) if (is_a_console(fd)) return fd; - error_msg("Couldnt get a file descriptor referring to the console\n"); + error_msg("Couldnt get a file descriptor referring to the console"); return -1; /* total failure */ } @@ -1374,7 +1376,7 @@ extern char * xstrndup (const char *s, int n) { char *t; if (s == NULL) - error_msg_and_die("xstrndup bug\n"); + error_msg_and_die("xstrndup bug"); t = xmalloc(n+1); strncpy(t,s,n); @@ -1495,13 +1497,13 @@ extern int find_real_root_device_name(char* name) char fileName[BUFSIZ]; if (stat("/", &rootStat) != 0) { - error_msg("could not stat '/'\n"); + error_msg("could not stat '/'"); return( FALSE); } dir = opendir("/dev"); if (!dir) { - error_msg("could not open '/dev'\n"); + error_msg("could not open '/dev'"); return( FALSE); } @@ -1660,7 +1662,7 @@ void xregcomp(regex_t *preg, const char *regex, int cflags) int errmsgsz = regerror(ret, preg, NULL, 0); char *errmsg = xmalloc(errmsgsz); regerror(ret, preg, errmsg, errmsgsz); - error_msg_and_die("xregcomp: %s\n", errmsg); + error_msg_and_die("xregcomp: %s", errmsg); } } #endif @@ -1707,7 +1709,7 @@ unsigned long parse_number(const char *numstr, struct suffix_mult *suffixes) ret = strtoul(numstr, &end, 10); if (numstr == end) - error_msg_and_die("invalid number `%s'\n", numstr); + error_msg_and_die("invalid number `%s'", numstr); while (end[0] != '\0') { for (sm = suffixes; sm->suffix != NULL; sm++) { len = strlen(sm->suffix); @@ -1718,7 +1720,7 @@ unsigned long parse_number(const char *numstr, struct suffix_mult *suffixes) } } if (sm->suffix == NULL) - error_msg_and_die("invalid number `%s'\n", numstr); + error_msg_and_die("invalid number `%s'", numstr); } return ret; } diff --git a/uudecode.c b/uudecode.c index fcfcfd903..cccc52872 100644 --- a/uudecode.c +++ b/uudecode.c @@ -46,7 +46,7 @@ static int read_stduu (const char *inname) char *p; if (fgets (buf, sizeof(buf), stdin) == NULL) { - error_msg("%s: Short file\n", inname); + error_msg("%s: Short file", inname); return FALSE; } p = buf; @@ -81,7 +81,7 @@ static int read_stduu (const char *inname) if (fgets (buf, sizeof(buf), stdin) == NULL || strcmp (buf, "end\n")) { - error_msg("%s: No `end' line\n", inname); + error_msg("%s: No `end' line", inname); return FALSE; } @@ -131,7 +131,7 @@ static int read_base64 (const char *inname) unsigned char *p; if (fgets (buf, sizeof(buf), stdin) == NULL) { - error_msg("%s: Short file\n", inname); + error_msg("%s: Short file", inname); return FALSE; } p = buf; @@ -139,7 +139,7 @@ static int read_base64 (const char *inname) if (memcmp (buf, "====", 4) == 0) break; if (last_data != 0) { - error_msg("%s: data following `=' padding character\n", inname); + error_msg("%s: data following `=' padding character", inname); return FALSE; } @@ -161,14 +161,14 @@ static int read_base64 (const char *inname) while ((b64_tab[*p] & '\100') != 0) if (*p == '\n' || *p++ == '=') { - error_msg("%s: illegal line\n", inname); + error_msg("%s: illegal line", inname); return FALSE; } c2 = b64_tab[*p++]; while (b64_tab[*p] == '\177') if (*p++ == '\n') { - error_msg("%s: illegal line\n", inname); + error_msg("%s: illegal line", inname); return FALSE; } if (*p == '=') { @@ -180,7 +180,7 @@ static int read_base64 (const char *inname) while (b64_tab[*p] == '\177') if (*p++ == '\n') { - error_msg("%s: illegal line\n", inname); + error_msg("%s: illegal line", inname); return FALSE; } putchar (c1 << 2 | c2 >> 4); @@ -212,7 +212,7 @@ static int decode (const char *inname, while (1) { if (fgets (buf, sizeof (buf), stdin) == NULL) { - error_msg("%s: No `begin' line\n", inname); + error_msg("%s: No `begin' line", inname); return FALSE; } @@ -237,13 +237,13 @@ static int decode (const char *inname, while (*p != '/') ++p; if (*p == '\0') { - error_msg("%s: Illegal ~user\n", inname); + error_msg("%s: Illegal ~user", inname); return FALSE; } *p++ = '\0'; pw = getpwnam (buf + 1); if (pw == NULL) { - error_msg("%s: No user `%s'\n", inname, buf + 1); + error_msg("%s: No user `%s'", inname, buf + 1); return FALSE; } n = strlen (pw->pw_dir); diff --git a/uuencode.c b/uuencode.c index 5df49026b..73098ba26 100644 --- a/uuencode.c +++ b/uuencode.c @@ -142,7 +142,7 @@ static void encode() } if (ferror (stdin)) - error_msg("Read error\n"); + error_msg("Read error"); if (trans_ptr == uu_std) { putchar (ENC ('\0')); @@ -196,7 +196,7 @@ int uuencode_main (int argc, encode(); printf(trans_ptr == uu_std ? "end\n" : "====\n"); if (ferror (stdout)) { - error_msg("Write error\n"); + error_msg("Write error"); return EXIT_FAILURE; } return EXIT_SUCCESS; @@ -148,7 +148,7 @@ int wget_main(int argc, char **argv) #endif } if (do_continue && !fname_out) - error_msg_and_die("cannot specify continue (-c) without a filename (-O)\n"); + error_msg_and_die("cannot specify continue (-c) without a filename (-O)"); /* @@ -200,7 +200,7 @@ int wget_main(int argc, char **argv) */ if (fgets(buf, sizeof(buf), sfp) == NULL) { close_and_delete_outfile(output, fname_out, do_continue); - error_msg_and_die("no response from server\n"); + error_msg_and_die("no response from server"); } for (s = buf ; *s != '\0' && !isspace(*s) ; ++s) ; @@ -230,7 +230,7 @@ int wget_main(int argc, char **argv) } if (strcasecmp(buf, "transfer-encoding") == 0) { close_and_delete_outfile(output, fname_out, do_continue); - error_msg_and_die("server wants to do %s transfer encoding\n", s); + error_msg_and_die("server wants to do %s transfer encoding", s); continue; } } @@ -267,7 +267,7 @@ void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path) *uri_port = 80; if (strncmp(url, "http://", 7) != 0) - error_msg_and_die("not an http url: %s\n", url); + error_msg_and_die("not an http url: %s", url); *uri_host = url + 7; @@ -297,7 +297,7 @@ FILE *open_socket(char *host, int port) memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; if ((hp = (struct hostent *) gethostbyname(host)) == NULL) - error_msg_and_die("cannot resolve %s\n", host); + error_msg_and_die("cannot resolve %s", host); memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length); sin.sin_port = htons(port); @@ -338,7 +338,7 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc) /* verify we are at the end of the header name */ if (*s != ':') - error_msg_and_die("bad header line: %s\n", buf); + error_msg_and_die("bad header line: %s", buf); /* locate the start of the header value */ for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s) @@ -532,7 +532,7 @@ progressmeter(int flag) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: wget.c,v 1.24 2001/01/31 17:49:47 andersen Exp $ + * $Id: wget.c,v 1.25 2001/01/31 19:00:21 kraai Exp $ */ @@ -38,5 +38,5 @@ extern int whoami_main(int argc, char **argv) puts(user); return EXIT_SUCCESS; } - error_msg_and_die("cannot find username for UID %u\n", (unsigned) uid); + error_msg_and_die("cannot find username for UID %u", (unsigned) uid); } |