|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 827 (0x33b) Types: TextFile Names: »smatch.c«
└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit └─⟦3658e588a⟧ »EurOpenD3/mail/mh/mh-6.7.tar.Z« └─⟦c75e36ecb⟧ └─⟦this⟧ »mh-6.7/sbr/smatch.c«
/* smatch.c - match a switch */ #include "../h/mh.h" #define abs(i) (i < 0 ? -i : i) 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); }