=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/whatis/Attic/whatis.c,v retrieving revision 1.4 retrieving revision 1.5 diff -c -r1.4 -r1.5 *** src/usr.bin/whatis/Attic/whatis.c 1997/11/30 05:30:37 1.4 --- src/usr.bin/whatis/Attic/whatis.c 2000/04/01 05:05:35 1.5 *************** *** 1,4 **** ! /* $OpenBSD: whatis.c,v 1.4 1997/11/30 05:30:37 deraadt Exp $ */ /* * Copyright (c) 1987, 1993 --- 1,4 ---- ! /* $OpenBSD: whatis.c,v 1.5 2000/04/01 05:05:35 millert Exp $ */ /* * Copyright (c) 1987, 1993 *************** *** 58,63 **** --- 58,64 ---- #define MAXLINELEN 8192 /* max line handled */ static int *found, foundman; + extern char *__progname; void dashtrunc __P((char *, char *)); int match __P((char *, char *)); *************** *** 103,109 **** memset(found, 0, argc * sizeof(int)); for (p = argv; *p; ++p) /* trim full paths */ ! if (beg = strrchr(*p, '/')) *p = beg + 1; if (p_augment) --- 104,110 ---- memset(found, 0, argc * sizeof(int)); for (p = argv; *p; ++p) /* trim full paths */ ! if ((beg = strrchr(*p, '/'))) *p = beg + 1; if (p_augment) *************** *** 141,147 **** char hold[MAXPATHLEN]; for (name = path; name; name = end) { /* through name list */ ! if (end = strchr(name, ':')) *end++ = '\0'; if (buildpath) { --- 142,148 ---- char hold[MAXPATHLEN]; for (name = path; name; name = end) { /* through name list */ ! if ((end = strchr(name, ':'))) *end++ = '\0'; if (buildpath) { *************** *** 175,181 **** /* * match -- ! * match a full word */ int match(bp, str) --- 176,182 ---- /* * match -- ! * match a full word or a full string */ int match(bp, str) *************** *** 187,199 **** if (!*str || !*bp) return(0); for (len = strlen(str);;) { ! for (; *bp && !isdigit(*bp) && !isalpha(*bp); ++bp); if (!*bp) break; ! for (start = bp++; ! *bp && (*bp == '_' || isdigit(*bp) || isalpha(*bp)); ++bp); ! if (bp - start == len && !strncasecmp(start, str, len)) ! return(1); } return(0); } --- 188,213 ---- if (!*str || !*bp) return(0); for (len = strlen(str);;) { ! /* skip leading crud */ ! for (; *bp && !isalnum(*bp); ++bp) ! ; if (!*bp) break; ! ! /* check for word match first */ ! for (start = bp++; *bp && (*bp == '_' || isalnum(*bp)); ++bp) ! ; ! if (bp - start == len) { ! if (strncasecmp(start, str, len) == 0) ! return(1); ! } else if (*bp && *bp != ',') { ! /* check for full string match */ ! for (bp = start; ! *bp && *bp != ',' && *bp != '(' && !isspace(*bp); ++bp) ! ; ! if (bp - start == len && strncasecmp(start, str, len) == 0) ! return(1); ! } } return(0); } *************** *** 221,227 **** void usage() { (void)fprintf(stderr, ! "usage: whatis [-C file] [-M path] [-m path] command ...\n"); exit(1); } --- 235,243 ---- void usage() { + (void)fprintf(stderr, ! "usage: %s [-C file] [-M path] [-m path] command ...\n", ! __progname); exit(1); }