From 5eea098aaa4a43538ceabc7a7ffaeb0986cea33c Mon Sep 17 00:00:00 2001 From: wollman Date: Mon, 13 May 1996 17:43:19 +0000 Subject: Get rid of the last vestiges of the old MOUNT_* constants in the mount_* programs. While we're at it, collapse the four now-identical mount programs for devfs, fdesc, kernfs, and procfs into links to a new mount_std(8) which can mount any really generic filesystem such as these when called with the appropriate argv[0]. Also, convert the mount programs to use sysexits.h. --- sbin/mount_null/mount_null.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'sbin/mount_null') diff --git a/sbin/mount_null/mount_null.c b/sbin/mount_null/mount_null.c index e9e3bd8..d392db7 100644 --- a/sbin/mount_null/mount_null.c +++ b/sbin/mount_null/mount_null.c @@ -41,7 +41,11 @@ char copyright[] = #endif /* not lint */ #ifndef lint +/* static char sccsid[] = "@(#)mount_null.c 8.5 (Berkeley) 3/27/94"; +*/ +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include @@ -50,9 +54,10 @@ static char sccsid[] = "@(#)mount_null.c 8.5 (Berkeley) 3/27/94"; #include #include -#include #include #include +#include +#include #include "mntopts.h" @@ -62,7 +67,7 @@ struct mntopt mopts[] = { }; int subdir __P((const char *, const char *)); -void usage __P((void)); +static __dead void usage __P((void)) __dead2; int main(argc, argv) @@ -91,10 +96,10 @@ main(argc, argv) usage(); if (realpath(argv[0], target) == 0) - err(1, "%s", target); + err(EX_OSERR, "%s", target); if (subdir(target, argv[1]) || subdir(argv[1], target)) - errx(1, "%s (%s) and %s are not distinct paths", + errx(EX_USAGE, "%s (%s) and %s are not distinct paths", argv[0], target, argv[1]); args.target = target; @@ -102,13 +107,15 @@ main(argc, argv) vfc = getvfsbyname("null"); if(!vfc && vfsisloadable("null")) { if(vfsload("null")) - err(1, "vfsload(null)"); + err(EX_OSERR, "vfsload(null)"); endvfsent(); /* flush cache */ vfc = getvfsbyname("null"); } + if (!vfc) + errx(EX_OSERR, "null filesystem is not available"); - if (mount(vfc ? vfc->vfc_index : MOUNT_NULL, argv[1], mntflags, &args)) - err(1, NULL); + if (mount(vfc->vfc_index, argv[1], mntflags, &args)) + err(EX_OSERR, target); exit(0); } @@ -129,7 +136,7 @@ subdir(p, dir) return (0); } -void +static void usage() { (void)fprintf(stderr, -- cgit v1.1