comparison toys/which.c @ 535:d51be130fda2

More stabs at getting #includes right, and moving off of deprecated functions.
author Rob Landley <rob@landley.net>
date Thu, 08 Mar 2012 20:14:55 -0600
parents 5a0faa267866
children 1e8b9acdafeb
comparison
equal deleted inserted replaced
534:a864aa8c6331 535:d51be130fda2
28 { 28 {
29 struct string_list *list; 29 struct string_list *list;
30 30
31 // If they gave us a path, don't worry about $PATH or -a 31 // If they gave us a path, don't worry about $PATH or -a
32 32
33 if (index(filename, '/')) { 33 if (strchr(filename, '/')) {
34 // Confirm it has the executable bit set, and it's not a directory. 34 // Confirm it has the executable bit set, and it's not a directory.
35 if (!access(filename, X_OK)) { 35 if (!access(filename, X_OK)) {
36 struct stat st; 36 struct stat st;
37 37
38 if (!stat(filename, &st) && S_ISREG(st.st_mode)) { 38 if (!stat(filename, &st) && S_ISREG(st.st_mode)) {