From bcb1d8469db6e7e2f171898c3bd97c025101c345 Mon Sep 17 00:00:00 2001 From: Philippe Charnier Date: Mon, 6 Jul 1998 07:12:38 +0000 Subject: Remove unused #includes. Spelling. Add rcsid. Do not dot terminate err() strings. --- sbin/mount/getmntopts.3 | 4 ++-- sbin/mount/getmntopts.c | 8 ++------ sbin/mount/mntopts.h | 6 +++--- sbin/mount/mount.c | 37 ++++++++++++++++--------------------- sbin/mount/mount_ufs.c | 24 +++++++++++------------- sbin/mount/vfslist.c | 6 ++---- sbin/mount_ifs/getmntopts.3 | 4 ++-- sbin/mount_ifs/getmntopts.c | 8 ++------ sbin/mount_ifs/mntopts.h | 6 +++--- sbin/mount_ifs/mount.c | 37 ++++++++++++++++--------------------- sbin/mount_ifs/mount_ufs.c | 24 +++++++++++------------- sbin/mount_ifs/vfslist.c | 6 ++---- 12 files changed, 72 insertions(+), 98 deletions(-) diff --git a/sbin/mount/getmntopts.3 b/sbin/mount/getmntopts.3 index 8424104620b6..405e5871535d 100644 --- a/sbin/mount/getmntopts.3 +++ b/sbin/mount/getmntopts.3 @@ -70,8 +70,8 @@ has the following format: .Bd -literal struct mntopt { char *m_option; /* option name */ - int m_inverse; /* is this a negative option, eg "dev" */ - int m_flag; /* bit to set, eg MNT_RDONLY */ + int m_inverse; /* is this a negative option, e.g. "dev" */ + int m_flag; /* bit to set, e.g. MNT_RDONLY */ int m_altloc; /* non-zero to use altflagp rather than flagp */ }; .Ed diff --git a/sbin/mount/getmntopts.c b/sbin/mount/getmntopts.c index 733ef7f7acc9..25b8d090c128 100644 --- a/sbin/mount/getmntopts.c +++ b/sbin/mount/getmntopts.c @@ -36,20 +36,16 @@ static char sccsid[] = "@(#)getmntopts.c 8.3 (Berkeley) 3/29/95"; #else static const char rcsid[] = - "$Id$"; + "$Id: getmntopts.c,v 1.6 1997/08/24 21:02:47 steve Exp $"; #endif #endif /* not lint */ #include -#include #include -#include -#include #include #include -#include "extern.h" #include "mntopts.h" int getmnt_silent = 0; @@ -96,7 +92,7 @@ getmntopts(options, m0, flagp, altflagp) break; } - /* Save flag, or fail if option is not recognised. */ + /* Save flag, or fail if option is not recognized. */ if (m->m_option) { thisflagp = m->m_altloc ? altflagp : flagp; if (negative == m->m_inverse) diff --git a/sbin/mount/mntopts.h b/sbin/mount/mntopts.h index e78518a377bb..1be391d585c4 100644 --- a/sbin/mount/mntopts.h +++ b/sbin/mount/mntopts.h @@ -31,13 +31,13 @@ * SUCH DAMAGE. * * @(#)mntopts.h 8.7 (Berkeley) 3/29/95 - * $Id: mntopts.h,v 1.12 1997/11/13 00:28:48 julian Exp $ + * $Id: mntopts.h,v 1.13 1998/04/08 18:31:17 wosch Exp $ */ struct mntopt { const char *m_option; /* option name */ - int m_inverse; /* if a negative option, eg "dev" */ - int m_flag; /* bit to set, eg. MNT_RDONLY */ + int m_inverse; /* if a negative option, e.g. "dev" */ + int m_flag; /* bit to set, e.g. MNT_RDONLY */ int m_altloc; /* 1 => set bit in altflags */ }; diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index d27898e4eea0..493944451690 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -40,10 +40,9 @@ static const char copyright[] = #ifndef lint #if 0 static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95"; -#else -static const char rcsid[] = - "$Id: mount.c,v 1.26 1998/05/17 21:57:17 dt Exp $"; #endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include @@ -79,7 +78,7 @@ void prmount __P((struct statfs *)); void putfsent __P((const struct statfs *)); void usage __P((void)); -/* Map from mount otions to printable formats. */ +/* Map from mount options to printable formats. */ static struct opt { int o_opt; const char *o_name; @@ -155,7 +154,7 @@ main(argc, argv) break; case 't': if (vfslist != NULL) - errx(1, "only one -t option may be specified."); + errx(1, "only one -t option may be specified"); vfslist = makevfslist(optarg); vfstype = optarg; break; @@ -222,7 +221,7 @@ main(argc, argv) if (init_flags & MNT_UPDATE) { if ((mntbuf = getmntpt(*argv)) == NULL) errx(1, - "unknown special file or file system %s.", + "unknown special file or file system %s", *argv); if ((fs = getfsfile(mntbuf->f_mntonname)) != NULL) mntfromname = fs->fs_spec; @@ -234,10 +233,10 @@ main(argc, argv) } if ((fs = getfsfile(*argv)) == NULL && (fs = getfsspec(*argv)) == NULL) - errx(1, "%s: unknown special file or file system.", + errx(1, "%s: unknown special file or file system", *argv); if (BADTYPE(fs->fs_type)) - errx(1, "%s has unknown file system type.", + errx(1, "%s has unknown file system type", *argv); rval = mountfs(fs->fs_vfstype, fs->fs_spec, fs->fs_file, init_flags, options, fs->fs_mntops); @@ -355,7 +354,7 @@ mountfs(vfstype, spec, name, flags, options, mntopts) if (realpath(name, mntpath) != NULL && stat(mntpath, &sb) == 0) { if (!S_ISDIR(sb.st_mode)) { - warnx("%s: Not a directory", mntpath); + warnx("%s: not a directory", mntpath); return (1); } } else { @@ -386,7 +385,7 @@ mountfs(vfstype, spec, name, flags, options, mntopts) /* * XXX * The mount_mfs (newfs) command uses -o to select the - * optimisation mode. We don't pass the default "-o rw" + * optimization mode. We don't pass the default "-o rw" * for that reason. */ if (flags & MNT_UPDATE) @@ -427,10 +426,8 @@ mountfs(vfstype, spec, name, flags, options, mntopts) char *cp; for (edir = edirs; *edir; edir++) len += strlen(*edir) + 2; /* ", " */ - if ((cp = malloc(len)) == NULL) { - warn(NULL); - exit(1); - } + if ((cp = malloc(len)) == NULL) + errx(1, "malloc failed"); cp[0] = '\0'; for (edir = edirs; *edir; edir++) { strcat(cp, *edir); @@ -529,7 +526,7 @@ catopt(s0, s1) if (s0 && *s0) { i = strlen(s0) + strlen(s1) + 1 + 1; if ((cp = malloc(i)) == NULL) - err(1, NULL); + errx(1, "malloc failed"); (void)snprintf(cp, i, "%s,%s", s0, s1); } else cp = strdup(s1); @@ -570,12 +567,10 @@ void usage() { - (void)fprintf(stderr, - "usage: mount %s %s\n mount %s\n mount %s\n", - "[-dfpruvw] [-o options] [-t ufs | external_type]", - "special node", - "[-adfpruvw] [-t ufs | external_type]", - "[-dfpruvw] special | node"); + (void)fprintf(stderr, "%s\n%s\n%s\n", +"usage: mount [-dfpruvw] [-o options] [-t ufs | external_type] special node", +" mount [-adfpruvw] [-t ufs | external_type]", +" mount [-dfpruvw] special | node"); exit(1); } diff --git a/sbin/mount/mount_ufs.c b/sbin/mount/mount_ufs.c index 1ec97c4ce209..00c2e72f0230 100644 --- a/sbin/mount/mount_ufs.c +++ b/sbin/mount/mount_ufs.c @@ -40,10 +40,9 @@ static const char copyright[] = #ifndef lint #if 0 static char sccsid[] = "@(#)mount_ufs.c 8.4 (Berkeley) 4/26/95"; -#else -static const char rcsid[] = - "$Id: mount_ufs.c,v 1.12 1998/03/08 19:03:05 steve Exp $"; #endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include @@ -52,8 +51,6 @@ static const char rcsid[] = #include #include #include -#include -#include #include #include @@ -132,7 +129,7 @@ mount_ufs(argc, argv) result = -1; /* * If we are mounting root, and we have a mount of something that - * might be the compatability slice, try mounting other slices + * might be the compatibility slice, try mounting other slices * first. If the kernel has done the right thing and mounted * the slice because the disk is really sliced, this will find * the real root filesystem. If not, we'll try what was supplied. @@ -158,21 +155,22 @@ mount_ufs(argc, argv) #else if (mount(vfc.vfc_name, fs_name, mntflags, &args) < 0) { #endif - (void)fprintf(stderr, "%s on %s: ", args.fspec, fs_name); switch (errno) { case EMFILE: - (void)fprintf(stderr, "mount table full.\n"); + warnx("%s on %s: mount table full", + args.fspec, fs_name); break; case EINVAL: if (mntflags & MNT_UPDATE) - (void)fprintf(stderr, - "Specified device does not match mounted device.\n"); + warnx( + "%s on %s: specified device does not match mounted device", + args.fspec, fs_name); else - (void)fprintf(stderr, - "Incorrect super block.\n"); + warnx("%s on %s: incorrect super block", + args.fspec, fs_name); break; default: - (void)fprintf(stderr, "%s\n", strerror(errno)); + warn(NULL); break; } return (1); diff --git a/sbin/mount/vfslist.c b/sbin/mount/vfslist.c index 15edaf3ec1aa..871de264f76a 100644 --- a/sbin/mount/vfslist.c +++ b/sbin/mount/vfslist.c @@ -34,16 +34,14 @@ #ifndef lint #if 0 static char sccsid[] = "@(#)vfslist.c 8.1 (Berkeley) 5/8/95"; -#else +#endif static const char rcsid[] = "$Id$"; -#endif #endif /* not lint */ #include #include #include -#include #include "extern.h" @@ -83,7 +81,7 @@ makevfslist(fslist) if (*nextcp == ',') i++; if ((av = malloc((size_t)(i + 2) * sizeof(char *))) == NULL) { - warn(NULL); + warnx("malloc failed"); return (NULL); } nextcp = fslist; diff --git a/sbin/mount_ifs/getmntopts.3 b/sbin/mount_ifs/getmntopts.3 index 8424104620b6..405e5871535d 100644 --- a/sbin/mount_ifs/getmntopts.3 +++ b/sbin/mount_ifs/getmntopts.3 @@ -70,8 +70,8 @@ has the following format: .Bd -literal struct mntopt { char *m_option; /* option name */ - int m_inverse; /* is this a negative option, eg "dev" */ - int m_flag; /* bit to set, eg MNT_RDONLY */ + int m_inverse; /* is this a negative option, e.g. "dev" */ + int m_flag; /* bit to set, e.g. MNT_RDONLY */ int m_altloc; /* non-zero to use altflagp rather than flagp */ }; .Ed diff --git a/sbin/mount_ifs/getmntopts.c b/sbin/mount_ifs/getmntopts.c index 733ef7f7acc9..25b8d090c128 100644 --- a/sbin/mount_ifs/getmntopts.c +++ b/sbin/mount_ifs/getmntopts.c @@ -36,20 +36,16 @@ static char sccsid[] = "@(#)getmntopts.c 8.3 (Berkeley) 3/29/95"; #else static const char rcsid[] = - "$Id$"; + "$Id: getmntopts.c,v 1.6 1997/08/24 21:02:47 steve Exp $"; #endif #endif /* not lint */ #include -#include #include -#include -#include #include #include -#include "extern.h" #include "mntopts.h" int getmnt_silent = 0; @@ -96,7 +92,7 @@ getmntopts(options, m0, flagp, altflagp) break; } - /* Save flag, or fail if option is not recognised. */ + /* Save flag, or fail if option is not recognized. */ if (m->m_option) { thisflagp = m->m_altloc ? altflagp : flagp; if (negative == m->m_inverse) diff --git a/sbin/mount_ifs/mntopts.h b/sbin/mount_ifs/mntopts.h index e78518a377bb..1be391d585c4 100644 --- a/sbin/mount_ifs/mntopts.h +++ b/sbin/mount_ifs/mntopts.h @@ -31,13 +31,13 @@ * SUCH DAMAGE. * * @(#)mntopts.h 8.7 (Berkeley) 3/29/95 - * $Id: mntopts.h,v 1.12 1997/11/13 00:28:48 julian Exp $ + * $Id: mntopts.h,v 1.13 1998/04/08 18:31:17 wosch Exp $ */ struct mntopt { const char *m_option; /* option name */ - int m_inverse; /* if a negative option, eg "dev" */ - int m_flag; /* bit to set, eg. MNT_RDONLY */ + int m_inverse; /* if a negative option, e.g. "dev" */ + int m_flag; /* bit to set, e.g. MNT_RDONLY */ int m_altloc; /* 1 => set bit in altflags */ }; diff --git a/sbin/mount_ifs/mount.c b/sbin/mount_ifs/mount.c index d27898e4eea0..493944451690 100644 --- a/sbin/mount_ifs/mount.c +++ b/sbin/mount_ifs/mount.c @@ -40,10 +40,9 @@ static const char copyright[] = #ifndef lint #if 0 static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95"; -#else -static const char rcsid[] = - "$Id: mount.c,v 1.26 1998/05/17 21:57:17 dt Exp $"; #endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include @@ -79,7 +78,7 @@ void prmount __P((struct statfs *)); void putfsent __P((const struct statfs *)); void usage __P((void)); -/* Map from mount otions to printable formats. */ +/* Map from mount options to printable formats. */ static struct opt { int o_opt; const char *o_name; @@ -155,7 +154,7 @@ main(argc, argv) break; case 't': if (vfslist != NULL) - errx(1, "only one -t option may be specified."); + errx(1, "only one -t option may be specified"); vfslist = makevfslist(optarg); vfstype = optarg; break; @@ -222,7 +221,7 @@ main(argc, argv) if (init_flags & MNT_UPDATE) { if ((mntbuf = getmntpt(*argv)) == NULL) errx(1, - "unknown special file or file system %s.", + "unknown special file or file system %s", *argv); if ((fs = getfsfile(mntbuf->f_mntonname)) != NULL) mntfromname = fs->fs_spec; @@ -234,10 +233,10 @@ main(argc, argv) } if ((fs = getfsfile(*argv)) == NULL && (fs = getfsspec(*argv)) == NULL) - errx(1, "%s: unknown special file or file system.", + errx(1, "%s: unknown special file or file system", *argv); if (BADTYPE(fs->fs_type)) - errx(1, "%s has unknown file system type.", + errx(1, "%s has unknown file system type", *argv); rval = mountfs(fs->fs_vfstype, fs->fs_spec, fs->fs_file, init_flags, options, fs->fs_mntops); @@ -355,7 +354,7 @@ mountfs(vfstype, spec, name, flags, options, mntopts) if (realpath(name, mntpath) != NULL && stat(mntpath, &sb) == 0) { if (!S_ISDIR(sb.st_mode)) { - warnx("%s: Not a directory", mntpath); + warnx("%s: not a directory", mntpath); return (1); } } else { @@ -386,7 +385,7 @@ mountfs(vfstype, spec, name, flags, options, mntopts) /* * XXX * The mount_mfs (newfs) command uses -o to select the - * optimisation mode. We don't pass the default "-o rw" + * optimization mode. We don't pass the default "-o rw" * for that reason. */ if (flags & MNT_UPDATE) @@ -427,10 +426,8 @@ mountfs(vfstype, spec, name, flags, options, mntopts) char *cp; for (edir = edirs; *edir; edir++) len += strlen(*edir) + 2; /* ", " */ - if ((cp = malloc(len)) == NULL) { - warn(NULL); - exit(1); - } + if ((cp = malloc(len)) == NULL) + errx(1, "malloc failed"); cp[0] = '\0'; for (edir = edirs; *edir; edir++) { strcat(cp, *edir); @@ -529,7 +526,7 @@ catopt(s0, s1) if (s0 && *s0) { i = strlen(s0) + strlen(s1) + 1 + 1; if ((cp = malloc(i)) == NULL) - err(1, NULL); + errx(1, "malloc failed"); (void)snprintf(cp, i, "%s,%s", s0, s1); } else cp = strdup(s1); @@ -570,12 +567,10 @@ void usage() { - (void)fprintf(stderr, - "usage: mount %s %s\n mount %s\n mount %s\n", - "[-dfpruvw] [-o options] [-t ufs | external_type]", - "special node", - "[-adfpruvw] [-t ufs | external_type]", - "[-dfpruvw] special | node"); + (void)fprintf(stderr, "%s\n%s\n%s\n", +"usage: mount [-dfpruvw] [-o options] [-t ufs | external_type] special node", +" mount [-adfpruvw] [-t ufs | external_type]", +" mount [-dfpruvw] special | node"); exit(1); } diff --git a/sbin/mount_ifs/mount_ufs.c b/sbin/mount_ifs/mount_ufs.c index 1ec97c4ce209..00c2e72f0230 100644 --- a/sbin/mount_ifs/mount_ufs.c +++ b/sbin/mount_ifs/mount_ufs.c @@ -40,10 +40,9 @@ static const char copyright[] = #ifndef lint #if 0 static char sccsid[] = "@(#)mount_ufs.c 8.4 (Berkeley) 4/26/95"; -#else -static const char rcsid[] = - "$Id: mount_ufs.c,v 1.12 1998/03/08 19:03:05 steve Exp $"; #endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include @@ -52,8 +51,6 @@ static const char rcsid[] = #include #include #include -#include -#include #include #include @@ -132,7 +129,7 @@ mount_ufs(argc, argv) result = -1; /* * If we are mounting root, and we have a mount of something that - * might be the compatability slice, try mounting other slices + * might be the compatibility slice, try mounting other slices * first. If the kernel has done the right thing and mounted * the slice because the disk is really sliced, this will find * the real root filesystem. If not, we'll try what was supplied. @@ -158,21 +155,22 @@ mount_ufs(argc, argv) #else if (mount(vfc.vfc_name, fs_name, mntflags, &args) < 0) { #endif - (void)fprintf(stderr, "%s on %s: ", args.fspec, fs_name); switch (errno) { case EMFILE: - (void)fprintf(stderr, "mount table full.\n"); + warnx("%s on %s: mount table full", + args.fspec, fs_name); break; case EINVAL: if (mntflags & MNT_UPDATE) - (void)fprintf(stderr, - "Specified device does not match mounted device.\n"); + warnx( + "%s on %s: specified device does not match mounted device", + args.fspec, fs_name); else - (void)fprintf(stderr, - "Incorrect super block.\n"); + warnx("%s on %s: incorrect super block", + args.fspec, fs_name); break; default: - (void)fprintf(stderr, "%s\n", strerror(errno)); + warn(NULL); break; } return (1); diff --git a/sbin/mount_ifs/vfslist.c b/sbin/mount_ifs/vfslist.c index 15edaf3ec1aa..871de264f76a 100644 --- a/sbin/mount_ifs/vfslist.c +++ b/sbin/mount_ifs/vfslist.c @@ -34,16 +34,14 @@ #ifndef lint #if 0 static char sccsid[] = "@(#)vfslist.c 8.1 (Berkeley) 5/8/95"; -#else +#endif static const char rcsid[] = "$Id$"; -#endif #endif /* not lint */ #include #include #include -#include #include "extern.h" @@ -83,7 +81,7 @@ makevfslist(fslist) if (*nextcp == ',') i++; if ((av = malloc((size_t)(i + 2) * sizeof(char *))) == NULL) { - warn(NULL); + warnx("malloc failed"); return (NULL); } nextcp = fslist; -- cgit v1.2.3