]> diplodocus.org Git - nmh/blobdiff - sbr/smatch.c
Escape literal leading full stop in man/new.man.
[nmh] / sbr / smatch.c
index 88a098b3a0e629678b3c386eb1f51e728aacf33f..8ec6e3f2b3aae99b6a565d6f46a0ecf8cda162dc 100644 (file)
 
 
 int
-smatch(char *string, struct swit *swp)
+smatch(const char *string, const struct swit *swp)
 {
-    char *sp, *tcp;
+    const char *sp, *tcp;
     int firstone, len;
-    struct swit *tp;
+    const struct swit *tp;
 
     firstone = UNKWNSW;
 
@@ -29,16 +29,16 @@ smatch(char *string, struct swit *swp)
            continue;                   /* no match */
        for (sp = string; *sp == *tcp++;) {
            if (*sp++ == '\0')
-               return (tp - swp);      /* exact match */
+               return tp->swret;       /* exact match */
        }
        if (*sp) {
            if (*sp != ' ')
                continue;               /* no match */
            if (*--tcp == '\0')
-               return (tp - swp);      /* exact match */
+               return tp->swret;       /* exact match */
        }
        if (firstone == UNKWNSW)
-           firstone = tp - swp;
+           firstone = tp->swret;
        else
            firstone = AMBIGSW;
     }