diff options
| author | Toby Goodwin <LibreSoftwareDesign@gmail.com> | 2012-10-01 21:51:47 +0100 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:23:24 +0100 |
| commit | 826eea2e08a9ec4254ccbd4d12fcd7828f8c413d (patch) | |
| tree | ab8dcc897b6dd8d3d59c7d054966c68f684ed79d /which.c | |
| parent | c8a77b86b4f8c91314222a8e12e6e37cf182ee10 (diff) | |
various minor fixups
Diffstat (limited to 'which.c')
| -rw-r--r-- | which.c | 31 |
1 files changed, 17 insertions, 14 deletions
@@ -70,22 +70,25 @@ static bool rc_access(char *path, bool verbose) { return FALSE; } +/* 2012-10-01 I don't know where this routine came from. Obviously I can + * see what it's doing, and were it implemented properly it might be a + * good thing. */ static char *protect(char *in) { - char *out = ealloc(strlen(in) * 2 + 1); - - int i; - int p = 0; + char *out = ealloc(strlen(in) * 2 + 1); - for (i = 0; i < strlen(in); ++i) { - if (isprint(in[i])) { - out[p++] = in[i]; - ++p; - } else { - out[p++] = '\\'; - out[p++] = '?'; - } - } - return out; /* XXXX */ + int i; + int p = 0; + + for (i = 0; i < strlen(in); ++i) { + if (isprint(in[i])) { + out[p++] = in[i]; + } else { + out[p++] = '\\'; + out[p++] = '?'; + } + } + out[p] = '\0'; + return out; /* XXXX */ } /* return a full pathname by searching $path, and by checking the status of the file */ |