]> diplodocus.org Git - nmh/blobdiff - sbr/smatch.c
Support iCalendar event request files that don't end with a newline.
[nmh] / sbr / smatch.c
index 1a104ada2228cc2c631432df1d77857483db41af..f30e589905ee4c772dfb4bcf68d12ff1c713c058 100644 (file)
@@ -1,8 +1,4 @@
-
-/*
- * smatch.c -- match a switch (option)
- *
- * $Id$
+/* smatch.c -- match a switch (option)
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
 
 
 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;
 
@@ -31,16 +27,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;
     }