+/*
+ * Handle the getoption arg.
+ * Essentially update "opflags", "retrycnt" and "nfsargs"
+ */
+getnfsopts(optarg, nfsargsp, opflagsp, retrycntp)
+ char *optarg;
+ struct nfs_args *nfsargsp;
+ int *opflagsp;
+ int *retrycntp;
+{
+ register char *cp, *nextcp;
+ int num;
+ char *nump;
+
+ cp = optarg;
+ while (cp != NULL && *cp != '\0') {
+ if ((nextcp = index(cp, ',')) != NULL)
+ *nextcp++ = '\0';
+ if ((nump = index(cp, '=')) != NULL) {
+ *nump++ = '\0';
+ num = atoi(nump);
+ } else
+ num = -1;
+ /*
+ * Just test for a string match and do it
+ */
+ if (!strcmp(cp, "bg")) {
+ *opflagsp |= BGRND;
+ } else if (!strcmp(cp, "soft")) {
+ if (nfsargsp->flags & NFSMNT_SPONGY) {
+ fprintf(stderr,
+ "Options soft, spongy mutually exclusive\n");
+ exit(1);
+ }
+ nfsargsp->flags |= NFSMNT_SOFT;
+ } else if (!strcmp(cp, "spongy")) {
+ if (nfsargsp->flags & NFSMNT_SOFT) {
+ fprintf(stderr,
+ "Options soft, spongy mutually exclusive\n");
+ exit(1);
+ }
+ nfsargsp->flags |= NFSMNT_SPONGY;
+ } else if (!strcmp(cp, "intr")) {
+ nfsargsp->flags |= NFSMNT_INT;
+ } else if (!strcmp(cp, "tcp")) {
+ nfsargsp->sotype = SOCK_STREAM;
+ } else if (!strcmp(cp, "noconn")) {
+ nfsargsp->flags |= NFSMNT_NOCONN;
+ } else if (!strcmp(cp, "retry") && num > 0) {
+ *retrycntp = num;
+ } else if (!strcmp(cp, "rsize") && num > 0) {
+ nfsargsp->rsize = num;
+ nfsargsp->flags |= NFSMNT_RSIZE;
+ } else if (!strcmp(cp, "wsize") && num > 0) {
+ nfsargsp->wsize = num;
+ nfsargsp->flags |= NFSMNT_WSIZE;
+ } else if (!strcmp(cp, "timeo") && num > 0) {
+ nfsargsp->timeo = num;
+ nfsargsp->flags |= NFSMNT_TIMEO;
+ } else if (!strcmp(cp, "retrans") && num > 0) {
+ nfsargsp->retrans = num;
+ nfsargsp->flags |= NFSMNT_RETRANS;
+ }
+ cp = nextcp;
+ }
+ if (nfsargsp->sotype == SOCK_DGRAM) {
+ if (nfsargsp->rsize > NFS_MAXDGRAMDATA)
+ nfsargsp->rsize = NFS_MAXDGRAMDATA;
+ if (nfsargsp->wsize > NFS_MAXDGRAMDATA)
+ nfsargsp->wsize = NFS_MAXDGRAMDATA;
+ }
+}
+