diff options
| author | Toby Goodwin <toby@paccrat.org> | 2015-05-15 19:36:55 +0100 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:23:24 +0100 |
| commit | 27c900d6ae9cd0dcf4bc97bc9b8c1882e40ccfa8 (patch) | |
| tree | 9ce71c54d395ebc0e84ecded69a75d2ed0ce831c /which.c | |
| parent | 3202133256713848312dddefba2250a6803bfec6 (diff) | |
snapshot from cvs: 2005-03-03
Diffstat (limited to 'which.c')
| -rw-r--r-- | which.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -70,6 +70,24 @@ static bool rc_access(char *path, bool verbose) { return FALSE; } +static char *protect(char *in) { + char *out = ealloc(strlen(in) * 2 + 1); + + int i; + int p = 0; + + for (i = 0; i < strlen(in); ++i) { + if (isprint(in[i])) { + out[p++] = in[i]; + ++p; + } else { + out[p++] = '\\'; + out[p++] = '?'; + } + } + return out; /* XXXX */ +} + /* return a full pathname by searching $path, and by checking the status of the file */ extern char *which(char *name, bool verbose) { @@ -120,6 +138,6 @@ extern char *which(char *name, bool verbose) { return test; } if (verbose) - fprint(2, "%s not found\n", name); + fprint(2, "rc: cannot find `%s'\n", protect(name)); return NULL; } |