if (len != -1) {
path[len] = 0;
} else {
- error_msg("%s: %s\n", proc, strerror(errno));
+ perror_msg("%s", proc);
return NULL;
}
return strdup(path);
rc = Link(busybox, command);
if (rc) {
- error_msg("%s: %s\n", command, strerror(errno));
+ perror_msg("%s", command);
}
}
}
else
tarFd = open(tarName, O_RDONLY);
if (tarFd < 0)
- error_msg_and_die( "Error opening '%s': %s\n", tarName, strerror(errno));
+ perror_msg_and_die("Error opening '%s'", tarName);
#ifdef BB_FEATURE_TAR_GZIP
/* unzip tarFd in a seperate process */
return( TRUE);
if (create_path(header->name, header->mode) != TRUE) {
- error_msg("%s: Cannot mkdir: %s\n",
- header->name, strerror(errno));
+ perror_msg("%s: Cannot mkdir", header->name);
return( FALSE);
}
/* make the final component, just in case it was
return( TRUE);
if (link(header->linkname, header->name) < 0) {
- error_msg("%s: Cannot create hard link to '%s': %s\n",
- header->name, header->linkname, strerror(errno));
+ perror_msg("%s: Cannot create hard link to '%s'", header->name,
+ header->linkname);
return( FALSE);
}
#ifdef S_ISLNK
if (symlink(header->linkname, header->name) < 0) {
- error_msg("%s: Cannot create symlink to '%s': %s\n",
- header->name, header->linkname, strerror(errno));
+ perror_msg("%s: Cannot create symlink to '%s'", header->name,
+ header->linkname);
return( FALSE);
}
/* Try to change ownership of the symlink.
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) {
- error_msg("%s: Cannot mknod: %s\n",
- header->name, strerror(errno));
+ perror_msg("%s: Cannot mknod", header->name);
return( FALSE);
}
} else if (S_ISFIFO(header->mode)) {
if (mkfifo(header->name, header->mode) < 0) {
- error_msg("%s: Cannot mkfifo: %s\n",
- header->name, strerror(errno));
+ perror_msg("%s: Cannot mkfifo", header->name);
return( FALSE);
}
}
close(tarFd);
if (status > 0) {
/* Bummer - we read a partial header */
- error_msg( "Error reading tar file: %s\n", strerror(errno));
+ perror_msg("Error reading tar file");
return ( FALSE);
}
else if (errorFlag==TRUE) {
header.typeflag = SYMTYPE;
link_size = readlink(fileName, buffer, sizeof(buffer) - 1);
if ( link_size < 0) {
- error_msg("Error reading symlink '%s': %s\n", header.name, strerror(errno));
+ perror_msg("Error reading symlink '%s'", header.name);
return ( FALSE);
}
buffer[link_size] = '\0';
else
tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (tbInfo.tarFd < 0) {
- error_msg( "Error opening '%s': %s\n", tarName, strerror(errno));
+ perror_msg( "Error opening '%s'", tarName);
freeHardLinkInfo(&tbInfo.hlInfoHead);
return ( FALSE);
}
if (len != -1) {
path[len] = 0;
} else {
- error_msg("%s: %s\n", proc, strerror(errno));
+ perror_msg("%s", proc);
return NULL;
}
return strdup(path);
rc = Link(busybox, command);
if (rc) {
- error_msg("%s: %s\n", command, strerror(errno));
+ perror_msg("%s", command);
}
}
}
argv++;
if (chroot(*argv) || (chdir("/"))) {
- error_msg_and_die("cannot change root directory to %s: %s\n", *argv, strerror(errno));
+ perror_msg_and_die("cannot change root directory to %s", *argv);
}
argc--;
return EXIT_SUCCESS;
#endif
}
- error_msg_and_die("cannot execute %s: %s\n", prog, strerror(errno));
+ perror_msg_and_die("cannot execute %s", prog);
}
fd = open("/dev/tty0", O_RDWR);
if (fd < 0) {
- error_msg("Error opening /dev/tty0: %s\n", strerror(errno));
+ perror_msg("Error opening /dev/tty0");
return EXIT_FAILURE;
}
fd = open("/dev/tty", O_RDWR);
if (fd < 0) {
- error_msg("Error opening /dev/tty1: %s\n", strerror(errno));
- return EXIT_FAILURE;
+ perror_msg_and_die("Error opening /dev/tty1");
}
if (screen_map_load(fd, stdin)) {
- error_msg("Error loading acm: %s\n", strerror(errno));
- return EXIT_FAILURE;
+ perror_msg_and_die("Error loading acm");
}
write(fd, "\033(K", 3);
argv++;
if (chroot(*argv) || (chdir("/"))) {
- error_msg_and_die("cannot change root directory to %s: %s\n", *argv, strerror(errno));
+ perror_msg_and_die("cannot change root directory to %s", *argv);
}
argc--;
return EXIT_SUCCESS;
#endif
}
- error_msg_and_die("cannot execute %s: %s\n", prog, strerror(errno));
+ perror_msg_and_die("cannot execute %s", prog);
}
for (i = optind; i < argc; i++) {
file = fopen(argv[i], "r");
if (file == NULL) {
- error_msg("%s: %s\n", argv[i], strerror(errno));
+ perror_msg("%s", argv[i]);
} else {
cut_file(file);
fclose(file);
}
head(len, fp);
if (errno) {
- error_msg("%s: %s\n", argv[optind], strerror(errno));
+ perror_msg("%s", argv[optind]);
status = EXIT_FAILURE;
errno = 0;
}
#ifdef BB_FEATURE_LS_FOLLOWLINKS
if (follow_links == TRUE) {
if (stat(cur->fullname, &cur->dstat)) {
- error_msg("%s: %s\n", cur->fullname, strerror(errno));
+ perror_msg("%s", cur->fullname);
status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
} else
#endif
if (lstat(cur->fullname, &cur->dstat)) {
- error_msg("%s: %s\n", cur->fullname, strerror(errno));
+ perror_msg("%s", cur->fullname);
status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
nfiles= 0;
dir = opendir(path);
if (dir == NULL) {
- error_msg("%s: %s\n", path, strerror(errno));
+ perror_msg("%s", path);
status = EXIT_FAILURE;
return(NULL); /* could not open the dir */
}
} else {
fp = fopen(filename, OPENOPTS(binary));
if (fp == NULL) {
- error_msg("%s: %s\n", filename, strerror(errno));
+ perror_msg("%s", filename);
return FALSE;
}
}
if (md5_stream(fp, md5_result)) {
- error_msg("%s: %s\n", filename, strerror(errno));
+ perror_msg("%s", filename);
if (fp != stdin)
fclose(fp);
}
if (fp != stdin && fclose(fp) == EOF) {
- error_msg("%s: %s\n", filename, strerror(errno));
+ perror_msg("%s", filename);
return FALSE;
}
} else {
checkfile_stream = fopen(checkfile_name, "r");
if (checkfile_stream == NULL) {
- error_msg("%s: %s\n", checkfile_name, strerror(errno));
+ perror_msg("%s", checkfile_name);
return FALSE;
}
}
}
if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) {
- error_msg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
+ perror_msg("md5sum: %s", checkfile_name);
return FALSE;
}
char buf[BUFSIZ + 1];
if (getcwd(buf, sizeof(buf)) == NULL)
- error_msg_and_die("%s\n", strerror(errno));
+ perror_msg_and_die("getcwd");
- printf("%s\n", buf);
+ puts(buf);
return EXIT_SUCCESS;
}
while (optind < argc) {
if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) {
nfiles--;
- error_msg("%s: %s\n", argv[optind-1], strerror(errno));
+ perror_msg("%s", argv[optind-1]);
status = 1;
}
}
&& (freopen (outname, "w", stdout) == NULL
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
)) {
- error_msg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
+ perror_msg("%s", outname); /* */
return FALSE;
}
if (decode (argv[optind], outname) != 0)
exit_status = FALSE;
} else {
- error_msg("%s: %s\n", argv[optind], strerror(errno));
+ perror_msg("%s", argv[optind]);
exit_status = EXIT_FAILURE;
}
optind++;
trans_ptr = uu_std; /* Standard encoding is old uu format */
/* Parse any options */
- while ((opt = getopt (argc, argv, "m")) != EOF) {
+ while ((opt = getopt (argc, argv, "m")) > 0) {
switch (opt) {
case 'm':
trans_ptr = uu_base64;
break;
- case 0:
- break;
-
default:
usage(uuencode_usage);
}
case 2:
/* Optional first argument is input file. */
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
- error_msg("%s: %s\n", argv[optind], strerror(errno));
+ perror_msg("%s", argv[optind]);
return EXIT_FAILURE;
}
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
if (mv_Action_first_time && (dz_i == is_mv)) {
mv_Action_first_time = errno = 0;
if (rename(fileName, destName) < 0 && errno != EXDEV) {
- error_msg("rename(%s, %s): %s\n", fileName, destName,
- strerror(errno));
+ perror_msg("rename(%s, %s)", fileName, destName);
goto do_copyFile; /* Try anyway... */
}
else if (errno == EXDEV)
if (preserveFlag == TRUE && statbuf->st_nlink > 1) {
if (is_in_ino_dev_hashtable(statbuf, &name)) {
if (link(name, destName) < 0) {
- error_msg("link(%s, %s): %s\n", name, destName, strerror(errno));
+ perror_msg("link(%s, %s)", name, destName);
return FALSE;
}
return TRUE;
if (S_ISDIR(statbuf->st_mode)) {
if (rmdir(fileName) < 0) {
- error_msg("rmdir(%s): %s\n", fileName, strerror(errno));
+ perror_msg("rmdir(%s)", fileName);
status = FALSE;
}
} else if (unlink(fileName) < 0) {
- error_msg("unlink(%s): %s\n", fileName, strerror(errno));
+ perror_msg("unlink(%s)", fileName);
status = FALSE;
}
return status;
char *pushd, *d, *p;
if ((pushd = getcwd(NULL, BUFSIZ + 1)) == NULL) {
- error_msg("getcwd(): %s\n", strerror(errno));
+ perror_msg("getcwd()");
continue;
}
if (chdir(baseDestName) < 0) {
- error_msg("chdir(%s): %s\n", baseSrcName, strerror(errno));
+ perror_msg("chdir(%s)", baseSrcName);
continue;
}
if ((d = getcwd(NULL, BUFSIZ + 1)) == NULL) {
- error_msg("getcwd(): %s\n", strerror(errno));
+ perror_msg("getcwd()");
continue;
}
while (!state && *d != '\0') {
if (stat(d, &sb) < 0) { /* stat not lstat - always dereference targets */
- error_msg("stat(%s): %s\n", d, strerror(errno));
+ perror_msg("stat(%s)", d);
state = -1;
continue;
}
}
}
if (chdir(pushd) < 0) {
- error_msg("chdir(%s): %s\n", pushd, strerror(errno));
+ perror_msg("chdir(%s)", pushd);
free(pushd);
free(d);
continue;
for (i = optind; i < argc; i++) {
file = fopen(argv[i], "r");
if (file == NULL) {
- error_msg("%s: %s\n", argv[i], strerror(errno));
+ perror_msg("%s", argv[i]);
} else {
cut_file(file);
fclose(file);
fd = open("/dev/tty0", O_RDWR);
if (fd < 0) {
- error_msg("Error opening /dev/tty0: %s\n", strerror(errno));
+ perror_msg("Error opening /dev/tty0");
return EXIT_FAILURE;
}
for (i = optind; i < argc; i++) {
file = fopen(argv[i], "r");
if (file == NULL) {
- error_msg("%s: %s\n", argv[i], strerror(errno));
+ perror_msg("%s", argv[i]);
} else {
process_file(file);
fclose(file);
file = fopen(cur_file, "r");
if (file == NULL) {
if (!suppress_err_msgs)
- error_msg("%s: %s\n", cur_file, strerror(errno));
+ perror_msg("%s", cur_file);
}
else {
grep_file(file);
}
if ((f = open(argv[1], O_RDWR)) == -1) {
- error_msg_and_die( "cannot open %s: %s\n", argv[1], strerror(errno));
+ perror_msg_and_die("cannot open %s", argv[1]);
}
if (ioctl(f, BLKFLSBUF) < 0) {
- error_msg_and_die( "failed ioctl on %s: %s\n", argv[1], strerror(errno));
+ perror_msg_and_die("failed ioctl on %s", argv[1]);
}
/* Don't bother closing. Exit does
* that, so we can save a few bytes */
file = fopen(cur_file, "r");
if (file == NULL) {
if (!suppress_err_msgs)
- error_msg("%s: %s\n", cur_file, strerror(errno));
+ perror_msg("%s", cur_file);
}
else {
grep_file(file);
}
head(len, fp);
if (errno) {
- error_msg("%s: %s\n", argv[optind], strerror(errno));
+ perror_msg("%s", argv[optind]);
status = EXIT_FAILURE;
errno = 0;
}
#ifndef MODUTILS_MODULE_H
#define MODUTILS_MODULE_H 1
-#ident "$Id: insmod.c,v 1.32 2000/12/13 16:41:29 andersen Exp $"
+#ident "$Id: insmod.c,v 1.33 2000/12/18 03:57:16 kraai Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
#ifndef MODUTILS_OBJ_H
#define MODUTILS_OBJ_H 1
-#ident "$Id: insmod.c,v 1.32 2000/12/13 16:41:29 andersen Exp $"
+#ident "$Id: insmod.c,v 1.33 2000/12/18 03:57:16 kraai Exp $"
/* The relocatable object is manipulated using elfin types. */
nks = get_kernel_syms(NULL);
if (nks < 0) {
- error_msg("get_kernel_syms: %s: %s\n", m_name, strerror(errno));
+ perror_msg("get_kernel_syms: %s", m_name);
return 0;
}
m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN
: 0), &routines, symtab);
if (ret)
- error_msg("init_module: %s: %s\n", m_name, strerror(errno));
+ perror_msg("init_module: %s", m_name);
free(image);
free(symtab);
module_names = xrealloc(module_names, bufsize = ret);
goto retry_modules_load;
}
- error_msg("QM_MODULES: %s\n", strerror(errno));
+ perror_msg("QM_MODULES");
return 0;
}
/* The module was removed out from underneath us. */
continue;
}
- error_msg("query_module: QM_INFO: %s: %s\n", mn, strerror(errno));
+ perror_msg("query_module: QM_INFO: %s", mn);
return 0;
}
/* The module was removed out from underneath us. */
continue;
default:
- error_msg("query_module: QM_SYMBOLS: %s: %s\n", mn, strerror(errno));
+ perror_msg("query_module: QM_SYMBOLS: %s", mn);
return 0;
}
}
syms = xrealloc(syms, bufsize = ret);
goto retry_kern_sym_load;
}
- error_msg("kernel: QM_SYMBOLS: %s\n", strerror(errno));
+ perror_msg("kernel: QM_SYMBOLS");
return 0;
}
nksyms = nsyms = ret;
ret = new_sys_init_module(m_name, (struct new_module *) image);
if (ret)
- error_msg("init_module: %s: %s\n", m_name, strerror(errno));
+ perror_msg("init_module: %s", m_name);
free(image);
fseek(fp, 0, SEEK_SET);
if (fread(&f->header, sizeof(f->header), 1, fp) != 1) {
- error_msg("error reading ELF header: %s\n", strerror(errno));
+ perror_msg("error reading ELF header");
return NULL;
}
section_headers = alloca(sizeof(ElfW(Shdr)) * shnum);
fseek(fp, f->header.e_shoff, SEEK_SET);
if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) {
- error_msg("error reading ELF section headers: %s\n", strerror(errno));
+ perror_msg("error reading ELF section headers");
return NULL;
}
sec->contents = xmalloc(sec->header.sh_size);
fseek(fp, sec->header.sh_offset, SEEK_SET);
if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) {
- error_msg("error reading ELF section data: %s\n", strerror(errno));
+ perror_msg("error reading ELF section data");
return NULL;
}
} else {
m_size);
goto out;
default:
- error_msg("create_module: %s: %s\n", m_name, strerror(errno));
+ perror_msg("create_module: %s", m_name);
goto out;
}
int pid;
if (!isdigit(**argv))
- error_msg_and_die( "Bad PID: %s\n", strerror(errno));
+ perror_msg_and_die( "Bad PID");
pid = strtol(*argv, NULL, 0);
if (kill(pid, sig) != 0)
- error_msg_and_die( "Could not kill pid '%d': %s\n", pid, strerror(errno));
+ perror_msg_and_die( "Could not kill pid '%d'", pid);
argv++;
}
}
if (*pidList==myPid)
continue;
if (kill(*pidList, sig) != 0)
- error_msg_and_die( "Could not kill pid '%d': %s\n", *pidList, strerror(errno));
+ perror_msg_and_die( "Could not kill pid '%d'", *pidList);
}
/* Note that we don't bother to free the memory
* allocated in find_pid_by_name(). It will be freed
fd = open("/dev/tty", O_RDWR);
if (fd < 0) {
- error_msg("Error opening /dev/tty1: %s\n", strerror(errno));
- return EXIT_FAILURE;
+ perror_msg_and_die("Error opening /dev/tty1");
}
if (screen_map_load(fd, stdin)) {
- error_msg("Error loading acm: %s\n", strerror(errno));
- return EXIT_FAILURE;
+ perror_msg_and_die("Error loading acm");
}
write(fd, "\033(K", 3);
#ifdef BB_FEATURE_LS_FOLLOWLINKS
if (follow_links == TRUE) {
if (stat(cur->fullname, &cur->dstat)) {
- error_msg("%s: %s\n", cur->fullname, strerror(errno));
+ perror_msg("%s", cur->fullname);
status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
} else
#endif
if (lstat(cur->fullname, &cur->dstat)) {
- error_msg("%s: %s\n", cur->fullname, strerror(errno));
+ perror_msg("%s", cur->fullname);
status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
nfiles= 0;
dir = opendir(path);
if (dir == NULL) {
- error_msg("%s: %s\n", path, strerror(errno));
+ perror_msg("%s", path);
status = EXIT_FAILURE;
return(NULL); /* could not open the dir */
}
} else {
fp = fopen(filename, OPENOPTS(binary));
if (fp == NULL) {
- error_msg("%s: %s\n", filename, strerror(errno));
+ perror_msg("%s", filename);
return FALSE;
}
}
if (md5_stream(fp, md5_result)) {
- error_msg("%s: %s\n", filename, strerror(errno));
+ perror_msg("%s", filename);
if (fp != stdin)
fclose(fp);
}
if (fp != stdin && fclose(fp) == EOF) {
- error_msg("%s: %s\n", filename, strerror(errno));
+ perror_msg("%s", filename);
return FALSE;
}
} else {
checkfile_stream = fopen(checkfile_name, "r");
if (checkfile_stream == NULL) {
- error_msg("%s: %s\n", checkfile_name, strerror(errno));
+ perror_msg("%s", checkfile_name);
return FALSE;
}
}
}
if (checkfile_stream != stdin && fclose(checkfile_stream) == EOF) {
- error_msg("md5sum: %s: %s\n", checkfile_name, strerror(errno));
+ perror_msg("md5sum: %s", checkfile_name);
return FALSE;
}
buf = xrealloc(buf, bufsize);
size = readlink(argv[1], buf, bufsize);
if (size == -1)
- error_msg_and_die("%s: %s\n", argv[1], strerror(errno));
+ perror_msg_and_die("%s", argv[1]);
}
buf[size] = '\0';
#ifndef MODUTILS_MODULE_H
#define MODUTILS_MODULE_H 1
-#ident "$Id: insmod.c,v 1.32 2000/12/13 16:41:29 andersen Exp $"
+#ident "$Id: insmod.c,v 1.33 2000/12/18 03:57:16 kraai Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
#ifndef MODUTILS_OBJ_H
#define MODUTILS_OBJ_H 1
-#ident "$Id: insmod.c,v 1.32 2000/12/13 16:41:29 andersen Exp $"
+#ident "$Id: insmod.c,v 1.33 2000/12/18 03:57:16 kraai Exp $"
/* The relocatable object is manipulated using elfin types. */
nks = get_kernel_syms(NULL);
if (nks < 0) {
- error_msg("get_kernel_syms: %s: %s\n", m_name, strerror(errno));
+ perror_msg("get_kernel_syms: %s", m_name);
return 0;
}
m_size | (flag_autoclean ? OLD_MOD_AUTOCLEAN
: 0), &routines, symtab);
if (ret)
- error_msg("init_module: %s: %s\n", m_name, strerror(errno));
+ perror_msg("init_module: %s", m_name);
free(image);
free(symtab);
module_names = xrealloc(module_names, bufsize = ret);
goto retry_modules_load;
}
- error_msg("QM_MODULES: %s\n", strerror(errno));
+ perror_msg("QM_MODULES");
return 0;
}
/* The module was removed out from underneath us. */
continue;
}
- error_msg("query_module: QM_INFO: %s: %s\n", mn, strerror(errno));
+ perror_msg("query_module: QM_INFO: %s", mn);
return 0;
}
/* The module was removed out from underneath us. */
continue;
default:
- error_msg("query_module: QM_SYMBOLS: %s: %s\n", mn, strerror(errno));
+ perror_msg("query_module: QM_SYMBOLS: %s", mn);
return 0;
}
}
syms = xrealloc(syms, bufsize = ret);
goto retry_kern_sym_load;
}
- error_msg("kernel: QM_SYMBOLS: %s\n", strerror(errno));
+ perror_msg("kernel: QM_SYMBOLS");
return 0;
}
nksyms = nsyms = ret;
ret = new_sys_init_module(m_name, (struct new_module *) image);
if (ret)
- error_msg("init_module: %s: %s\n", m_name, strerror(errno));
+ perror_msg("init_module: %s", m_name);
free(image);
fseek(fp, 0, SEEK_SET);
if (fread(&f->header, sizeof(f->header), 1, fp) != 1) {
- error_msg("error reading ELF header: %s\n", strerror(errno));
+ perror_msg("error reading ELF header");
return NULL;
}
section_headers = alloca(sizeof(ElfW(Shdr)) * shnum);
fseek(fp, f->header.e_shoff, SEEK_SET);
if (fread(section_headers, sizeof(ElfW(Shdr)), shnum, fp) != shnum) {
- error_msg("error reading ELF section headers: %s\n", strerror(errno));
+ perror_msg("error reading ELF section headers");
return NULL;
}
sec->contents = xmalloc(sec->header.sh_size);
fseek(fp, sec->header.sh_offset, SEEK_SET);
if (fread(sec->contents, sec->header.sh_size, 1, fp) != 1) {
- error_msg("error reading ELF section data: %s\n", strerror(errno));
+ perror_msg("error reading ELF section data");
return NULL;
}
} else {
m_size);
goto out;
default:
- error_msg("create_module: %s: %s\n", m_name, strerror(errno));
+ perror_msg("create_module: %s", m_name);
goto out;
}
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno));
+ perror_msg_and_die("open failed for `%s'", device);
/* How many filesystems? We need to know to allocate enough space */
numfilesystems = ioctl (fd, DEVMTAB_COUNT_FILESYSTEMS);
if (numfilesystems<0)
- error_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno));
+ perror_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS");
fslist = (struct k_fstype *) xcalloc ( numfilesystems, sizeof(struct k_fstype));
/* Grab the list of available filesystems */
status = ioctl (fd, DEVMTAB_GET_FILESYSTEMS, fslist);
if (status<0)
- error_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno));
+ perror_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS");
/* Walk the list trying to mount filesystems
* that do not claim to be nodev filesystems */
if (status == FALSE) {
if (whineOnErrors == TRUE) {
- error_msg("Mounting %s on %s failed: %s\n",
- blockDevice, directory, strerror(errno));
+ perror_msg("Mounting %s on %s failed", blockDevice, directory);
}
return (FALSE);
}
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno));
+ perror_msg_and_die("open failed for `%s'", device);
/* How many mounted filesystems? We need to know to
* allocate enough space for later... */
numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS);
if (numfilesystems<0)
- error_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno));
+ perror_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS");
mntentlist = (struct k_mntent *) xcalloc ( numfilesystems, sizeof(struct k_mntent));
/* Grab the list of mounted filesystems */
if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0)
- error_msg_and_die( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno));
+ perror_msg_and_die( "\nDEVMTAB_GET_MOUNTS");
for( i = 0 ; i < numfilesystems ; i++) {
fprintf( stdout, "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname,
fstabmount = TRUE;
if (f == NULL)
- error_msg_and_die( "\nCannot read /etc/fstab: %s\n", strerror (errno));
+ perror_msg_and_die( "\nCannot read /etc/fstab");
while ((m = getmntent(f)) != NULL) {
if (all == FALSE && directory == NULL && (
rc = nfsmount (device, directory, &flags,
&extra_opts, &string_flags, 1);
if ( rc != 0) {
- error_msg_and_die("nfsmount failed: %s\n", strerror(errno));
+ perror_msg_and_die("nfsmount failed");
rc = EXIT_FAILURE;
}
}
/* vi: set sw=4 ts=4: */
/*
- * $Id: ping.c,v 1.28 2000/12/07 19:56:48 markw Exp $
+ * $Id: ping.c,v 1.29 2000/12/18 03:57:16 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)
- error_msg_and_die("sendto: %s\n", strerror(errno));
+ perror_msg_and_die("sendto");
else if ((size_t)i != sizeof(packet))
error_msg_and_die("ping wrote %d chars; %d expected\n", i,
(int)sizeof(packet));
if (connect(s, (struct sockaddr *)&s_addr, sizeof s_addr) < 0)
{
- error_msg_and_die("Unable to connect to remote host: %s\n", strerror(errno));
+ perror_msg_and_die("Unable to connect to remote host");
}
return s;
}
/* vi: set sw=4 ts=4: */
/*
- * $Id: ping.c,v 1.28 2000/12/07 19:56:48 markw Exp $
+ * $Id: ping.c,v 1.29 2000/12/18 03:57:16 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)
- error_msg_and_die("sendto: %s\n", strerror(errno));
+ perror_msg_and_die("sendto");
else if ((size_t)i != sizeof(packet))
error_msg_and_die("ping wrote %d chars; %d expected\n", i,
(int)sizeof(packet));
int pid;
if (!isdigit(**argv))
- error_msg_and_die( "Bad PID: %s\n", strerror(errno));
+ perror_msg_and_die( "Bad PID");
pid = strtol(*argv, NULL, 0);
if (kill(pid, sig) != 0)
- error_msg_and_die( "Could not kill pid '%d': %s\n", pid, strerror(errno));
+ perror_msg_and_die( "Could not kill pid '%d'", pid);
argv++;
}
}
if (*pidList==myPid)
continue;
if (kill(*pidList, sig) != 0)
- error_msg_and_die( "Could not kill pid '%d': %s\n", *pidList, strerror(errno));
+ perror_msg_and_die( "Could not kill pid '%d'", *pidList);
}
/* Note that we don't bother to free the memory
* allocated in find_pid_by_name(). It will be freed
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- error_msg_and_die( "open failed for `%s': %s\n", device, strerror (errno));
+ perror_msg_and_die( "open failed for `%s'", device);
/* Find out how many processes there are */
if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0)
- error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
+ perror_msg_and_die( "\nDEVPS_GET_PID_LIST");
/* Allocate some memory -- grab a few extras just in case
* some new processes start up while we wait. The kernel will
/* Now grab the pid list */
if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0)
- error_msg_and_die("\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
+ perror_msg_and_die("\nDEVPS_GET_PID_LIST");
#ifdef BB_FEATURE_AUTOWIDTH
ioctl(fileno(stdout), TIOCGWINSZ, &win);
info.pid = pid_array[i];
if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)
- error_msg_and_die("\nDEVPS_GET_PID_INFO: %s\n", strerror (errno));
+ perror_msg_and_die("\nDEVPS_GET_PID_INFO");
/* Make some adjustments as needed */
my_getpwuid(uidName, info.euid);
/* close device */
if (close (fd) != 0)
- error_msg_and_die("close failed for `%s': %s\n", device, strerror (errno));
+ perror_msg_and_die("close failed for `%s'", device);
exit (0);
}
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- error_msg_and_die( "open failed for `%s': %s\n", device, strerror (errno));
+ perror_msg_and_die( "open failed for `%s'", device);
/* Find out how many processes there are */
if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0)
- error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
+ perror_msg_and_die( "\nDEVPS_GET_PID_LIST");
/* Allocate some memory -- grab a few extras just in case
* some new processes start up while we wait. The kernel will
/* Now grab the pid list */
if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0)
- error_msg_and_die("\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
+ perror_msg_and_die("\nDEVPS_GET_PID_LIST");
#ifdef BB_FEATURE_AUTOWIDTH
ioctl(fileno(stdout), TIOCGWINSZ, &win);
info.pid = pid_array[i];
if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)
- error_msg_and_die("\nDEVPS_GET_PID_INFO: %s\n", strerror (errno));
+ perror_msg_and_die("\nDEVPS_GET_PID_INFO");
/* Make some adjustments as needed */
my_getpwuid(uidName, info.euid);
/* close device */
if (close (fd) != 0)
- error_msg_and_die("close failed for `%s': %s\n", device, strerror (errno));
+ perror_msg_and_die("close failed for `%s'", device);
exit (0);
}
char buf[BUFSIZ + 1];
if (getcwd(buf, sizeof(buf)) == NULL)
- error_msg_and_die("%s\n", strerror(errno));
+ perror_msg_and_die("getcwd");
- printf("%s\n", buf);
+ puts(buf);
return EXIT_SUCCESS;
}
int fd;
if (!(h = gethostbyname(host))) { /* get the IP addr */
- error_msg("%s: %s\n", host, strerror(errno));
+ perror_msg("%s", host);
return(-1);
}
if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */
- error_msg("%s: %s\n", "time", strerror(errno));
+ perror_msg("%s", "time");
return(-1);
}
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { /* get net connection */
- error_msg("%s: %s\n", "socket", strerror(errno));
+ perror_msg("%s", "socket");
return(-1);
}
sin.sin_family = AF_INET;
if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { /* connect to time server */
- error_msg("%s: %s\n", host, strerror(errno));
+ perror_msg("%s", host);
close(fd);
return(-1);
}
}
if (setdate) {
if (stime(&time) < 0)
- error_msg_and_die("Could not set time of day: %s\n", strerror(errno));
+ perror_msg_and_die("Could not set time of day");
}
if (printdate) {
fprintf(stdout, "%s", ctime(&time));
buf = xrealloc(buf, bufsize);
size = readlink(argv[1], buf, bufsize);
if (size == -1)
- error_msg_and_die("%s: %s\n", argv[1], strerror(errno));
+ perror_msg_and_die("%s", argv[1]);
}
buf[size] = '\0';
for (i = optind; i < argc; i++) {
file = fopen(argv[i], "r");
if (file == NULL) {
- error_msg("%s: %s\n", argv[i], strerror(errno));
+ perror_msg("%s", argv[i]);
} else {
process_file(file);
fclose(file);
/* Create the syslog file so realpath() can work. */
close (open (_PATH_LOG, O_RDWR | O_CREAT, 0644));
if (realpath (_PATH_LOG, lfile) == NULL)
- error_msg_and_die ("Could not resolve path to " _PATH_LOG ": %s\n", strerror (errno));
+ perror_msg_and_die ("Could not resolve path to " _PATH_LOG);
unlink (lfile);
sunx.sun_family = AF_UNIX;
strncpy (sunx.sun_path, lfile, sizeof (sunx.sun_path));
if ((sock_fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
- error_msg_and_die ("Couldn't obtain descriptor for socket " _PATH_LOG ": %s\n", strerror (errno));
+ perror_msg_and_die ("Couldn't obtain descriptor for socket " _PATH_LOG);
addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path);
if ((bind (sock_fd, (struct sockaddr *) &sunx, addrLength)) || (listen (sock_fd, 5)))
- error_msg_and_die ("Could not connect to socket " _PATH_LOG ": %s\n", strerror (errno));
+ perror_msg_and_die ("Could not connect to socket " _PATH_LOG);
if (chmod (lfile, 0666) < 0)
- error_msg_and_die ("Could not set permission on " _PATH_LOG ": %s\n", strerror (errno));
+ perror_msg_and_die ("Could not set permission on " _PATH_LOG);
FD_ZERO (&fds);
FD_SET (sock_fd, &fds);
if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) {
if (errno == EINTR) continue; /* alarm may have happened. */
- error_msg_and_die ("select error: %s\n", strerror (errno));
+ perror_msg_and_die ("select error");
}
for (fd = 0; (n_ready > 0) && (fd < FD_SETSIZE); fd++) {
pid_t pid;
if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) {
- error_msg_and_die ("accept error: %s\n", strerror (errno));
+ perror_msg_and_die ("accept error");
}
pid = fork();
/* Create the syslog file so realpath() can work. */
close (open (_PATH_LOG, O_RDWR | O_CREAT, 0644));
if (realpath (_PATH_LOG, lfile) == NULL)
- error_msg_and_die ("Could not resolve path to " _PATH_LOG ": %s\n", strerror (errno));
+ perror_msg_and_die ("Could not resolve path to " _PATH_LOG);
unlink (lfile);
sunx.sun_family = AF_UNIX;
strncpy (sunx.sun_path, lfile, sizeof (sunx.sun_path));
if ((sock_fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
- error_msg_and_die ("Couldn't obtain descriptor for socket " _PATH_LOG ": %s\n", strerror (errno));
+ perror_msg_and_die ("Couldn't obtain descriptor for socket " _PATH_LOG);
addrLength = sizeof (sunx.sun_family) + strlen (sunx.sun_path);
if ((bind (sock_fd, (struct sockaddr *) &sunx, addrLength)) || (listen (sock_fd, 5)))
- error_msg_and_die ("Could not connect to socket " _PATH_LOG ": %s\n", strerror (errno));
+ perror_msg_and_die ("Could not connect to socket " _PATH_LOG);
if (chmod (lfile, 0666) < 0)
- error_msg_and_die ("Could not set permission on " _PATH_LOG ": %s\n", strerror (errno));
+ perror_msg_and_die ("Could not set permission on " _PATH_LOG);
FD_ZERO (&fds);
FD_SET (sock_fd, &fds);
if ((n_ready = select (FD_SETSIZE, &readfds, NULL, NULL, NULL)) < 0) {
if (errno == EINTR) continue; /* alarm may have happened. */
- error_msg_and_die ("select error: %s\n", strerror (errno));
+ perror_msg_and_die ("select error");
}
for (fd = 0; (n_ready > 0) && (fd < FD_SETSIZE); fd++) {
pid_t pid;
if ((conn = accept (sock_fd, (struct sockaddr *) &sunx, &addrLength)) < 0) {
- error_msg_and_die ("accept error: %s\n", strerror (errno));
+ perror_msg_and_die ("accept error");
}
pid = fork();
else
tarFd = open(tarName, O_RDONLY);
if (tarFd < 0)
- error_msg_and_die( "Error opening '%s': %s\n", tarName, strerror(errno));
+ perror_msg_and_die("Error opening '%s'", tarName);
#ifdef BB_FEATURE_TAR_GZIP
/* unzip tarFd in a seperate process */
return( TRUE);
if (create_path(header->name, header->mode) != TRUE) {
- error_msg("%s: Cannot mkdir: %s\n",
- header->name, strerror(errno));
+ perror_msg("%s: Cannot mkdir", header->name);
return( FALSE);
}
/* make the final component, just in case it was
return( TRUE);
if (link(header->linkname, header->name) < 0) {
- error_msg("%s: Cannot create hard link to '%s': %s\n",
- header->name, header->linkname, strerror(errno));
+ perror_msg("%s: Cannot create hard link to '%s'", header->name,
+ header->linkname);
return( FALSE);
}
#ifdef S_ISLNK
if (symlink(header->linkname, header->name) < 0) {
- error_msg("%s: Cannot create symlink to '%s': %s\n",
- header->name, header->linkname, strerror(errno));
+ perror_msg("%s: Cannot create symlink to '%s'", header->name,
+ header->linkname);
return( FALSE);
}
/* Try to change ownership of the symlink.
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) {
- error_msg("%s: Cannot mknod: %s\n",
- header->name, strerror(errno));
+ perror_msg("%s: Cannot mknod", header->name);
return( FALSE);
}
} else if (S_ISFIFO(header->mode)) {
if (mkfifo(header->name, header->mode) < 0) {
- error_msg("%s: Cannot mkfifo: %s\n",
- header->name, strerror(errno));
+ perror_msg("%s: Cannot mkfifo", header->name);
return( FALSE);
}
}
close(tarFd);
if (status > 0) {
/* Bummer - we read a partial header */
- error_msg( "Error reading tar file: %s\n", strerror(errno));
+ perror_msg("Error reading tar file");
return ( FALSE);
}
else if (errorFlag==TRUE) {
header.typeflag = SYMTYPE;
link_size = readlink(fileName, buffer, sizeof(buffer) - 1);
if ( link_size < 0) {
- error_msg("Error reading symlink '%s': %s\n", header.name, strerror(errno));
+ perror_msg("Error reading symlink '%s'", header.name);
return ( FALSE);
}
buffer[link_size] = '\0';
else
tbInfo.tarFd = open (tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (tbInfo.tarFd < 0) {
- error_msg( "Error opening '%s': %s\n", tarName, strerror(errno));
+ perror_msg( "Error opening '%s'", tarName);
freeHardLinkInfo(&tbInfo.hlInfoHead);
return ( FALSE);
}
while (optind < argc) {
if ((files[nfiles++] = fopen(argv[optind++], mode)) == NULL) {
nfiles--;
- error_msg("%s: %s\n", argv[optind-1], strerror(errno));
+ perror_msg("%s", argv[optind-1]);
status = 1;
}
}
if (connect(s, (struct sockaddr *)&s_addr, sizeof s_addr) < 0)
{
- error_msg_and_die("Unable to connect to remote host: %s\n", strerror(errno));
+ perror_msg_and_die("Unable to connect to remote host");
}
return s;
}
}
if ((f = open(argv[1], O_RDWR)) == -1) {
- error_msg_and_die( "cannot open %s: %s\n", argv[1], strerror(errno));
+ perror_msg_and_die("cannot open %s", argv[1]);
}
if (ioctl(f, BLKFLSBUF) < 0) {
- error_msg_and_die( "failed ioctl on %s: %s\n", argv[1], strerror(errno));
+ perror_msg_and_die("failed ioctl on %s", argv[1]);
}
/* Don't bother closing. Exit does
* that, so we can save a few bytes */
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno));
+ perror_msg_and_die("open failed for `%s'", device);
/* How many filesystems? We need to know to allocate enough space */
numfilesystems = ioctl (fd, DEVMTAB_COUNT_FILESYSTEMS);
if (numfilesystems<0)
- error_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS: %s\n", strerror (errno));
+ perror_msg_and_die("\nDEVMTAB_COUNT_FILESYSTEMS");
fslist = (struct k_fstype *) xcalloc ( numfilesystems, sizeof(struct k_fstype));
/* Grab the list of available filesystems */
status = ioctl (fd, DEVMTAB_GET_FILESYSTEMS, fslist);
if (status<0)
- error_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS: %s\n", strerror (errno));
+ perror_msg_and_die("\nDEVMTAB_GET_FILESYSTEMS");
/* Walk the list trying to mount filesystems
* that do not claim to be nodev filesystems */
if (status == FALSE) {
if (whineOnErrors == TRUE) {
- error_msg("Mounting %s on %s failed: %s\n",
- blockDevice, directory, strerror(errno));
+ perror_msg("Mounting %s on %s failed", blockDevice, directory);
}
return (FALSE);
}
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- error_msg_and_die("open failed for `%s': %s\n", device, strerror (errno));
+ perror_msg_and_die("open failed for `%s'", device);
/* How many mounted filesystems? We need to know to
* allocate enough space for later... */
numfilesystems = ioctl (fd, DEVMTAB_COUNT_MOUNTS);
if (numfilesystems<0)
- error_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS: %s\n", strerror (errno));
+ perror_msg_and_die( "\nDEVMTAB_COUNT_MOUNTS");
mntentlist = (struct k_mntent *) xcalloc ( numfilesystems, sizeof(struct k_mntent));
/* Grab the list of mounted filesystems */
if (ioctl (fd, DEVMTAB_GET_MOUNTS, mntentlist)<0)
- error_msg_and_die( "\nDEVMTAB_GET_MOUNTS: %s\n", strerror (errno));
+ perror_msg_and_die( "\nDEVMTAB_GET_MOUNTS");
for( i = 0 ; i < numfilesystems ; i++) {
fprintf( stdout, "%s %s %s %s %d %d\n", mntentlist[i].mnt_fsname,
fstabmount = TRUE;
if (f == NULL)
- error_msg_and_die( "\nCannot read /etc/fstab: %s\n", strerror (errno));
+ perror_msg_and_die( "\nCannot read /etc/fstab");
while ((m = getmntent(f)) != NULL) {
if (all == FALSE && directory == NULL && (
rc = nfsmount (device, directory, &flags,
&extra_opts, &string_flags, 1);
if ( rc != 0) {
- error_msg_and_die("nfsmount failed: %s\n", strerror(errno));
+ perror_msg_and_die("nfsmount failed");
rc = EXIT_FAILURE;
}
}
int fd;
if (!(h = gethostbyname(host))) { /* get the IP addr */
- error_msg("%s: %s\n", host, strerror(errno));
+ perror_msg("%s", host);
return(-1);
}
if ((tserv = getservbyname("time", "tcp")) == NULL) { /* find port # */
- error_msg("%s: %s\n", "time", strerror(errno));
+ perror_msg("%s", "time");
return(-1);
}
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { /* get net connection */
- error_msg("%s: %s\n", "socket", strerror(errno));
+ perror_msg("%s", "socket");
return(-1);
}
sin.sin_family = AF_INET;
if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) { /* connect to time server */
- error_msg("%s: %s\n", host, strerror(errno));
+ perror_msg("%s", host);
close(fd);
return(-1);
}
}
if (setdate) {
if (stime(&time) < 0)
- error_msg_and_die("Could not set time of day: %s\n", strerror(errno));
+ perror_msg_and_die("Could not set time of day");
}
if (printdate) {
fprintf(stdout, "%s", ctime(&time));
/* open device */
fd = open(device, O_RDONLY);
if (fd < 0)
- error_msg_and_die( "open failed for `%s': %s\n", device, strerror (errno));
+ perror_msg_and_die( "open failed for `%s'", device);
/* Find out how many processes there are */
if (ioctl (fd, DEVPS_GET_NUM_PIDS, &num_pids)<0)
- error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
+ perror_msg_and_die( "\nDEVPS_GET_PID_LIST");
/* Allocate some memory -- grab a few extras just in case
* some new processes start up while we wait. The kernel will
/* Now grab the pid list */
if (ioctl (fd, DEVPS_GET_PID_LIST, pid_array)<0)
- error_msg_and_die( "\nDEVPS_GET_PID_LIST: %s\n", strerror (errno));
+ perror_msg_and_die( "\nDEVPS_GET_PID_LIST");
/* Now search for a match */
for (i=1, j=0; i<pid_array[0] ; i++) {
info.pid = pid_array[i];
if (ioctl (fd, DEVPS_GET_PID_INFO, &info)<0)
- error_msg_and_die( "\nDEVPS_GET_PID_INFO: %s\n", strerror (errno));
+ perror_msg_and_die( "\nDEVPS_GET_PID_INFO");
/* Make sure we only match on the process name */
p=info.command_line+1;
/* close device */
if (close (fd) != 0)
- error_msg_and_die( "close failed for `%s': %s\n",device, strerror (errno));
+ perror_msg_and_die( "close failed for `%s'", device);
return pidList;
}
dir = opendir("/proc");
if (!dir)
- error_msg_and_die( "Cannot open /proc: %s\n", strerror (errno));
+ perror_msg_and_die( "Cannot open /proc");
while ((next = readdir(dir)) != NULL) {
FILE *status;
{
FILE *fp;
if ((fp = fopen(path, mode)) == NULL) {
- error_msg("%s: %s\n", path, strerror(errno));
+ perror_msg("%s", path);
errno = 0;
}
return fp;
{
FILE *fp;
if ((fp = fopen(path, mode)) == NULL)
- error_msg_and_die("%s: %s\n", path, strerror(errno));
+ perror_msg_and_die("%s", path);
return fp;
}
#endif
&& (freopen (outname, "w", stdout) == NULL
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
)) {
- error_msg("%s: %s %s\n", outname, inname, strerror(errno)); /* */
+ perror_msg("%s", outname); /* */
return FALSE;
}
if (decode (argv[optind], outname) != 0)
exit_status = FALSE;
} else {
- error_msg("%s: %s\n", argv[optind], strerror(errno));
+ perror_msg("%s", argv[optind]);
exit_status = EXIT_FAILURE;
}
optind++;
trans_ptr = uu_std; /* Standard encoding is old uu format */
/* Parse any options */
- while ((opt = getopt (argc, argv, "m")) != EOF) {
+ while ((opt = getopt (argc, argv, "m")) > 0) {
switch (opt) {
case 'm':
trans_ptr = uu_base64;
break;
- case 0:
- break;
-
default:
usage(uuencode_usage);
}
case 2:
/* Optional first argument is input file. */
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
- error_msg("%s: %s\n", argv[optind], strerror(errno));
+ perror_msg("%s", argv[optind]);
return EXIT_FAILURE;
}
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);