readSize = copySize;
writeSize = fullRead(srcFd, buffer, readSize);
if (writeSize <= 0) {
- errorMsg(io_error, "copySubFile :", strerror(errno));
+ errorMsg(io_error, "copySubFile", strerror(errno));
return (FALSE);
}
doneSize = fullWrite(dstFd, buffer, writeSize);
if (doneSize <= 0) {
- errorMsg(io_error, "copySubFile :", strerror(errno));
+ errorMsg(io_error, "copySubFile", strerror(errno));
return (FALSE);
}
copySize -= doneSize;
return (FALSE);
}
if (fullRead(arFd, arVersion, 8) <= 0) {
- errorMsg( "ar: Unexpected EOF in archive\n");
+ errorMsg( "Unexpected EOF in archive\n");
return (FALSE);
}
if (strncmp(arVersion,"!<arch>",7) != 0) {
readSize = copySize;
writeSize = fullRead(srcFd, buffer, readSize);
if (writeSize <= 0) {
- errorMsg(io_error, "copySubFile :", strerror(errno));
+ errorMsg(io_error, "copySubFile", strerror(errno));
return (FALSE);
}
doneSize = fullWrite(dstFd, buffer, writeSize);
if (doneSize <= 0) {
- errorMsg(io_error, "copySubFile :", strerror(errno));
+ errorMsg(io_error, "copySubFile", strerror(errno));
return (FALSE);
}
copySize -= doneSize;
return (FALSE);
}
if (fullRead(arFd, arVersion, 8) <= 0) {
- errorMsg( "ar: Unexpected EOF in archive\n");
+ errorMsg( "Unexpected EOF in archive\n");
return (FALSE);
}
if (strncmp(arVersion,"!<arch>",7) != 0) {
# define DECLARE(type, array, size) type * array
# define ALLOC(type, array, size) { \
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
- if (array == NULL) errorMsg(memory_exhausted, "gunzip"); \
+ if (array == NULL) errorMsg(memory_exhausted); \
}
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
#else
int res = inflate();
if (res == 3) {
- errorMsg(memory_exhausted, "gunzip");
+ errorMsg(memory_exhausted);
} else if (res != 0) {
errorMsg("invalid compressed data--format violated");
}
# define DECLARE(type, array, size) type * array
# define ALLOC(type, array, size) { \
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
- if (array == NULL) errorMsg(memory_exhausted, "gzip"); \
+ if (array == NULL) errorMsg(memory_exhausted); \
}
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
#else
nargv = (char **) calloc(*argcp + 1, sizeof(char *));
if (nargv == NULL)
- errorMsg(memory_exhausted, "gzip");
+ errorMsg(memory_exhausted);
oargv = *argvp;
*argvp = nargv;
}
if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) {
/* Tarball seems to have a problem */
- errorMsg("tar: Unexpected EOF in archive\n");
+ errorMsg("Unexpected EOF in archive\n");
return( FALSE);
}
if ( readSize < writeSize )
return( TRUE);
if (createPath(header->name, header->mode) != TRUE) {
- errorMsg("tar: %s: Cannot mkdir: %s\n",
+ errorMsg("%s: Cannot mkdir: %s\n",
header->name, strerror(errno));
return( FALSE);
}
return( TRUE);
if (link(header->linkname, header->name) < 0) {
- errorMsg("tar: %s: Cannot create hard link to '%s': %s\n",
+ errorMsg("%s: Cannot create hard link to '%s': %s\n",
header->name, header->linkname, strerror(errno));
return( FALSE);
}
#ifdef S_ISLNK
if (symlink(header->linkname, header->name) < 0) {
- errorMsg("tar: %s: Cannot create symlink to '%s': %s\n",
+ errorMsg("%s: Cannot create symlink to '%s': %s\n",
header->name, header->linkname, strerror(errno));
return( FALSE);
}
/* Do not change permissions or date on symlink,
* since it changes the pointed to file instead. duh. */
#else
- errorMsg("tar: %s: Cannot create symlink to '%s': %s\n",
+ errorMsg("%s: Cannot create symlink to '%s': %s\n",
header->name, header->linkname,
"symlinks not supported");
#endif
if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) {
if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) {
- errorMsg("tar: %s: Cannot mknod: %s\n",
+ errorMsg("%s: Cannot mknod: %s\n",
header->name, strerror(errno));
return( FALSE);
}
} else if (S_ISFIFO(header->mode)) {
if (mkfifo(header->name, header->mode) < 0) {
- errorMsg("tar: %s: Cannot mkfifo: %s\n",
+ errorMsg("%s: Cannot mkfifo: %s\n",
header->name, strerror(errno));
return( FALSE);
}
++*(header->name);
if (alreadyWarned == FALSE) {
- errorMsg("tar: Removing leading '/' from member names\n");
+ errorMsg("Removing leading '/' from member names\n");
alreadyWarned = TRUE;
}
}
return ( FALSE);
}
else if (errorFlag==TRUE) {
- errorMsg( "tar: Error exit delayed from previous errors\n");
+ errorMsg( "Error exit delayed from previous errors\n");
return( FALSE);
} else
return( status);
close( tarFd);
if ( *(header.name) == '\0' ) {
if (errorFlag==TRUE)
- errorMsg( "tar: Error exit delayed from previous errors\n");
+ errorMsg( "Error exit delayed from previous errors\n");
else
return( TRUE);
}
if (*fileName=='/') {
static int alreadyWarned=FALSE;
if (alreadyWarned==FALSE) {
- errorMsg("tar: Removing leading '/' from member names\n");
+ errorMsg("Removing leading '/' from member names\n");
alreadyWarned=TRUE;
}
strncpy(header.name, fileName+1, sizeof(header.name));
header.typeflag = REGTYPE;
putOctal(header.size, sizeof(header.size), statbuf->st_size);
} else {
- errorMsg("tar: %s: Unknown file type\n", fileName);
+ errorMsg("%s: Unknown file type\n", fileName);
return ( FALSE);
}
/* It is against the rules to archive a socket */
if (S_ISSOCK(statbuf->st_mode)) {
- errorMsg("tar: %s: socket ignored\n", fileName);
+ errorMsg("%s: socket ignored\n", fileName);
return( TRUE);
}
* the new tarball */
if (tbInfo->statBuf.st_dev == statbuf->st_dev &&
tbInfo->statBuf.st_ino == statbuf->st_ino) {
- errorMsg("tar: %s: file is the archive; skipping\n", fileName);
+ errorMsg("%s: file is the archive; skipping\n", fileName);
return( TRUE);
}
/* open the file we want to archive, and make sure all is well */
if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
- errorMsg("tar: %s: Cannot open: %s\n", fileName, strerror(errno));
+ errorMsg("%s: Cannot open: %s\n", fileName, strerror(errno));
return( FALSE);
}
/* Make sure there is at least one file to tar up. */
if (argc <= 0)
- fatalError("tar: Cowardly refusing to create an empty archive\n");
+ fatalError("Cowardly refusing to create an empty archive\n");
/* Open the tar file for writing. */
if (tostdoutFlag == TRUE)
else
tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (tbInfo.tarFd < 0) {
- errorMsg( "tar: Error opening '%s': %s\n", tarName, strerror(errno));
+ errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno));
return ( FALSE);
}
tbInfo.excludeList=excludeList;
/* Hang up the tools, close up shop, head home */
close(tarFd);
if (errorFlag == TRUE) {
- errorMsg("tar: Error exit delayed from previous errors\n");
+ errorMsg("Error exit delayed from previous errors\n");
return(FALSE);
}
return( TRUE);
case CHMOD_APP:
/* Parse the specified modes */
if (parse_mode(theMode, &(statbuf->st_mode)) == FALSE) {
- fatalError( "%s: unknown mode: %s\n", applet_name, theMode);
+ fatalError( "unknown mode: %s\n", theMode);
}
if (chmod(fileName, statbuf->st_mode) == 0)
return (TRUE);
if (*argv == p)
uid = my_getpwnam(*argv);
if (uid == -1) {
- fatalError( "%s: unknown user name: %s\n",
- applet_name, *argv);
+ fatalError( "unknown user name: %s\n", *argv);
}
}
}
/* Ok, ready to do the deed now */
if (argc <= 1) {
- fatalError( "%s: too few arguments\n", applet_name);
+ fatalError( "too few arguments\n");
}
while (argc-- > 1) {
if (recursiveAction (*(++argv), recursiveFlag, FALSE, FALSE,
exit(TRUE);
bad_group:
- fatalError( "%s: unknown group name: %s\n", applet_name, groupName);
+ fatalError( "unknown group name: %s\n", groupName);
}
/*
argv++;
if (chroot(*argv) || (chdir("/"))) {
- fatalError("chroot: cannot change root directory to %s: %s\n",
- *argv, strerror(errno));
+ fatalError("cannot change root directory to %s: %s\n", *argv, strerror(errno));
}
argc--;
prog = "/bin/sh";
execlp(prog, prog, NULL);
}
- fatalError("chroot: cannot execute %s: %s\n",
- prog, strerror(errno));
+ fatalError("cannot execute %s: %s\n", prog, strerror(errno));
}
argv++;
if (chroot(*argv) || (chdir("/"))) {
- fatalError("chroot: cannot change root directory to %s: %s\n",
- *argv, strerror(errno));
+ fatalError("cannot change root directory to %s: %s\n", *argv, strerror(errno));
}
argc--;
prog = "/bin/sh";
execlp(prog, prog, NULL);
}
- fatalError("chroot: cannot execute %s: %s\n",
- prog, strerror(errno));
+ fatalError("cannot execute %s: %s\n", prog, strerror(errno));
}
&(tm_time->tm_min), &(tm_time->tm_year));
if (nr < 4 || nr > 5) {
- fatalError(invalid_date, "date", t_string);
+ fatalError(invalid_date, t_string);
}
/* correct for century - minor Y2K problem here? */
}
- fatalError(invalid_date, "date", t_string);
+ fatalError(invalid_date, t_string);
}
case 'u':
utc = 1;
if (putenv("TZ=UTC0") != 0)
- fatalError(memory_exhausted, "date");
+ fatalError(memory_exhausted);
break;
case 'd':
use_arg = 1;
/* Correct any day of week and day of year etc fields */
tm = mktime(&tm_time);
if (tm < 0)
- fatalError(invalid_date, "date", date_str);
+ fatalError(invalid_date, date_str);
/* if setting time, set it */
if (set_time) {
if (stime(&tm) < 0) {
- fatalError("date: can't set date.\n");
+ fatalError("can't set date.\n");
}
}
}
} else {
fp = fopen(filename, OPENOPTS(binary));
if (fp == NULL) {
- errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
+ errorMsg("%s: %s\n", filename, strerror(errno));
return FALSE;
}
}
if (md5_stream(fp, md5_result)) {
- errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
+ errorMsg("%s: %s\n", filename, strerror(errno));
if (fp != stdin)
fclose(fp);
}
if (fp != stdin && fclose(fp) == EOF) {
- errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
+ errorMsg("%s: %s\n", filename, strerror(errno));
return FALSE;
}
} else {
checkfile_stream = fopen(checkfile_name, "r");
if (checkfile_stream == NULL) {
- errorMsg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
+ errorMsg("%s: %s\n", checkfile_name, strerror(errno));
return FALSE;
}
}
char buf[BUFSIZ + 1];
if (getcwd(buf, sizeof(buf)) == NULL)
- fatalError("pwd: %s\n", strerror(errno));
+ fatalError("%s\n", strerror(errno));
printf("%s\n", buf);
return(TRUE);
if (create == FALSE && errno == ENOENT)
exit(TRUE);
else {
- fatalError("touch: %s", strerror(errno));
+ fatalError("%s", strerror(errno));
}
}
close(fd);
if (utime(*argv, NULL)) {
- fatalError("touch: %s", strerror(errno));
+ fatalError("%s", strerror(errno));
}
argc--;
argv++;
complement(input);
if (argv[index] != NULL) {
if (*argv[index] == '\0')
- fatalError("tr: STRING2 cannot be empty\n");
+ fatalError("STRING2 cannot be empty\n");
expand(argv[index], output);
map(input, output);
}
&& (freopen (outname, "w", stdout) == NULL
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
)) {
- errorMsg("uudeoce %s: %s %s\n", outname, inname, strerror(errno)); /* */
+ errorMsg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
return FALSE;
}
if (decode (argv[optind], outname) != 0)
exit_status = FALSE;
} else {
- errorMsg("uudecode: %s: %s\n", argv[optind], strerror(errno));
+ errorMsg("%s: %s\n", argv[optind], strerror(errno));
exit_status = FALSE;
}
optind++;
case 2:
/* Optional first argument is input file. */
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
- errorMsg("uuencode: %s: %s\n", argv[optind], strerror(errno));
+ errorMsg("%s: %s\n", argv[optind], strerror(errno));
exit FALSE;
}
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
&(tm_time->tm_min), &(tm_time->tm_year));
if (nr < 4 || nr > 5) {
- fatalError(invalid_date, "date", t_string);
+ fatalError(invalid_date, t_string);
}
/* correct for century - minor Y2K problem here? */
}
- fatalError(invalid_date, "date", t_string);
+ fatalError(invalid_date, t_string);
}
case 'u':
utc = 1;
if (putenv("TZ=UTC0") != 0)
- fatalError(memory_exhausted, "date");
+ fatalError(memory_exhausted);
break;
case 'd':
use_arg = 1;
/* Correct any day of week and day of year etc fields */
tm = mktime(&tm_time);
if (tm < 0)
- fatalError(invalid_date, "date", date_str);
+ fatalError(invalid_date, date_str);
/* if setting time, set it */
if (set_time) {
if (stime(&tm) < 0) {
- fatalError("date: can't set date.\n");
+ fatalError("can't set date.\n");
}
}
}
else if (my_str[idx] == '/') {
idx = index_of_next_unescaped_slash(idx, my_str);
if (idx == -1)
- fatalError("sed: unterminated match expression\n");
+ fatalError("unterminated match expression\n");
my_str[idx] = '\0';
*regex = (regex_t *)xmalloc(sizeof(regex_t));
if (bb_regcomp(*regex, my_str+1, REG_NEWLINE) != 0) {
/* last part (mandatory) will be a command */
if (cmdstr[idx] == '\0')
- fatalError("sed: missing command\n");
+ fatalError("missing command\n");
if (!strchr("pds", cmdstr[idx])) /* <-- XXX add new commands here */
- fatalError("sed: invalid command\n");
+ fatalError("invalid command\n");
sed_cmd->cmd = cmdstr[idx];
/* special-case handling for 's' */
if (sed_cmd->cmd == 's') {
/* verify that we have an 's' followed by a 'slash' */
if (cmdstr[++idx] != '/')
- fatalError("sed: bad format in substitution expression\n");
+ fatalError("bad format in substitution expression\n");
/* save the match string */
oldidx = idx+1;
idx = index_of_next_unescaped_slash(idx, cmdstr);
if (idx == -1)
- fatalError("sed: bad format in substitution expression\n");
+ fatalError("bad format in substitution expression\n");
match = strdup_substr(cmdstr, oldidx, idx);
/* save the replacement string */
oldidx = idx+1;
idx = index_of_next_unescaped_slash(idx, cmdstr);
if (idx == -1)
- fatalError("sed: bad format in substitution expression\n");
+ fatalError("bad format in substitution expression\n");
sed_cmd->replace = strdup_substr(cmdstr, oldidx, idx);
/* process the flags */
cflags |= REG_ICASE;
break;
default:
- fatalError("sed: bad option in substitution expression\n");
+ fatalError("bad option in substitution expression\n");
}
}
}
if ((f = open(argv[1], O_RDWR)) == -1) {
- fatalError( "freeramdisk: cannot open %s: %s\n", argv[1], strerror(errno));
+ fatalError( "cannot open %s: %s\n", argv[1], strerror(errno));
}
if (ioctl(f, BLKFLSBUF) < 0) {
- fatalError( "freeramdisk: failed ioctl on %s: %s\n", argv[1], strerror(errno));
+ fatalError( "failed ioctl on %s: %s\n", argv[1], strerror(errno));
}
/* Don't bother closing. Exit does
* that, so we can save a few bytes */
# define DECLARE(type, array, size) type * array
# define ALLOC(type, array, size) { \
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
- if (array == NULL) errorMsg(memory_exhausted, "gunzip"); \
+ if (array == NULL) errorMsg(memory_exhausted); \
}
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
#else
int res = inflate();
if (res == 3) {
- errorMsg(memory_exhausted, "gunzip");
+ errorMsg(memory_exhausted);
} else if (res != 0) {
errorMsg("invalid compressed data--format violated");
}
# define DECLARE(type, array, size) type * array
# define ALLOC(type, array, size) { \
array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
- if (array == NULL) errorMsg(memory_exhausted, "gzip"); \
+ if (array == NULL) errorMsg(memory_exhausted); \
}
# define FREE(array) {if (array != NULL) free(array), array=NULL;}
#else
nargv = (char **) calloc(*argcp + 1, sizeof(char *));
if (nargv == NULL)
- errorMsg(memory_exhausted, "gzip");
+ errorMsg(memory_exhausted);
oargv = *argvp;
*argvp = nargv;
#endif
execvp(newJob.progs[i].argv[0], newJob.progs[i].argv);
- fatalError("sh: %s: %s\n", newJob.progs[i].argv[0],
+ fatalError("%s: %s\n", newJob.progs[i].argv[0],
strerror(errno));
}
/* initialize the cwd */
cwd = (char *) calloc(BUFSIZ, sizeof(char));
if (cwd == 0) {
- fatalError("sh: out of memory\n");
+ fatalError("out of memory\n");
}
getcwd(cwd, sizeof(char)*BUFSIZ);
int i;
local_pending_command = (char *) calloc(BUFSIZ, sizeof(char));
if (local_pending_command == 0) {
- fatalError("sh: out of memory\n");
+ fatalError("out of memory\n");
}
for(i=2; i<argc; i++)
{
local_pending_command = realloc(local_pending_command,
strlen(local_pending_command) + strlen(argv[i]));
if (local_pending_command==NULL)
- fatalError("sh: commands for -c option too long\n");
+ fatalError("commands for -c option too long\n");
}
strcat(local_pending_command, argv[i]);
if ( (i + 1) < argc)
else {
input = fopen(argv[1], "r");
if (!input) {
- fatalError("sh: Couldn't open file '%s': %s\n", argv[1],
+ fatalError("Couldn't open file '%s': %s\n", argv[1],
strerror(errno));
}
}
} else {
fp = fopen(filename, OPENOPTS(binary));
if (fp == NULL) {
- errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
+ errorMsg("%s: %s\n", filename, strerror(errno));
return FALSE;
}
}
if (md5_stream(fp, md5_result)) {
- errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
+ errorMsg("%s: %s\n", filename, strerror(errno));
if (fp != stdin)
fclose(fp);
}
if (fp != stdin && fclose(fp) == EOF) {
- errorMsg("md5sum: %s: %s\n", filename, strerror(errno));
+ errorMsg("%s: %s\n", filename, strerror(errno));
return FALSE;
}
} else {
checkfile_stream = fopen(checkfile_name, "r");
if (checkfile_stream == NULL) {
- errorMsg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
+ errorMsg("%s: %s\n", checkfile_name, strerror(errno));
return FALSE;
}
}
BB_DEF_MESSAGE(not_a_directory, "%s: %s: not a directory\n")
#endif
#if defined bb_need_memory_exhausted || ! defined BB_DECLARE_EXTERN
- BB_DEF_MESSAGE(memory_exhausted, "%s: memory exhausted\n")
+ BB_DEF_MESSAGE(memory_exhausted, "memory exhausted\n")
#endif
#if defined bb_need_invalid_date || ! defined BB_DECLARE_EXTERN
- BB_DEF_MESSAGE(invalid_date, "%s: invalid date `%s'\n")
+ BB_DEF_MESSAGE(invalid_date, "invalid date `%s'\n")
#endif
#if defined bb_need_invalid_option || ! defined BB_DECLARE_EXTERN
BB_DEF_MESSAGE(invalid_option, "%s: invalid option -- %c\n")
#endif
if (errno == EPERM) {
- fatalError("mount: permission denied. Are you root?\n");
+ fatalError("permission denied. Are you root?\n");
}
return (FALSE);
hostinfo = (struct hostent *) gethostbyname(*argv);
if (!hostinfo) {
- fatalError("nc: cannot resolve %s\n", *argv);
+ fatalError("cannot resolve %s\n", *argv);
}
address.sin_family = AF_INET;
hostinfo = (struct hostent *) gethostbyname(*argv);
if (!hostinfo) {
- fatalError("nc: cannot resolve %s\n", *argv);
+ fatalError("cannot resolve %s\n", *argv);
}
address.sin_family = AF_INET;
/* vi: set sw=4 ts=4: */
/*
- * $Id: ping.c,v 1.19 2000/07/09 06:59:58 andersen Exp $
+ * $Id: ping.c,v 1.20 2000/07/12 17:02:35 kraai Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
if (i < 0)
- fatalError("ping: sendto: %s\n", strerror(errno));
+ fatalError("sendto: %s\n", strerror(errno));
else if (i != sizeof(packet))
fatalError("ping wrote %d chars; %d expected\n", i,
(int)sizeof(packet));
/* vi: set sw=4 ts=4: */
/*
- * $Id: ping.c,v 1.19 2000/07/09 06:59:58 andersen Exp $
+ * $Id: ping.c,v 1.20 2000/07/12 17:02:35 kraai Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
(struct sockaddr *) &pingaddr, sizeof(struct sockaddr_in));
if (i < 0)
- fatalError("ping: sendto: %s\n", strerror(errno));
+ fatalError("sendto: %s\n", strerror(errno));
else if (i != sizeof(packet))
fatalError("ping wrote %d chars; %d expected\n", i,
(int)sizeof(packet));
char buf[BUFSIZ + 1];
if (getcwd(buf, sizeof(buf)) == NULL)
- fatalError("pwd: %s\n", strerror(errno));
+ fatalError("%s\n", strerror(errno));
printf("%s\n", buf);
return(TRUE);
else if (my_str[idx] == '/') {
idx = index_of_next_unescaped_slash(idx, my_str);
if (idx == -1)
- fatalError("sed: unterminated match expression\n");
+ fatalError("unterminated match expression\n");
my_str[idx] = '\0';
*regex = (regex_t *)xmalloc(sizeof(regex_t));
if (bb_regcomp(*regex, my_str+1, REG_NEWLINE) != 0) {
/* last part (mandatory) will be a command */
if (cmdstr[idx] == '\0')
- fatalError("sed: missing command\n");
+ fatalError("missing command\n");
if (!strchr("pds", cmdstr[idx])) /* <-- XXX add new commands here */
- fatalError("sed: invalid command\n");
+ fatalError("invalid command\n");
sed_cmd->cmd = cmdstr[idx];
/* special-case handling for 's' */
if (sed_cmd->cmd == 's') {
/* verify that we have an 's' followed by a 'slash' */
if (cmdstr[++idx] != '/')
- fatalError("sed: bad format in substitution expression\n");
+ fatalError("bad format in substitution expression\n");
/* save the match string */
oldidx = idx+1;
idx = index_of_next_unescaped_slash(idx, cmdstr);
if (idx == -1)
- fatalError("sed: bad format in substitution expression\n");
+ fatalError("bad format in substitution expression\n");
match = strdup_substr(cmdstr, oldidx, idx);
/* save the replacement string */
oldidx = idx+1;
idx = index_of_next_unescaped_slash(idx, cmdstr);
if (idx == -1)
- fatalError("sed: bad format in substitution expression\n");
+ fatalError("bad format in substitution expression\n");
sed_cmd->replace = strdup_substr(cmdstr, oldidx, idx);
/* process the flags */
cflags |= REG_ICASE;
break;
default:
- fatalError("sed: bad option in substitution expression\n");
+ fatalError("bad option in substitution expression\n");
}
}
#endif
execvp(newJob.progs[i].argv[0], newJob.progs[i].argv);
- fatalError("sh: %s: %s\n", newJob.progs[i].argv[0],
+ fatalError("%s: %s\n", newJob.progs[i].argv[0],
strerror(errno));
}
/* initialize the cwd */
cwd = (char *) calloc(BUFSIZ, sizeof(char));
if (cwd == 0) {
- fatalError("sh: out of memory\n");
+ fatalError("out of memory\n");
}
getcwd(cwd, sizeof(char)*BUFSIZ);
int i;
local_pending_command = (char *) calloc(BUFSIZ, sizeof(char));
if (local_pending_command == 0) {
- fatalError("sh: out of memory\n");
+ fatalError("out of memory\n");
}
for(i=2; i<argc; i++)
{
local_pending_command = realloc(local_pending_command,
strlen(local_pending_command) + strlen(argv[i]));
if (local_pending_command==NULL)
- fatalError("sh: commands for -c option too long\n");
+ fatalError("commands for -c option too long\n");
}
strcat(local_pending_command, argv[i]);
if ( (i + 1) < argc)
else {
input = fopen(argv[1], "r");
if (!input) {
- fatalError("sh: Couldn't open file '%s': %s\n", argv[1],
+ fatalError("Couldn't open file '%s': %s\n", argv[1],
strerror(errno));
}
}
#endif
execvp(newJob.progs[i].argv[0], newJob.progs[i].argv);
- fatalError("sh: %s: %s\n", newJob.progs[i].argv[0],
+ fatalError("%s: %s\n", newJob.progs[i].argv[0],
strerror(errno));
}
/* initialize the cwd */
cwd = (char *) calloc(BUFSIZ, sizeof(char));
if (cwd == 0) {
- fatalError("sh: out of memory\n");
+ fatalError("out of memory\n");
}
getcwd(cwd, sizeof(char)*BUFSIZ);
int i;
local_pending_command = (char *) calloc(BUFSIZ, sizeof(char));
if (local_pending_command == 0) {
- fatalError("sh: out of memory\n");
+ fatalError("out of memory\n");
}
for(i=2; i<argc; i++)
{
local_pending_command = realloc(local_pending_command,
strlen(local_pending_command) + strlen(argv[i]));
if (local_pending_command==NULL)
- fatalError("sh: commands for -c option too long\n");
+ fatalError("commands for -c option too long\n");
}
strcat(local_pending_command, argv[i]);
if ( (i + 1) < argc)
else {
input = fopen(argv[1], "r");
if (!input) {
- fatalError("sh: Couldn't open file '%s': %s\n", argv[1],
+ fatalError("Couldn't open file '%s': %s\n", argv[1],
strerror(errno));
}
}
}
if ( (readSize = fullRead(header->tarFd, buffer, readSize)) <= 0 ) {
/* Tarball seems to have a problem */
- errorMsg("tar: Unexpected EOF in archive\n");
+ errorMsg("Unexpected EOF in archive\n");
return( FALSE);
}
if ( readSize < writeSize )
return( TRUE);
if (createPath(header->name, header->mode) != TRUE) {
- errorMsg("tar: %s: Cannot mkdir: %s\n",
+ errorMsg("%s: Cannot mkdir: %s\n",
header->name, strerror(errno));
return( FALSE);
}
return( TRUE);
if (link(header->linkname, header->name) < 0) {
- errorMsg("tar: %s: Cannot create hard link to '%s': %s\n",
+ errorMsg("%s: Cannot create hard link to '%s': %s\n",
header->name, header->linkname, strerror(errno));
return( FALSE);
}
#ifdef S_ISLNK
if (symlink(header->linkname, header->name) < 0) {
- errorMsg("tar: %s: Cannot create symlink to '%s': %s\n",
+ errorMsg("%s: Cannot create symlink to '%s': %s\n",
header->name, header->linkname, strerror(errno));
return( FALSE);
}
/* Do not change permissions or date on symlink,
* since it changes the pointed to file instead. duh. */
#else
- errorMsg("tar: %s: Cannot create symlink to '%s': %s\n",
+ errorMsg("%s: Cannot create symlink to '%s': %s\n",
header->name, header->linkname,
"symlinks not supported");
#endif
if (S_ISCHR(header->mode) || S_ISBLK(header->mode) || S_ISSOCK(header->mode)) {
if (mknod(header->name, header->mode, makedev(header->devmajor, header->devminor)) < 0) {
- errorMsg("tar: %s: Cannot mknod: %s\n",
+ errorMsg("%s: Cannot mknod: %s\n",
header->name, strerror(errno));
return( FALSE);
}
} else if (S_ISFIFO(header->mode)) {
if (mkfifo(header->name, header->mode) < 0) {
- errorMsg("tar: %s: Cannot mkfifo: %s\n",
+ errorMsg("%s: Cannot mkfifo: %s\n",
header->name, strerror(errno));
return( FALSE);
}
++*(header->name);
if (alreadyWarned == FALSE) {
- errorMsg("tar: Removing leading '/' from member names\n");
+ errorMsg("Removing leading '/' from member names\n");
alreadyWarned = TRUE;
}
}
return ( FALSE);
}
else if (errorFlag==TRUE) {
- errorMsg( "tar: Error exit delayed from previous errors\n");
+ errorMsg( "Error exit delayed from previous errors\n");
return( FALSE);
} else
return( status);
close( tarFd);
if ( *(header.name) == '\0' ) {
if (errorFlag==TRUE)
- errorMsg( "tar: Error exit delayed from previous errors\n");
+ errorMsg( "Error exit delayed from previous errors\n");
else
return( TRUE);
}
if (*fileName=='/') {
static int alreadyWarned=FALSE;
if (alreadyWarned==FALSE) {
- errorMsg("tar: Removing leading '/' from member names\n");
+ errorMsg("Removing leading '/' from member names\n");
alreadyWarned=TRUE;
}
strncpy(header.name, fileName+1, sizeof(header.name));
header.typeflag = REGTYPE;
putOctal(header.size, sizeof(header.size), statbuf->st_size);
} else {
- errorMsg("tar: %s: Unknown file type\n", fileName);
+ errorMsg("%s: Unknown file type\n", fileName);
return ( FALSE);
}
/* It is against the rules to archive a socket */
if (S_ISSOCK(statbuf->st_mode)) {
- errorMsg("tar: %s: socket ignored\n", fileName);
+ errorMsg("%s: socket ignored\n", fileName);
return( TRUE);
}
* the new tarball */
if (tbInfo->statBuf.st_dev == statbuf->st_dev &&
tbInfo->statBuf.st_ino == statbuf->st_ino) {
- errorMsg("tar: %s: file is the archive; skipping\n", fileName);
+ errorMsg("%s: file is the archive; skipping\n", fileName);
return( TRUE);
}
/* open the file we want to archive, and make sure all is well */
if ((inputFileFd = open(fileName, O_RDONLY)) < 0) {
- errorMsg("tar: %s: Cannot open: %s\n", fileName, strerror(errno));
+ errorMsg("%s: Cannot open: %s\n", fileName, strerror(errno));
return( FALSE);
}
/* Make sure there is at least one file to tar up. */
if (argc <= 0)
- fatalError("tar: Cowardly refusing to create an empty archive\n");
+ fatalError("Cowardly refusing to create an empty archive\n");
/* Open the tar file for writing. */
if (tostdoutFlag == TRUE)
else
tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (tbInfo.tarFd < 0) {
- errorMsg( "tar: Error opening '%s': %s\n", tarName, strerror(errno));
+ errorMsg( "Error opening '%s': %s\n", tarName, strerror(errno));
return ( FALSE);
}
tbInfo.excludeList=excludeList;
/* Hang up the tools, close up shop, head home */
close(tarFd);
if (errorFlag == TRUE) {
- errorMsg("tar: Error exit delayed from previous errors\n");
+ errorMsg("Error exit delayed from previous errors\n");
return(FALSE);
}
return( TRUE);
if (create == FALSE && errno == ENOENT)
exit(TRUE);
else {
- fatalError("touch: %s", strerror(errno));
+ fatalError("%s", strerror(errno));
}
}
close(fd);
if (utime(*argv, NULL)) {
- fatalError("touch: %s", strerror(errno));
+ fatalError("%s", strerror(errno));
}
argc--;
argv++;
complement(input);
if (argv[index] != NULL) {
if (*argv[index] == '\0')
- fatalError("tr: STRING2 cannot be empty\n");
+ fatalError("STRING2 cannot be empty\n");
expand(argv[index], output);
map(input, output);
}
if (status != 0 && doForce == TRUE) {
status = umount2(blockDevice, MNT_FORCE);
if (status != 0) {
- fatalError("umount: forced umount of %s failed!\n", blockDevice);
+ fatalError("forced umount of %s failed!\n", blockDevice);
}
}
#endif
}
if ((f = open(argv[1], O_RDWR)) == -1) {
- fatalError( "freeramdisk: cannot open %s: %s\n", argv[1], strerror(errno));
+ fatalError( "cannot open %s: %s\n", argv[1], strerror(errno));
}
if (ioctl(f, BLKFLSBUF) < 0) {
- fatalError( "freeramdisk: failed ioctl on %s: %s\n", argv[1], strerror(errno));
+ fatalError( "failed ioctl on %s: %s\n", argv[1], strerror(errno));
}
/* Don't bother closing. Exit does
* that, so we can save a few bytes */
#endif
if (errno == EPERM) {
- fatalError("mount: permission denied. Are you root?\n");
+ fatalError("permission denied. Are you root?\n");
}
return (FALSE);
if (status != 0 && doForce == TRUE) {
status = umount2(blockDevice, MNT_FORCE);
if (status != 0) {
- fatalError("umount: forced umount of %s failed!\n", blockDevice);
+ fatalError("forced umount of %s failed!\n", blockDevice);
}
}
#endif
va_start(p, s);
fflush(stdout);
+ fprintf(stderr, "%s: ", applet_name);
vfprintf(stderr, s, p);
va_end(p);
fflush(stderr);
va_start(p, s);
fflush(stdout);
+ fprintf(stderr, "%s: ", applet_name);
vfprintf(stderr, s, p);
va_end(p);
fflush(stderr);
&& (strlen(pidName) == strlen(info.command_line))) {
pidList=realloc( pidList, sizeof(pid_t) * (j+2));
if (pidList==NULL)
- fatalError(memory_exhausted, "");
+ fatalError(memory_exhausted);
pidList[j++]=info.pid;
}
}
&& (strlen(pidName) == strlen(p))) {
pidList=realloc( pidList, sizeof(pid_t) * (i+2));
if (pidList==NULL)
- fatalError(memory_exhausted, "");
+ fatalError(memory_exhausted);
pidList[i++]=strtol(next->d_name, NULL, 0);
}
}
void *cp = malloc(size);
if (cp == NULL)
- fatalError(memory_exhausted, "");
+ fatalError(memory_exhausted);
return cp;
}
t = strdup (s);
if (t == NULL)
- fatalError(memory_exhausted, "");
+ fatalError(memory_exhausted);
return t;
}
&& (freopen (outname, "w", stdout) == NULL
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
)) {
- errorMsg("uudeoce %s: %s %s\n", outname, inname, strerror(errno)); /* */
+ errorMsg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
return FALSE;
}
if (decode (argv[optind], outname) != 0)
exit_status = FALSE;
} else {
- errorMsg("uudecode: %s: %s\n", argv[optind], strerror(errno));
+ errorMsg("%s: %s\n", argv[optind], strerror(errno));
exit_status = FALSE;
}
optind++;
case 2:
/* Optional first argument is input file. */
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
- errorMsg("uuencode: %s: %s\n", argv[optind], strerror(errno));
+ errorMsg("%s: %s\n", argv[optind], strerror(errno));
exit FALSE;
}
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);