+getstdopts(options, flagp)
+ char *options;
+ long *flagp;
+{
+ register char *opt;
+ int negative;
+ char *optbuf[BUFSIZ], *strtok();
+
+ strcpy(optbuf, options);
+ for (opt = strtok(optbuf, ","); opt; opt = strtok(NULL, ",")) {
+ if (opt[0] == 'n' && opt[1] == 'o') {
+ negative++;
+ opt += 2;
+ } else {
+ negative = 0;
+ }
+ if (!negative && !strcasecmp(opt, FSTAB_RO)) {
+ *flagp |= M_RDONLY;
+ continue;
+ }
+ if (!negative && !strcasecmp(opt, FSTAB_RW)) {
+ *flagp &= ~M_RDONLY;
+ continue;
+ }
+ if (!strcasecmp(opt, "exec")) {
+ if (negative)
+ *flagp |= M_NOEXEC;
+ else
+ *flagp &= ~M_NOEXEC;
+ continue;
+ }
+ if (!strcasecmp(opt, "suid")) {
+ if (negative)
+ *flagp |= M_NOSUID;
+ else
+ *flagp &= ~M_NOSUID;
+ continue;
+ }
+ if (!strcasecmp(opt, "dev")) {
+ if (negative)
+ *flagp |= M_NODEV;
+ else
+ *flagp &= ~M_NODEV;
+ continue;
+ }
+ if (!strcasecmp(opt, "synchronous")) {
+ if (!negative)
+ *flagp |= M_SYNCHRONOUS;
+ else
+ *flagp &= ~M_SYNCHRONOUS;
+ continue;
+ }
+ }
+}
+
+getufsopts(options, flagp)
+ char *options;
+ long *flagp;
+{
+
+ return;
+}
+
+getexecopts(options, argv)
+ char *options;
+ char **argv;
+{
+ register int argc = 0;
+ register char *opt;
+ char *strtok();
+
+ for (opt = strtok(options, ","); opt; opt = strtok(NULL, ",")) {
+ if (opt[0] != '-')
+ continue;
+ argv[argc++] = opt;
+ if (opt[2] == '\0' || opt[2] != '=')
+ continue;
+ opt[2] = '\0';
+ argv[argc++] = &opt[3];
+ }
+ return (argc);
+}
+
+struct statfs *
+getmntpt(name)
+ char *name;
+{
+ long mntsize;
+ register long i;
+ struct statfs *mntbuf;
+
+ mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
+ for (i = 0; i < mntsize; i++) {
+ if (!strcmp(mntbuf[i].f_mntfromname, name) ||
+ !strcmp(mntbuf[i].f_mntonname, name))
+ return (&mntbuf[i]);
+ }
+ return ((struct statfs *)0);
+}
+
+static int skipvfs;
+
+badvfstype(vfstype, vfslist)
+ char *vfstype;
+ char **vfslist;
+{
+
+ if (vfslist == 0)
+ return(0);
+ while (*vfslist) {
+ if (strcmp(vfstype, *vfslist) == 0)
+ return(skipvfs);
+ vfslist++;
+ }
+ return (!skipvfs);
+}
+
+char **
+makevfslist(fslist)
+ char *fslist;
+{
+ register char **av, *nextcp;
+ register int i;
+ char *malloc();
+
+ if (fslist == NULL)
+ return (NULL);
+ if (fslist[0] == 'n' && fslist[1] == 'o') {
+ fslist += 2;
+ skipvfs = 1;
+ }
+ for (i = 0, nextcp = fslist; *nextcp; nextcp++)
+ if (*nextcp == ',')
+ i++;
+ av = (char **)malloc((i+2) * sizeof(char *));
+ if (av == NULL)
+ return (NULL);
+ nextcp = fslist;
+ i = 0;
+ av[i++] = nextcp;
+ while (nextcp = index(nextcp, ',')) {
+ *nextcp++ = '\0';
+ av[i++] = nextcp;
+ }
+ av[i++] = 0;
+ return (av);
+}
+