Removed trailing \n from error_msg{,_and_die} messages.
This commit is contained in:
parent
63ec273245
commit
dd19c69904
@ -113,7 +113,7 @@ int main(int argc, char **argv)
|
|||||||
exit((*(applet->main)) (argc, argv));
|
exit((*(applet->main)) (argc, argv));
|
||||||
}
|
}
|
||||||
|
|
||||||
error_msg_and_die("applet not found\n");
|
error_msg_and_die("applet not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
6
ar.c
6
ar.c
@ -65,9 +65,9 @@ extern ar_headers_t get_headers(int srcFd)
|
|||||||
|
|
||||||
/* check ar magic */
|
/* check ar magic */
|
||||||
if (full_read(srcFd, ar_magic, 8) != 8)
|
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)
|
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) {
|
while (full_read(srcFd, (char *) &raw_ar_header, 60)==60) {
|
||||||
/* check the end of header markers are valid */
|
/* check the end of header markers are valid */
|
||||||
@ -168,7 +168,7 @@ extern int ar_main(int argc, char **argv)
|
|||||||
usage(ar_usage);
|
usage(ar_usage);
|
||||||
|
|
||||||
if ( (srcFd = open(argv[optind], O_RDONLY)) < 0)
|
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++;
|
optind++;
|
||||||
head = get_headers(srcFd);
|
head = get_headers(srcFd);
|
||||||
|
@ -65,9 +65,9 @@ extern ar_headers_t get_headers(int srcFd)
|
|||||||
|
|
||||||
/* check ar magic */
|
/* check ar magic */
|
||||||
if (full_read(srcFd, ar_magic, 8) != 8)
|
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)
|
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) {
|
while (full_read(srcFd, (char *) &raw_ar_header, 60)==60) {
|
||||||
/* check the end of header markers are valid */
|
/* check the end of header markers are valid */
|
||||||
@ -168,7 +168,7 @@ extern int ar_main(int argc, char **argv)
|
|||||||
usage(ar_usage);
|
usage(ar_usage);
|
||||||
|
|
||||||
if ( (srcFd = open(argv[optind], O_RDONLY)) < 0)
|
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++;
|
optind++;
|
||||||
head = get_headers(srcFd);
|
head = get_headers(srcFd);
|
||||||
|
@ -118,7 +118,7 @@ extern int dpkg_deb_main(int argc, char **argv)
|
|||||||
extract_flag = TRUE;
|
extract_flag = TRUE;
|
||||||
strcpy(ar_filename, "data.tar.gz");
|
strcpy(ar_filename, "data.tar.gz");
|
||||||
if ( (optind + 2) > argc ) {
|
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]));
|
target_dir = (char *) xmalloc(strlen(argv[optind+1]));
|
||||||
strcpy(target_dir, 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;
|
list_flag = TRUE;
|
||||||
strcpy(ar_filename, "data.tar.gz");
|
strcpy(ar_filename, "data.tar.gz");
|
||||||
if ( (optind + 2) > argc ) {
|
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]));
|
target_dir = (char *) xmalloc(strlen(argv[optind+1]));
|
||||||
strcpy(target_dir, 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);
|
*ar_headers = get_headers(srcFd);
|
||||||
if (ar_headers->next==NULL)
|
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) {
|
while (ar_headers->next != NULL) {
|
||||||
if (strcmp(ar_headers->name, ar_filename)==0)
|
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);
|
mkdir(target_dir, 0755);
|
||||||
}
|
}
|
||||||
if (chdir(target_dir)==-1) {
|
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);
|
status = readTarFile(srcFd, extract_flag, list_flag, extract_to_stdout, verbose_flag, NULL, extract_list);
|
||||||
|
@ -297,7 +297,7 @@ int in; /* input file descriptor */
|
|||||||
|
|
||||||
method = (int) get_byte();
|
method = (int) get_byte();
|
||||||
if (method != DEFLATED) {
|
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;
|
exit_code = ERROR;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1116,11 +1116,11 @@ int in, out; /* input and output file descriptors */
|
|||||||
if (res == 3) {
|
if (res == 3) {
|
||||||
error_msg(memory_exhausted);
|
error_msg(memory_exhausted);
|
||||||
} else if (res != 0) {
|
} else if (res != 0) {
|
||||||
error_msg("invalid compressed data--format violated\n");
|
error_msg("invalid compressed data--format violated");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
error_msg("internal error, invalid method\n");
|
error_msg("internal error, invalid method");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the crc and original length */
|
/* Get the crc and original length */
|
||||||
@ -1149,15 +1149,15 @@ int in, out; /* input and output file descriptors */
|
|||||||
|
|
||||||
/* Validate decompression */
|
/* Validate decompression */
|
||||||
if (orig_crc != updcrc(outbuf, 0)) {
|
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) {
|
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 */
|
/* Check if there are more entries in a pkzip file */
|
||||||
if (pkzip && inptr + 4 < insize && LG(inbuf + inptr) == LOCSIG) {
|
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)
|
if (exit_code == OK)
|
||||||
exit_code = WARNING;
|
exit_code = WARNING;
|
||||||
}
|
}
|
||||||
@ -1261,9 +1261,9 @@ int gunzip_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isatty(fileno(stdin)) && fromstdin==1 && force==0)
|
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)
|
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();
|
gunzip_init();
|
||||||
|
|
||||||
|
@ -1382,7 +1382,7 @@ int length;
|
|||||||
(char *) window + start, length) != EQUAL) {
|
(char *) window + start, length) != EQUAL) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" start %d, match %d, length %d\n", start, match, length);
|
" start %d, match %d, length %d\n", start, match, length);
|
||||||
error_msg("invalid match\n");
|
error_msg("invalid match");
|
||||||
}
|
}
|
||||||
if (verbose > 1) {
|
if (verbose > 1) {
|
||||||
fprintf(stderr, "\\[%d,%d]", start - match, length);
|
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)
|
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)
|
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;
|
foreground = signal(SIGINT, SIG_IGN) != SIG_IGN;
|
||||||
if (foreground) {
|
if (foreground) {
|
||||||
@ -2894,7 +2894,7 @@ int eof; /* true if this is the last block for a file */
|
|||||||
#endif
|
#endif
|
||||||
/* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
|
/* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
|
||||||
if (buf == (char *) 0)
|
if (buf == (char *) 0)
|
||||||
error_msg("block vanished\n");
|
error_msg("block vanished");
|
||||||
|
|
||||||
copy_block(buf, (unsigned) stored_len, 0); /* without header */
|
copy_block(buf, (unsigned) stored_len, 0); /* without header */
|
||||||
compressed_len = stored_len << 3;
|
compressed_len = stored_len << 3;
|
||||||
@ -3077,7 +3077,7 @@ local void set_file_type()
|
|||||||
bin_freq += dyn_ltree[n++].Freq;
|
bin_freq += dyn_ltree[n++].Freq;
|
||||||
*file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII;
|
*file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII;
|
||||||
if (*file_type == BINARY && translate_eol) {
|
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 */
|
/* Copy the program name first */
|
||||||
if (oargc-- < 0)
|
if (oargc-- < 0)
|
||||||
error_msg("argc<=0\n");
|
error_msg("argc<=0");
|
||||||
*(nargv++) = *(oargv++);
|
*(nargv++) = *(oargv++);
|
||||||
|
|
||||||
/* Then copy the environment args */
|
/* Then copy the environment args */
|
||||||
|
@ -165,10 +165,10 @@ extern int tar_unzip_init(int tarFd)
|
|||||||
signal(SIGCHLD, child_died);
|
signal(SIGCHLD, child_died);
|
||||||
|
|
||||||
if (pipe(unzip_pipe)!=0)
|
if (pipe(unzip_pipe)!=0)
|
||||||
error_msg_and_die("pipe error\n");
|
error_msg_and_die("pipe error");
|
||||||
|
|
||||||
if ( (child_pid = fork()) == -1)
|
if ( (child_pid = fork()) == -1)
|
||||||
error_msg_and_die("fork failure\n");
|
error_msg_and_die("fork failure");
|
||||||
|
|
||||||
if (child_pid==0) {
|
if (child_pid==0) {
|
||||||
/* child process */
|
/* child process */
|
||||||
@ -259,7 +259,7 @@ extern int tar_main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
if (*tarName != '-')
|
if (*tarName != '-')
|
||||||
error_msg_and_die( "Only one 'f' option allowed\n");
|
error_msg_and_die( "Only one 'f' option allowed");
|
||||||
tarName = optarg;
|
tarName = optarg;
|
||||||
break;
|
break;
|
||||||
#if defined BB_FEATURE_TAR_EXCLUDE
|
#if defined BB_FEATURE_TAR_EXCLUDE
|
||||||
@ -294,11 +294,11 @@ extern int tar_main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if (createFlag == TRUE) {
|
if (createFlag == TRUE) {
|
||||||
#ifndef BB_FEATURE_TAR_CREATE
|
#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
|
#else
|
||||||
#ifdef BB_FEATURE_TAR_GZIP
|
#ifdef BB_FEATURE_TAR_GZIP
|
||||||
if (unzipFlag==TRUE)
|
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
|
#endif
|
||||||
status = writeTarFile(tarName, verboseFlag, argv + optind, excludeList);
|
status = writeTarFile(tarName, verboseFlag, argv + optind, excludeList);
|
||||||
#endif
|
#endif
|
||||||
@ -330,7 +330,7 @@ extern int tar_main(int argc, char **argv)
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
flagError:
|
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
|
static void
|
||||||
@ -383,7 +383,7 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
}
|
}
|
||||||
if ( (readSize = full_read(header->tarFd, buffer, readSize)) <= 0 ) {
|
if ( (readSize = full_read(header->tarFd, buffer, readSize)) <= 0 ) {
|
||||||
/* Tarball seems to have a problem */
|
/* Tarball seems to have a problem */
|
||||||
error_msg("Unexpected EOF in archive\n");
|
error_msg("Unexpected EOF in archive");
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
if ( readSize < writeSize )
|
if ( readSize < writeSize )
|
||||||
@ -476,7 +476,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
/* Do not change permissions or date on symlink,
|
/* Do not change permissions or date on symlink,
|
||||||
* since it changes the pointed to file instead. duh. */
|
* since it changes the pointed to file instead. duh. */
|
||||||
#else
|
#else
|
||||||
error_msg("%s: Cannot create symlink to '%s': %s\n",
|
error_msg("%s: Cannot create symlink to '%s': %s",
|
||||||
header->name, header->linkname,
|
header->name, header->linkname,
|
||||||
"symlinks not supported");
|
"symlinks not supported");
|
||||||
#endif
|
#endif
|
||||||
@ -543,7 +543,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header)
|
|||||||
++*(header->name);
|
++*(header->name);
|
||||||
|
|
||||||
if (alreadyWarned == FALSE) {
|
if (alreadyWarned == FALSE) {
|
||||||
error_msg("Removing leading '/' from member names\n");
|
error_msg("Removing leading '/' from member names");
|
||||||
alreadyWarned = TRUE;
|
alreadyWarned = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -644,7 +644,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag,
|
|||||||
goto endgame;
|
goto endgame;
|
||||||
} else {
|
} else {
|
||||||
errorFlag=TRUE;
|
errorFlag=TRUE;
|
||||||
error_msg("Bad tar header, skipping\n");
|
error_msg("Bad tar header, skipping");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -791,7 +791,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag,
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
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);
|
close( tarFd);
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
@ -803,7 +803,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag,
|
|||||||
return ( FALSE);
|
return ( FALSE);
|
||||||
}
|
}
|
||||||
else if (errorFlag==TRUE) {
|
else if (errorFlag==TRUE) {
|
||||||
error_msg( "Error exit delayed from previous errors\n");
|
error_msg( "Error exit delayed from previous errors");
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
} else
|
} else
|
||||||
return( status);
|
return( status);
|
||||||
@ -813,7 +813,7 @@ endgame:
|
|||||||
close( tarFd);
|
close( tarFd);
|
||||||
if ( *(header.name) == '\0' ) {
|
if ( *(header.name) == '\0' ) {
|
||||||
if (errorFlag==TRUE)
|
if (errorFlag==TRUE)
|
||||||
error_msg( "Error exit delayed from previous errors\n");
|
error_msg( "Error exit delayed from previous errors");
|
||||||
else
|
else
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
@ -1002,7 +1002,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *header_name,
|
|||||||
header.typeflag = REGTYPE;
|
header.typeflag = REGTYPE;
|
||||||
putOctal(header.size, sizeof(header.size), statbuf->st_size);
|
putOctal(header.size, sizeof(header.size), statbuf->st_size);
|
||||||
} else {
|
} else {
|
||||||
error_msg("%s: Unknown file type\n", real_name);
|
error_msg("%s: Unknown file type", real_name);
|
||||||
return ( FALSE);
|
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 */
|
/* It is against the rules to archive a socket */
|
||||||
if (S_ISSOCK(statbuf->st_mode)) {
|
if (S_ISSOCK(statbuf->st_mode)) {
|
||||||
error_msg("%s: socket ignored\n", fileName);
|
error_msg("%s: socket ignored", fileName);
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1070,7 +1070,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
|
|||||||
* the new tarball */
|
* the new tarball */
|
||||||
if (tbInfo->statBuf.st_dev == statbuf->st_dev &&
|
if (tbInfo->statBuf.st_dev == statbuf->st_dev &&
|
||||||
tbInfo->statBuf.st_ino == statbuf->st_ino) {
|
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);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1078,7 +1078,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
|
|||||||
while (header_name[0] == '/') {
|
while (header_name[0] == '/') {
|
||||||
static int alreadyWarned=FALSE;
|
static int alreadyWarned=FALSE;
|
||||||
if (alreadyWarned==FALSE) {
|
if (alreadyWarned==FALSE) {
|
||||||
error_msg("Removing leading '/' from member names\n");
|
error_msg("Removing leading '/' from member names");
|
||||||
alreadyWarned=TRUE;
|
alreadyWarned=TRUE;
|
||||||
}
|
}
|
||||||
header_name++;
|
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 */
|
/* open the file we want to archive, and make sure all is well */
|
||||||
if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
|
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);
|
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. */
|
/* Make sure there is at least one file to tar up. */
|
||||||
if (*argv == NULL)
|
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. */
|
/* Open the tar file for writing. */
|
||||||
if (!strcmp(tarName, "-"))
|
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 */
|
/* Hang up the tools, close up shop, head home */
|
||||||
close(tarFd);
|
close(tarFd);
|
||||||
if (errorFlag == TRUE) {
|
if (errorFlag == TRUE) {
|
||||||
error_msg("Error exit delayed from previous errors\n");
|
error_msg("Error exit delayed from previous errors");
|
||||||
freeHardLinkInfo(&tbInfo.hlInfoHead);
|
freeHardLinkInfo(&tbInfo.hlInfoHead);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ int main(int argc, char **argv)
|
|||||||
exit((*(applet->main)) (argc, argv));
|
exit((*(applet->main)) (argc, argv));
|
||||||
}
|
}
|
||||||
|
|
||||||
error_msg_and_die("applet not found\n");
|
error_msg_and_die("applet not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
|||||||
case CHMOD_APP:
|
case CHMOD_APP:
|
||||||
/* Parse the specified modes */
|
/* Parse the specified modes */
|
||||||
if (parse_mode(theMode, &(statbuf->st_mode)) == FALSE) {
|
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)
|
if (chmod(fileName, statbuf->st_mode) == 0)
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@ -150,7 +150,7 @@ int chmod_chown_chgrp_main(int argc, char **argv)
|
|||||||
if (*argv == p)
|
if (*argv == p)
|
||||||
uid = my_getpwnam(*argv);
|
uid = my_getpwnam(*argv);
|
||||||
if (uid == -1) {
|
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;
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
bad_group:
|
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();
|
input_backward();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error_msg("\n*** Error: minimum screen width is %d\n", cmdedit_termw);
|
error_msg("\n*** Error: minimum screen width is %d", cmdedit_termw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,9 +31,9 @@ int deallocvt_main(int argc, char *argv[])
|
|||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
num = atoi(argv[i]);
|
num = atoi(argv[i]);
|
||||||
if (num == 0)
|
if (num == 0)
|
||||||
error_msg("0: illegal VT number\n");
|
error_msg("0: illegal VT number");
|
||||||
else if (num == 1)
|
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))
|
else if (ioctl(fd, VT_DISALLOCATE, num))
|
||||||
perror_msg_and_die("VT_DISALLOCATE");
|
perror_msg_and_die("VT_DISALLOCATE");
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ int dumpkmap_main(int argc, char **argv)
|
|||||||
ke.kb_table = i;
|
ke.kb_table = i;
|
||||||
if (ioctl(fd, KDGKBENT, &ke) < 0) {
|
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 {
|
else {
|
||||||
write(1,(void*)&ke.kb_value,2);
|
write(1,(void*)&ke.kb_value,2);
|
||||||
|
@ -70,7 +70,7 @@ int screen_map_load(int fd, FILE * fp)
|
|||||||
if (parse_failed) {
|
if (parse_failed) {
|
||||||
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||||
if (errno == ESPIPE)
|
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
|
else
|
||||||
perror_msg_and_die("fseek failed reading binary 16bit screen-map");
|
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");
|
perror_msg_and_die("Cannot read [new] map from file");
|
||||||
#if 0
|
#if 0
|
||||||
else
|
else
|
||||||
error_msg("Input screen-map is binary.\n");
|
error_msg("Input screen-map is binary.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ int screen_map_load(int fd, FILE * fp)
|
|||||||
/* rewind... */
|
/* rewind... */
|
||||||
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||||
if (errno == ESPIPE)
|
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);
|
exit(1);
|
||||||
else
|
else
|
||||||
perror_msg_and_die("fseek failed assuming 8bit screen-map");
|
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 (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||||
if (errno == ESPIPE)
|
if (errno == ESPIPE)
|
||||||
/* should not - it succedeed above */
|
/* should not - it succedeed above */
|
||||||
error_msg_and_die("fseek() returned ESPIPE !\n");
|
error_msg_and_die("fseek() returned ESPIPE !");
|
||||||
else
|
else
|
||||||
perror_msg_and_die("fseek for binary 8bit screen-map");
|
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");
|
perror_msg_and_die("Cannot read [old] map from file");
|
||||||
#if 0
|
#if 0
|
||||||
else
|
else
|
||||||
error_msg("Input screen-map is binary.\n");
|
error_msg("Input screen-map is binary.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ int screen_map_load(int fd, FILE * fp)
|
|||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
error_msg("Error parsing symbolic map\n");
|
error_msg("Error parsing symbolic map");
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
|
|||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
|
|
||||||
if (unit < 1 || unit > 32)
|
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++)
|
for (i = 0; i < fontsize; i++)
|
||||||
memcpy(buf + (32 * i), inbuf + (unit * i), unit);
|
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)) {
|
if (ioctl(fd, PIO_UNIMAPCLR, &advice)) {
|
||||||
#ifdef ENOIOCTLCMD
|
#ifdef ENOIOCTLCMD
|
||||||
if (errno == ENOIOCTLCMD) {
|
if (errno == ENOIOCTLCMD) {
|
||||||
error_msg("It seems this kernel is older than 1.1.92\n");
|
error_msg("It seems this kernel is older than 1.1.92");
|
||||||
error_msg_and_die("No Unicode mapping table loaded.\n");
|
error_msg_and_die("No Unicode mapping table loaded.");
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
perror_msg_and_die("PIO_UNIMAPCLR");
|
perror_msg_and_die("PIO_UNIMAPCLR");
|
||||||
@ -174,11 +174,11 @@ static void loadnewfont(int fd)
|
|||||||
goto no_psf;
|
goto no_psf;
|
||||||
|
|
||||||
if (psfhdr.mode > PSF_MAXMODE)
|
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);
|
fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256);
|
||||||
#if !defined( PIO_FONTX ) || defined( __sparc__ )
|
#if !defined( PIO_FONTX ) || defined( __sparc__ )
|
||||||
if (fontsize != 256)
|
if (fontsize != 256)
|
||||||
error_msg_and_die("Only fontsize 256 supported\n");
|
error_msg_and_die("Only fontsize 256 supported");
|
||||||
#endif
|
#endif
|
||||||
hastable = (psfhdr.mode & PSF_MODEHASTAB);
|
hastable = (psfhdr.mode & PSF_MODEHASTAB);
|
||||||
unit = psfhdr.charsize;
|
unit = psfhdr.charsize;
|
||||||
@ -186,7 +186,7 @@ static void loadnewfont(int fd)
|
|||||||
|
|
||||||
head = head0 + fontsize * unit;
|
head = head0 + fontsize * unit;
|
||||||
if (head > inputlth || (!hastable && head != inputlth))
|
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);
|
do_loadfont(fd, inbuf + head0, unit, fontsize);
|
||||||
if (hastable)
|
if (hastable)
|
||||||
do_loadtable(fd, inbuf + head, inputlth - head, fontsize);
|
do_loadtable(fd, inbuf + head, inputlth - head, fontsize);
|
||||||
@ -201,7 +201,7 @@ static void loadnewfont(int fd)
|
|||||||
} else {
|
} else {
|
||||||
/* bare font */
|
/* bare font */
|
||||||
if (inputlth & 0377)
|
if (inputlth & 0377)
|
||||||
error_msg_and_die("Bad input file size\n");
|
error_msg_and_die("Bad input file size");
|
||||||
offset = 0;
|
offset = 0;
|
||||||
unit = inputlth / 256;
|
unit = inputlth / 256;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ int loadkmap_main(int argc, char **argv)
|
|||||||
|
|
||||||
read(0, buff, 7);
|
read(0, buff, 7);
|
||||||
if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 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))
|
if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS))
|
||||||
perror_msg_and_die("Error reading keymap flags");
|
perror_msg_and_die("Error reading keymap flags");
|
||||||
|
@ -52,18 +52,18 @@ setkeycodes_main(int argc, char** argv)
|
|||||||
a.keycode = atoi(argv[2]);
|
a.keycode = atoi(argv[2]);
|
||||||
a.scancode = sc = strtol(argv[1], &ep, 16);
|
a.scancode = sc = strtol(argv[1], &ep, 16);
|
||||||
if (*ep) {
|
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) {
|
if (a.scancode > 127) {
|
||||||
a.scancode -= 0xe000;
|
a.scancode -= 0xe000;
|
||||||
a.scancode += 128;
|
a.scancode += 128;
|
||||||
}
|
}
|
||||||
if (a.scancode > 255 || a.keycode > 127) {
|
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)) {
|
if (ioctl(fd,KDSETKEYCODE,&a)) {
|
||||||
perror("KDSETKEYCODE");
|
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;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
|
@ -54,12 +54,12 @@ static void decompose_list(const char *list)
|
|||||||
/* the list must contain only digits and no more than one minus sign */
|
/* the list must contain only digits and no more than one minus sign */
|
||||||
for (ptr = (char *)list; *ptr; ptr++) {
|
for (ptr = (char *)list; *ptr; ptr++) {
|
||||||
if (!isdigit(*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 == '-') {
|
if (*ptr == '-') {
|
||||||
nminus++;
|
nminus++;
|
||||||
if (nminus > 1) {
|
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) {
|
if (nminus == 0) {
|
||||||
startpos = strtol(list, &ptr, 10);
|
startpos = strtol(list, &ptr, 10);
|
||||||
if (startpos == 0) {
|
if (startpos == 0) {
|
||||||
error_msg_and_die("missing list of fields\n");
|
error_msg_and_die("missing list of fields");
|
||||||
}
|
}
|
||||||
endpos = startpos;
|
endpos = startpos;
|
||||||
}
|
}
|
||||||
@ -188,14 +188,14 @@ extern int cut_main(int argc, char **argv)
|
|||||||
case 'f':
|
case 'f':
|
||||||
/* make sure they didn't ask for two types of lists */
|
/* make sure they didn't ask for two types of lists */
|
||||||
if (part != 0) {
|
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;
|
part = (char)opt;
|
||||||
decompose_list(optarg);
|
decompose_list(optarg);
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
if (strlen(optarg) > 1) {
|
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];
|
delim = optarg[0];
|
||||||
break;
|
break;
|
||||||
@ -209,17 +209,17 @@ extern int cut_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (part == 0) {
|
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') {
|
if (supress_non_delimited_lines && part != 'f') {
|
||||||
error_msg_and_die("suppressing non-delimited lines makes sense"
|
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') {
|
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
|
/* argv[(optind)..(argc-1)] should be names of file to process. If no
|
||||||
|
@ -76,7 +76,7 @@ int dd_main(int argc, char **argv)
|
|||||||
sync = TRUE;
|
sync = TRUE;
|
||||||
buf += 4;
|
buf += 4;
|
||||||
} else {
|
} 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')
|
if (buf[0] == '\0')
|
||||||
break;
|
break;
|
||||||
|
@ -118,7 +118,7 @@ extern int df_main(int argc, char **argv)
|
|||||||
for(i = optind; i < argc; i++)
|
for(i = optind; i < argc; i++)
|
||||||
{
|
{
|
||||||
if ((mountEntry = find_mount_point(argv[i], mtab_file)) == 0) {
|
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;
|
status = EXIT_FAILURE;
|
||||||
} else if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir))
|
} else if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir))
|
||||||
status = EXIT_FAILURE;
|
status = EXIT_FAILURE;
|
||||||
|
@ -76,14 +76,14 @@ int expr_main (int argc, char **argv)
|
|||||||
VALUE *v;
|
VALUE *v;
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
error_msg_and_die("too few arguments\n");
|
error_msg_and_die("too few arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
args = argv + 1;
|
args = argv + 1;
|
||||||
|
|
||||||
v = eval ();
|
v = eval ();
|
||||||
if (*args)
|
if (*args)
|
||||||
error_msg_and_die ("syntax error\n");
|
error_msg_and_die ("syntax error");
|
||||||
|
|
||||||
if (v->type == integer)
|
if (v->type == integer)
|
||||||
printf ("%d\n", v->u.i);
|
printf ("%d\n", v->u.i);
|
||||||
@ -218,7 +218,7 @@ static \
|
|||||||
int name (l, r) VALUE *l; VALUE *r; \
|
int name (l, r) VALUE *l; VALUE *r; \
|
||||||
{ \
|
{ \
|
||||||
if (!toarith (l) || !toarith (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; \
|
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; \
|
int name (l, r) VALUE *l; VALUE *r; \
|
||||||
{ \
|
{ \
|
||||||
if (!toarith (l) || !toarith (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) \
|
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; \
|
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;
|
re_syntax_options = RE_SYNTAX_POSIX_BASIC;
|
||||||
errmsg = re_compile_pattern (pv->u.s, len, &re_buffer);
|
errmsg = re_compile_pattern (pv->u.s, len, &re_buffer);
|
||||||
if (errmsg) {
|
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);
|
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;
|
VALUE *v;
|
||||||
|
|
||||||
if (!*args)
|
if (!*args)
|
||||||
error_msg_and_die ( "syntax error\n");
|
error_msg_and_die ( "syntax error");
|
||||||
|
|
||||||
if (nextarg ("(")) {
|
if (nextarg ("(")) {
|
||||||
args++;
|
args++;
|
||||||
v = eval ();
|
v = eval ();
|
||||||
if (!nextarg (")"))
|
if (!nextarg (")"))
|
||||||
error_msg_and_die ( "syntax error\n");
|
error_msg_and_die ( "syntax error");
|
||||||
args++;
|
args++;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextarg (")"))
|
if (nextarg (")"))
|
||||||
error_msg_and_die ( "syntax error\n");
|
error_msg_and_die ( "syntax error");
|
||||||
|
|
||||||
return str_value (*args++);
|
return str_value (*args++);
|
||||||
}
|
}
|
||||||
@ -329,7 +329,7 @@ static VALUE *eval6 (void)
|
|||||||
if (nextarg ("quote")) {
|
if (nextarg ("quote")) {
|
||||||
args++;
|
args++;
|
||||||
if (!*args)
|
if (!*args)
|
||||||
error_msg_and_die ( "syntax error\n");
|
error_msg_and_die ( "syntax error");
|
||||||
return str_value (*args++);
|
return str_value (*args++);
|
||||||
}
|
}
|
||||||
else if (nextarg ("length")) {
|
else if (nextarg ("length")) {
|
||||||
|
@ -77,7 +77,7 @@ extern int id_main(int argc, char **argv)
|
|||||||
pwnam=my_getpwnam(user);
|
pwnam=my_getpwnam(user);
|
||||||
grnam=my_getgrnam(group);
|
grnam=my_getgrnam(group);
|
||||||
if (gid == -1 || pwnam==-1 || grnam==-1) {
|
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) {
|
if (no_group) {
|
||||||
|
@ -37,5 +37,5 @@ extern int logname_main(int argc, char **argv)
|
|||||||
puts(user);
|
puts(user);
|
||||||
return EXIT_SUCCESS;
|
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)
|
if (split_3(line, line_length, &md5num, &binary, &filename)
|
||||||
|| !hex_digits(md5num)) {
|
|| !hex_digits(md5num)) {
|
||||||
if (warn) {
|
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);
|
checkfile_name, (unsigned long) line_number);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -764,7 +764,7 @@ static int md5_check(const char *checkfile_name)
|
|||||||
while (!feof(checkfile_stream) && !ferror(checkfile_stream));
|
while (!feof(checkfile_stream) && !ferror(checkfile_stream));
|
||||||
|
|
||||||
if (ferror(checkfile_stream)) {
|
if (ferror(checkfile_stream)) {
|
||||||
error_msg("%s: read error\n", checkfile_name); /* */
|
error_msg("%s: read error", checkfile_name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -775,7 +775,7 @@ static int md5_check(const char *checkfile_name)
|
|||||||
|
|
||||||
if (n_properly_formated_lines == 0) {
|
if (n_properly_formated_lines == 0) {
|
||||||
/* Warn if no tests are found. */
|
/* 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);
|
checkfile_name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
@ -784,13 +784,13 @@ static int md5_check(const char *checkfile_name)
|
|||||||
- n_open_or_read_failures);
|
- n_open_or_read_failures);
|
||||||
|
|
||||||
if (n_open_or_read_failures > 0) {
|
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);
|
n_open_or_read_failures, n_properly_formated_lines);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n_mismatched_checksums > 0) {
|
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);
|
n_mismatched_checksums, n_computed_checkums);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -855,26 +855,26 @@ int md5sum_main(int argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (file_type_specified && do_check) {
|
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) {
|
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) {
|
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) {
|
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) {
|
if (n_strings > 0) {
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (optind < argc) {
|
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) {
|
for (i = 0; i < n_strings; ++i) {
|
||||||
size_t cnt;
|
size_t cnt;
|
||||||
@ -887,7 +887,7 @@ int md5sum_main(int argc,
|
|||||||
}
|
}
|
||||||
} else if (do_check) {
|
} else if (do_check) {
|
||||||
if (optind + 1 < argc) {
|
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]);
|
err = md5_check ((optind == argc) ? "-" : argv[optind]);
|
||||||
@ -940,11 +940,11 @@ int md5sum_main(int argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fclose (stdout) == EOF) {
|
if (fclose (stdout) == EOF) {
|
||||||
error_msg_and_die("write error\n");
|
error_msg_and_die("write error");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (have_read_stdin && fclose (stdin) == EOF) {
|
if (have_read_stdin && fclose (stdin) == EOF) {
|
||||||
error_msg_and_die("standard input\n");
|
error_msg_and_die("standard input");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
|
@ -52,7 +52,7 @@ extern int mkdir_main(int argc, char **argv)
|
|||||||
/* Find the specified modes */
|
/* Find the specified modes */
|
||||||
mode = 0;
|
mode = 0;
|
||||||
if (parse_mode(*(++argv), &mode) == FALSE) {
|
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
|
/* Set the umask for this process so it doesn't
|
||||||
* screw up whatever the user just entered. */
|
* screw up whatever the user just entered. */
|
||||||
@ -85,7 +85,7 @@ extern int mkdir_main(int argc, char **argv)
|
|||||||
strcpy(buf, *argv);
|
strcpy(buf, *argv);
|
||||||
status = stat(buf, &statBuf);
|
status = stat(buf, &statBuf);
|
||||||
if (parentFlag == FALSE && status != -1 && errno != ENOENT) {
|
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) {
|
if (parentFlag == TRUE) {
|
||||||
strcat(buf, "/");
|
strcat(buf, "/");
|
||||||
|
@ -184,7 +184,7 @@ test_main(int argc, char** argv)
|
|||||||
|
|
||||||
if (strcmp(applet_name, "[") == 0) {
|
if (strcmp(applet_name, "[") == 0) {
|
||||||
if (strcmp(argv[--argc], "]"))
|
if (strcmp(argv[--argc], "]"))
|
||||||
error_msg_and_die("missing ]\n");
|
error_msg_and_die("missing ]");
|
||||||
argv[argc] = NULL;
|
argv[argc] = NULL;
|
||||||
}
|
}
|
||||||
/* Implement special cases from POSIX.2, section 4.62.4 */
|
/* Implement special cases from POSIX.2, section 4.62.4 */
|
||||||
@ -233,9 +233,9 @@ syntax(op, msg)
|
|||||||
char *msg;
|
char *msg;
|
||||||
{
|
{
|
||||||
if (op && *op)
|
if (op && *op)
|
||||||
error_msg_and_die("%s: %s\n", op, msg);
|
error_msg_and_die("%s: %s", op, msg);
|
||||||
else
|
else
|
||||||
error_msg_and_die("%s\n", msg);
|
error_msg_and_die("%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -470,13 +470,13 @@ getn(s)
|
|||||||
r = strtol(s, &p, 10);
|
r = strtol(s, &p, 10);
|
||||||
|
|
||||||
if (errno != 0)
|
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))
|
while (isspace(*p))
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
if (*p)
|
if (*p)
|
||||||
error_msg_and_die("%s: bad number\n", s);
|
error_msg_and_die("%s: bad number", s);
|
||||||
|
|
||||||
return (int) r;
|
return (int) r;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ extern int tr_main(int argc, char **argv)
|
|||||||
input_length = complement(input, input_length);
|
input_length = complement(input, input_length);
|
||||||
if (argv[index] != NULL) {
|
if (argv[index] != NULL) {
|
||||||
if (*argv[index] == '\0')
|
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);
|
output_length = expand(argv[index], output);
|
||||||
map(input, input_length, output, output_length);
|
map(input, input_length, output, output_length);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ static int read_stduu (const char *inname)
|
|||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (fgets (buf, sizeof(buf), stdin) == NULL) {
|
if (fgets (buf, sizeof(buf), stdin) == NULL) {
|
||||||
error_msg("%s: Short file\n", inname);
|
error_msg("%s: Short file", inname);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
p = buf;
|
p = buf;
|
||||||
@ -81,7 +81,7 @@ static int read_stduu (const char *inname)
|
|||||||
|
|
||||||
if (fgets (buf, sizeof(buf), stdin) == NULL
|
if (fgets (buf, sizeof(buf), stdin) == NULL
|
||||||
|| strcmp (buf, "end\n")) {
|
|| strcmp (buf, "end\n")) {
|
||||||
error_msg("%s: No `end' line\n", inname);
|
error_msg("%s: No `end' line", inname);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ static int read_base64 (const char *inname)
|
|||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
|
|
||||||
if (fgets (buf, sizeof(buf), stdin) == NULL) {
|
if (fgets (buf, sizeof(buf), stdin) == NULL) {
|
||||||
error_msg("%s: Short file\n", inname);
|
error_msg("%s: Short file", inname);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
p = buf;
|
p = buf;
|
||||||
@ -139,7 +139,7 @@ static int read_base64 (const char *inname)
|
|||||||
if (memcmp (buf, "====", 4) == 0)
|
if (memcmp (buf, "====", 4) == 0)
|
||||||
break;
|
break;
|
||||||
if (last_data != 0) {
|
if (last_data != 0) {
|
||||||
error_msg("%s: data following `=' padding character\n", inname);
|
error_msg("%s: data following `=' padding character", inname);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,14 +161,14 @@ static int read_base64 (const char *inname)
|
|||||||
|
|
||||||
while ((b64_tab[*p] & '\100') != 0)
|
while ((b64_tab[*p] & '\100') != 0)
|
||||||
if (*p == '\n' || *p++ == '=') {
|
if (*p == '\n' || *p++ == '=') {
|
||||||
error_msg("%s: illegal line\n", inname);
|
error_msg("%s: illegal line", inname);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
c2 = b64_tab[*p++];
|
c2 = b64_tab[*p++];
|
||||||
|
|
||||||
while (b64_tab[*p] == '\177')
|
while (b64_tab[*p] == '\177')
|
||||||
if (*p++ == '\n') {
|
if (*p++ == '\n') {
|
||||||
error_msg("%s: illegal line\n", inname);
|
error_msg("%s: illegal line", inname);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (*p == '=') {
|
if (*p == '=') {
|
||||||
@ -180,7 +180,7 @@ static int read_base64 (const char *inname)
|
|||||||
|
|
||||||
while (b64_tab[*p] == '\177')
|
while (b64_tab[*p] == '\177')
|
||||||
if (*p++ == '\n') {
|
if (*p++ == '\n') {
|
||||||
error_msg("%s: illegal line\n", inname);
|
error_msg("%s: illegal line", inname);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
putchar (c1 << 2 | c2 >> 4);
|
putchar (c1 << 2 | c2 >> 4);
|
||||||
@ -212,7 +212,7 @@ static int decode (const char *inname,
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (fgets (buf, sizeof (buf), stdin) == NULL) {
|
if (fgets (buf, sizeof (buf), stdin) == NULL) {
|
||||||
error_msg("%s: No `begin' line\n", inname);
|
error_msg("%s: No `begin' line", inname);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,13 +237,13 @@ static int decode (const char *inname,
|
|||||||
while (*p != '/')
|
while (*p != '/')
|
||||||
++p;
|
++p;
|
||||||
if (*p == '\0') {
|
if (*p == '\0') {
|
||||||
error_msg("%s: Illegal ~user\n", inname);
|
error_msg("%s: Illegal ~user", inname);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
pw = getpwnam (buf + 1);
|
pw = getpwnam (buf + 1);
|
||||||
if (pw == NULL) {
|
if (pw == NULL) {
|
||||||
error_msg("%s: No user `%s'\n", inname, buf + 1);
|
error_msg("%s: No user `%s'", inname, buf + 1);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
n = strlen (pw->pw_dir);
|
n = strlen (pw->pw_dir);
|
||||||
|
@ -142,7 +142,7 @@ static void encode()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ferror (stdin))
|
if (ferror (stdin))
|
||||||
error_msg("Read error\n");
|
error_msg("Read error");
|
||||||
|
|
||||||
if (trans_ptr == uu_std) {
|
if (trans_ptr == uu_std) {
|
||||||
putchar (ENC ('\0'));
|
putchar (ENC ('\0'));
|
||||||
@ -196,7 +196,7 @@ int uuencode_main (int argc,
|
|||||||
encode();
|
encode();
|
||||||
printf(trans_ptr == uu_std ? "end\n" : "====\n");
|
printf(trans_ptr == uu_std ? "end\n" : "====\n");
|
||||||
if (ferror (stdout)) {
|
if (ferror (stdout)) {
|
||||||
error_msg("Write error\n");
|
error_msg("Write error");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
@ -38,5 +38,5 @@ extern int whoami_main(int argc, char **argv)
|
|||||||
puts(user);
|
puts(user);
|
||||||
return EXIT_SUCCESS;
|
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);
|
||||||
}
|
}
|
||||||
|
2
cp_mv.c
2
cp_mv.c
@ -282,7 +282,7 @@ extern int cp_mv_main(int argc, char **argv)
|
|||||||
if ((sb.st_ino == srcStatBuf.st_ino) &&
|
if ((sb.st_ino == srcStatBuf.st_ino) &&
|
||||||
(sb.st_dev == srcStatBuf.st_dev)) {
|
(sb.st_dev == srcStatBuf.st_dev)) {
|
||||||
error_msg("Cannot %s `%s' into a subdirectory of itself, "
|
error_msg("Cannot %s `%s' into a subdirectory of itself, "
|
||||||
"`%s/%s'\n", applet_name, baseSrcName,
|
"`%s/%s'", applet_name, baseSrcName,
|
||||||
baseDestName, baseSrcName);
|
baseDestName, baseSrcName);
|
||||||
state = -1;
|
state = -1;
|
||||||
continue;
|
continue;
|
||||||
|
16
cut.c
16
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 */
|
/* the list must contain only digits and no more than one minus sign */
|
||||||
for (ptr = (char *)list; *ptr; ptr++) {
|
for (ptr = (char *)list; *ptr; ptr++) {
|
||||||
if (!isdigit(*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 == '-') {
|
if (*ptr == '-') {
|
||||||
nminus++;
|
nminus++;
|
||||||
if (nminus > 1) {
|
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) {
|
if (nminus == 0) {
|
||||||
startpos = strtol(list, &ptr, 10);
|
startpos = strtol(list, &ptr, 10);
|
||||||
if (startpos == 0) {
|
if (startpos == 0) {
|
||||||
error_msg_and_die("missing list of fields\n");
|
error_msg_and_die("missing list of fields");
|
||||||
}
|
}
|
||||||
endpos = startpos;
|
endpos = startpos;
|
||||||
}
|
}
|
||||||
@ -188,14 +188,14 @@ extern int cut_main(int argc, char **argv)
|
|||||||
case 'f':
|
case 'f':
|
||||||
/* make sure they didn't ask for two types of lists */
|
/* make sure they didn't ask for two types of lists */
|
||||||
if (part != 0) {
|
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;
|
part = (char)opt;
|
||||||
decompose_list(optarg);
|
decompose_list(optarg);
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
if (strlen(optarg) > 1) {
|
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];
|
delim = optarg[0];
|
||||||
break;
|
break;
|
||||||
@ -209,17 +209,17 @@ extern int cut_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (part == 0) {
|
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') {
|
if (supress_non_delimited_lines && part != 'f') {
|
||||||
error_msg_and_die("suppressing non-delimited lines makes sense"
|
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') {
|
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
|
/* argv[(optind)..(argc-1)] should be names of file to process. If no
|
||||||
|
6
dc.c
6
dc.c
@ -14,14 +14,14 @@ static unsigned int pointer;
|
|||||||
static void push(double a)
|
static void push(double a)
|
||||||
{
|
{
|
||||||
if (pointer >= (sizeof(stack) / sizeof(*stack)))
|
if (pointer >= (sizeof(stack) / sizeof(*stack)))
|
||||||
error_msg_and_die("stack overflow\n");
|
error_msg_and_die("stack overflow");
|
||||||
stack[pointer++] = a;
|
stack[pointer++] = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
static double pop()
|
static double pop()
|
||||||
{
|
{
|
||||||
if (pointer == 0)
|
if (pointer == 0)
|
||||||
error_msg_and_die("stack underflow\n");
|
error_msg_and_die("stack underflow");
|
||||||
return stack[--pointer];
|
return stack[--pointer];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ static void stack_machine(const char *argument)
|
|||||||
}
|
}
|
||||||
o++;
|
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
|
/* return pointer to next token in buffer and set *buffer to one char
|
||||||
|
2
dd.c
2
dd.c
@ -76,7 +76,7 @@ int dd_main(int argc, char **argv)
|
|||||||
sync = TRUE;
|
sync = TRUE;
|
||||||
buf += 4;
|
buf += 4;
|
||||||
} else {
|
} 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')
|
if (buf[0] == '\0')
|
||||||
break;
|
break;
|
||||||
|
@ -31,9 +31,9 @@ int deallocvt_main(int argc, char *argv[])
|
|||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
num = atoi(argv[i]);
|
num = atoi(argv[i]);
|
||||||
if (num == 0)
|
if (num == 0)
|
||||||
error_msg("0: illegal VT number\n");
|
error_msg("0: illegal VT number");
|
||||||
else if (num == 1)
|
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))
|
else if (ioctl(fd, VT_DISALLOCATE, num))
|
||||||
perror_msg_and_die("VT_DISALLOCATE");
|
perror_msg_and_die("VT_DISALLOCATE");
|
||||||
}
|
}
|
||||||
|
2
df.c
2
df.c
@ -118,7 +118,7 @@ extern int df_main(int argc, char **argv)
|
|||||||
for(i = optind; i < argc; i++)
|
for(i = optind; i < argc; i++)
|
||||||
{
|
{
|
||||||
if ((mountEntry = find_mount_point(argv[i], mtab_file)) == 0) {
|
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;
|
status = EXIT_FAILURE;
|
||||||
} else if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir))
|
} else if (!df(mountEntry->mnt_fsname, mountEntry->mnt_dir))
|
||||||
status = EXIT_FAILURE;
|
status = EXIT_FAILURE;
|
||||||
|
@ -118,7 +118,7 @@ extern int dpkg_deb_main(int argc, char **argv)
|
|||||||
extract_flag = TRUE;
|
extract_flag = TRUE;
|
||||||
strcpy(ar_filename, "data.tar.gz");
|
strcpy(ar_filename, "data.tar.gz");
|
||||||
if ( (optind + 2) > argc ) {
|
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]));
|
target_dir = (char *) xmalloc(strlen(argv[optind+1]));
|
||||||
strcpy(target_dir, 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;
|
list_flag = TRUE;
|
||||||
strcpy(ar_filename, "data.tar.gz");
|
strcpy(ar_filename, "data.tar.gz");
|
||||||
if ( (optind + 2) > argc ) {
|
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]));
|
target_dir = (char *) xmalloc(strlen(argv[optind+1]));
|
||||||
strcpy(target_dir, 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);
|
*ar_headers = get_headers(srcFd);
|
||||||
if (ar_headers->next==NULL)
|
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) {
|
while (ar_headers->next != NULL) {
|
||||||
if (strcmp(ar_headers->name, ar_filename)==0)
|
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);
|
mkdir(target_dir, 0755);
|
||||||
}
|
}
|
||||||
if (chdir(target_dir)==-1) {
|
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);
|
status = readTarFile(srcFd, extract_flag, list_flag, extract_to_stdout, verbose_flag, NULL, extract_list);
|
||||||
|
@ -81,7 +81,7 @@ int dumpkmap_main(int argc, char **argv)
|
|||||||
ke.kb_table = i;
|
ke.kb_table = i;
|
||||||
if (ioctl(fd, KDGKBENT, &ke) < 0) {
|
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 {
|
else {
|
||||||
write(1,(void*)&ke.kb_value,2);
|
write(1,(void*)&ke.kb_value,2);
|
||||||
|
@ -169,7 +169,7 @@ static int get_address(struct sed_cmd *sed_cmd, const char *str, int *line, rege
|
|||||||
else if (my_str[idx] == '/') {
|
else if (my_str[idx] == '/') {
|
||||||
idx = index_of_next_unescaped_regexp_delim(sed_cmd, my_str, ++idx);
|
idx = index_of_next_unescaped_regexp_delim(sed_cmd, my_str, ++idx);
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
error_msg_and_die("unterminated match expression\n");
|
error_msg_and_die("unterminated match expression");
|
||||||
my_str[idx] = '\0';
|
my_str[idx] = '\0';
|
||||||
*regex = (regex_t *)xmalloc(sizeof(regex_t));
|
*regex = (regex_t *)xmalloc(sizeof(regex_t));
|
||||||
xregcomp(*regex, my_str+1, 0);
|
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 {
|
else {
|
||||||
error_msg("get_address: no address found in string\n"
|
error_msg("get_address: no address found in string\n"
|
||||||
"\t(you probably didn't check the string you passed me)\n");
|
"\t(you probably didn't check the string you passed me)");
|
||||||
idx = -1;
|
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
|
/* verify that the 's' is followed by something. That something
|
||||||
* (typically a 'slash') is now our regexp delimiter... */
|
* (typically a 'slash') is now our regexp delimiter... */
|
||||||
if (!substr[++idx])
|
if (!substr[++idx])
|
||||||
error_msg_and_die("bad format in substitution expression\n");
|
error_msg_and_die("bad format in substitution expression");
|
||||||
else
|
else
|
||||||
sed_cmd->delimiter=substr[idx];
|
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;
|
oldidx = idx+1;
|
||||||
idx = index_of_next_unescaped_regexp_delim(sed_cmd, substr, ++idx);
|
idx = index_of_next_unescaped_regexp_delim(sed_cmd, substr, ++idx);
|
||||||
if (idx == -1)
|
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);
|
match = strdup_substr(substr, oldidx, idx);
|
||||||
|
|
||||||
/* determine the number of back references in the match string */
|
/* 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;
|
oldidx = idx+1;
|
||||||
idx = index_of_next_unescaped_regexp_delim(sed_cmd, substr, ++idx);
|
idx = index_of_next_unescaped_regexp_delim(sed_cmd, substr, ++idx);
|
||||||
if (idx == -1)
|
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);
|
sed_cmd->replace = strdup_substr(substr, oldidx, idx);
|
||||||
|
|
||||||
/* process the flags */
|
/* 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]))
|
if (strchr("; \t\v\n\r", substr[idx]))
|
||||||
goto out;
|
goto out;
|
||||||
/* else */
|
/* 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'))
|
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 */
|
/* store the edit line text */
|
||||||
/* make editline big enough to accomodate the extra '\n' we will tack on
|
/* 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 */
|
/* last part (mandatory) will be a command */
|
||||||
if (cmdstr[idx] == '\0')
|
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 */
|
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];
|
sed_cmd->cmd = cmdstr[idx];
|
||||||
|
|
||||||
/* special-case handling for (s)ubstitution */
|
/* 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 */
|
/* special-case handling for (a)ppend, (i)nsert, and (c)hange */
|
||||||
else if (strchr("aic", cmdstr[idx])) {
|
else if (strchr("aic", cmdstr[idx])) {
|
||||||
if (sed_cmd->end_line || sed_cmd->end_match)
|
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]);
|
idx += parse_edit_cmd(sed_cmd, &cmdstr[idx]);
|
||||||
}
|
}
|
||||||
/* if it was a single-letter command (such as 'p' or 'd') we need to
|
/* if it was a single-letter command (such as 'p' or 'd') we need to
|
||||||
|
20
expr.c
20
expr.c
@ -76,14 +76,14 @@ int expr_main (int argc, char **argv)
|
|||||||
VALUE *v;
|
VALUE *v;
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
error_msg_and_die("too few arguments\n");
|
error_msg_and_die("too few arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
args = argv + 1;
|
args = argv + 1;
|
||||||
|
|
||||||
v = eval ();
|
v = eval ();
|
||||||
if (*args)
|
if (*args)
|
||||||
error_msg_and_die ("syntax error\n");
|
error_msg_and_die ("syntax error");
|
||||||
|
|
||||||
if (v->type == integer)
|
if (v->type == integer)
|
||||||
printf ("%d\n", v->u.i);
|
printf ("%d\n", v->u.i);
|
||||||
@ -218,7 +218,7 @@ static \
|
|||||||
int name (l, r) VALUE *l; VALUE *r; \
|
int name (l, r) VALUE *l; VALUE *r; \
|
||||||
{ \
|
{ \
|
||||||
if (!toarith (l) || !toarith (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; \
|
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; \
|
int name (l, r) VALUE *l; VALUE *r; \
|
||||||
{ \
|
{ \
|
||||||
if (!toarith (l) || !toarith (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) \
|
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; \
|
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;
|
re_syntax_options = RE_SYNTAX_POSIX_BASIC;
|
||||||
errmsg = re_compile_pattern (pv->u.s, len, &re_buffer);
|
errmsg = re_compile_pattern (pv->u.s, len, &re_buffer);
|
||||||
if (errmsg) {
|
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);
|
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;
|
VALUE *v;
|
||||||
|
|
||||||
if (!*args)
|
if (!*args)
|
||||||
error_msg_and_die ( "syntax error\n");
|
error_msg_and_die ( "syntax error");
|
||||||
|
|
||||||
if (nextarg ("(")) {
|
if (nextarg ("(")) {
|
||||||
args++;
|
args++;
|
||||||
v = eval ();
|
v = eval ();
|
||||||
if (!nextarg (")"))
|
if (!nextarg (")"))
|
||||||
error_msg_and_die ( "syntax error\n");
|
error_msg_and_die ( "syntax error");
|
||||||
args++;
|
args++;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextarg (")"))
|
if (nextarg (")"))
|
||||||
error_msg_and_die ( "syntax error\n");
|
error_msg_and_die ( "syntax error");
|
||||||
|
|
||||||
return str_value (*args++);
|
return str_value (*args++);
|
||||||
}
|
}
|
||||||
@ -329,7 +329,7 @@ static VALUE *eval6 (void)
|
|||||||
if (nextarg ("quote")) {
|
if (nextarg ("quote")) {
|
||||||
args++;
|
args++;
|
||||||
if (!*args)
|
if (!*args)
|
||||||
error_msg_and_die ( "syntax error\n");
|
error_msg_and_die ( "syntax error");
|
||||||
return str_value (*args++);
|
return str_value (*args++);
|
||||||
}
|
}
|
||||||
else if (nextarg ("length")) {
|
else if (nextarg ("length")) {
|
||||||
|
4
fbset.c
4
fbset.c
@ -284,7 +284,7 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
error_msg( "mode reading not compiled in\n");
|
error_msg( "mode reading not compiled in");
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -434,7 +434,7 @@ extern int fbset_main(int argc, char **argv)
|
|||||||
perror_msg_and_die("fbset(ioctl)");
|
perror_msg_and_die("fbset(ioctl)");
|
||||||
if (g_options & OPT_READMODE) {
|
if (g_options & OPT_READMODE) {
|
||||||
if (!readmode(&var, modefile, mode)) {
|
if (!readmode(&var, modefile, mode)) {
|
||||||
error_msg("Unknown video mode `%s'\n", mode);
|
error_msg("Unknown video mode `%s'", mode);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ static void show_usage(void)
|
|||||||
|
|
||||||
static void die(const char *str)
|
static void die(const char *str)
|
||||||
{
|
{
|
||||||
error_msg("%s\n", str);
|
error_msg("%s", str);
|
||||||
leave(8);
|
leave(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
getopt.c
8
getopt.c
@ -258,7 +258,7 @@ void add_long_options(char *options)
|
|||||||
arg_opt=required_argument;
|
arg_opt=required_argument;
|
||||||
}
|
}
|
||||||
if (strlen(tokptr) == 0)
|
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);
|
add_longopt(tokptr,arg_opt);
|
||||||
}
|
}
|
||||||
@ -277,7 +277,7 @@ void set_shell(const char *new_shell)
|
|||||||
else if (!strcmp(new_shell,"csh"))
|
else if (!strcmp(new_shell,"csh"))
|
||||||
shell=TCSH;
|
shell=TCSH;
|
||||||
else
|
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");
|
printf(" --\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
} else
|
} else
|
||||||
error_msg_and_die("missing optstring argument\n");
|
error_msg_and_die("missing optstring argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv[1][0] != '-' || compatible) {
|
if (argv[1][0] != '-' || compatible) {
|
||||||
@ -377,7 +377,7 @@ int getopt_main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!optstr) {
|
if (!optstr) {
|
||||||
if (optind >= argc)
|
if (optind >= argc)
|
||||||
error_msg_and_die("missing optstring argument\n");
|
error_msg_and_die("missing optstring argument");
|
||||||
else {
|
else {
|
||||||
optstr=xmalloc(strlen(argv[optind])+1);
|
optstr=xmalloc(strlen(argv[optind])+1);
|
||||||
strcpy(optstr,argv[optind]);
|
strcpy(optstr,argv[optind]);
|
||||||
|
16
gunzip.c
16
gunzip.c
@ -297,7 +297,7 @@ int in; /* input file descriptor */
|
|||||||
|
|
||||||
method = (int) get_byte();
|
method = (int) get_byte();
|
||||||
if (method != DEFLATED) {
|
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;
|
exit_code = ERROR;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1116,11 +1116,11 @@ int in, out; /* input and output file descriptors */
|
|||||||
if (res == 3) {
|
if (res == 3) {
|
||||||
error_msg(memory_exhausted);
|
error_msg(memory_exhausted);
|
||||||
} else if (res != 0) {
|
} else if (res != 0) {
|
||||||
error_msg("invalid compressed data--format violated\n");
|
error_msg("invalid compressed data--format violated");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
error_msg("internal error, invalid method\n");
|
error_msg("internal error, invalid method");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the crc and original length */
|
/* Get the crc and original length */
|
||||||
@ -1149,15 +1149,15 @@ int in, out; /* input and output file descriptors */
|
|||||||
|
|
||||||
/* Validate decompression */
|
/* Validate decompression */
|
||||||
if (orig_crc != updcrc(outbuf, 0)) {
|
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) {
|
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 */
|
/* Check if there are more entries in a pkzip file */
|
||||||
if (pkzip && inptr + 4 < insize && LG(inbuf + inptr) == LOCSIG) {
|
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)
|
if (exit_code == OK)
|
||||||
exit_code = WARNING;
|
exit_code = WARNING;
|
||||||
}
|
}
|
||||||
@ -1261,9 +1261,9 @@ int gunzip_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isatty(fileno(stdin)) && fromstdin==1 && force==0)
|
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)
|
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();
|
gunzip_init();
|
||||||
|
|
||||||
|
12
gzip.c
12
gzip.c
@ -1382,7 +1382,7 @@ int length;
|
|||||||
(char *) window + start, length) != EQUAL) {
|
(char *) window + start, length) != EQUAL) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" start %d, match %d, length %d\n", start, match, length);
|
" start %d, match %d, length %d\n", start, match, length);
|
||||||
error_msg("invalid match\n");
|
error_msg("invalid match");
|
||||||
}
|
}
|
||||||
if (verbose > 1) {
|
if (verbose > 1) {
|
||||||
fprintf(stderr, "\\[%d,%d]", start - match, length);
|
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)
|
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)
|
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;
|
foreground = signal(SIGINT, SIG_IGN) != SIG_IGN;
|
||||||
if (foreground) {
|
if (foreground) {
|
||||||
@ -2894,7 +2894,7 @@ int eof; /* true if this is the last block for a file */
|
|||||||
#endif
|
#endif
|
||||||
/* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
|
/* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
|
||||||
if (buf == (char *) 0)
|
if (buf == (char *) 0)
|
||||||
error_msg("block vanished\n");
|
error_msg("block vanished");
|
||||||
|
|
||||||
copy_block(buf, (unsigned) stored_len, 0); /* without header */
|
copy_block(buf, (unsigned) stored_len, 0); /* without header */
|
||||||
compressed_len = stored_len << 3;
|
compressed_len = stored_len << 3;
|
||||||
@ -3077,7 +3077,7 @@ local void set_file_type()
|
|||||||
bin_freq += dyn_ltree[n++].Freq;
|
bin_freq += dyn_ltree[n++].Freq;
|
||||||
*file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII;
|
*file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII;
|
||||||
if (*file_type == BINARY && translate_eol) {
|
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 */
|
/* Copy the program name first */
|
||||||
if (oargc-- < 0)
|
if (oargc-- < 0)
|
||||||
error_msg("argc<=0\n");
|
error_msg("argc<=0");
|
||||||
*(nargv++) = *(oargv++);
|
*(nargv++) = *(oargv++);
|
||||||
|
|
||||||
/* Then copy the environment args */
|
/* Then copy the environment args */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* vi: set sw=4 ts=4: */
|
/* 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
|
* Mini hostname implementation for busybox
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||||
@ -41,7 +41,7 @@ void do_sethostname(char *s, int isfile)
|
|||||||
if (!isfile) {
|
if (!isfile) {
|
||||||
if (sethostname(s, strlen(s)) < 0) {
|
if (sethostname(s, strlen(s)) < 0) {
|
||||||
if (errno == EPERM)
|
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
|
else
|
||||||
perror_msg_and_die("sethostname");
|
perror_msg_and_die("sethostname");
|
||||||
}
|
}
|
||||||
|
2
id.c
2
id.c
@ -77,7 +77,7 @@ extern int id_main(int argc, char **argv)
|
|||||||
pwnam=my_getpwnam(user);
|
pwnam=my_getpwnam(user);
|
||||||
grnam=my_getgrnam(group);
|
grnam=my_getgrnam(group);
|
||||||
if (gid == -1 || pwnam==-1 || grnam==-1) {
|
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) {
|
if (no_group) {
|
||||||
|
70
insmod.c
70
insmod.c
@ -81,7 +81,7 @@
|
|||||||
#ifndef MODUTILS_MODULE_H
|
#ifndef MODUTILS_MODULE_H
|
||||||
static const int MODUTILS_MODULE_H = 1;
|
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.
|
/* 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
|
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
|
#ifndef MODUTILS_OBJ_H
|
||||||
static const int MODUTILS_OBJ_H = 1;
|
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. */
|
/* 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
|
/* Don't report an error if the symbol is coming from
|
||||||
the kernel or some external module. */
|
the kernel or some external module. */
|
||||||
if (secidx <= SHN_HIRESERVE)
|
if (secidx <= SHN_HIRESERVE)
|
||||||
error_msg("%s multiply defined\n", name);
|
error_msg("%s multiply defined", name);
|
||||||
return sym;
|
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. */
|
/* Also check that the parameter was not resolved from the kernel. */
|
||||||
if (sym == NULL || sym->secidx > SHN_HIRESERVE) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1432,7 +1432,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
|
|||||||
str = alloca(strlen(q));
|
str = alloca(strlen(q));
|
||||||
for (r = str, q++; *q != '"'; ++q, ++r) {
|
for (r = str, q++; *q != '"'; ++q, ++r) {
|
||||||
if (*q == '\0') {
|
if (*q == '\0') {
|
||||||
error_msg("improperly terminated string argument for %s\n", p);
|
error_msg("improperly terminated string argument for %s", p);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (*q == '\\')
|
} else if (*q == '\\')
|
||||||
switch (*++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);
|
p = get_modinfo_value(f, key);
|
||||||
key += 5;
|
key += 5;
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
error_msg("invalid parameter %s\n", key);
|
error_msg("invalid parameter %s", key);
|
||||||
return 0;
|
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. */
|
/* Also check that the parameter was not resolved from the kernel. */
|
||||||
if (sym == NULL || sym->secidx > SHN_HIRESERVE) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1822,7 +1822,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
|
|||||||
str = alloca(strlen(q));
|
str = alloca(strlen(q));
|
||||||
for (r = str, q++; *q != '"'; ++q, ++r) {
|
for (r = str, q++; *q != '"'; ++q, ++r) {
|
||||||
if (*q == '\0') {
|
if (*q == '\0') {
|
||||||
error_msg("improperly terminated string argument for %s\n",
|
error_msg("improperly terminated string argument for %s",
|
||||||
key);
|
key);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (*q == '\\')
|
} 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 ? */
|
/* Probably we should do that outside the loop ? */
|
||||||
if (!isdigit(*(p + 1))) {
|
if (!isdigit(*(p + 1))) {
|
||||||
error_msg("parameter type 'c' for %s must be followed by"
|
error_msg("parameter type 'c' for %s must be followed by"
|
||||||
" the maximum size\n", key);
|
" the maximum size", key);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
charssize = strtoul(p + 1, (char **) NULL, 10);
|
charssize = strtoul(p + 1, (char **) NULL, 10);
|
||||||
|
|
||||||
/* Check length */
|
/* Check length */
|
||||||
if (strlen(str) >= charssize) {
|
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);
|
charssize - 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1953,7 +1953,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error_msg("unknown parameter type '%c' for %s\n", *p, key);
|
error_msg("unknown parameter type '%c' for %s", *p, key);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1972,21 +1972,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
|
|||||||
|
|
||||||
case ',':
|
case ',':
|
||||||
if (++n > max) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
++q;
|
++q;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error_msg("invalid argument syntax for %s\n", key);
|
error_msg("invalid argument syntax for %s", key);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
end_of_arg:
|
end_of_arg:
|
||||||
if (n < min) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2372,7 +2372,7 @@ int obj_check_undefineds(struct obj_file *f)
|
|||||||
sym->secidx = SHN_ABS;
|
sym->secidx = SHN_ABS;
|
||||||
sym->value = 0;
|
sym->value = 0;
|
||||||
} else {
|
} else {
|
||||||
error_msg("unresolved symbol %s\n", sym->name);
|
error_msg("unresolved symbol %s", sym->name);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2599,11 +2599,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base)
|
|||||||
errmsg = "Unhandled relocation";
|
errmsg = "Unhandled relocation";
|
||||||
bad_reloc:
|
bad_reloc:
|
||||||
if (extsym) {
|
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),
|
(long) ELFW(R_TYPE) (rel->r_info),
|
||||||
strtab + extsym->st_name);
|
strtab + extsym->st_name);
|
||||||
} else {
|
} else {
|
||||||
error_msg("%s of type %ld\n", errmsg,
|
error_msg("%s of type %ld", errmsg,
|
||||||
(long) ELFW(R_TYPE) (rel->r_info));
|
(long) ELFW(R_TYPE) (rel->r_info));
|
||||||
}
|
}
|
||||||
ret = 0;
|
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_MAG1] != ELFMAG1
|
||||||
|| f->header.e_ident[EI_MAG2] != ELFMAG2
|
|| f->header.e_ident[EI_MAG2] != ELFMAG2
|
||||||
|| f->header.e_ident[EI_MAG3] != ELFMAG3) {
|
|| f->header.e_ident[EI_MAG3] != ELFMAG3) {
|
||||||
error_msg("not an ELF file\n");
|
error_msg("not an ELF file");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (f->header.e_ident[EI_CLASS] != ELFCLASSM
|
if (f->header.e_ident[EI_CLASS] != ELFCLASSM
|
||||||
|| f->header.e_ident[EI_DATA] != ELFDATAM
|
|| f->header.e_ident[EI_DATA] != ELFDATAM
|
||||||
|| f->header.e_ident[EI_VERSION] != EV_CURRENT
|
|| f->header.e_ident[EI_VERSION] != EV_CURRENT
|
||||||
|| !MATCH_MACHINE(f->header.e_machine)) {
|
|| !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;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (f->header.e_type != ET_REL) {
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the section headers. */
|
/* Read the section headers. */
|
||||||
|
|
||||||
if (f->header.e_shentsize != sizeof(ElfW(Shdr))) {
|
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) f->header.e_shentsize,
|
||||||
(unsigned long) sizeof(ElfW(Shdr)));
|
(unsigned long) sizeof(ElfW(Shdr)));
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2759,11 +2759,11 @@ struct obj_file *obj_load(FILE * fp)
|
|||||||
|
|
||||||
#if SHT_RELM == SHT_REL
|
#if SHT_RELM == SHT_REL
|
||||||
case SHT_RELA:
|
case SHT_RELA:
|
||||||
error_msg("RELA relocations not supported on this architecture\n");
|
error_msg("RELA relocations not supported on this architecture");
|
||||||
return NULL;
|
return NULL;
|
||||||
#else
|
#else
|
||||||
case SHT_REL:
|
case SHT_REL:
|
||||||
error_msg("REL relocations not supported on this architecture\n");
|
error_msg("REL relocations not supported on this architecture");
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2776,7 +2776,7 @@ struct obj_file *obj_load(FILE * fp)
|
|||||||
break;
|
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);
|
(long) sec->header.sh_type);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -2805,7 +2805,7 @@ struct obj_file *obj_load(FILE * fp)
|
|||||||
ElfW(Sym) * sym;
|
ElfW(Sym) * sym;
|
||||||
|
|
||||||
if (sec->header.sh_entsize != sizeof(ElfW(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) sec->header.sh_entsize,
|
||||||
(unsigned long) sizeof(ElfW(Sym)));
|
(unsigned long) sizeof(ElfW(Sym)));
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2837,7 +2837,7 @@ struct obj_file *obj_load(FILE * fp)
|
|||||||
|
|
||||||
case SHT_RELM:
|
case SHT_RELM:
|
||||||
if (sec->header.sh_entsize != sizeof(ElfW(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) sec->header.sh_entsize,
|
||||||
(unsigned long) sizeof(ElfW(RelM)));
|
(unsigned long) sizeof(ElfW(RelM)));
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2949,11 +2949,11 @@ extern int insmod_main( int argc, char **argv)
|
|||||||
if (m_filename[0] == '\0'
|
if (m_filename[0] == '\0'
|
||||||
|| ((fp = fopen(m_filename, "r")) == NULL))
|
|| ((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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} 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
|
} else
|
||||||
memcpy(m_filename, argv[optind], strlen(argv[optind]));
|
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);
|
m_version = old_get_module_version(f, m_strversion);
|
||||||
if (m_version == -1) {
|
if (m_version == -1) {
|
||||||
error_msg("couldn't find the kernel version the module was "
|
error_msg("couldn't find the kernel version the module was "
|
||||||
"compiled for\n");
|
"compiled for");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2985,12 +2985,12 @@ extern int insmod_main( int argc, char **argv)
|
|||||||
if (flag_force_load) {
|
if (flag_force_load) {
|
||||||
error_msg("Warning: kernel-module version mismatch\n"
|
error_msg("Warning: kernel-module version mismatch\n"
|
||||||
"\t%s was compiled for kernel version %s\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);
|
m_filename, m_strversion, k_strversion);
|
||||||
} else {
|
} else {
|
||||||
error_msg("kernel-module version mismatch\n"
|
error_msg("kernel-module version mismatch\n"
|
||||||
"\t%s was compiled for kernel version %s\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);
|
m_filename, m_strversion, k_strversion);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -3006,7 +3006,7 @@ extern int insmod_main( int argc, char **argv)
|
|||||||
goto out;
|
goto out;
|
||||||
k_crcs = new_is_kernel_checksummed();
|
k_crcs = new_is_kernel_checksummed();
|
||||||
#else
|
#else
|
||||||
error_msg("Not configured to support new kernels\n");
|
error_msg("Not configured to support new kernels");
|
||||||
goto out;
|
goto out;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
@ -3015,7 +3015,7 @@ extern int insmod_main( int argc, char **argv)
|
|||||||
goto out;
|
goto out;
|
||||||
k_crcs = old_is_kernel_checksummed();
|
k_crcs = old_is_kernel_checksummed();
|
||||||
#else
|
#else
|
||||||
error_msg("Not configured to support old kernels\n");
|
error_msg("Not configured to support old kernels");
|
||||||
goto out;
|
goto out;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -3072,10 +3072,10 @@ extern int insmod_main( int argc, char **argv)
|
|||||||
m_addr = create_module(m_name, m_size);
|
m_addr = create_module(m_name, m_size);
|
||||||
if (m_addr==-1) switch (errno) {
|
if (m_addr==-1) switch (errno) {
|
||||||
case EEXIST:
|
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;
|
goto out;
|
||||||
case ENOMEM:
|
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);
|
m_size);
|
||||||
goto out;
|
goto out;
|
||||||
default:
|
default:
|
||||||
|
4
kill.c
4
kill.c
@ -223,7 +223,7 @@ extern int kill_main(int argc, char **argv)
|
|||||||
pidList = find_pid_by_name( *argv);
|
pidList = find_pid_by_name( *argv);
|
||||||
if (!pidList) {
|
if (!pidList) {
|
||||||
all_found = FALSE;
|
all_found = FALSE;
|
||||||
error_msg( "%s: no process killed\n", *argv);
|
error_msg( "%s: no process killed", *argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(; pidList && *pidList!=0; pidList++) {
|
for(; pidList && *pidList!=0; pidList++) {
|
||||||
@ -246,5 +246,5 @@ extern int kill_main(int argc, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
error_msg_and_die( "bad signal name: %s\n", *argv);
|
error_msg_and_die( "bad signal name: %s", *argv);
|
||||||
}
|
}
|
||||||
|
30
lash.c
30
lash.c
@ -321,13 +321,13 @@ static int builtin_fg_bg(struct child_prog *child)
|
|||||||
struct job *job=NULL;
|
struct job *job=NULL;
|
||||||
|
|
||||||
if (!child->argv[1] || child->argv[2]) {
|
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]);
|
child->argv[0]);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sscanf(child->argv[1], "%%%d", &jobNum) != 1) {
|
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]);
|
child->argv[0], child->argv[1]);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
@ -339,7 +339,7 @@ static int builtin_fg_bg(struct child_prog *child)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!job) {
|
if (!job) {
|
||||||
error_msg("%s: unknown job %d\n",
|
error_msg("%s: unknown job %d",
|
||||||
child->argv[0], jobNum);
|
child->argv[0], jobNum);
|
||||||
return EXIT_FAILURE;
|
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);
|
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))) {
|
if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
|
||||||
shell_context = 0; /* Reset the shell's context on an error */
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,7 +520,7 @@ static int builtin_else(struct child_prog *child)
|
|||||||
|
|
||||||
if (! (cmd->job_context & THEN_EXP_CONTEXT)) {
|
if (! (cmd->job_context & THEN_EXP_CONTEXT)) {
|
||||||
shell_context = 0; /* Reset the shell's context on an error */
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
/* If the if result was TRUE, skip the 'else' stuff */
|
/* 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);
|
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))) {
|
if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
|
||||||
shell_context = 0; /* Reset the shell's context on an error */
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
/* Clear out the if and then context bits */
|
/* 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) {
|
if (openfd < 0) {
|
||||||
/* this could get lost if stderr has been redirected, but
|
/* this could get lost if stderr has been redirected, but
|
||||||
bash and ash both lose it as well (though zsh doesn't!) */
|
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));
|
strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -960,7 +960,7 @@ static void expand_argument(struct child_prog *prog, int *argcPtr,
|
|||||||
if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){
|
if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){
|
||||||
rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->glob_result);
|
rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->glob_result);
|
||||||
if (rc == GLOB_NOSPACE) {
|
if (rc == GLOB_NOSPACE) {
|
||||||
error_msg("out of space during glob operation\n");
|
error_msg("out of space during glob operation");
|
||||||
return;
|
return;
|
||||||
} else if (rc == GLOB_NOMATCH ||
|
} else if (rc == GLOB_NOMATCH ||
|
||||||
(!rc && (prog->glob_result.gl_pathc - i) == 1 &&
|
(!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 == '\\') {
|
if (*src == '\\') {
|
||||||
src++;
|
src++;
|
||||||
if (!*src) {
|
if (!*src) {
|
||||||
error_msg("character expected after \\\n");
|
error_msg("character expected after \\");
|
||||||
free_job(job);
|
free_job(job);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1152,7 +1152,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
|
|||||||
chptr++;
|
chptr++;
|
||||||
|
|
||||||
if (!*chptr) {
|
if (!*chptr) {
|
||||||
error_msg("file name expected after %c\n", *src);
|
error_msg("file name expected after %c", *src);
|
||||||
free_job(job);
|
free_job(job);
|
||||||
job->num_progs=0;
|
job->num_progs=0;
|
||||||
return 1;
|
return 1;
|
||||||
@ -1171,7 +1171,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
|
|||||||
if (*prog->argv[argc_l])
|
if (*prog->argv[argc_l])
|
||||||
argc_l++;
|
argc_l++;
|
||||||
if (!argc_l) {
|
if (!argc_l) {
|
||||||
error_msg("empty command in pipe\n");
|
error_msg("empty command in pipe");
|
||||||
free_job(job);
|
free_job(job);
|
||||||
job->num_progs=0;
|
job->num_progs=0;
|
||||||
return 1;
|
return 1;
|
||||||
@ -1199,7 +1199,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
|
|||||||
src++;
|
src++;
|
||||||
|
|
||||||
if (!*src) {
|
if (!*src) {
|
||||||
error_msg("empty command in pipe\n");
|
error_msg("empty command in pipe");
|
||||||
free_job(job);
|
free_job(job);
|
||||||
job->num_progs=0;
|
job->num_progs=0;
|
||||||
return 1;
|
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");
|
printf("erik: found a continue char at EOL...\n");
|
||||||
command = (char *) xcalloc(BUFSIZ, sizeof(char));
|
command = (char *) xcalloc(BUFSIZ, sizeof(char));
|
||||||
if (get_command(input, command)) {
|
if (get_command(input, command)) {
|
||||||
error_msg("character expected after \\\n");
|
error_msg("character expected after \\");
|
||||||
free(command);
|
free(command);
|
||||||
free_job(job);
|
free_job(job);
|
||||||
return 1;
|
return 1;
|
||||||
@ -1323,7 +1323,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
|
|||||||
free(command);
|
free(command);
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
error_msg("character expected after \\\n");
|
error_msg("character expected after \\");
|
||||||
free(command);
|
free(command);
|
||||||
free_job(job);
|
free_job(job);
|
||||||
return 1;
|
return 1;
|
||||||
@ -1738,7 +1738,7 @@ int shell_main(int argc_l, char **argv_l)
|
|||||||
case 'c':
|
case 'c':
|
||||||
input = NULL;
|
input = NULL;
|
||||||
if (local_pending_command != 0)
|
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]);
|
local_pending_command = xstrdup(argv[optind]);
|
||||||
optind++;
|
optind++;
|
||||||
argv = argv+optind;
|
argv = argv+optind;
|
||||||
|
12
loadacm.c
12
loadacm.c
@ -70,7 +70,7 @@ int screen_map_load(int fd, FILE * fp)
|
|||||||
if (parse_failed) {
|
if (parse_failed) {
|
||||||
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||||
if (errno == ESPIPE)
|
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
|
else
|
||||||
perror_msg_and_die("fseek failed reading binary 16bit screen-map");
|
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");
|
perror_msg_and_die("Cannot read [new] map from file");
|
||||||
#if 0
|
#if 0
|
||||||
else
|
else
|
||||||
error_msg("Input screen-map is binary.\n");
|
error_msg("Input screen-map is binary.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ int screen_map_load(int fd, FILE * fp)
|
|||||||
/* rewind... */
|
/* rewind... */
|
||||||
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
if (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||||
if (errno == ESPIPE)
|
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);
|
exit(1);
|
||||||
else
|
else
|
||||||
perror_msg_and_die("fseek failed assuming 8bit screen-map");
|
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 (-1 == fseek(fp, 0, SEEK_SET)) {
|
||||||
if (errno == ESPIPE)
|
if (errno == ESPIPE)
|
||||||
/* should not - it succedeed above */
|
/* should not - it succedeed above */
|
||||||
error_msg_and_die("fseek() returned ESPIPE !\n");
|
error_msg_and_die("fseek() returned ESPIPE !");
|
||||||
else
|
else
|
||||||
perror_msg_and_die("fseek for binary 8bit screen-map");
|
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");
|
perror_msg_and_die("Cannot read [old] map from file");
|
||||||
#if 0
|
#if 0
|
||||||
else
|
else
|
||||||
error_msg("Input screen-map is binary.\n");
|
error_msg("Input screen-map is binary.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ int screen_map_load(int fd, FILE * fp)
|
|||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
error_msg("Error parsing symbolic map\n");
|
error_msg("Error parsing symbolic map");
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
loadfont.c
14
loadfont.c
@ -62,7 +62,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
|
|||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
|
|
||||||
if (unit < 1 || unit > 32)
|
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++)
|
for (i = 0; i < fontsize; i++)
|
||||||
memcpy(buf + (32 * i), inbuf + (unit * i), unit);
|
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)) {
|
if (ioctl(fd, PIO_UNIMAPCLR, &advice)) {
|
||||||
#ifdef ENOIOCTLCMD
|
#ifdef ENOIOCTLCMD
|
||||||
if (errno == ENOIOCTLCMD) {
|
if (errno == ENOIOCTLCMD) {
|
||||||
error_msg("It seems this kernel is older than 1.1.92\n");
|
error_msg("It seems this kernel is older than 1.1.92");
|
||||||
error_msg_and_die("No Unicode mapping table loaded.\n");
|
error_msg_and_die("No Unicode mapping table loaded.");
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
perror_msg_and_die("PIO_UNIMAPCLR");
|
perror_msg_and_die("PIO_UNIMAPCLR");
|
||||||
@ -174,11 +174,11 @@ static void loadnewfont(int fd)
|
|||||||
goto no_psf;
|
goto no_psf;
|
||||||
|
|
||||||
if (psfhdr.mode > PSF_MAXMODE)
|
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);
|
fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256);
|
||||||
#if !defined( PIO_FONTX ) || defined( __sparc__ )
|
#if !defined( PIO_FONTX ) || defined( __sparc__ )
|
||||||
if (fontsize != 256)
|
if (fontsize != 256)
|
||||||
error_msg_and_die("Only fontsize 256 supported\n");
|
error_msg_and_die("Only fontsize 256 supported");
|
||||||
#endif
|
#endif
|
||||||
hastable = (psfhdr.mode & PSF_MODEHASTAB);
|
hastable = (psfhdr.mode & PSF_MODEHASTAB);
|
||||||
unit = psfhdr.charsize;
|
unit = psfhdr.charsize;
|
||||||
@ -186,7 +186,7 @@ static void loadnewfont(int fd)
|
|||||||
|
|
||||||
head = head0 + fontsize * unit;
|
head = head0 + fontsize * unit;
|
||||||
if (head > inputlth || (!hastable && head != inputlth))
|
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);
|
do_loadfont(fd, inbuf + head0, unit, fontsize);
|
||||||
if (hastable)
|
if (hastable)
|
||||||
do_loadtable(fd, inbuf + head, inputlth - head, fontsize);
|
do_loadtable(fd, inbuf + head, inputlth - head, fontsize);
|
||||||
@ -201,7 +201,7 @@ static void loadnewfont(int fd)
|
|||||||
} else {
|
} else {
|
||||||
/* bare font */
|
/* bare font */
|
||||||
if (inputlth & 0377)
|
if (inputlth & 0377)
|
||||||
error_msg_and_die("Bad input file size\n");
|
error_msg_and_die("Bad input file size");
|
||||||
offset = 0;
|
offset = 0;
|
||||||
unit = inputlth / 256;
|
unit = inputlth / 256;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ int loadkmap_main(int argc, char **argv)
|
|||||||
|
|
||||||
read(0, buff, 7);
|
read(0, buff, 7);
|
||||||
if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 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))
|
if (MAX_NR_KEYMAPS != read(0, flags, MAX_NR_KEYMAPS))
|
||||||
perror_msg_and_die("Error reading keymap flags");
|
perror_msg_and_die("Error reading keymap flags");
|
||||||
|
4
logger.c
4
logger.c
@ -87,14 +87,14 @@ static int pencode(char *s)
|
|||||||
*s = '\0';
|
*s = '\0';
|
||||||
fac = decode(save, facilitynames);
|
fac = decode(save, facilitynames);
|
||||||
if (fac < 0)
|
if (fac < 0)
|
||||||
error_msg_and_die("unknown facility name: %s\n", save);
|
error_msg_and_die("unknown facility name: %s", save);
|
||||||
*s++ = '.';
|
*s++ = '.';
|
||||||
} else {
|
} else {
|
||||||
s = save;
|
s = save;
|
||||||
}
|
}
|
||||||
lev = decode(s, prioritynames);
|
lev = decode(s, prioritynames);
|
||||||
if (lev < 0)
|
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));
|
return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,5 +37,5 @@ extern int logname_main(int argc, char **argv)
|
|||||||
puts(user);
|
puts(user);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
error_msg_and_die("no login name\n");
|
error_msg_and_die("no login name");
|
||||||
}
|
}
|
||||||
|
26
md5sum.c
26
md5sum.c
@ -719,7 +719,7 @@ static int md5_check(const char *checkfile_name)
|
|||||||
if (split_3(line, line_length, &md5num, &binary, &filename)
|
if (split_3(line, line_length, &md5num, &binary, &filename)
|
||||||
|| !hex_digits(md5num)) {
|
|| !hex_digits(md5num)) {
|
||||||
if (warn) {
|
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);
|
checkfile_name, (unsigned long) line_number);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -764,7 +764,7 @@ static int md5_check(const char *checkfile_name)
|
|||||||
while (!feof(checkfile_stream) && !ferror(checkfile_stream));
|
while (!feof(checkfile_stream) && !ferror(checkfile_stream));
|
||||||
|
|
||||||
if (ferror(checkfile_stream)) {
|
if (ferror(checkfile_stream)) {
|
||||||
error_msg("%s: read error\n", checkfile_name); /* */
|
error_msg("%s: read error", checkfile_name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -775,7 +775,7 @@ static int md5_check(const char *checkfile_name)
|
|||||||
|
|
||||||
if (n_properly_formated_lines == 0) {
|
if (n_properly_formated_lines == 0) {
|
||||||
/* Warn if no tests are found. */
|
/* 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);
|
checkfile_name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
@ -784,13 +784,13 @@ static int md5_check(const char *checkfile_name)
|
|||||||
- n_open_or_read_failures);
|
- n_open_or_read_failures);
|
||||||
|
|
||||||
if (n_open_or_read_failures > 0) {
|
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);
|
n_open_or_read_failures, n_properly_formated_lines);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n_mismatched_checksums > 0) {
|
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);
|
n_mismatched_checksums, n_computed_checkums);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -855,26 +855,26 @@ int md5sum_main(int argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (file_type_specified && do_check) {
|
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) {
|
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) {
|
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) {
|
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) {
|
if (n_strings > 0) {
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (optind < argc) {
|
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) {
|
for (i = 0; i < n_strings; ++i) {
|
||||||
size_t cnt;
|
size_t cnt;
|
||||||
@ -887,7 +887,7 @@ int md5sum_main(int argc,
|
|||||||
}
|
}
|
||||||
} else if (do_check) {
|
} else if (do_check) {
|
||||||
if (optind + 1 < argc) {
|
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]);
|
err = md5_check ((optind == argc) ? "-" : argv[optind]);
|
||||||
@ -940,11 +940,11 @@ int md5sum_main(int argc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fclose (stdout) == EOF) {
|
if (fclose (stdout) == EOF) {
|
||||||
error_msg_and_die("write error\n");
|
error_msg_and_die("write error");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (have_read_stdin && fclose (stdin) == EOF) {
|
if (have_read_stdin && fclose (stdin) == EOF) {
|
||||||
error_msg_and_die("standard input\n");
|
error_msg_and_die("standard input");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err == 0)
|
if (err == 0)
|
||||||
|
20
messages.c
20
messages.c
@ -52,37 +52,37 @@
|
|||||||
"BusyBox v" BB_VER " (" BB_BT ") multi-call binary -- GPL2")
|
"BusyBox v" BB_VER " (" BB_BT ") multi-call binary -- GPL2")
|
||||||
#endif
|
#endif
|
||||||
#if defined bb_need_name_too_long || ! defined BB_DECLARE_EXTERN
|
#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
|
#endif
|
||||||
#if defined bb_need_omitting_directory || ! defined BB_DECLARE_EXTERN
|
#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
|
#endif
|
||||||
#if defined bb_need_not_a_directory || ! defined BB_DECLARE_EXTERN
|
#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
|
#endif
|
||||||
#if defined bb_need_memory_exhausted || ! defined BB_DECLARE_EXTERN
|
#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
|
#endif
|
||||||
#if defined bb_need_invalid_date || ! defined BB_DECLARE_EXTERN
|
#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
|
#endif
|
||||||
#if defined bb_need_invalid_option || ! defined BB_DECLARE_EXTERN
|
#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
|
#endif
|
||||||
#if defined bb_need_io_error || ! defined BB_DECLARE_EXTERN
|
#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
|
#endif
|
||||||
#if defined bb_need_help || ! defined BB_DECLARE_EXTERN
|
#if defined bb_need_help || ! defined BB_DECLARE_EXTERN
|
||||||
BB_DEF_MESSAGE(dash_dash_help, "--help")
|
BB_DEF_MESSAGE(dash_dash_help, "--help")
|
||||||
#endif
|
#endif
|
||||||
#if defined bb_need_write_error || ! defined BB_DECLARE_EXTERN
|
#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
|
#endif
|
||||||
#if defined bb_need_too_few_args || ! defined BB_DECLARE_EXTERN
|
#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
|
#endif
|
||||||
#if defined bb_need_name_longer_than_foo || ! defined BB_DECLARE_EXTERN
|
#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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,14 +14,14 @@ static unsigned int pointer;
|
|||||||
static void push(double a)
|
static void push(double a)
|
||||||
{
|
{
|
||||||
if (pointer >= (sizeof(stack) / sizeof(*stack)))
|
if (pointer >= (sizeof(stack) / sizeof(*stack)))
|
||||||
error_msg_and_die("stack overflow\n");
|
error_msg_and_die("stack overflow");
|
||||||
stack[pointer++] = a;
|
stack[pointer++] = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
static double pop()
|
static double pop()
|
||||||
{
|
{
|
||||||
if (pointer == 0)
|
if (pointer == 0)
|
||||||
error_msg_and_die("stack underflow\n");
|
error_msg_and_die("stack underflow");
|
||||||
return stack[--pointer];
|
return stack[--pointer];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ static void stack_machine(const char *argument)
|
|||||||
}
|
}
|
||||||
o++;
|
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
|
/* return pointer to next token in buffer and set *buffer to one char
|
||||||
|
@ -76,7 +76,7 @@ extern int mt_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (code->name == 0) {
|
if (code->name == 0) {
|
||||||
error_msg("unrecognized opcode %s.\n", argv[1]);
|
error_msg("unrecognized opcode %s.", argv[1]);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
mkdir.c
4
mkdir.c
@ -52,7 +52,7 @@ extern int mkdir_main(int argc, char **argv)
|
|||||||
/* Find the specified modes */
|
/* Find the specified modes */
|
||||||
mode = 0;
|
mode = 0;
|
||||||
if (parse_mode(*(++argv), &mode) == FALSE) {
|
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
|
/* Set the umask for this process so it doesn't
|
||||||
* screw up whatever the user just entered. */
|
* screw up whatever the user just entered. */
|
||||||
@ -85,7 +85,7 @@ extern int mkdir_main(int argc, char **argv)
|
|||||||
strcpy(buf, *argv);
|
strcpy(buf, *argv);
|
||||||
status = stat(buf, &statBuf);
|
status = stat(buf, &statBuf);
|
||||||
if (parentFlag == FALSE && status != -1 && errno != ENOENT) {
|
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) {
|
if (parentFlag == TRUE) {
|
||||||
strcat(buf, "/");
|
strcat(buf, "/");
|
||||||
|
50
mkfs_minix.c
50
mkfs_minix.c
@ -279,7 +279,7 @@ static void check_mount(void)
|
|||||||
if (!mnt)
|
if (!mnt)
|
||||||
return;
|
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)
|
static long valid_offset(int fd, int offset)
|
||||||
@ -336,28 +336,28 @@ static void write_tables(void)
|
|||||||
Super.s_state &= ~MINIX_ERROR_FS;
|
Super.s_state &= ~MINIX_ERROR_FS;
|
||||||
|
|
||||||
if (lseek(DEV, 0, SEEK_SET))
|
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))
|
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))
|
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))
|
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))
|
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))
|
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))
|
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)
|
static void write_block(int blk, char *buffer)
|
||||||
{
|
{
|
||||||
if (blk * BLOCK_SIZE != lseek(DEV, blk * BLOCK_SIZE, SEEK_SET))
|
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))
|
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)
|
static int get_free_block(void)
|
||||||
@ -365,7 +365,7 @@ static int get_free_block(void)
|
|||||||
int blk;
|
int blk;
|
||||||
|
|
||||||
if (used_good_blocks + 1 >= MAX_GOOD_BLOCKS)
|
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)
|
if (used_good_blocks)
|
||||||
blk = good_blocks_table[used_good_blocks - 1] + 1;
|
blk = good_blocks_table[used_good_blocks - 1] + 1;
|
||||||
else
|
else
|
||||||
@ -373,7 +373,7 @@ static int get_free_block(void)
|
|||||||
while (blk < ZONES && zone_in_use(blk))
|
while (blk < ZONES && zone_in_use(blk))
|
||||||
blk++;
|
blk++;
|
||||||
if (blk >= ZONES)
|
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;
|
good_blocks_table[used_good_blocks] = blk;
|
||||||
used_good_blocks++;
|
used_good_blocks++;
|
||||||
return blk;
|
return blk;
|
||||||
@ -439,7 +439,7 @@ static void make_bad_inode(void)
|
|||||||
goto end_bad;
|
goto end_bad;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
error_msg_and_die("too many bad blocks\n");
|
error_msg_and_die("too many bad blocks");
|
||||||
end_bad:
|
end_bad:
|
||||||
if (ind)
|
if (ind)
|
||||||
write_block(ind, (char *) ind_block);
|
write_block(ind, (char *) ind_block);
|
||||||
@ -489,7 +489,7 @@ static void make_bad_inode2(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Could make triple indirect block here */
|
/* 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:
|
end_bad:
|
||||||
if (ind)
|
if (ind)
|
||||||
write_block(ind, (char *) ind_block);
|
write_block(ind, (char *) ind_block);
|
||||||
@ -590,7 +590,7 @@ static void setup_tables(void)
|
|||||||
* /sbin/mkfs.minix -i 200 test.fs
|
* /sbin/mkfs.minix -i 200 test.fs
|
||||||
* */
|
* */
|
||||||
if (i >= 999) {
|
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;
|
FIRSTZONE = NORM_FIRSTZONE;
|
||||||
inode_map = xmalloc(IMAPS * BLOCK_SIZE);
|
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. */
|
/* Seek to the correct loc. */
|
||||||
if (lseek(DEV, current_block * BLOCK_SIZE, SEEK_SET) !=
|
if (lseek(DEV, current_block * BLOCK_SIZE, SEEK_SET) !=
|
||||||
current_block * BLOCK_SIZE) {
|
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) {
|
while (currently_testing < ZONES) {
|
||||||
if (lseek(DEV, currently_testing * BLOCK_SIZE, SEEK_SET) !=
|
if (lseek(DEV, currently_testing * BLOCK_SIZE, SEEK_SET) !=
|
||||||
currently_testing * BLOCK_SIZE)
|
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;
|
try = TEST_BUFFER_BLOCKS;
|
||||||
if (currently_testing + try > ZONES)
|
if (currently_testing + try > ZONES)
|
||||||
try = ZONES - currently_testing;
|
try = ZONES - currently_testing;
|
||||||
@ -670,7 +670,7 @@ static void check_blocks(void)
|
|||||||
if (got == try)
|
if (got == try)
|
||||||
continue;
|
continue;
|
||||||
if (currently_testing < FIRSTZONE)
|
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);
|
mark_zone(currently_testing);
|
||||||
badblocks++;
|
badblocks++;
|
||||||
currently_testing++;
|
currently_testing++;
|
||||||
@ -690,7 +690,7 @@ char *filename;
|
|||||||
|
|
||||||
listfile = fopen(filename, "r");
|
listfile = fopen(filename, "r");
|
||||||
if (listfile == (FILE *) NULL) {
|
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)) {
|
while (!feof(listfile)) {
|
||||||
fscanf(listfile, "%ld\n", &blockno);
|
fscanf(listfile, "%ld\n", &blockno);
|
||||||
@ -712,10 +712,10 @@ extern int mkfs_minix_main(int argc, char **argv)
|
|||||||
int stopIt=FALSE;
|
int stopIt=FALSE;
|
||||||
|
|
||||||
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
|
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
|
#ifdef BB_FEATURE_MINIX2
|
||||||
if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
|
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
|
#endif
|
||||||
|
|
||||||
/* Parse options */
|
/* Parse options */
|
||||||
@ -781,7 +781,7 @@ extern int mkfs_minix_main(int argc, char **argv)
|
|||||||
#ifdef BB_FEATURE_MINIX2
|
#ifdef BB_FEATURE_MINIX2
|
||||||
version2 = 1;
|
version2 = 1;
|
||||||
#else
|
#else
|
||||||
error_msg("%s: not compiled with minix v2 support\n",
|
error_msg("%s: not compiled with minix v2 support",
|
||||||
device_name);
|
device_name);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
#endif
|
#endif
|
||||||
@ -832,13 +832,13 @@ goodbye:
|
|||||||
strcpy(tmp + 2, ".badblocks");
|
strcpy(tmp + 2, ".badblocks");
|
||||||
DEV = open(device_name, O_RDWR);
|
DEV = open(device_name, O_RDWR);
|
||||||
if (DEV < 0)
|
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)
|
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))
|
if (!S_ISBLK(statbuf.st_mode))
|
||||||
check = 0;
|
check = 0;
|
||||||
else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340)
|
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();
|
setup_tables();
|
||||||
if (check)
|
if (check)
|
||||||
check_blocks();
|
check_blocks();
|
||||||
|
32
mkswap.c
32
mkswap.c
@ -87,7 +87,7 @@ static void init_signature_page()
|
|||||||
|
|
||||||
#ifdef PAGE_SIZE
|
#ifdef PAGE_SIZE
|
||||||
if (pagesize != PAGE_SIZE)
|
if (pagesize != PAGE_SIZE)
|
||||||
error_msg("Assuming pages of size %d\n", pagesize);
|
error_msg("Assuming pages of size %d", pagesize);
|
||||||
#endif
|
#endif
|
||||||
signature_page = (int *) xmalloc(pagesize);
|
signature_page = (int *) xmalloc(pagesize);
|
||||||
memset(signature_page, 0, pagesize);
|
memset(signature_page, 0, pagesize);
|
||||||
@ -185,7 +185,7 @@ static void page_bad(int page)
|
|||||||
bit_test_and_clear(signature_page, page);
|
bit_test_and_clear(signature_page, page);
|
||||||
else {
|
else {
|
||||||
if (badpages == MAX_BADPAGES)
|
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;
|
p->badpages[badpages] = page;
|
||||||
}
|
}
|
||||||
badpages++;
|
badpages++;
|
||||||
@ -206,7 +206,7 @@ static void check_blocks(void)
|
|||||||
}
|
}
|
||||||
if (do_seek && lseek(DEV, current_page * pagesize, SEEK_SET) !=
|
if (do_seek && lseek(DEV, current_page * pagesize, SEEK_SET) !=
|
||||||
current_page * pagesize)
|
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)))) {
|
if ((do_seek = (pagesize != read(DEV, buffer, pagesize)))) {
|
||||||
page_bad(current_page++);
|
page_bad(current_page++);
|
||||||
continue;
|
continue;
|
||||||
@ -307,14 +307,14 @@ int mkswap_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!device_name) {
|
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);
|
usage(mkswap_usage);
|
||||||
}
|
}
|
||||||
sz = get_size(device_name);
|
sz = get_size(device_name);
|
||||||
if (!PAGES) {
|
if (!PAGES) {
|
||||||
PAGES = sz;
|
PAGES = sz;
|
||||||
} else if (PAGES > sz && !force) {
|
} 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));
|
PAGES * (pagesize / 1024), sz * (pagesize / 1024));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
@ -330,11 +330,11 @@ int mkswap_main(int argc, char **argv)
|
|||||||
version = 1;
|
version = 1;
|
||||||
}
|
}
|
||||||
if (version != 0 && 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);
|
usage(mkswap_usage);
|
||||||
}
|
}
|
||||||
if (PAGES < 10) {
|
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));
|
(long) (10 * pagesize / 1024));
|
||||||
usage(mkswap_usage);
|
usage(mkswap_usage);
|
||||||
}
|
}
|
||||||
@ -353,7 +353,7 @@ int mkswap_main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
if (PAGES > maxpages) {
|
if (PAGES > maxpages) {
|
||||||
PAGES = maxpages;
|
PAGES = maxpages;
|
||||||
error_msg("warning: truncating swap area to %ldkB\n",
|
error_msg("warning: truncating swap area to %ldkB",
|
||||||
PAGES * pagesize / 1024);
|
PAGES * pagesize / 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ int mkswap_main(int argc, char **argv)
|
|||||||
if (!S_ISBLK(statbuf.st_mode))
|
if (!S_ISBLK(statbuf.st_mode))
|
||||||
check = 0;
|
check = 0;
|
||||||
else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340)
|
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__
|
#ifdef __sparc__
|
||||||
if (!force && version == 0) {
|
if (!force && version == 0) {
|
||||||
@ -372,7 +372,7 @@ int mkswap_main(int argc, char **argv)
|
|||||||
unsigned short *q, sum;
|
unsigned short *q, sum;
|
||||||
|
|
||||||
if (read(DEV, buffer, 512) != 512)
|
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) {
|
if (buffer[508] == 0xDA && buffer[509] == 0xBE) {
|
||||||
q = (unsigned short *) (buffer + 510);
|
q = (unsigned short *) (buffer + 510);
|
||||||
for (sum = 0; q >= (unsigned short *) buffer;)
|
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"
|
error_msg("Device '%s' contains a valid Sun disklabel.\n"
|
||||||
"This probably means creating v0 swap would destroy your partition table\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"
|
"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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -391,7 +391,7 @@ int mkswap_main(int argc, char **argv)
|
|||||||
if (version == 0 || check)
|
if (version == 0 || check)
|
||||||
check_blocks();
|
check_blocks();
|
||||||
if (version == 0 && !bit_test_and_clear(signature_page, 0))
|
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) {
|
if (version == 1) {
|
||||||
p->version = version;
|
p->version = version;
|
||||||
p->last_page = PAGES - 1;
|
p->last_page = PAGES - 1;
|
||||||
@ -400,23 +400,23 @@ int mkswap_main(int argc, char **argv)
|
|||||||
|
|
||||||
goodpages = PAGES - badpages - 1;
|
goodpages = PAGES - badpages - 1;
|
||||||
if (goodpages <= 0)
|
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",
|
printf("Setting up swapspace version %d, size = %ld bytes\n",
|
||||||
version, (long) (goodpages * pagesize));
|
version, (long) (goodpages * pagesize));
|
||||||
write_signature((version == 0) ? "SWAP-SPACE" : "SWAPSPACE2");
|
write_signature((version == 0) ? "SWAP-SPACE" : "SWAPSPACE2");
|
||||||
|
|
||||||
offset = ((version == 0) ? 0 : 1024);
|
offset = ((version == 0) ? 0 : 1024);
|
||||||
if (lseek(DEV, offset, SEEK_SET) != offset)
|
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)
|
if (write(DEV, (char *) signature_page + offset, pagesize - 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
|
* A subsequent swapon() will fail if the signature
|
||||||
* is not actually on disk. (This is a kernel bug.)
|
* is not actually on disk. (This is a kernel bug.)
|
||||||
*/
|
*/
|
||||||
if (fsync(DEV))
|
if (fsync(DEV))
|
||||||
error_msg_and_die("fsync failed\n");
|
error_msg_and_die("fsync failed");
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
#ifndef MODUTILS_MODULE_H
|
#ifndef MODUTILS_MODULE_H
|
||||||
static const int MODUTILS_MODULE_H = 1;
|
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.
|
/* 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
|
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
|
#ifndef MODUTILS_OBJ_H
|
||||||
static const int MODUTILS_OBJ_H = 1;
|
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. */
|
/* 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
|
/* Don't report an error if the symbol is coming from
|
||||||
the kernel or some external module. */
|
the kernel or some external module. */
|
||||||
if (secidx <= SHN_HIRESERVE)
|
if (secidx <= SHN_HIRESERVE)
|
||||||
error_msg("%s multiply defined\n", name);
|
error_msg("%s multiply defined", name);
|
||||||
return sym;
|
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. */
|
/* Also check that the parameter was not resolved from the kernel. */
|
||||||
if (sym == NULL || sym->secidx > SHN_HIRESERVE) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1432,7 +1432,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
|
|||||||
str = alloca(strlen(q));
|
str = alloca(strlen(q));
|
||||||
for (r = str, q++; *q != '"'; ++q, ++r) {
|
for (r = str, q++; *q != '"'; ++q, ++r) {
|
||||||
if (*q == '\0') {
|
if (*q == '\0') {
|
||||||
error_msg("improperly terminated string argument for %s\n", p);
|
error_msg("improperly terminated string argument for %s", p);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (*q == '\\')
|
} else if (*q == '\\')
|
||||||
switch (*++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);
|
p = get_modinfo_value(f, key);
|
||||||
key += 5;
|
key += 5;
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
error_msg("invalid parameter %s\n", key);
|
error_msg("invalid parameter %s", key);
|
||||||
return 0;
|
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. */
|
/* Also check that the parameter was not resolved from the kernel. */
|
||||||
if (sym == NULL || sym->secidx > SHN_HIRESERVE) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1822,7 +1822,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
|
|||||||
str = alloca(strlen(q));
|
str = alloca(strlen(q));
|
||||||
for (r = str, q++; *q != '"'; ++q, ++r) {
|
for (r = str, q++; *q != '"'; ++q, ++r) {
|
||||||
if (*q == '\0') {
|
if (*q == '\0') {
|
||||||
error_msg("improperly terminated string argument for %s\n",
|
error_msg("improperly terminated string argument for %s",
|
||||||
key);
|
key);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (*q == '\\')
|
} 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 ? */
|
/* Probably we should do that outside the loop ? */
|
||||||
if (!isdigit(*(p + 1))) {
|
if (!isdigit(*(p + 1))) {
|
||||||
error_msg("parameter type 'c' for %s must be followed by"
|
error_msg("parameter type 'c' for %s must be followed by"
|
||||||
" the maximum size\n", key);
|
" the maximum size", key);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
charssize = strtoul(p + 1, (char **) NULL, 10);
|
charssize = strtoul(p + 1, (char **) NULL, 10);
|
||||||
|
|
||||||
/* Check length */
|
/* Check length */
|
||||||
if (strlen(str) >= charssize) {
|
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);
|
charssize - 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1953,7 +1953,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error_msg("unknown parameter type '%c' for %s\n", *p, key);
|
error_msg("unknown parameter type '%c' for %s", *p, key);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1972,21 +1972,21 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
|
|||||||
|
|
||||||
case ',':
|
case ',':
|
||||||
if (++n > max) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
++q;
|
++q;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error_msg("invalid argument syntax for %s\n", key);
|
error_msg("invalid argument syntax for %s", key);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
end_of_arg:
|
end_of_arg:
|
||||||
if (n < min) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2372,7 +2372,7 @@ int obj_check_undefineds(struct obj_file *f)
|
|||||||
sym->secidx = SHN_ABS;
|
sym->secidx = SHN_ABS;
|
||||||
sym->value = 0;
|
sym->value = 0;
|
||||||
} else {
|
} else {
|
||||||
error_msg("unresolved symbol %s\n", sym->name);
|
error_msg("unresolved symbol %s", sym->name);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2599,11 +2599,11 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base)
|
|||||||
errmsg = "Unhandled relocation";
|
errmsg = "Unhandled relocation";
|
||||||
bad_reloc:
|
bad_reloc:
|
||||||
if (extsym) {
|
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),
|
(long) ELFW(R_TYPE) (rel->r_info),
|
||||||
strtab + extsym->st_name);
|
strtab + extsym->st_name);
|
||||||
} else {
|
} else {
|
||||||
error_msg("%s of type %ld\n", errmsg,
|
error_msg("%s of type %ld", errmsg,
|
||||||
(long) ELFW(R_TYPE) (rel->r_info));
|
(long) ELFW(R_TYPE) (rel->r_info));
|
||||||
}
|
}
|
||||||
ret = 0;
|
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_MAG1] != ELFMAG1
|
||||||
|| f->header.e_ident[EI_MAG2] != ELFMAG2
|
|| f->header.e_ident[EI_MAG2] != ELFMAG2
|
||||||
|| f->header.e_ident[EI_MAG3] != ELFMAG3) {
|
|| f->header.e_ident[EI_MAG3] != ELFMAG3) {
|
||||||
error_msg("not an ELF file\n");
|
error_msg("not an ELF file");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (f->header.e_ident[EI_CLASS] != ELFCLASSM
|
if (f->header.e_ident[EI_CLASS] != ELFCLASSM
|
||||||
|| f->header.e_ident[EI_DATA] != ELFDATAM
|
|| f->header.e_ident[EI_DATA] != ELFDATAM
|
||||||
|| f->header.e_ident[EI_VERSION] != EV_CURRENT
|
|| f->header.e_ident[EI_VERSION] != EV_CURRENT
|
||||||
|| !MATCH_MACHINE(f->header.e_machine)) {
|
|| !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;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (f->header.e_type != ET_REL) {
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the section headers. */
|
/* Read the section headers. */
|
||||||
|
|
||||||
if (f->header.e_shentsize != sizeof(ElfW(Shdr))) {
|
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) f->header.e_shentsize,
|
||||||
(unsigned long) sizeof(ElfW(Shdr)));
|
(unsigned long) sizeof(ElfW(Shdr)));
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2759,11 +2759,11 @@ struct obj_file *obj_load(FILE * fp)
|
|||||||
|
|
||||||
#if SHT_RELM == SHT_REL
|
#if SHT_RELM == SHT_REL
|
||||||
case SHT_RELA:
|
case SHT_RELA:
|
||||||
error_msg("RELA relocations not supported on this architecture\n");
|
error_msg("RELA relocations not supported on this architecture");
|
||||||
return NULL;
|
return NULL;
|
||||||
#else
|
#else
|
||||||
case SHT_REL:
|
case SHT_REL:
|
||||||
error_msg("REL relocations not supported on this architecture\n");
|
error_msg("REL relocations not supported on this architecture");
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2776,7 +2776,7 @@ struct obj_file *obj_load(FILE * fp)
|
|||||||
break;
|
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);
|
(long) sec->header.sh_type);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -2805,7 +2805,7 @@ struct obj_file *obj_load(FILE * fp)
|
|||||||
ElfW(Sym) * sym;
|
ElfW(Sym) * sym;
|
||||||
|
|
||||||
if (sec->header.sh_entsize != sizeof(ElfW(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) sec->header.sh_entsize,
|
||||||
(unsigned long) sizeof(ElfW(Sym)));
|
(unsigned long) sizeof(ElfW(Sym)));
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2837,7 +2837,7 @@ struct obj_file *obj_load(FILE * fp)
|
|||||||
|
|
||||||
case SHT_RELM:
|
case SHT_RELM:
|
||||||
if (sec->header.sh_entsize != sizeof(ElfW(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) sec->header.sh_entsize,
|
||||||
(unsigned long) sizeof(ElfW(RelM)));
|
(unsigned long) sizeof(ElfW(RelM)));
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2949,11 +2949,11 @@ extern int insmod_main( int argc, char **argv)
|
|||||||
if (m_filename[0] == '\0'
|
if (m_filename[0] == '\0'
|
||||||
|| ((fp = fopen(m_filename, "r")) == NULL))
|
|| ((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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
} else
|
} 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
|
} else
|
||||||
memcpy(m_filename, argv[optind], strlen(argv[optind]));
|
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);
|
m_version = old_get_module_version(f, m_strversion);
|
||||||
if (m_version == -1) {
|
if (m_version == -1) {
|
||||||
error_msg("couldn't find the kernel version the module was "
|
error_msg("couldn't find the kernel version the module was "
|
||||||
"compiled for\n");
|
"compiled for");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2985,12 +2985,12 @@ extern int insmod_main( int argc, char **argv)
|
|||||||
if (flag_force_load) {
|
if (flag_force_load) {
|
||||||
error_msg("Warning: kernel-module version mismatch\n"
|
error_msg("Warning: kernel-module version mismatch\n"
|
||||||
"\t%s was compiled for kernel version %s\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);
|
m_filename, m_strversion, k_strversion);
|
||||||
} else {
|
} else {
|
||||||
error_msg("kernel-module version mismatch\n"
|
error_msg("kernel-module version mismatch\n"
|
||||||
"\t%s was compiled for kernel version %s\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);
|
m_filename, m_strversion, k_strversion);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -3006,7 +3006,7 @@ extern int insmod_main( int argc, char **argv)
|
|||||||
goto out;
|
goto out;
|
||||||
k_crcs = new_is_kernel_checksummed();
|
k_crcs = new_is_kernel_checksummed();
|
||||||
#else
|
#else
|
||||||
error_msg("Not configured to support new kernels\n");
|
error_msg("Not configured to support new kernels");
|
||||||
goto out;
|
goto out;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
@ -3015,7 +3015,7 @@ extern int insmod_main( int argc, char **argv)
|
|||||||
goto out;
|
goto out;
|
||||||
k_crcs = old_is_kernel_checksummed();
|
k_crcs = old_is_kernel_checksummed();
|
||||||
#else
|
#else
|
||||||
error_msg("Not configured to support old kernels\n");
|
error_msg("Not configured to support old kernels");
|
||||||
goto out;
|
goto out;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -3072,10 +3072,10 @@ extern int insmod_main( int argc, char **argv)
|
|||||||
m_addr = create_module(m_name, m_size);
|
m_addr = create_module(m_name, m_size);
|
||||||
if (m_addr==-1) switch (errno) {
|
if (m_addr==-1) switch (errno) {
|
||||||
case EEXIST:
|
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;
|
goto out;
|
||||||
case ENOMEM:
|
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);
|
m_size);
|
||||||
goto out;
|
goto out;
|
||||||
default:
|
default:
|
||||||
|
10
mount.c
10
mount.c
@ -132,20 +132,20 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
|
|||||||
|
|
||||||
specialfile = find_unused_loop_device();
|
specialfile = find_unused_loop_device();
|
||||||
if (specialfile == NULL) {
|
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)) {
|
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 */
|
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;
|
flags &= ~MS_RDONLY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
status = mount(specialfile, dir, filesystemtype, flags, string_flags);
|
status = mount(specialfile, dir, filesystemtype, flags, string_flags);
|
||||||
if (errno == EROFS) {
|
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);
|
status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (errno == EPERM) {
|
if (errno == EPERM) {
|
||||||
error_msg_and_die("permission denied. Are you root?\n");
|
error_msg_and_die("permission denied. Are you root?");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
2
mt.c
2
mt.c
@ -76,7 +76,7 @@ extern int mt_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (code->name == 0) {
|
if (code->name == 0) {
|
||||||
error_msg("unrecognized opcode %s.\n", argv[1]);
|
error_msg("unrecognized opcode %s.", argv[1]);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
nc.c
2
nc.c
@ -59,7 +59,7 @@ int nc_main(int argc, char **argv)
|
|||||||
perror_msg_and_die("socket");
|
perror_msg_and_die("socket");
|
||||||
|
|
||||||
if ((hostinfo = gethostbyname(*argv)) == NULL)
|
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_family = AF_INET;
|
||||||
address.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list;
|
address.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* vi: set sw=4 ts=4: */
|
/* 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
|
* Mini hostname implementation for busybox
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||||
@ -41,7 +41,7 @@ void do_sethostname(char *s, int isfile)
|
|||||||
if (!isfile) {
|
if (!isfile) {
|
||||||
if (sethostname(s, strlen(s)) < 0) {
|
if (sethostname(s, strlen(s)) < 0) {
|
||||||
if (errno == EPERM)
|
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
|
else
|
||||||
perror_msg_and_die("sethostname");
|
perror_msg_and_die("sethostname");
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ int nc_main(int argc, char **argv)
|
|||||||
perror_msg_and_die("socket");
|
perror_msg_and_die("socket");
|
||||||
|
|
||||||
if ((hostinfo = gethostbyname(*argv)) == NULL)
|
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_family = AF_INET;
|
||||||
address.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list;
|
address.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* vi: set sw=4 ts=4: */
|
/* 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
|
* Mini ping implementation for busybox
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||||
@ -203,7 +203,7 @@ static void ping(const char *host)
|
|||||||
|
|
||||||
pingaddr.sin_family = AF_INET;
|
pingaddr.sin_family = AF_INET;
|
||||||
if (!(h = gethostbyname(host))) {
|
if (!(h = gethostbyname(host))) {
|
||||||
error_msg("unknown host %s\n", host);
|
error_msg("unknown host %s", host);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr));
|
memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr));
|
||||||
@ -324,7 +324,7 @@ static void sendping(int junk)
|
|||||||
if (i < 0)
|
if (i < 0)
|
||||||
perror_msg_and_die("sendto");
|
perror_msg_and_die("sendto");
|
||||||
else if ((size_t)i != sizeof(packet))
|
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));
|
(int)sizeof(packet));
|
||||||
|
|
||||||
signal(SIGALRM, sendping);
|
signal(SIGALRM, sendping);
|
||||||
@ -419,7 +419,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
} else
|
} else
|
||||||
if (icmppkt->icmp_type != ICMP_ECHO)
|
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));
|
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,
|
if ((pingsock = socket(AF_INET, SOCK_RAW,
|
||||||
(proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */
|
(proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */
|
||||||
if (errno == EPERM)
|
if (errno == EPERM)
|
||||||
error_msg_and_die("permission denied. (are you root?)\n");
|
error_msg_and_die("permission denied. (are you root?)");
|
||||||
else
|
else
|
||||||
perror_msg_and_die("creating a raw socket");
|
perror_msg_and_die("creating a raw socket");
|
||||||
}
|
}
|
||||||
@ -449,12 +449,12 @@ static void ping(const char *host)
|
|||||||
|
|
||||||
pingaddr.sin_family = AF_INET;
|
pingaddr.sin_family = AF_INET;
|
||||||
if (!(h = gethostbyname(host))) {
|
if (!(h = gethostbyname(host))) {
|
||||||
error_msg("unknown host %s\n", host);
|
error_msg("unknown host %s", host);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (h->h_addrtype != AF_INET) {
|
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);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,7 +584,7 @@ static int getport(char * p)
|
|||||||
|
|
||||||
if ((unsigned)(port - 1 ) > 65534)
|
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;
|
return port;
|
||||||
}
|
}
|
||||||
@ -596,7 +596,7 @@ static struct in_addr getserver(char * host)
|
|||||||
struct hostent * he;
|
struct hostent * he;
|
||||||
if ((he = gethostbyname(host)) == NULL)
|
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);
|
memcpy(&addr, he->h_addr, sizeof addr);
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ int wget_main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (do_continue && !fname_out)
|
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) {
|
if (fgets(buf, sizeof(buf), sfp) == NULL) {
|
||||||
close_and_delete_outfile(output, fname_out, do_continue);
|
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)
|
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) {
|
if (strcasecmp(buf, "transfer-encoding") == 0) {
|
||||||
close_and_delete_outfile(output, fname_out, do_continue);
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -267,7 +267,7 @@ void parse_url(char *url, char **uri_host, int *uri_port, char **uri_path)
|
|||||||
*uri_port = 80;
|
*uri_port = 80;
|
||||||
|
|
||||||
if (strncmp(url, "http://", 7) != 0)
|
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;
|
*uri_host = url + 7;
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ FILE *open_socket(char *host, int port)
|
|||||||
memset(&sin, 0, sizeof(sin));
|
memset(&sin, 0, sizeof(sin));
|
||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
if ((hp = (struct hostent *) gethostbyname(host)) == NULL)
|
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);
|
memcpy(&sin.sin_addr, hp->h_addr_list[0], hp->h_length);
|
||||||
sin.sin_port = htons(port);
|
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 */
|
/* verify we are at the end of the header name */
|
||||||
if (*s != ':')
|
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 */
|
/* locate the start of the header value */
|
||||||
for (*s++ = '\0' ; *s == ' ' || *s == '\t' ; ++s)
|
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
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* 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 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
24
nfsmount.c
24
nfsmount.c
@ -307,7 +307,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
|
|||||||
msock = fsock = -1;
|
msock = fsock = -1;
|
||||||
mclient = NULL;
|
mclient = NULL;
|
||||||
if (strlen(spec) >= sizeof(hostdir)) {
|
if (strlen(spec) >= sizeof(hostdir)) {
|
||||||
error_msg("excessively long host:dir argument\n");
|
error_msg("excessively long host:dir argument");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
strcpy(hostdir, spec);
|
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) */
|
until they can be fully supported. (mack@sgi.com) */
|
||||||
if ((s = strchr(hostdir, ','))) {
|
if ((s = strchr(hostdir, ','))) {
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
error_msg("warning: multiple hostnames not supported\n");
|
error_msg("warning: multiple hostnames not supported");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error_msg("directory to mount not in host:dir format\n");
|
error_msg("directory to mount not in host:dir format");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,11 +332,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if ((hp = gethostbyname(hostname)) == NULL) {
|
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;
|
goto fail;
|
||||||
} else {
|
} else {
|
||||||
if (hp->h_length > sizeof(struct in_addr)) {
|
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);
|
hp->h_length = sizeof(struct in_addr);
|
||||||
}
|
}
|
||||||
memcpy(&server_addr.sin_addr,
|
memcpy(&server_addr.sin_addr,
|
||||||
@ -353,7 +353,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
|
|||||||
if (!old_opts)
|
if (!old_opts)
|
||||||
old_opts = "";
|
old_opts = "";
|
||||||
if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_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;
|
goto fail;
|
||||||
}
|
}
|
||||||
sprintf(new_opts, "%s%saddr=%s",
|
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);
|
data.flags |= (nolock ? NFS_MOUNT_NONLM : 0);
|
||||||
#endif
|
#endif
|
||||||
if (nfsvers > MAX_NFSPROT) {
|
if (nfsvers > MAX_NFSPROT) {
|
||||||
error_msg("NFSv%d not supported!\n", nfsvers);
|
error_msg("NFSv%d not supported!", nfsvers);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (mountvers > MAX_NFSPROT) {
|
if (mountvers > MAX_NFSPROT) {
|
||||||
error_msg("NFSv%d not supported!\n", nfsvers);
|
error_msg("NFSv%d not supported!", nfsvers);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (nfsvers && !mountvers)
|
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);
|
mount_server_addr.sin_addr.s_addr = inet_addr(hostname);
|
||||||
} else {
|
} else {
|
||||||
if ((hp = gethostbyname(mounthost)) == NULL) {
|
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;
|
goto fail;
|
||||||
} else {
|
} else {
|
||||||
if (hp->h_length > sizeof(struct in_addr)) {
|
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);
|
hp->h_length = sizeof(struct in_addr);
|
||||||
}
|
}
|
||||||
mount_server_addr.sin_family = AF_INET;
|
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 (nfsvers == 2) {
|
||||||
if (status.nfsv2.fhs_status != 0) {
|
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,
|
hostname, dirname,
|
||||||
nfs_strerror(status.nfsv2.fhs_status));
|
nfs_strerror(status.nfsv2.fhs_status));
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -734,7 +734,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
|
|||||||
#if NFS_MOUNT_VERSION >= 4
|
#if NFS_MOUNT_VERSION >= 4
|
||||||
fhandle3 *fhandle;
|
fhandle3 *fhandle;
|
||||||
if (status.nfsv3.fhs_status != 0) {
|
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,
|
hostname, dirname,
|
||||||
nfs_strerror(status.nfsv3.fhs_status));
|
nfs_strerror(status.nfsv3.fhs_status));
|
||||||
goto fail;
|
goto fail;
|
||||||
|
14
ping.c
14
ping.c
@ -1,6 +1,6 @@
|
|||||||
/* vi: set sw=4 ts=4: */
|
/* 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
|
* Mini ping implementation for busybox
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||||
@ -203,7 +203,7 @@ static void ping(const char *host)
|
|||||||
|
|
||||||
pingaddr.sin_family = AF_INET;
|
pingaddr.sin_family = AF_INET;
|
||||||
if (!(h = gethostbyname(host))) {
|
if (!(h = gethostbyname(host))) {
|
||||||
error_msg("unknown host %s\n", host);
|
error_msg("unknown host %s", host);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr));
|
memcpy(&pingaddr.sin_addr, h->h_addr, sizeof(pingaddr.sin_addr));
|
||||||
@ -324,7 +324,7 @@ static void sendping(int junk)
|
|||||||
if (i < 0)
|
if (i < 0)
|
||||||
perror_msg_and_die("sendto");
|
perror_msg_and_die("sendto");
|
||||||
else if ((size_t)i != sizeof(packet))
|
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));
|
(int)sizeof(packet));
|
||||||
|
|
||||||
signal(SIGALRM, sendping);
|
signal(SIGALRM, sendping);
|
||||||
@ -419,7 +419,7 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from)
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
} else
|
} else
|
||||||
if (icmppkt->icmp_type != ICMP_ECHO)
|
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));
|
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,
|
if ((pingsock = socket(AF_INET, SOCK_RAW,
|
||||||
(proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */
|
(proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */
|
||||||
if (errno == EPERM)
|
if (errno == EPERM)
|
||||||
error_msg_and_die("permission denied. (are you root?)\n");
|
error_msg_and_die("permission denied. (are you root?)");
|
||||||
else
|
else
|
||||||
perror_msg_and_die("creating a raw socket");
|
perror_msg_and_die("creating a raw socket");
|
||||||
}
|
}
|
||||||
@ -449,12 +449,12 @@ static void ping(const char *host)
|
|||||||
|
|
||||||
pingaddr.sin_family = AF_INET;
|
pingaddr.sin_family = AF_INET;
|
||||||
if (!(h = gethostbyname(host))) {
|
if (!(h = gethostbyname(host))) {
|
||||||
error_msg("unknown host %s\n", host);
|
error_msg("unknown host %s", host);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (h->h_addrtype != AF_INET) {
|
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);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ extern int kill_main(int argc, char **argv)
|
|||||||
pidList = find_pid_by_name( *argv);
|
pidList = find_pid_by_name( *argv);
|
||||||
if (!pidList) {
|
if (!pidList) {
|
||||||
all_found = FALSE;
|
all_found = FALSE;
|
||||||
error_msg( "%s: no process killed\n", *argv);
|
error_msg( "%s: no process killed", *argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(; pidList && *pidList!=0; pidList++) {
|
for(; pidList && *pidList!=0; pidList++) {
|
||||||
@ -246,5 +246,5 @@ extern int kill_main(int argc, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
error_msg_and_die( "bad signal name: %s\n", *argv);
|
error_msg_and_die( "bad signal name: %s", *argv);
|
||||||
}
|
}
|
||||||
|
@ -99,20 +99,20 @@ static void parse_proc_status(char *S, proc_t * P)
|
|||||||
if (tmp)
|
if (tmp)
|
||||||
sscanf(tmp, "Pid:\t%d\n" "PPid:\t%d\n", &P->pid, &P->ppid);
|
sscanf(tmp, "Pid:\t%d\n" "PPid:\t%d\n", &P->pid, &P->ppid);
|
||||||
else
|
else
|
||||||
error_msg("Internal error!\n");
|
error_msg("Internal error!");
|
||||||
|
|
||||||
/* For busybox, ignoring effective, saved, etc */
|
/* For busybox, ignoring effective, saved, etc */
|
||||||
tmp = strstr(S, "Uid:");
|
tmp = strstr(S, "Uid:");
|
||||||
if (tmp)
|
if (tmp)
|
||||||
sscanf(tmp, "Uid:\t%d", &P->ruid);
|
sscanf(tmp, "Uid:\t%d", &P->ruid);
|
||||||
else
|
else
|
||||||
error_msg("Internal error!\n");
|
error_msg("Internal error!");
|
||||||
|
|
||||||
tmp = strstr(S, "Gid:");
|
tmp = strstr(S, "Gid:");
|
||||||
if (tmp)
|
if (tmp)
|
||||||
sscanf(tmp, "Gid:\t%d", &P->rgid);
|
sscanf(tmp, "Gid:\t%d", &P->rgid);
|
||||||
else
|
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");
|
dir = opendir("/proc");
|
||||||
if (!dir)
|
if (!dir)
|
||||||
error_msg_and_die("Can't open /proc\n");
|
error_msg_and_die("Can't open /proc");
|
||||||
|
|
||||||
#ifdef BB_FEATURE_AUTOWIDTH
|
#ifdef BB_FEATURE_AUTOWIDTH
|
||||||
ioctl(fileno(stdout), TIOCGWINSZ, &win);
|
ioctl(fileno(stdout), TIOCGWINSZ, &win);
|
||||||
|
8
ps.c
8
ps.c
@ -99,20 +99,20 @@ static void parse_proc_status(char *S, proc_t * P)
|
|||||||
if (tmp)
|
if (tmp)
|
||||||
sscanf(tmp, "Pid:\t%d\n" "PPid:\t%d\n", &P->pid, &P->ppid);
|
sscanf(tmp, "Pid:\t%d\n" "PPid:\t%d\n", &P->pid, &P->ppid);
|
||||||
else
|
else
|
||||||
error_msg("Internal error!\n");
|
error_msg("Internal error!");
|
||||||
|
|
||||||
/* For busybox, ignoring effective, saved, etc */
|
/* For busybox, ignoring effective, saved, etc */
|
||||||
tmp = strstr(S, "Uid:");
|
tmp = strstr(S, "Uid:");
|
||||||
if (tmp)
|
if (tmp)
|
||||||
sscanf(tmp, "Uid:\t%d", &P->ruid);
|
sscanf(tmp, "Uid:\t%d", &P->ruid);
|
||||||
else
|
else
|
||||||
error_msg("Internal error!\n");
|
error_msg("Internal error!");
|
||||||
|
|
||||||
tmp = strstr(S, "Gid:");
|
tmp = strstr(S, "Gid:");
|
||||||
if (tmp)
|
if (tmp)
|
||||||
sscanf(tmp, "Gid:\t%d", &P->rgid);
|
sscanf(tmp, "Gid:\t%d", &P->rgid);
|
||||||
else
|
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");
|
dir = opendir("/proc");
|
||||||
if (!dir)
|
if (!dir)
|
||||||
error_msg_and_die("Can't open /proc\n");
|
error_msg_and_die("Can't open /proc");
|
||||||
|
|
||||||
#ifdef BB_FEATURE_AUTOWIDTH
|
#ifdef BB_FEATURE_AUTOWIDTH
|
||||||
ioctl(fileno(stdout), TIOCGWINSZ, &win);
|
ioctl(fileno(stdout), TIOCGWINSZ, &win);
|
||||||
|
2
rdate.c
2
rdate.c
@ -72,7 +72,7 @@ time_t askremotedate(char *host)
|
|||||||
}
|
}
|
||||||
if (read(fd, (void *)&nett, 4) != 4) { /* read time from server */
|
if (read(fd, (void *)&nett, 4) != 4) { /* read time from server */
|
||||||
close(fd);
|
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);
|
close(fd);
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ static void myread(int num, char *buffer)
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
perror_msg_and_die(progname);
|
perror_msg_and_die(progname);
|
||||||
else
|
else
|
||||||
error_msg_and_die("Unexpected end of input file!\n");
|
error_msg_and_die("Unexpected end of input file!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
20
sed.c
20
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] == '/') {
|
else if (my_str[idx] == '/') {
|
||||||
idx = index_of_next_unescaped_regexp_delim(sed_cmd, my_str, ++idx);
|
idx = index_of_next_unescaped_regexp_delim(sed_cmd, my_str, ++idx);
|
||||||
if (idx == -1)
|
if (idx == -1)
|
||||||
error_msg_and_die("unterminated match expression\n");
|
error_msg_and_die("unterminated match expression");
|
||||||
my_str[idx] = '\0';
|
my_str[idx] = '\0';
|
||||||
*regex = (regex_t *)xmalloc(sizeof(regex_t));
|
*regex = (regex_t *)xmalloc(sizeof(regex_t));
|
||||||
xregcomp(*regex, my_str+1, 0);
|
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 {
|
else {
|
||||||
error_msg("get_address: no address found in string\n"
|
error_msg("get_address: no address found in string\n"
|
||||||
"\t(you probably didn't check the string you passed me)\n");
|
"\t(you probably didn't check the string you passed me)");
|
||||||
idx = -1;
|
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
|
/* verify that the 's' is followed by something. That something
|
||||||
* (typically a 'slash') is now our regexp delimiter... */
|
* (typically a 'slash') is now our regexp delimiter... */
|
||||||
if (!substr[++idx])
|
if (!substr[++idx])
|
||||||
error_msg_and_die("bad format in substitution expression\n");
|
error_msg_and_die("bad format in substitution expression");
|
||||||
else
|
else
|
||||||
sed_cmd->delimiter=substr[idx];
|
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;
|
oldidx = idx+1;
|
||||||
idx = index_of_next_unescaped_regexp_delim(sed_cmd, substr, ++idx);
|
idx = index_of_next_unescaped_regexp_delim(sed_cmd, substr, ++idx);
|
||||||
if (idx == -1)
|
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);
|
match = strdup_substr(substr, oldidx, idx);
|
||||||
|
|
||||||
/* determine the number of back references in the match string */
|
/* 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;
|
oldidx = idx+1;
|
||||||
idx = index_of_next_unescaped_regexp_delim(sed_cmd, substr, ++idx);
|
idx = index_of_next_unescaped_regexp_delim(sed_cmd, substr, ++idx);
|
||||||
if (idx == -1)
|
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);
|
sed_cmd->replace = strdup_substr(substr, oldidx, idx);
|
||||||
|
|
||||||
/* process the flags */
|
/* 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]))
|
if (strchr("; \t\v\n\r", substr[idx]))
|
||||||
goto out;
|
goto out;
|
||||||
/* else */
|
/* 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'))
|
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 */
|
/* store the edit line text */
|
||||||
/* make editline big enough to accomodate the extra '\n' we will tack on
|
/* 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 */
|
/* last part (mandatory) will be a command */
|
||||||
if (cmdstr[idx] == '\0')
|
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 */
|
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];
|
sed_cmd->cmd = cmdstr[idx];
|
||||||
|
|
||||||
/* special-case handling for (s)ubstitution */
|
/* 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 */
|
/* special-case handling for (a)ppend, (i)nsert, and (c)hange */
|
||||||
else if (strchr("aic", cmdstr[idx])) {
|
else if (strchr("aic", cmdstr[idx])) {
|
||||||
if (sed_cmd->end_line || sed_cmd->end_match)
|
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]);
|
idx += parse_edit_cmd(sed_cmd, &cmdstr[idx]);
|
||||||
}
|
}
|
||||||
/* if it was a single-letter command (such as 'p' or 'd') we need to
|
/* if it was a single-letter command (such as 'p' or 'd') we need to
|
||||||
|
@ -52,18 +52,18 @@ setkeycodes_main(int argc, char** argv)
|
|||||||
a.keycode = atoi(argv[2]);
|
a.keycode = atoi(argv[2]);
|
||||||
a.scancode = sc = strtol(argv[1], &ep, 16);
|
a.scancode = sc = strtol(argv[1], &ep, 16);
|
||||||
if (*ep) {
|
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) {
|
if (a.scancode > 127) {
|
||||||
a.scancode -= 0xe000;
|
a.scancode -= 0xe000;
|
||||||
a.scancode += 128;
|
a.scancode += 128;
|
||||||
}
|
}
|
||||||
if (a.scancode > 255 || a.keycode > 127) {
|
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)) {
|
if (ioctl(fd,KDSETKEYCODE,&a)) {
|
||||||
perror("KDSETKEYCODE");
|
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;
|
argc -= 2;
|
||||||
argv += 2;
|
argv += 2;
|
||||||
|
30
sh.c
30
sh.c
@ -321,13 +321,13 @@ static int builtin_fg_bg(struct child_prog *child)
|
|||||||
struct job *job=NULL;
|
struct job *job=NULL;
|
||||||
|
|
||||||
if (!child->argv[1] || child->argv[2]) {
|
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]);
|
child->argv[0]);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sscanf(child->argv[1], "%%%d", &jobNum) != 1) {
|
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]);
|
child->argv[0], child->argv[1]);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
@ -339,7 +339,7 @@ static int builtin_fg_bg(struct child_prog *child)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!job) {
|
if (!job) {
|
||||||
error_msg("%s: unknown job %d\n",
|
error_msg("%s: unknown job %d",
|
||||||
child->argv[0], jobNum);
|
child->argv[0], jobNum);
|
||||||
return EXIT_FAILURE;
|
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);
|
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))) {
|
if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
|
||||||
shell_context = 0; /* Reset the shell's context on an error */
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,7 +520,7 @@ static int builtin_else(struct child_prog *child)
|
|||||||
|
|
||||||
if (! (cmd->job_context & THEN_EXP_CONTEXT)) {
|
if (! (cmd->job_context & THEN_EXP_CONTEXT)) {
|
||||||
shell_context = 0; /* Reset the shell's context on an error */
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
/* If the if result was TRUE, skip the 'else' stuff */
|
/* 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);
|
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))) {
|
if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
|
||||||
shell_context = 0; /* Reset the shell's context on an error */
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
/* Clear out the if and then context bits */
|
/* 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) {
|
if (openfd < 0) {
|
||||||
/* this could get lost if stderr has been redirected, but
|
/* this could get lost if stderr has been redirected, but
|
||||||
bash and ash both lose it as well (though zsh doesn't!) */
|
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));
|
strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -960,7 +960,7 @@ static void expand_argument(struct child_prog *prog, int *argcPtr,
|
|||||||
if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){
|
if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){
|
||||||
rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->glob_result);
|
rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->glob_result);
|
||||||
if (rc == GLOB_NOSPACE) {
|
if (rc == GLOB_NOSPACE) {
|
||||||
error_msg("out of space during glob operation\n");
|
error_msg("out of space during glob operation");
|
||||||
return;
|
return;
|
||||||
} else if (rc == GLOB_NOMATCH ||
|
} else if (rc == GLOB_NOMATCH ||
|
||||||
(!rc && (prog->glob_result.gl_pathc - i) == 1 &&
|
(!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 == '\\') {
|
if (*src == '\\') {
|
||||||
src++;
|
src++;
|
||||||
if (!*src) {
|
if (!*src) {
|
||||||
error_msg("character expected after \\\n");
|
error_msg("character expected after \\");
|
||||||
free_job(job);
|
free_job(job);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1152,7 +1152,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
|
|||||||
chptr++;
|
chptr++;
|
||||||
|
|
||||||
if (!*chptr) {
|
if (!*chptr) {
|
||||||
error_msg("file name expected after %c\n", *src);
|
error_msg("file name expected after %c", *src);
|
||||||
free_job(job);
|
free_job(job);
|
||||||
job->num_progs=0;
|
job->num_progs=0;
|
||||||
return 1;
|
return 1;
|
||||||
@ -1171,7 +1171,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
|
|||||||
if (*prog->argv[argc_l])
|
if (*prog->argv[argc_l])
|
||||||
argc_l++;
|
argc_l++;
|
||||||
if (!argc_l) {
|
if (!argc_l) {
|
||||||
error_msg("empty command in pipe\n");
|
error_msg("empty command in pipe");
|
||||||
free_job(job);
|
free_job(job);
|
||||||
job->num_progs=0;
|
job->num_progs=0;
|
||||||
return 1;
|
return 1;
|
||||||
@ -1199,7 +1199,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
|
|||||||
src++;
|
src++;
|
||||||
|
|
||||||
if (!*src) {
|
if (!*src) {
|
||||||
error_msg("empty command in pipe\n");
|
error_msg("empty command in pipe");
|
||||||
free_job(job);
|
free_job(job);
|
||||||
job->num_progs=0;
|
job->num_progs=0;
|
||||||
return 1;
|
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");
|
printf("erik: found a continue char at EOL...\n");
|
||||||
command = (char *) xcalloc(BUFSIZ, sizeof(char));
|
command = (char *) xcalloc(BUFSIZ, sizeof(char));
|
||||||
if (get_command(input, command)) {
|
if (get_command(input, command)) {
|
||||||
error_msg("character expected after \\\n");
|
error_msg("character expected after \\");
|
||||||
free(command);
|
free(command);
|
||||||
free_job(job);
|
free_job(job);
|
||||||
return 1;
|
return 1;
|
||||||
@ -1323,7 +1323,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
|
|||||||
free(command);
|
free(command);
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
error_msg("character expected after \\\n");
|
error_msg("character expected after \\");
|
||||||
free(command);
|
free(command);
|
||||||
free_job(job);
|
free_job(job);
|
||||||
return 1;
|
return 1;
|
||||||
@ -1738,7 +1738,7 @@ int shell_main(int argc_l, char **argv_l)
|
|||||||
case 'c':
|
case 'c':
|
||||||
input = NULL;
|
input = NULL;
|
||||||
if (local_pending_command != 0)
|
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]);
|
local_pending_command = xstrdup(argv[optind]);
|
||||||
optind++;
|
optind++;
|
||||||
argv = argv+optind;
|
argv = argv+optind;
|
||||||
|
@ -318,7 +318,7 @@ static void cmdedit_setwidth(int w, int redraw_flg)
|
|||||||
input_backward();
|
input_backward();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error_msg("\n*** Error: minimum screen width is %d\n", cmdedit_termw);
|
error_msg("\n*** Error: minimum screen width is %d", cmdedit_termw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
30
shell/lash.c
30
shell/lash.c
@ -321,13 +321,13 @@ static int builtin_fg_bg(struct child_prog *child)
|
|||||||
struct job *job=NULL;
|
struct job *job=NULL;
|
||||||
|
|
||||||
if (!child->argv[1] || child->argv[2]) {
|
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]);
|
child->argv[0]);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sscanf(child->argv[1], "%%%d", &jobNum) != 1) {
|
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]);
|
child->argv[0], child->argv[1]);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
@ -339,7 +339,7 @@ static int builtin_fg_bg(struct child_prog *child)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!job) {
|
if (!job) {
|
||||||
error_msg("%s: unknown job %d\n",
|
error_msg("%s: unknown job %d",
|
||||||
child->argv[0], jobNum);
|
child->argv[0], jobNum);
|
||||||
return EXIT_FAILURE;
|
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);
|
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))) {
|
if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
|
||||||
shell_context = 0; /* Reset the shell's context on an error */
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,7 +520,7 @@ static int builtin_else(struct child_prog *child)
|
|||||||
|
|
||||||
if (! (cmd->job_context & THEN_EXP_CONTEXT)) {
|
if (! (cmd->job_context & THEN_EXP_CONTEXT)) {
|
||||||
shell_context = 0; /* Reset the shell's context on an error */
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
/* If the if result was TRUE, skip the 'else' stuff */
|
/* 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);
|
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))) {
|
if (! (cmd->job_context & (IF_TRUE_CONTEXT|IF_FALSE_CONTEXT))) {
|
||||||
shell_context = 0; /* Reset the shell's context on an error */
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
/* Clear out the if and then context bits */
|
/* 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) {
|
if (openfd < 0) {
|
||||||
/* this could get lost if stderr has been redirected, but
|
/* this could get lost if stderr has been redirected, but
|
||||||
bash and ash both lose it as well (though zsh doesn't!) */
|
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));
|
strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -960,7 +960,7 @@ static void expand_argument(struct child_prog *prog, int *argcPtr,
|
|||||||
if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){
|
if (strpbrk(prog->argv[argc_l - 1],"*[]?")!= NULL){
|
||||||
rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->glob_result);
|
rc = glob(prog->argv[argc_l - 1], flags, NULL, &prog->glob_result);
|
||||||
if (rc == GLOB_NOSPACE) {
|
if (rc == GLOB_NOSPACE) {
|
||||||
error_msg("out of space during glob operation\n");
|
error_msg("out of space during glob operation");
|
||||||
return;
|
return;
|
||||||
} else if (rc == GLOB_NOMATCH ||
|
} else if (rc == GLOB_NOMATCH ||
|
||||||
(!rc && (prog->glob_result.gl_pathc - i) == 1 &&
|
(!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 == '\\') {
|
if (*src == '\\') {
|
||||||
src++;
|
src++;
|
||||||
if (!*src) {
|
if (!*src) {
|
||||||
error_msg("character expected after \\\n");
|
error_msg("character expected after \\");
|
||||||
free_job(job);
|
free_job(job);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -1152,7 +1152,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
|
|||||||
chptr++;
|
chptr++;
|
||||||
|
|
||||||
if (!*chptr) {
|
if (!*chptr) {
|
||||||
error_msg("file name expected after %c\n", *src);
|
error_msg("file name expected after %c", *src);
|
||||||
free_job(job);
|
free_job(job);
|
||||||
job->num_progs=0;
|
job->num_progs=0;
|
||||||
return 1;
|
return 1;
|
||||||
@ -1171,7 +1171,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
|
|||||||
if (*prog->argv[argc_l])
|
if (*prog->argv[argc_l])
|
||||||
argc_l++;
|
argc_l++;
|
||||||
if (!argc_l) {
|
if (!argc_l) {
|
||||||
error_msg("empty command in pipe\n");
|
error_msg("empty command in pipe");
|
||||||
free_job(job);
|
free_job(job);
|
||||||
job->num_progs=0;
|
job->num_progs=0;
|
||||||
return 1;
|
return 1;
|
||||||
@ -1199,7 +1199,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
|
|||||||
src++;
|
src++;
|
||||||
|
|
||||||
if (!*src) {
|
if (!*src) {
|
||||||
error_msg("empty command in pipe\n");
|
error_msg("empty command in pipe");
|
||||||
free_job(job);
|
free_job(job);
|
||||||
job->num_progs=0;
|
job->num_progs=0;
|
||||||
return 1;
|
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");
|
printf("erik: found a continue char at EOL...\n");
|
||||||
command = (char *) xcalloc(BUFSIZ, sizeof(char));
|
command = (char *) xcalloc(BUFSIZ, sizeof(char));
|
||||||
if (get_command(input, command)) {
|
if (get_command(input, command)) {
|
||||||
error_msg("character expected after \\\n");
|
error_msg("character expected after \\");
|
||||||
free(command);
|
free(command);
|
||||||
free_job(job);
|
free_job(job);
|
||||||
return 1;
|
return 1;
|
||||||
@ -1323,7 +1323,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
|
|||||||
free(command);
|
free(command);
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
error_msg("character expected after \\\n");
|
error_msg("character expected after \\");
|
||||||
free(command);
|
free(command);
|
||||||
free_job(job);
|
free_job(job);
|
||||||
return 1;
|
return 1;
|
||||||
@ -1738,7 +1738,7 @@ int shell_main(int argc_l, char **argv_l)
|
|||||||
case 'c':
|
case 'c':
|
||||||
input = NULL;
|
input = NULL;
|
||||||
if (local_pending_command != 0)
|
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]);
|
local_pending_command = xstrdup(argv[optind]);
|
||||||
optind++;
|
optind++;
|
||||||
argv = argv+optind;
|
argv = argv+optind;
|
||||||
|
@ -95,7 +95,7 @@ extern int swap_on_off_main(int argc, char **argv)
|
|||||||
struct stat statBuf;
|
struct stat statBuf;
|
||||||
|
|
||||||
if (stat("/etc/fstab", &statBuf) < 0)
|
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();
|
do_em_all();
|
||||||
break;
|
break;
|
||||||
|
@ -87,14 +87,14 @@ static int pencode(char *s)
|
|||||||
*s = '\0';
|
*s = '\0';
|
||||||
fac = decode(save, facilitynames);
|
fac = decode(save, facilitynames);
|
||||||
if (fac < 0)
|
if (fac < 0)
|
||||||
error_msg_and_die("unknown facility name: %s\n", save);
|
error_msg_and_die("unknown facility name: %s", save);
|
||||||
*s++ = '.';
|
*s++ = '.';
|
||||||
} else {
|
} else {
|
||||||
s = save;
|
s = save;
|
||||||
}
|
}
|
||||||
lev = decode(s, prioritynames);
|
lev = decode(s, prioritynames);
|
||||||
if (lev < 0)
|
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));
|
return ((lev & LOG_PRIMASK) | (fac & LOG_FACMASK));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ static const int IOV_COUNT = 2;
|
|||||||
|
|
||||||
if ( -1 == writev(remotefd,iov, IOV_COUNT)){
|
if ( -1 == writev(remotefd,iov, IOV_COUNT)){
|
||||||
error_msg_and_die("syslogd: cannot write to remote file handle on"
|
error_msg_and_die("syslogd: cannot write to remote file handle on"
|
||||||
"%s:%d\n",RemoteHost,RemotePort);
|
"%s:%d",RemoteHost,RemotePort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (local_logging == TRUE)
|
if (local_logging == TRUE)
|
||||||
@ -264,13 +264,13 @@ static void init_RemoteLog (void){
|
|||||||
remotefd = socket(AF_INET, SOCK_DGRAM, 0);
|
remotefd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
|
||||||
if (remotefd < 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);
|
hostinfo = (struct hostent *) gethostbyname(RemoteHost);
|
||||||
|
|
||||||
if (!hostinfo) {
|
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;
|
remoteaddr.sin_family = AF_INET;
|
||||||
@ -282,7 +282,7 @@ static void init_RemoteLog (void){
|
|||||||
for future operations
|
for future operations
|
||||||
*/
|
*/
|
||||||
if ( 0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))){
|
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)){
|
if ( -1 == writev(remotefd,iov, IOV_COUNT)){
|
||||||
error_msg_and_die("syslogd: cannot write to remote file handle on"
|
error_msg_and_die("syslogd: cannot write to remote file handle on"
|
||||||
"%s:%d\n",RemoteHost,RemotePort);
|
"%s:%d",RemoteHost,RemotePort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (local_logging == TRUE)
|
if (local_logging == TRUE)
|
||||||
@ -264,13 +264,13 @@ static void init_RemoteLog (void){
|
|||||||
remotefd = socket(AF_INET, SOCK_DGRAM, 0);
|
remotefd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||||
|
|
||||||
if (remotefd < 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);
|
hostinfo = (struct hostent *) gethostbyname(RemoteHost);
|
||||||
|
|
||||||
if (!hostinfo) {
|
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;
|
remoteaddr.sin_family = AF_INET;
|
||||||
@ -282,7 +282,7 @@ static void init_RemoteLog (void){
|
|||||||
for future operations
|
for future operations
|
||||||
*/
|
*/
|
||||||
if ( 0 != (connect(remotefd, (struct sockaddr *) &remoteaddr, len))){
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
40
tar.c
40
tar.c
@ -165,10 +165,10 @@ extern int tar_unzip_init(int tarFd)
|
|||||||
signal(SIGCHLD, child_died);
|
signal(SIGCHLD, child_died);
|
||||||
|
|
||||||
if (pipe(unzip_pipe)!=0)
|
if (pipe(unzip_pipe)!=0)
|
||||||
error_msg_and_die("pipe error\n");
|
error_msg_and_die("pipe error");
|
||||||
|
|
||||||
if ( (child_pid = fork()) == -1)
|
if ( (child_pid = fork()) == -1)
|
||||||
error_msg_and_die("fork failure\n");
|
error_msg_and_die("fork failure");
|
||||||
|
|
||||||
if (child_pid==0) {
|
if (child_pid==0) {
|
||||||
/* child process */
|
/* child process */
|
||||||
@ -259,7 +259,7 @@ extern int tar_main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
if (*tarName != '-')
|
if (*tarName != '-')
|
||||||
error_msg_and_die( "Only one 'f' option allowed\n");
|
error_msg_and_die( "Only one 'f' option allowed");
|
||||||
tarName = optarg;
|
tarName = optarg;
|
||||||
break;
|
break;
|
||||||
#if defined BB_FEATURE_TAR_EXCLUDE
|
#if defined BB_FEATURE_TAR_EXCLUDE
|
||||||
@ -294,11 +294,11 @@ extern int tar_main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if (createFlag == TRUE) {
|
if (createFlag == TRUE) {
|
||||||
#ifndef BB_FEATURE_TAR_CREATE
|
#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
|
#else
|
||||||
#ifdef BB_FEATURE_TAR_GZIP
|
#ifdef BB_FEATURE_TAR_GZIP
|
||||||
if (unzipFlag==TRUE)
|
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
|
#endif
|
||||||
status = writeTarFile(tarName, verboseFlag, argv + optind, excludeList);
|
status = writeTarFile(tarName, verboseFlag, argv + optind, excludeList);
|
||||||
#endif
|
#endif
|
||||||
@ -330,7 +330,7 @@ extern int tar_main(int argc, char **argv)
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
flagError:
|
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
|
static void
|
||||||
@ -383,7 +383,7 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
}
|
}
|
||||||
if ( (readSize = full_read(header->tarFd, buffer, readSize)) <= 0 ) {
|
if ( (readSize = full_read(header->tarFd, buffer, readSize)) <= 0 ) {
|
||||||
/* Tarball seems to have a problem */
|
/* Tarball seems to have a problem */
|
||||||
error_msg("Unexpected EOF in archive\n");
|
error_msg("Unexpected EOF in archive");
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
if ( readSize < writeSize )
|
if ( readSize < writeSize )
|
||||||
@ -476,7 +476,7 @@ tarExtractSymLink(TarInfo *header, int extractFlag, int tostdoutFlag)
|
|||||||
/* Do not change permissions or date on symlink,
|
/* Do not change permissions or date on symlink,
|
||||||
* since it changes the pointed to file instead. duh. */
|
* since it changes the pointed to file instead. duh. */
|
||||||
#else
|
#else
|
||||||
error_msg("%s: Cannot create symlink to '%s': %s\n",
|
error_msg("%s: Cannot create symlink to '%s': %s",
|
||||||
header->name, header->linkname,
|
header->name, header->linkname,
|
||||||
"symlinks not supported");
|
"symlinks not supported");
|
||||||
#endif
|
#endif
|
||||||
@ -543,7 +543,7 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header)
|
|||||||
++*(header->name);
|
++*(header->name);
|
||||||
|
|
||||||
if (alreadyWarned == FALSE) {
|
if (alreadyWarned == FALSE) {
|
||||||
error_msg("Removing leading '/' from member names\n");
|
error_msg("Removing leading '/' from member names");
|
||||||
alreadyWarned = TRUE;
|
alreadyWarned = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -644,7 +644,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag,
|
|||||||
goto endgame;
|
goto endgame;
|
||||||
} else {
|
} else {
|
||||||
errorFlag=TRUE;
|
errorFlag=TRUE;
|
||||||
error_msg("Bad tar header, skipping\n");
|
error_msg("Bad tar header, skipping");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -791,7 +791,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag,
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
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);
|
close( tarFd);
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
}
|
}
|
||||||
@ -803,7 +803,7 @@ extern int readTarFile(int tarFd, int extractFlag, int listFlag,
|
|||||||
return ( FALSE);
|
return ( FALSE);
|
||||||
}
|
}
|
||||||
else if (errorFlag==TRUE) {
|
else if (errorFlag==TRUE) {
|
||||||
error_msg( "Error exit delayed from previous errors\n");
|
error_msg( "Error exit delayed from previous errors");
|
||||||
return( FALSE);
|
return( FALSE);
|
||||||
} else
|
} else
|
||||||
return( status);
|
return( status);
|
||||||
@ -813,7 +813,7 @@ endgame:
|
|||||||
close( tarFd);
|
close( tarFd);
|
||||||
if ( *(header.name) == '\0' ) {
|
if ( *(header.name) == '\0' ) {
|
||||||
if (errorFlag==TRUE)
|
if (errorFlag==TRUE)
|
||||||
error_msg( "Error exit delayed from previous errors\n");
|
error_msg( "Error exit delayed from previous errors");
|
||||||
else
|
else
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
@ -1002,7 +1002,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *header_name,
|
|||||||
header.typeflag = REGTYPE;
|
header.typeflag = REGTYPE;
|
||||||
putOctal(header.size, sizeof(header.size), statbuf->st_size);
|
putOctal(header.size, sizeof(header.size), statbuf->st_size);
|
||||||
} else {
|
} else {
|
||||||
error_msg("%s: Unknown file type\n", real_name);
|
error_msg("%s: Unknown file type", real_name);
|
||||||
return ( FALSE);
|
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 */
|
/* It is against the rules to archive a socket */
|
||||||
if (S_ISSOCK(statbuf->st_mode)) {
|
if (S_ISSOCK(statbuf->st_mode)) {
|
||||||
error_msg("%s: socket ignored\n", fileName);
|
error_msg("%s: socket ignored", fileName);
|
||||||
return( TRUE);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1070,7 +1070,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
|
|||||||
* the new tarball */
|
* the new tarball */
|
||||||
if (tbInfo->statBuf.st_dev == statbuf->st_dev &&
|
if (tbInfo->statBuf.st_dev == statbuf->st_dev &&
|
||||||
tbInfo->statBuf.st_ino == statbuf->st_ino) {
|
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);
|
return( TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1078,7 +1078,7 @@ static int writeFileToTarball(const char *fileName, struct stat *statbuf, void*
|
|||||||
while (header_name[0] == '/') {
|
while (header_name[0] == '/') {
|
||||||
static int alreadyWarned=FALSE;
|
static int alreadyWarned=FALSE;
|
||||||
if (alreadyWarned==FALSE) {
|
if (alreadyWarned==FALSE) {
|
||||||
error_msg("Removing leading '/' from member names\n");
|
error_msg("Removing leading '/' from member names");
|
||||||
alreadyWarned=TRUE;
|
alreadyWarned=TRUE;
|
||||||
}
|
}
|
||||||
header_name++;
|
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 */
|
/* open the file we want to archive, and make sure all is well */
|
||||||
if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
|
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);
|
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. */
|
/* Make sure there is at least one file to tar up. */
|
||||||
if (*argv == NULL)
|
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. */
|
/* Open the tar file for writing. */
|
||||||
if (!strcmp(tarName, "-"))
|
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 */
|
/* Hang up the tools, close up shop, head home */
|
||||||
close(tarFd);
|
close(tarFd);
|
||||||
if (errorFlag == TRUE) {
|
if (errorFlag == TRUE) {
|
||||||
error_msg("Error exit delayed from previous errors\n");
|
error_msg("Error exit delayed from previous errors");
|
||||||
freeHardLinkInfo(&tbInfo.hlInfoHead);
|
freeHardLinkInfo(&tbInfo.hlInfoHead);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
4
telnet.c
4
telnet.c
@ -584,7 +584,7 @@ static int getport(char * p)
|
|||||||
|
|
||||||
if ((unsigned)(port - 1 ) > 65534)
|
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;
|
return port;
|
||||||
}
|
}
|
||||||
@ -596,7 +596,7 @@ static struct in_addr getserver(char * host)
|
|||||||
struct hostent * he;
|
struct hostent * he;
|
||||||
if ((he = gethostbyname(host)) == NULL)
|
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);
|
memcpy(&addr, he->h_addr, sizeof addr);
|
||||||
|
|
||||||
|
10
test.c
10
test.c
@ -184,7 +184,7 @@ test_main(int argc, char** argv)
|
|||||||
|
|
||||||
if (strcmp(applet_name, "[") == 0) {
|
if (strcmp(applet_name, "[") == 0) {
|
||||||
if (strcmp(argv[--argc], "]"))
|
if (strcmp(argv[--argc], "]"))
|
||||||
error_msg_and_die("missing ]\n");
|
error_msg_and_die("missing ]");
|
||||||
argv[argc] = NULL;
|
argv[argc] = NULL;
|
||||||
}
|
}
|
||||||
/* Implement special cases from POSIX.2, section 4.62.4 */
|
/* Implement special cases from POSIX.2, section 4.62.4 */
|
||||||
@ -233,9 +233,9 @@ syntax(op, msg)
|
|||||||
char *msg;
|
char *msg;
|
||||||
{
|
{
|
||||||
if (op && *op)
|
if (op && *op)
|
||||||
error_msg_and_die("%s: %s\n", op, msg);
|
error_msg_and_die("%s: %s", op, msg);
|
||||||
else
|
else
|
||||||
error_msg_and_die("%s\n", msg);
|
error_msg_and_die("%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -470,13 +470,13 @@ getn(s)
|
|||||||
r = strtol(s, &p, 10);
|
r = strtol(s, &p, 10);
|
||||||
|
|
||||||
if (errno != 0)
|
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))
|
while (isspace(*p))
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
if (*p)
|
if (*p)
|
||||||
error_msg_and_die("%s: bad number\n", s);
|
error_msg_and_die("%s: bad number", s);
|
||||||
|
|
||||||
return (int) r;
|
return (int) r;
|
||||||
}
|
}
|
||||||
|
2
tr.c
2
tr.c
@ -186,7 +186,7 @@ extern int tr_main(int argc, char **argv)
|
|||||||
input_length = complement(input, input_length);
|
input_length = complement(input, input_length);
|
||||||
if (argv[index] != NULL) {
|
if (argv[index] != NULL) {
|
||||||
if (*argv[index] == '\0')
|
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);
|
output_length = expand(argv[index], output);
|
||||||
map(input, input_length, output, output_length);
|
map(input, input_length, output, output_length);
|
||||||
}
|
}
|
||||||
|
8
umount.c
8
umount.c
@ -81,7 +81,7 @@ void mtab_read(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if ((fp = setmntent(mtab_file, "r")) == NULL) {
|
if ((fp = setmntent(mtab_file, "r")) == NULL) {
|
||||||
error_msg("Cannot open %s\n", mtab_file);
|
error_msg("Cannot open %s", mtab_file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while ((e = getmntent(fp))) {
|
while ((e = getmntent(fp))) {
|
||||||
@ -181,7 +181,7 @@ static int do_umount(const char *name, int useMtab)
|
|||||||
if (status != 0 && doForce == TRUE) {
|
if (status != 0 && doForce == TRUE) {
|
||||||
status = umount2(blockDevice, MNT_FORCE);
|
status = umount2(blockDevice, MNT_FORCE);
|
||||||
if (status != 0) {
|
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
|
#endif
|
||||||
@ -189,9 +189,9 @@ static int do_umount(const char *name, int useMtab)
|
|||||||
status = mount(blockDevice, name, NULL,
|
status = mount(blockDevice, name, NULL,
|
||||||
MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL);
|
MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL);
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
error_msg("%s busy - remounted read-only\n", blockDevice);
|
error_msg("%s busy - remounted read-only", blockDevice);
|
||||||
} else {
|
} else {
|
||||||
error_msg("Cannot remount %s read-only\n", blockDevice);
|
error_msg("Cannot remount %s read-only", blockDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (status == 0) {
|
if (status == 0) {
|
||||||
|
@ -284,7 +284,7 @@ static int readmode(struct fb_var_screeninfo *base, const char *fn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
error_msg( "mode reading not compiled in\n");
|
error_msg( "mode reading not compiled in");
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -434,7 +434,7 @@ extern int fbset_main(int argc, char **argv)
|
|||||||
perror_msg_and_die("fbset(ioctl)");
|
perror_msg_and_die("fbset(ioctl)");
|
||||||
if (g_options & OPT_READMODE) {
|
if (g_options & OPT_READMODE) {
|
||||||
if (!readmode(&var, modefile, mode)) {
|
if (!readmode(&var, modefile, mode)) {
|
||||||
error_msg("Unknown video mode `%s'\n", mode);
|
error_msg("Unknown video mode `%s'", mode);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ static void show_usage(void)
|
|||||||
|
|
||||||
static void die(const char *str)
|
static void die(const char *str)
|
||||||
{
|
{
|
||||||
error_msg("%s\n", str);
|
error_msg("%s", str);
|
||||||
leave(8);
|
leave(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ void add_long_options(char *options)
|
|||||||
arg_opt=required_argument;
|
arg_opt=required_argument;
|
||||||
}
|
}
|
||||||
if (strlen(tokptr) == 0)
|
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);
|
add_longopt(tokptr,arg_opt);
|
||||||
}
|
}
|
||||||
@ -277,7 +277,7 @@ void set_shell(const char *new_shell)
|
|||||||
else if (!strcmp(new_shell,"csh"))
|
else if (!strcmp(new_shell,"csh"))
|
||||||
shell=TCSH;
|
shell=TCSH;
|
||||||
else
|
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");
|
printf(" --\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
} else
|
} else
|
||||||
error_msg_and_die("missing optstring argument\n");
|
error_msg_and_die("missing optstring argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv[1][0] != '-' || compatible) {
|
if (argv[1][0] != '-' || compatible) {
|
||||||
@ -377,7 +377,7 @@ int getopt_main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!optstr) {
|
if (!optstr) {
|
||||||
if (optind >= argc)
|
if (optind >= argc)
|
||||||
error_msg_and_die("missing optstring argument\n");
|
error_msg_and_die("missing optstring argument");
|
||||||
else {
|
else {
|
||||||
optstr=xmalloc(strlen(argv[optind])+1);
|
optstr=xmalloc(strlen(argv[optind])+1);
|
||||||
strcpy(optstr,argv[optind]);
|
strcpy(optstr,argv[optind]);
|
||||||
|
@ -279,7 +279,7 @@ static void check_mount(void)
|
|||||||
if (!mnt)
|
if (!mnt)
|
||||||
return;
|
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)
|
static long valid_offset(int fd, int offset)
|
||||||
@ -336,28 +336,28 @@ static void write_tables(void)
|
|||||||
Super.s_state &= ~MINIX_ERROR_FS;
|
Super.s_state &= ~MINIX_ERROR_FS;
|
||||||
|
|
||||||
if (lseek(DEV, 0, SEEK_SET))
|
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))
|
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))
|
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))
|
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))
|
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))
|
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))
|
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)
|
static void write_block(int blk, char *buffer)
|
||||||
{
|
{
|
||||||
if (blk * BLOCK_SIZE != lseek(DEV, blk * BLOCK_SIZE, SEEK_SET))
|
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))
|
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)
|
static int get_free_block(void)
|
||||||
@ -365,7 +365,7 @@ static int get_free_block(void)
|
|||||||
int blk;
|
int blk;
|
||||||
|
|
||||||
if (used_good_blocks + 1 >= MAX_GOOD_BLOCKS)
|
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)
|
if (used_good_blocks)
|
||||||
blk = good_blocks_table[used_good_blocks - 1] + 1;
|
blk = good_blocks_table[used_good_blocks - 1] + 1;
|
||||||
else
|
else
|
||||||
@ -373,7 +373,7 @@ static int get_free_block(void)
|
|||||||
while (blk < ZONES && zone_in_use(blk))
|
while (blk < ZONES && zone_in_use(blk))
|
||||||
blk++;
|
blk++;
|
||||||
if (blk >= ZONES)
|
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;
|
good_blocks_table[used_good_blocks] = blk;
|
||||||
used_good_blocks++;
|
used_good_blocks++;
|
||||||
return blk;
|
return blk;
|
||||||
@ -439,7 +439,7 @@ static void make_bad_inode(void)
|
|||||||
goto end_bad;
|
goto end_bad;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
error_msg_and_die("too many bad blocks\n");
|
error_msg_and_die("too many bad blocks");
|
||||||
end_bad:
|
end_bad:
|
||||||
if (ind)
|
if (ind)
|
||||||
write_block(ind, (char *) ind_block);
|
write_block(ind, (char *) ind_block);
|
||||||
@ -489,7 +489,7 @@ static void make_bad_inode2(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Could make triple indirect block here */
|
/* 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:
|
end_bad:
|
||||||
if (ind)
|
if (ind)
|
||||||
write_block(ind, (char *) ind_block);
|
write_block(ind, (char *) ind_block);
|
||||||
@ -590,7 +590,7 @@ static void setup_tables(void)
|
|||||||
* /sbin/mkfs.minix -i 200 test.fs
|
* /sbin/mkfs.minix -i 200 test.fs
|
||||||
* */
|
* */
|
||||||
if (i >= 999) {
|
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;
|
FIRSTZONE = NORM_FIRSTZONE;
|
||||||
inode_map = xmalloc(IMAPS * BLOCK_SIZE);
|
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. */
|
/* Seek to the correct loc. */
|
||||||
if (lseek(DEV, current_block * BLOCK_SIZE, SEEK_SET) !=
|
if (lseek(DEV, current_block * BLOCK_SIZE, SEEK_SET) !=
|
||||||
current_block * BLOCK_SIZE) {
|
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) {
|
while (currently_testing < ZONES) {
|
||||||
if (lseek(DEV, currently_testing * BLOCK_SIZE, SEEK_SET) !=
|
if (lseek(DEV, currently_testing * BLOCK_SIZE, SEEK_SET) !=
|
||||||
currently_testing * BLOCK_SIZE)
|
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;
|
try = TEST_BUFFER_BLOCKS;
|
||||||
if (currently_testing + try > ZONES)
|
if (currently_testing + try > ZONES)
|
||||||
try = ZONES - currently_testing;
|
try = ZONES - currently_testing;
|
||||||
@ -670,7 +670,7 @@ static void check_blocks(void)
|
|||||||
if (got == try)
|
if (got == try)
|
||||||
continue;
|
continue;
|
||||||
if (currently_testing < FIRSTZONE)
|
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);
|
mark_zone(currently_testing);
|
||||||
badblocks++;
|
badblocks++;
|
||||||
currently_testing++;
|
currently_testing++;
|
||||||
@ -690,7 +690,7 @@ char *filename;
|
|||||||
|
|
||||||
listfile = fopen(filename, "r");
|
listfile = fopen(filename, "r");
|
||||||
if (listfile == (FILE *) NULL) {
|
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)) {
|
while (!feof(listfile)) {
|
||||||
fscanf(listfile, "%ld\n", &blockno);
|
fscanf(listfile, "%ld\n", &blockno);
|
||||||
@ -712,10 +712,10 @@ extern int mkfs_minix_main(int argc, char **argv)
|
|||||||
int stopIt=FALSE;
|
int stopIt=FALSE;
|
||||||
|
|
||||||
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
|
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
|
#ifdef BB_FEATURE_MINIX2
|
||||||
if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
|
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
|
#endif
|
||||||
|
|
||||||
/* Parse options */
|
/* Parse options */
|
||||||
@ -781,7 +781,7 @@ extern int mkfs_minix_main(int argc, char **argv)
|
|||||||
#ifdef BB_FEATURE_MINIX2
|
#ifdef BB_FEATURE_MINIX2
|
||||||
version2 = 1;
|
version2 = 1;
|
||||||
#else
|
#else
|
||||||
error_msg("%s: not compiled with minix v2 support\n",
|
error_msg("%s: not compiled with minix v2 support",
|
||||||
device_name);
|
device_name);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
#endif
|
#endif
|
||||||
@ -832,13 +832,13 @@ goodbye:
|
|||||||
strcpy(tmp + 2, ".badblocks");
|
strcpy(tmp + 2, ".badblocks");
|
||||||
DEV = open(device_name, O_RDWR);
|
DEV = open(device_name, O_RDWR);
|
||||||
if (DEV < 0)
|
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)
|
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))
|
if (!S_ISBLK(statbuf.st_mode))
|
||||||
check = 0;
|
check = 0;
|
||||||
else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340)
|
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();
|
setup_tables();
|
||||||
if (check)
|
if (check)
|
||||||
check_blocks();
|
check_blocks();
|
||||||
|
@ -87,7 +87,7 @@ static void init_signature_page()
|
|||||||
|
|
||||||
#ifdef PAGE_SIZE
|
#ifdef PAGE_SIZE
|
||||||
if (pagesize != PAGE_SIZE)
|
if (pagesize != PAGE_SIZE)
|
||||||
error_msg("Assuming pages of size %d\n", pagesize);
|
error_msg("Assuming pages of size %d", pagesize);
|
||||||
#endif
|
#endif
|
||||||
signature_page = (int *) xmalloc(pagesize);
|
signature_page = (int *) xmalloc(pagesize);
|
||||||
memset(signature_page, 0, pagesize);
|
memset(signature_page, 0, pagesize);
|
||||||
@ -185,7 +185,7 @@ static void page_bad(int page)
|
|||||||
bit_test_and_clear(signature_page, page);
|
bit_test_and_clear(signature_page, page);
|
||||||
else {
|
else {
|
||||||
if (badpages == MAX_BADPAGES)
|
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;
|
p->badpages[badpages] = page;
|
||||||
}
|
}
|
||||||
badpages++;
|
badpages++;
|
||||||
@ -206,7 +206,7 @@ static void check_blocks(void)
|
|||||||
}
|
}
|
||||||
if (do_seek && lseek(DEV, current_page * pagesize, SEEK_SET) !=
|
if (do_seek && lseek(DEV, current_page * pagesize, SEEK_SET) !=
|
||||||
current_page * pagesize)
|
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)))) {
|
if ((do_seek = (pagesize != read(DEV, buffer, pagesize)))) {
|
||||||
page_bad(current_page++);
|
page_bad(current_page++);
|
||||||
continue;
|
continue;
|
||||||
@ -307,14 +307,14 @@ int mkswap_main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!device_name) {
|
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);
|
usage(mkswap_usage);
|
||||||
}
|
}
|
||||||
sz = get_size(device_name);
|
sz = get_size(device_name);
|
||||||
if (!PAGES) {
|
if (!PAGES) {
|
||||||
PAGES = sz;
|
PAGES = sz;
|
||||||
} else if (PAGES > sz && !force) {
|
} 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));
|
PAGES * (pagesize / 1024), sz * (pagesize / 1024));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
@ -330,11 +330,11 @@ int mkswap_main(int argc, char **argv)
|
|||||||
version = 1;
|
version = 1;
|
||||||
}
|
}
|
||||||
if (version != 0 && 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);
|
usage(mkswap_usage);
|
||||||
}
|
}
|
||||||
if (PAGES < 10) {
|
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));
|
(long) (10 * pagesize / 1024));
|
||||||
usage(mkswap_usage);
|
usage(mkswap_usage);
|
||||||
}
|
}
|
||||||
@ -353,7 +353,7 @@ int mkswap_main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
if (PAGES > maxpages) {
|
if (PAGES > maxpages) {
|
||||||
PAGES = maxpages;
|
PAGES = maxpages;
|
||||||
error_msg("warning: truncating swap area to %ldkB\n",
|
error_msg("warning: truncating swap area to %ldkB",
|
||||||
PAGES * pagesize / 1024);
|
PAGES * pagesize / 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ int mkswap_main(int argc, char **argv)
|
|||||||
if (!S_ISBLK(statbuf.st_mode))
|
if (!S_ISBLK(statbuf.st_mode))
|
||||||
check = 0;
|
check = 0;
|
||||||
else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340)
|
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__
|
#ifdef __sparc__
|
||||||
if (!force && version == 0) {
|
if (!force && version == 0) {
|
||||||
@ -372,7 +372,7 @@ int mkswap_main(int argc, char **argv)
|
|||||||
unsigned short *q, sum;
|
unsigned short *q, sum;
|
||||||
|
|
||||||
if (read(DEV, buffer, 512) != 512)
|
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) {
|
if (buffer[508] == 0xDA && buffer[509] == 0xBE) {
|
||||||
q = (unsigned short *) (buffer + 510);
|
q = (unsigned short *) (buffer + 510);
|
||||||
for (sum = 0; q >= (unsigned short *) buffer;)
|
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"
|
error_msg("Device '%s' contains a valid Sun disklabel.\n"
|
||||||
"This probably means creating v0 swap would destroy your partition table\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"
|
"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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -391,7 +391,7 @@ int mkswap_main(int argc, char **argv)
|
|||||||
if (version == 0 || check)
|
if (version == 0 || check)
|
||||||
check_blocks();
|
check_blocks();
|
||||||
if (version == 0 && !bit_test_and_clear(signature_page, 0))
|
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) {
|
if (version == 1) {
|
||||||
p->version = version;
|
p->version = version;
|
||||||
p->last_page = PAGES - 1;
|
p->last_page = PAGES - 1;
|
||||||
@ -400,23 +400,23 @@ int mkswap_main(int argc, char **argv)
|
|||||||
|
|
||||||
goodpages = PAGES - badpages - 1;
|
goodpages = PAGES - badpages - 1;
|
||||||
if (goodpages <= 0)
|
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",
|
printf("Setting up swapspace version %d, size = %ld bytes\n",
|
||||||
version, (long) (goodpages * pagesize));
|
version, (long) (goodpages * pagesize));
|
||||||
write_signature((version == 0) ? "SWAP-SPACE" : "SWAPSPACE2");
|
write_signature((version == 0) ? "SWAP-SPACE" : "SWAPSPACE2");
|
||||||
|
|
||||||
offset = ((version == 0) ? 0 : 1024);
|
offset = ((version == 0) ? 0 : 1024);
|
||||||
if (lseek(DEV, offset, SEEK_SET) != offset)
|
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)
|
if (write(DEV, (char *) signature_page + offset, pagesize - 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
|
* A subsequent swapon() will fail if the signature
|
||||||
* is not actually on disk. (This is a kernel bug.)
|
* is not actually on disk. (This is a kernel bug.)
|
||||||
*/
|
*/
|
||||||
if (fsync(DEV))
|
if (fsync(DEV))
|
||||||
error_msg_and_die("fsync failed\n");
|
error_msg_and_die("fsync failed");
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -132,20 +132,20 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
|
|||||||
|
|
||||||
specialfile = find_unused_loop_device();
|
specialfile = find_unused_loop_device();
|
||||||
if (specialfile == NULL) {
|
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)) {
|
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 */
|
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;
|
flags &= ~MS_RDONLY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
status = mount(specialfile, dir, filesystemtype, flags, string_flags);
|
status = mount(specialfile, dir, filesystemtype, flags, string_flags);
|
||||||
if (errno == EROFS) {
|
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);
|
status = mount(specialfile, dir, filesystemtype, flags |= MS_RDONLY, string_flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (errno == EPERM) {
|
if (errno == EPERM) {
|
||||||
error_msg_and_die("permission denied. Are you root?\n");
|
error_msg_and_die("permission denied. Are you root?");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
@ -307,7 +307,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
|
|||||||
msock = fsock = -1;
|
msock = fsock = -1;
|
||||||
mclient = NULL;
|
mclient = NULL;
|
||||||
if (strlen(spec) >= sizeof(hostdir)) {
|
if (strlen(spec) >= sizeof(hostdir)) {
|
||||||
error_msg("excessively long host:dir argument\n");
|
error_msg("excessively long host:dir argument");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
strcpy(hostdir, spec);
|
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) */
|
until they can be fully supported. (mack@sgi.com) */
|
||||||
if ((s = strchr(hostdir, ','))) {
|
if ((s = strchr(hostdir, ','))) {
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
error_msg("warning: multiple hostnames not supported\n");
|
error_msg("warning: multiple hostnames not supported");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
error_msg("directory to mount not in host:dir format\n");
|
error_msg("directory to mount not in host:dir format");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,11 +332,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if ((hp = gethostbyname(hostname)) == NULL) {
|
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;
|
goto fail;
|
||||||
} else {
|
} else {
|
||||||
if (hp->h_length > sizeof(struct in_addr)) {
|
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);
|
hp->h_length = sizeof(struct in_addr);
|
||||||
}
|
}
|
||||||
memcpy(&server_addr.sin_addr,
|
memcpy(&server_addr.sin_addr,
|
||||||
@ -353,7 +353,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
|
|||||||
if (!old_opts)
|
if (!old_opts)
|
||||||
old_opts = "";
|
old_opts = "";
|
||||||
if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_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;
|
goto fail;
|
||||||
}
|
}
|
||||||
sprintf(new_opts, "%s%saddr=%s",
|
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);
|
data.flags |= (nolock ? NFS_MOUNT_NONLM : 0);
|
||||||
#endif
|
#endif
|
||||||
if (nfsvers > MAX_NFSPROT) {
|
if (nfsvers > MAX_NFSPROT) {
|
||||||
error_msg("NFSv%d not supported!\n", nfsvers);
|
error_msg("NFSv%d not supported!", nfsvers);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (mountvers > MAX_NFSPROT) {
|
if (mountvers > MAX_NFSPROT) {
|
||||||
error_msg("NFSv%d not supported!\n", nfsvers);
|
error_msg("NFSv%d not supported!", nfsvers);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (nfsvers && !mountvers)
|
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);
|
mount_server_addr.sin_addr.s_addr = inet_addr(hostname);
|
||||||
} else {
|
} else {
|
||||||
if ((hp = gethostbyname(mounthost)) == NULL) {
|
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;
|
goto fail;
|
||||||
} else {
|
} else {
|
||||||
if (hp->h_length > sizeof(struct in_addr)) {
|
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);
|
hp->h_length = sizeof(struct in_addr);
|
||||||
}
|
}
|
||||||
mount_server_addr.sin_family = AF_INET;
|
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 (nfsvers == 2) {
|
||||||
if (status.nfsv2.fhs_status != 0) {
|
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,
|
hostname, dirname,
|
||||||
nfs_strerror(status.nfsv2.fhs_status));
|
nfs_strerror(status.nfsv2.fhs_status));
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -734,7 +734,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
|
|||||||
#if NFS_MOUNT_VERSION >= 4
|
#if NFS_MOUNT_VERSION >= 4
|
||||||
fhandle3 *fhandle;
|
fhandle3 *fhandle;
|
||||||
if (status.nfsv3.fhs_status != 0) {
|
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,
|
hostname, dirname,
|
||||||
nfs_strerror(status.nfsv3.fhs_status));
|
nfs_strerror(status.nfsv3.fhs_status));
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -72,7 +72,7 @@ time_t askremotedate(char *host)
|
|||||||
}
|
}
|
||||||
if (read(fd, (void *)&nett, 4) != 4) { /* read time from server */
|
if (read(fd, (void *)&nett, 4) != 4) { /* read time from server */
|
||||||
close(fd);
|
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);
|
close(fd);
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ extern int swap_on_off_main(int argc, char **argv)
|
|||||||
struct stat statBuf;
|
struct stat statBuf;
|
||||||
|
|
||||||
if (stat("/etc/fstab", &statBuf) < 0)
|
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();
|
do_em_all();
|
||||||
break;
|
break;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user