121156Sdist /* 261503Sbostic * Copyright (c) 1980, 1989, 1993 361503Sbostic * The Regents of the University of California. All rights reserved. 439322Smckusick * 542702Sbostic * %sccs.include.redist.c% 621156Sdist */ 721156Sdist 810811Ssam #ifndef lint 961503Sbostic static char copyright[] = 1061503Sbostic "@(#) Copyright (c) 1980, 1989, 1993\n\ 1161503Sbostic The Regents of the University of California. All rights reserved.\n"; 1239322Smckusick #endif /* not lint */ 131057Sbill 1421156Sdist #ifndef lint 15*66177Sbostic static char sccsid[] = "@(#)mount.c 8.14 (Berkeley) 02/21/94"; 1639322Smckusick #endif /* not lint */ 1721156Sdist 1866138Sbostic #include <sys/param.h> 1966138Sbostic #include <sys/wait.h> 2066138Sbostic #include <sys/mount.h> 2166131Spendry 2266138Sbostic #include <err.h> 2366138Sbostic #include <errno.h> 2466138Sbostic #include <fstab.h> 2566138Sbostic #include <signal.h> 2666131Spendry #include <stdio.h> 2766131Spendry #include <stdlib.h> 2866138Sbostic #include <string.h> 2966131Spendry #include <unistd.h> 3066138Sbostic 3145524Sbostic #include "pathnames.h" 321057Sbill 3340369Smckusick 3466138Sbostic int debug, force, verbose, mnttype, skipvfs; 3566130Spendry char *mntname; 3639131Smckusick 3766138Sbostic int badvfsname __P((char *, char **)); 3866138Sbostic int badvfstype __P((int, char **)); 3966138Sbostic int getexecopts __P((char *, char **)); 4066138Sbostic struct statfs 4166138Sbostic *getmntpt __P((char *)); 4266138Sbostic int getmnttype __P((char *)); 4366138Sbostic void getstdopts __P((char *, int *)); 4466138Sbostic void getufsopts __P((char *, int *)); 4566138Sbostic char **makevfslist __P((char *)); 4666138Sbostic int mountfs __P((char *, char *, int, char *, char *, char *)); 4766138Sbostic void prmount __P((char *, char *, int)); 4866138Sbostic void usage __P((void)); 4966138Sbostic 5066130Spendry int 5166130Spendry main(argc, argv) 525073Sroot int argc; 5366138Sbostic char *argv[]; 541057Sbill { 5566130Spendry struct fstab *fs; 5666130Spendry struct statfs *mntbuf; 57*66177Sbostic FILE *mountdfp; 58*66177Sbostic pid_t pid; 5966138Sbostic long mntsize; 60*66177Sbostic int all, ch, i, rval, updateflg; 6166138Sbostic char *cp, *type, *options, **vfslist; 621057Sbill 6366138Sbostic mntname = "ufs"; 6438445Smckusick mnttype = MOUNT_UFS; 6566138Sbostic 6666138Sbostic all = updateflg = 0; 6766138Sbostic options = type = NULL; 6866138Sbostic vfslist = NULL; 6966138Sbostic while ((ch = getopt(argc, argv, "adfo:rwt:uv")) != EOF) 7066138Sbostic switch(ch) { 7135339Sbostic case 'a': 7235339Sbostic all = 1; 7335339Sbostic break; 7456841Smckusick case 'd': 7556841Smckusick debug = 1; 7656841Smckusick break; 7735339Sbostic case 'f': 7856841Smckusick force = 1; 7935339Sbostic break; 8066138Sbostic case 'o': 8166138Sbostic options = optarg; 8266138Sbostic break; 8335339Sbostic case 'r': 8412808Ssam type = FSTAB_RO; 8535339Sbostic break; 8666138Sbostic case 't': 8766138Sbostic vfslist = makevfslist(optarg); 8866138Sbostic mnttype = getmnttype(optarg); 8966138Sbostic break; 9039333Smckusick case 'u': 9141403Smckusick updateflg = MNT_UPDATE; 9239333Smckusick break; 9335339Sbostic case 'v': 9435339Sbostic verbose = 1; 9535339Sbostic break; 9635339Sbostic case 'w': 9735339Sbostic type = FSTAB_RW; 9835339Sbostic break; 9935339Sbostic case '?': 10035339Sbostic default: 10135339Sbostic usage(); 10239131Smckusick /* NOTREACHED */ 1035073Sroot } 10435339Sbostic argc -= optind; 10535339Sbostic argv += optind; 10635339Sbostic 10766138Sbostic #define BADTYPE(type) \ 10866138Sbostic (strcmp(type, FSTAB_RO) && \ 10966138Sbostic strcmp(type, FSTAB_RW) && strcmp(type, FSTAB_RQ)) 11035339Sbostic 111*66177Sbostic rval = 0; 1124460Sroot if (all) { 11366138Sbostic while ((fs = getfsent()) != NULL) { 11435372Sbostic if (BADTYPE(fs->fs_type)) 11535372Sbostic continue; 11640844Smckusick if (badvfsname(fs->fs_vfstype, vfslist)) 11740051Smckusick continue; 11866138Sbostic /* `/' is special, it's always mounted. */ 11939333Smckusick mnttype = getmnttype(fs->fs_vfstype); 120*66177Sbostic if (mountfs(fs->fs_spec, fs->fs_file, updateflg, 121*66177Sbostic type, options, fs->fs_mntops)) 122*66177Sbostic rval = 1; 12335372Sbostic } 12435341Sbostic exit(rval); 12535339Sbostic } 1265073Sroot 12735339Sbostic if (argc == 0) { 12856841Smckusick if (verbose || debug || type) 12935339Sbostic usage(); 13066139Sbostic if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0) 13166139Sbostic err(1, "getmntinfo"); 13240844Smckusick for (i = 0; i < mntsize; i++) { 13340844Smckusick if (badvfstype(mntbuf[i].f_type, vfslist)) 13440844Smckusick continue; 13566138Sbostic prmount(mntbuf[i].f_mntfromname, 13666138Sbostic mntbuf[i].f_mntonname, mntbuf[i].f_flags); 13740844Smckusick } 1384460Sroot exit(0); 1391057Sbill } 14012808Ssam 141*66177Sbostic if (argc == 1 && vfslist != NULL) { 14266131Spendry usage(); 143*66177Sbostic /* NOTREACHED */ 144*66177Sbostic } 14566131Spendry 14639465Smckusick if (argc == 1 && updateflg) { 14766138Sbostic if ((mntbuf = getmntpt(*argv)) == NULL) 14866138Sbostic errx(1, 14966138Sbostic "unknown special file or file system %s.", *argv); 15039465Smckusick mnttype = mntbuf->f_type; 15166138Sbostic if ((fs = getfsfile(mntbuf->f_mntonname)) == NULL) 15266131Spendry errx(1, "can't find fstab entry for %s.", *argv); 15353711Smckusick mntname = fs->fs_vfstype; 15453711Smckusick 15553711Smckusick /* 15653711Smckusick * Default type to fstab version if none specified on the 15753711Smckusick * command line. 15853711Smckusick */ 15953711Smckusick if (type == NULL) 16053711Smckusick type = fs->fs_type; 16153711Smckusick 16253711Smckusick /* 16353711Smckusick * Default options to fstab version if none specified on the 16453711Smckusick * command line. 16553711Smckusick */ 16653711Smckusick if (options == NULL) 16753711Smckusick options = fs->fs_mntops; 16853711Smckusick else { 16953711Smckusick /* 17053711Smckusick * Concat the two strings with the command line 17153711Smckusick * options last so that they will override the 17253711Smckusick * fstab options. 17353711Smckusick */ 17453711Smckusick i = strlen(fs->fs_mntops) + strlen(options) + 2; 17566138Sbostic if ((cp = malloc((size_t)i)) == NULL) 17666139Sbostic err(1, NULL); 17766138Sbostic (void)snprintf(cp, i, "%s,%s", fs->fs_mntops, options); 17853711Smckusick options = cp; 17953711Smckusick } 180*66177Sbostic rval = mountfs(fs->fs_spec, 18166138Sbostic mntbuf->f_mntonname, updateflg, type, options, NULL); 18240496Smckusick } else if (argc == 1) { 18366138Sbostic if ((fs = getfsfile(*argv)) == NULL && 18466138Sbostic (fs = getfsspec(*argv)) == NULL) 18566138Sbostic errx(1, 186*66177Sbostic "%s: unknown special file or file system.", *argv); 18766138Sbostic if (BADTYPE(fs->fs_type)) 18866139Sbostic errx(1, "%s has unknown file system type.", *argv); 18939333Smckusick mnttype = getmnttype(fs->fs_vfstype); 190*66177Sbostic rval = mountfs(fs->fs_spec, 19166138Sbostic fs->fs_file, updateflg, type, options, fs->fs_mntops); 19240496Smckusick } else if (argc != 2) { 19340496Smckusick usage(); 194*66177Sbostic /* NOTREACHED */ 19540496Smckusick } else { 19642857Smckusick /* 19766138Sbostic * If -t flag has not been specified, and spec contains either 19866138Sbostic * a ':' or a '@' then assume that an NFS filesystem is being 19966138Sbostic * specified ala Sun. 20042857Smckusick */ 20166138Sbostic if (vfslist == NULL && 20266131Spendry (strchr(argv[0], ':') || strchr(argv[0], '@'))) { 20342857Smckusick mnttype = MOUNT_NFS; 20452182Smckusick mntname = "nfs"; 20552182Smckusick } 206*66177Sbostic rval = 207*66177Sbostic mountfs(argv[0], argv[1], updateflg, type, options, NULL); 20812808Ssam } 20966174Spendry /* 210*66177Sbostic * If the mount succeeded, and root did the mount, then tell 211*66177Sbostic * mountd the good news. Pid checks are probably unnecessary, 212*66177Sbostic * but don't hurt. 21366174Spendry */ 214*66177Sbostic if (rval == 0 && getuid() == 0 && 215*66177Sbostic (mountdfp = fopen(_PATH_MOUNTDPID, "r")) != NULL) { 216*66177Sbostic if (fscanf(mountdfp, "%ld", &pid) == 1 && 217*66177Sbostic pid > 0 && pid != -1 && kill(pid, SIGHUP)) 218*66177Sbostic err(1, "signal mountd"); 219*66177Sbostic (void)fclose(mountdfp); 22040496Smckusick } 22166138Sbostic 222*66177Sbostic exit(rval); 22312808Ssam } 22412808Ssam 22566138Sbostic int 22639333Smckusick mountfs(spec, name, flags, type, options, mntopts) 22739131Smckusick char *spec, *name, *type, *options, *mntopts; 22839333Smckusick int flags; 22912808Ssam { 23066138Sbostic struct ufs_args args; 23142253Sbostic pid_t pid; 23266138Sbostic int argc, i, status; 23339131Smckusick char *argp, *argv[50]; 23466138Sbostic char execname[MAXPATHLEN + 1], flagval[12], mntpath[MAXPATHLEN]; 2351057Sbill 23639333Smckusick if (mntopts) 23739333Smckusick getstdopts(mntopts, &flags); 23839316Smckusick if (options) 23939316Smckusick getstdopts(options, &flags); 24039333Smckusick if (type) 24139333Smckusick getstdopts(type, &flags); 24256841Smckusick if (force) 24356841Smckusick flags |= MNT_FORCE; 24466133Spendry 24566133Spendry if (realpath(name, mntpath) == 0) { 24666133Spendry warn("%s", mntpath); 24766133Spendry return (1); 24866133Spendry } 24966133Spendry 25066133Spendry name = mntpath; 25166133Spendry 25266131Spendry if (strcmp(name, "/") == 0) 25366131Spendry flags |= MNT_UPDATE; 25466131Spendry 25539316Smckusick switch (mnttype) { 25639316Smckusick case MOUNT_UFS: 25739333Smckusick if (mntopts) 25839333Smckusick getufsopts(mntopts, &flags); 25939316Smckusick if (options) 26039316Smckusick getufsopts(options, &flags); 26139316Smckusick args.fspec = spec; 26266138Sbostic #define DEFAULT_ROOTUID -2 26365714Shibler args.export.ex_root = DEFAULT_ROOTUID; 26441403Smckusick if (flags & MNT_RDONLY) 26565714Shibler args.export.ex_flags = MNT_EXRDONLY; 26640496Smckusick else 26765714Shibler args.export.ex_flags = 0; 26839316Smckusick argp = (caddr_t)&args; 26939316Smckusick break; 27052110Smckusick case MOUNT_MFS: 27139316Smckusick case MOUNT_NFS: 27239322Smckusick default: 27339322Smckusick argv[0] = mntname; 27439329Smckusick argc = 1; 27539322Smckusick if (flags) { 27639322Smckusick argv[argc++] = "-F"; 27766138Sbostic (void)snprintf(flagval, sizeof(flagval), "%d", flags); 27839322Smckusick argv[argc++] = flagval; 27939322Smckusick } 28039333Smckusick if (mntopts) 28139333Smckusick argc += getexecopts(mntopts, &argv[argc]); 28239329Smckusick if (options) 28339329Smckusick argc += getexecopts(options, &argv[argc]); 28439316Smckusick argv[argc++] = spec; 28539316Smckusick argv[argc++] = name; 28639521Smckusick argv[argc++] = NULL; 28766138Sbostic snprintf(execname, sizeof(execname), 28866138Sbostic "%s/mount_%s", _PATH_EXECDIR, mntname); 28939316Smckusick if (verbose) { 29042253Sbostic (void)printf("exec: %s", execname); 29142253Sbostic for (i = 1; i < argc - 1; i++) 29242253Sbostic (void)printf(" %s", argv[i]); 29342253Sbostic (void)printf("\n"); 29439316Smckusick } 29556841Smckusick if (debug) 29639316Smckusick break; 29742253Sbostic if (pid = vfork()) { 29842253Sbostic if (pid == -1) { 29966131Spendry warn("vfork starting file system"); 30039316Smckusick return (1); 30139131Smckusick } 30266130Spendry if (waitpid(pid, &status, 0) != -1 && 30339316Smckusick WIFEXITED(status) && 30439316Smckusick WEXITSTATUS(status) != 0) 30539316Smckusick return (WEXITSTATUS(status)); 30639322Smckusick spec = mntname; 30739316Smckusick goto out; 30839316Smckusick } 30966130Spendry execv(execname, argv); 31066131Spendry err(1, "cannot exec %s for %s", execname, name); 31139316Smckusick /* NOTREACHED */ 31238632Smckusick 31339316Smckusick } 31456841Smckusick if (!debug && mount(mnttype, name, flags, argp)) { 31566138Sbostic (void)fprintf(stderr, "%s on %s: ", spec, name); 31639316Smckusick switch (errno) { 31739316Smckusick case EMFILE: 31866139Sbostic (void)fprintf(stderr, "Mount table full.\n"); 31939316Smckusick break; 32039316Smckusick case EINVAL: 32141403Smckusick if (flags & MNT_UPDATE) 32266138Sbostic (void)fprintf(stderr, "Specified device %s\n", 32345689Smckusick "does not match mounted device"); 32445569Skarels else if (mnttype == MOUNT_UFS) 32566138Sbostic (void)fprintf(stderr, "Bogus super block\n"); 32639333Smckusick else 32766138Sbostic perror(NULL); 32839316Smckusick break; 32939316Smckusick default: 33066138Sbostic perror(NULL); 33139316Smckusick break; 3324460Sroot } 33366130Spendry return (1); 3344460Sroot } 33535339Sbostic 33666138Sbostic out: if (verbose) 33739316Smckusick prmount(spec, name, flags); 33866130Spendry return (0); 3391057Sbill } 34035339Sbostic 34166138Sbostic void 34239316Smckusick prmount(spec, name, flags) 34339316Smckusick char *spec, *name; 34466130Spendry int flags; 34535339Sbostic { 34666130Spendry int first; 34738632Smckusick 34842253Sbostic (void)printf("%s on %s", spec, name); 34942253Sbostic if (!(flags & MNT_VISFLAGMASK)) { 35042253Sbostic (void)printf("\n"); 35142253Sbostic return; 35242253Sbostic } 35342253Sbostic first = 0; 35442253Sbostic #define PR(msg) (void)printf("%s%s", !first++ ? " (" : ", ", msg) 35541403Smckusick if (flags & MNT_RDONLY) 35642253Sbostic PR("read-only"); 35741403Smckusick if (flags & MNT_NOEXEC) 35842253Sbostic PR("noexec"); 35941403Smckusick if (flags & MNT_NOSUID) 36042253Sbostic PR("nosuid"); 36141403Smckusick if (flags & MNT_NODEV) 36242253Sbostic PR("nodev"); 36341403Smckusick if (flags & MNT_SYNCHRONOUS) 36442253Sbostic PR("synchronous"); 36565609Smckusick if (flags & MNT_ASYNC) 36665609Smckusick PR("asynchronous"); 36741403Smckusick if (flags & MNT_QUOTA) 36842253Sbostic PR("with quotas"); 36941403Smckusick if (flags & MNT_LOCAL) 37042253Sbostic PR("local"); 37166171Spendry if (flags & MNT_USER) 37266171Spendry PR("user mount"); 37355394Spendry if (flags & MNT_UNION) 37455394Spendry PR("union"); 37541403Smckusick if (flags & MNT_EXPORTED) 37652110Smckusick PR("NFS exported"); 37742253Sbostic (void)printf(")\n"); 37835339Sbostic } 37935339Sbostic 38066138Sbostic int 38139133Smckusick getmnttype(fstype) 38239133Smckusick char *fstype; 38339133Smckusick { 38439133Smckusick 38539322Smckusick mntname = fstype; 38666138Sbostic return (strcmp(fstype, "ufs") == 0 ? MOUNT_UFS : 0); 38739133Smckusick } 38839133Smckusick 38966138Sbostic void 39039316Smckusick getstdopts(options, flagp) 39139316Smckusick char *options; 39242253Sbostic int *flagp; 39339316Smckusick { 39439316Smckusick int negative; 39566138Sbostic char *opt, optbuf[BUFSIZ]; 39639316Smckusick 39742253Sbostic (void)strcpy(optbuf, options); 39866138Sbostic for (opt = strtok(optbuf, ","); opt; opt = strtok(NULL, ",")) { 39965852Smckusick if (opt[0] == '-') 40065852Smckusick continue; 40139316Smckusick if (opt[0] == 'n' && opt[1] == 'o') { 40239316Smckusick negative++; 40339316Smckusick opt += 2; 40466138Sbostic } else 40539316Smckusick negative = 0; 40639333Smckusick if (!negative && !strcasecmp(opt, FSTAB_RO)) { 40741403Smckusick *flagp |= MNT_RDONLY; 40839333Smckusick continue; 40939333Smckusick } 41039333Smckusick if (!negative && !strcasecmp(opt, FSTAB_RW)) { 41141403Smckusick *flagp &= ~MNT_RDONLY; 41239333Smckusick continue; 41339333Smckusick } 41439316Smckusick if (!strcasecmp(opt, "exec")) { 41539316Smckusick if (negative) 41641403Smckusick *flagp |= MNT_NOEXEC; 41739333Smckusick else 41841403Smckusick *flagp &= ~MNT_NOEXEC; 41939316Smckusick continue; 42039316Smckusick } 42139316Smckusick if (!strcasecmp(opt, "suid")) { 42239316Smckusick if (negative) 42341403Smckusick *flagp |= MNT_NOSUID; 42439333Smckusick else 42541403Smckusick *flagp &= ~MNT_NOSUID; 42639316Smckusick continue; 42739316Smckusick } 42839316Smckusick if (!strcasecmp(opt, "dev")) { 42939316Smckusick if (negative) 43041403Smckusick *flagp |= MNT_NODEV; 43139333Smckusick else 43241403Smckusick *flagp &= ~MNT_NODEV; 43339316Smckusick continue; 43439316Smckusick } 43539316Smckusick if (!strcasecmp(opt, "synchronous")) { 43639316Smckusick if (!negative) 43741403Smckusick *flagp |= MNT_SYNCHRONOUS; 43839333Smckusick else 43941403Smckusick *flagp &= ~MNT_SYNCHRONOUS; 44039316Smckusick continue; 44139316Smckusick } 44265609Smckusick if (!strcasecmp(opt, "asynchronous")) { 44365609Smckusick if (!negative) 44465609Smckusick *flagp |= MNT_ASYNC; 44565609Smckusick else 44665609Smckusick *flagp &= ~MNT_ASYNC; 44765609Smckusick continue; 44865609Smckusick } 44955394Spendry if (!strcasecmp(opt, "union")) { 45055394Spendry if (!negative) 45155394Spendry *flagp |= MNT_UNION; 45255394Spendry else 45355394Spendry *flagp &= ~MNT_UNION; 45455394Spendry continue; 45555394Spendry } 45666138Sbostic (void)fprintf(stderr, "mount: %s: unknown option\n", opt); 45739316Smckusick } 45839316Smckusick } 45939316Smckusick 46042253Sbostic /* ARGSUSED */ 46166138Sbostic void 46239131Smckusick getufsopts(options, flagp) 46339131Smckusick char *options; 46442253Sbostic int *flagp; 46539131Smckusick { 46666130Spendry 46739131Smckusick return; 46839131Smckusick } 46939131Smckusick 47066138Sbostic int 47139329Smckusick getexecopts(options, argv) 47266138Sbostic char *options, **argv; 47339131Smckusick { 47466138Sbostic int argc; 47566130Spendry char *opt; 47639131Smckusick 47766138Sbostic argc = 0; 47866138Sbostic for (opt = strtok(options, ","); opt; opt = strtok(NULL, ",")) { 47939131Smckusick if (opt[0] != '-') 48039131Smckusick continue; 48139131Smckusick argv[argc++] = opt; 48239131Smckusick if (opt[2] == '\0' || opt[2] != '=') 48339131Smckusick continue; 48439131Smckusick opt[2] = '\0'; 48539131Smckusick argv[argc++] = &opt[3]; 48639131Smckusick } 48739131Smckusick return (argc); 48839131Smckusick } 48939131Smckusick 49066138Sbostic struct statfs * 49139465Smckusick getmntpt(name) 49239465Smckusick char *name; 49339465Smckusick { 49439465Smckusick struct statfs *mntbuf; 49566138Sbostic long i, mntsize; 49639465Smckusick 49740337Smckusick mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); 49839465Smckusick for (i = 0; i < mntsize; i++) { 49939465Smckusick if (!strcmp(mntbuf[i].f_mntfromname, name) || 50039465Smckusick !strcmp(mntbuf[i].f_mntonname, name)) 50139465Smckusick return (&mntbuf[i]); 50239465Smckusick } 50366138Sbostic return (NULL); 50439465Smckusick } 50539465Smckusick 50666138Sbostic int 50740051Smckusick badvfstype(vfstype, vfslist) 50866130Spendry int vfstype; 50940051Smckusick char **vfslist; 51040051Smckusick { 51140051Smckusick 51266138Sbostic if (vfslist == NULL) 51366130Spendry return (0); 51466138Sbostic while (*vfslist != NULL) { 51540844Smckusick if (vfstype == getmnttype(*vfslist)) 51666130Spendry return (skipvfs); 51740051Smckusick vfslist++; 51840051Smckusick } 51940051Smckusick return (!skipvfs); 52040051Smckusick } 52140051Smckusick 52266138Sbostic int 52340844Smckusick badvfsname(vfsname, vfslist) 52440844Smckusick char *vfsname; 52540844Smckusick char **vfslist; 52640844Smckusick { 52740844Smckusick 52866138Sbostic if (vfslist == NULL) 52966130Spendry return (0); 53066138Sbostic while (*vfslist != NULL) { 53140844Smckusick if (strcmp(vfsname, *vfslist) == 0) 53266130Spendry return (skipvfs); 53340844Smckusick vfslist++; 53440844Smckusick } 53540844Smckusick return (!skipvfs); 53640844Smckusick } 53740844Smckusick 53866138Sbostic char ** 53940051Smckusick makevfslist(fslist) 54040051Smckusick char *fslist; 54140051Smckusick { 54266138Sbostic int i; 54366130Spendry char **av, *nextcp; 54440051Smckusick 54540051Smckusick if (fslist == NULL) 54640051Smckusick return (NULL); 54740051Smckusick if (fslist[0] == 'n' && fslist[1] == 'o') { 54840051Smckusick fslist += 2; 54940051Smckusick skipvfs = 1; 55040051Smckusick } 55140051Smckusick for (i = 0, nextcp = fslist; *nextcp; nextcp++) 55240051Smckusick if (*nextcp == ',') 55340051Smckusick i++; 55466138Sbostic av = malloc((size_t)(i + 2) * sizeof(char *)); 55540051Smckusick if (av == NULL) 55640051Smckusick return (NULL); 55740051Smckusick nextcp = fslist; 55840051Smckusick i = 0; 55940051Smckusick av[i++] = nextcp; 56066138Sbostic while ((nextcp = index(nextcp, ',')) != NULL) { 56140051Smckusick *nextcp++ = '\0'; 56240051Smckusick av[i++] = nextcp; 56340051Smckusick } 56466138Sbostic av[i++] = NULL; 56540051Smckusick return (av); 56640051Smckusick } 56766138Sbostic 56866138Sbostic void 56966138Sbostic usage() 57066138Sbostic { 57166138Sbostic 57266138Sbostic (void)fprintf(stderr, 57366171Spendry "usage: %s %s\n %s\n %s\n", 57466171Spendry "mount [-dfruvw] [-t ufs | external_type]", 57566171Spendry "[-o options] special node", 57666171Spendry "mount [-adfruvw] [-t ufs | external_type]", 57766171Spendry "mount [-dfruvw] special | node"); 57866138Sbostic exit(1); 57966138Sbostic } 580