From: Charles Hannum <mycroft@NetBSD.ORG>
SCCS-vsn: sbin/clri/clri.c 8.3
SCCS-vsn: sbin/dump/dumprmt.c 8.2
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)clri.c 8.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)clri.c 8.3 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
err(1, "%s", fs);
if (lseek(fd, (off_t)(SBLOCK * DEV_BSIZE), SEEK_SET) < 0)
err(1, "%s", fs);
err(1, "%s", fs);
if (lseek(fd, (off_t)(SBLOCK * DEV_BSIZE), SEEK_SET) < 0)
err(1, "%s", fs);
- if (read(fd, sblock, sizeof(sblock)) != sizeof(sblock)) {
- (void)fprintf(stderr,
- "clri: %s: can't read the superblock.\n", fs);
- exit(1);
- }
+ if (read(fd, sblock, sizeof(sblock)) != sizeof(sblock))
+ errx(1, "%s: can't read superblock", fs);
sbp = (struct fs *)sblock;
sbp = (struct fs *)sblock;
- if (sbp->fs_magic != FS_MAGIC) {
- (void)fprintf(stderr,
- "clri: %s: superblock magic number 0x%x, not 0x%x.\n",
+ if (sbp->fs_magic != FS_MAGIC)
+ errx(1, "%s: superblock magic number 0x%x, not 0x%x",
fs, sbp->fs_magic, FS_MAGIC);
fs, sbp->fs_magic, FS_MAGIC);
bsize = sbp->fs_bsize;
/* remaining arguments are inode numbers. */
while (*++argv) {
/* get the inode number. */
bsize = sbp->fs_bsize;
/* remaining arguments are inode numbers. */
while (*++argv) {
/* get the inode number. */
- if ((inonum = atoi(*argv)) <= 0) {
- (void)fprintf(stderr,
- "clri: %s is not a valid inode number.\n", *argv);
- exit(1);
- }
+ if ((inonum = atoi(*argv)) <= 0)
+ errx(1, "%s is not a valid inode number", *argv);
(void)printf("clearing %d\n", inonum);
/* read in the appropriate block. */
(void)printf("clearing %d\n", inonum);
/* read in the appropriate block. */
-static char sccsid[] = "@(#)dumprmt.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)dumprmt.c 8.2 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
#include <protocols/dumprestore.h>
#include <ctype.h>
#include <protocols/dumprestore.h>
#include <ctype.h>
#include <netdb.h>
#include <pwd.h>
#include <signal.h>
#include <netdb.h>
#include <pwd.h>
#include <signal.h>
- (void) fprintf(stderr, "rdump: Lost connection to remote host.\n");
- exit(1);
+ errx(1, "Lost connection to remote host.");
if (sp == NULL) {
sp = getservbyname("shell", "tcp");
if (sp == NULL) {
sp = getservbyname("shell", "tcp");
- if (sp == NULL) {
- (void) fprintf(stderr,
- "rdump: shell/tcp: unknown service\n");
- exit(1);
- }
+ if (sp == NULL)
+ errx(1, "shell/tcp: unknown service");
pwd = getpwuid(getuid());
pwd = getpwuid(getuid());
- if (pwd == NULL) {
- (void) fprintf(stderr, "rdump: who are you?\n");
- exit(1);
- }
+ if (pwd == NULL)
+ errx(1, "who are you?");
}
if ((cp = index(rmtpeer, '@')) != NULL) {
tuser = rmtpeer;
}
if ((cp = index(rmtpeer, '@')) != NULL) {
tuser = rmtpeer;
for (cp = cp0; *cp; cp++) {
c = *cp;
if (!isascii(c) || !(isalnum(c) || c == '_' || c == '-')) {
for (cp = cp0; *cp; cp++) {
c = *cp;
if (!isascii(c) || !(isalnum(c) || c == '_' || c == '-')) {
- (void) fprintf(stderr, "rdump: invalid user name %s\n",
- cp0);
+ warnx("invalid user name: %s", cp0);