Rev 3366 | Rev 3460 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3366 | Rev 3372 | ||
|---|---|---|---|
| Line 46... | Line 46... | ||
| 46 | #include "errors.h" |
46 | #include "errors.h" |
| 47 | 47 | ||
| 48 | /* FIXME: Just have find_command() return an allocated string */ |
48 | /* FIXME: Just have find_command() return an allocated string */ |
| 49 | char *found; |
49 | char *found; |
| 50 | 50 | ||
| - | 51 | static char *find_command(char *); |
|
| - | 52 | static unsigned int try_access(const char *); |
|
| - | 53 | ||
| 51 | /* work-around for access() */ |
54 | /* work-around for access() */ |
| 52 | unsigned int try_access(const char *f) |
55 | static unsigned int try_access(const char *f) |
| 53 | { |
56 | { |
| 54 | int fd; |
57 | int fd; |
| 55 | 58 | ||
| 56 | fd = open(f, O_RDONLY); |
59 | fd = open(f, O_RDONLY); |
| 57 | if (fd > -1) { |
60 | if (fd > -1) { |
| Line 61... | Line 64... | ||
| 61 | return -1; |
64 | return -1; |
| 62 | } |
65 | } |
| 63 | 66 | ||
| 64 | /* Returns the full path of "cmd" if cmd is found, else just hand back |
67 | /* Returns the full path of "cmd" if cmd is found, else just hand back |
| 65 | * cmd as it was presented */ |
68 | * cmd as it was presented */ |
| 66 | char *find_command(char *cmd) |
69 | static char *find_command(char *cmd) |
| 67 | { |
70 | { |
| 68 | char *path_tok; |
71 | char *path_tok; |
| 69 | char *path[PATH_MAX]; |
72 | char *path[PATH_MAX]; |
| 70 | int n = 0, i = 0; |
73 | int n = 0, i = 0; |
| 71 | size_t x = strlen(cmd) + 2; |
74 | size_t x = strlen(cmd) + 2; |