=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/which/which.c,v retrieving revision 1.11 retrieving revision 1.12 diff -c -r1.11 -r1.12 *** src/usr.bin/which/which.c 2003/06/17 21:56:26 1.11 --- src/usr.bin/which/which.c 2004/09/23 17:44:47 1.12 *************** *** 1,4 **** ! /* $OpenBSD: which.c,v 1.11 2003/06/17 21:56:26 millert Exp $ */ /* * Copyright (c) 1997 Todd C. Miller --- 1,4 ---- ! /* $OpenBSD: which.c,v 1.12 2004/09/23 17:44:47 millert Exp $ */ /* * Copyright (c) 1997 Todd C. Miller *************** *** 17,23 **** */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: which.c,v 1.11 2003/06/17 21:56:26 millert Exp $"; #endif /* not lint */ #include --- 17,23 ---- */ #ifndef lint ! static const char rcsid[] = "$OpenBSD: which.c,v 1.12 2004/09/23 17:44:47 millert Exp $"; #endif /* not lint */ #include *************** *** 38,44 **** extern char *__progname; int findprog(char *, char *, int, int); ! void usage(void); /* * which(1) -- find an executable(s) in the user's path --- 38,44 ---- extern char *__progname; int findprog(char *, char *, int, int); ! __dead void usage(void); /* * which(1) -- find an executable(s) in the user's path *************** *** 121,130 **** if ((stat(prog, &sbuf) == 0) && S_ISREG(sbuf.st_mode) && access(prog, X_OK) == 0) { (void)puts(prog); ! return(1); } else { (void)printf("%s: Command not found.\n", prog); ! return(0); } } --- 121,130 ---- if ((stat(prog, &sbuf) == 0) && S_ISREG(sbuf.st_mode) && access(prog, X_OK) == 0) { (void)puts(prog); ! return (1); } else { (void)printf("%s: Command not found.\n", prog); ! return (0); } } *************** *** 142,148 **** if (plen + 1 + proglen >= sizeof(filename)) { warnx("%s/%s: %s", p, prog, strerror(ENAMETOOLONG)); ! return(0); } snprintf(filename, sizeof(filename), "%s/%s", p, prog); --- 142,149 ---- if (plen + 1 + proglen >= sizeof(filename)) { warnx("%s/%s: %s", p, prog, strerror(ENAMETOOLONG)); ! free(path); ! return (0); } snprintf(filename, sizeof(filename), "%s/%s", p, prog); *************** *** 150,157 **** access(filename, X_OK) == 0) { (void)puts(filename); rval = 1; ! if (!allmatches) ! return(rval); } } (void)free(path); --- 151,160 ---- access(filename, X_OK) == 0) { (void)puts(filename); rval = 1; ! if (!allmatches) { ! free(path); ! return (rval); ! } } } (void)free(path); *************** *** 159,168 **** /* whereis(1) is silent on failure. */ if (!rval && progmode != PROG_WHEREIS) (void)printf("%s: Command not found.\n", prog); ! return(rval); } ! void usage(void) { (void) fprintf(stderr, "Usage: %s [-a] name [...]\n", __progname); --- 162,171 ---- /* whereis(1) is silent on failure. */ if (!rval && progmode != PROG_WHEREIS) (void)printf("%s: Command not found.\n", prog); ! return (rval); } ! __dead void usage(void) { (void) fprintf(stderr, "Usage: %s [-a] name [...]\n", __progname);