=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/apropos/Attic/apropos.c,v retrieving revision 1.8 retrieving revision 1.13 diff -u -r1.8 -r1.13 --- src/usr.bin/apropos/Attic/apropos.c 2002/02/16 21:27:43 1.8 +++ src/usr.bin/apropos/Attic/apropos.c 2007/08/06 19:16:06 1.13 @@ -1,4 +1,4 @@ -/* $OpenBSD: apropos.c,v 1.8 2002/02/16 21:27:43 millert Exp $ */ +/* $OpenBSD: apropos.c,v 1.13 2007/08/06 19:16:06 sobrado Exp $ */ /* $NetBSD: apropos.c,v 1.5 1995/09/04 20:46:20 tls Exp $ */ /* @@ -13,11 +13,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -44,7 +40,7 @@ #if 0 static char sccsid[] = "@(#)apropos.c 8.8 (Berkeley) 5/4/95"; #else -static char rcsid[] = "$OpenBSD: apropos.c,v 1.8 2002/02/16 21:27:43 millert Exp $"; +static char rcsid[] = "$OpenBSD: apropos.c,v 1.13 2007/08/06 19:16:06 sobrado Exp $"; #endif #endif /* not lint */ @@ -72,9 +68,7 @@ void usage(void); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { ENTRY *ep; TAG *tp; @@ -105,9 +99,8 @@ if (argc < 1) usage(); - if ((found = malloc((u_int)argc * sizeof(int))) == NULL) + if ((found = calloc(argc, sizeof(int))) == NULL) err(1, NULL); - memset(found, 0, argc * sizeof(int)); for (p = argv; *p; ++p) /* convert to lower-case */ lowstr(*p, *p); @@ -119,8 +112,8 @@ else { config(conffile); ep = (tp = getlist("_whatdb")) == NULL ? - NULL : tp->list.tqh_first; - for (; ep != NULL; ep = ep->q.tqe_next) + NULL : TAILQ_FIRST(&tp->list); + for (; ep != NULL; ep = TAILQ_NEXT(ep, q)) apropos(argv, ep->s, 0); } @@ -137,9 +130,7 @@ } void -apropos(argv, path, buildpath) - char **argv, *path; - int buildpath; +apropos(char **argv, char *path, int buildpath) { char *end, *name, **p; char buf[MAXLINELEN + 1], wbuf[MAXLINELEN + 1]; @@ -187,8 +178,7 @@ * match anywhere the string appears */ int -match(bp, str) - char *bp, *str; +match(char *bp, char *str) { int len; char test; @@ -209,8 +199,7 @@ * convert a string to lower case */ void -lowstr(from, to) - char *from, *to; +lowstr(char *from, char *to) { char ch; @@ -224,10 +213,10 @@ * print usage message and die */ void -usage() +usage(void) { (void)fprintf(stderr, - "usage: apropos [-C file] [-M path] [-m path] keyword [...]\n"); + "usage: apropos [-C file] [-M path] [-m path] keyword ...\n"); exit(1); }