head 1.5; access; symbols; locks; strict; comment @ * @; 1.5 date 92.12.15.00.20.22; author jromine; state Exp; branches; next 1.4; 1.4 date 92.05.19.20.58.04; author jromine; state Exp; branches; next 1.3; 1.3 date 90.04.05.15.32.17; author sources; state Exp; branches; next 1.2; 1.2 date 90.04.05.14.49.48; author sources; state Exp; branches; next 1.1; 1.1 date 90.02.09.09.33.31; author sources; state Exp; branches; next ; desc @@ 1.5 log @endif sugar @ text @/* smatch.c - match a switch */ #ifndef lint static char ident[] = "@@(#)$Id: smatch.c,v 1.4 1992/05/19 20:58:04 jromine Exp jromine $"; #endif /* lint */ #include "../h/mh.h" #ifndef abs #define abs(i) (i < 0 ? -i : i) #endif smatch(string, swp) register char *string; register struct swit *swp; { register char *sp, *tcp; struct swit *tp; int firstone, stringlen; firstone = UNKWNSW; if (string == 0) return firstone; for (stringlen = strlen (string), tp = swp; tcp = tp -> sw; tp++) { if (stringlen < abs (tp -> minchars)) continue; /* no match */ for (sp = string; *sp == *tcp++;) { if (*sp++ == 0) return (tp - swp);/* exact match */ } if (*sp != 0) { if (*sp != ' ') continue; /* no match */ if (*--tcp == 0) return (tp - swp);/* exact match */ } if (firstone == UNKWNSW) firstone = tp - swp; else firstone = AMBIGSW; } return (firstone); } @ 1.4 log @AIX @ text @d3 2 a4 2 static char ident[] = "@@(#)$Id: smatch.c,v 1.3 1990/04/05 15:32:17 sources Exp jromine $"; #endif lint @ 1.3 log @add ID @ text @d3 1 a3 1 static char ident[] = "@@(#)$Id:$"; d8 1 a8 1 d10 1 a10 1 @ 1.2 log @add ID @ text @d3 1 a3 1 static char ident[] = "$Id:"; @ 1.1 log @Initial revision @ text @d2 3 @