|
18 | 18 |
|
19 | 19 | static int help(const char *prgm) |
20 | 20 | { |
21 | | - fprintf(stdout, "usage: %s <OPTION>\n", prgm); |
| 21 | + fprintf(stdout, "usage: %s <option>\n", prgm); |
22 | 22 | fprintf(stdout, "\n"); |
23 | 23 | fprintf(stdout, "Get various configuration information needed to compile programs\n"); |
24 | | - fprintf(stdout, "using the CE C Toolchain.\n"); |
| 24 | + fprintf(stdout, "using the CE C/C++ Toolchain.\n"); |
25 | 25 | fprintf(stdout, "\n"); |
26 | 26 | fprintf(stdout, "Options:\n"); |
27 | | - fprintf(stdout, " --version Print CE C Toolchain version.\n"); |
| 27 | + fprintf(stdout, " --version Print CE C/C++ Toolchain version.\n"); |
28 | 28 | fprintf(stdout, " --prefix Print the installation prefix.\n"); |
29 | 29 | fprintf(stdout, " --makefile Core toolchain makefile path.\n"); |
30 | 30 | fprintf(stdout, " --help Show this page.\n"); |
@@ -52,21 +52,20 @@ static const char *executable_path(void) |
52 | 52 | return path; |
53 | 53 | } |
54 | 54 |
|
55 | | -static bool str_has_whitespace(const char *str, size_t max) |
| 55 | +static bool is_valid_path(const char *str, size_t max) |
56 | 56 | { |
57 | 57 | size_t i = 0; |
58 | 58 |
|
59 | | - for (i = 0; i < max; ++i) |
| 59 | + for (; i < max; ++i) |
60 | 60 | { |
61 | 61 | char c = str[i]; |
62 | | - switch (c) |
| 62 | + if (!c) |
63 | 63 | { |
64 | | - case '\0': |
65 | | - return false; |
66 | | - case '\t': case '\r': case '\n': case '\v': case '\f': case ' ': |
67 | | - return true; |
68 | | - default: |
69 | | - break; |
| 64 | + return true; |
| 65 | + } |
| 66 | + if (isspace(c)) |
| 67 | + { |
| 68 | + return false; |
70 | 69 | } |
71 | 70 | } |
72 | 71 |
|
@@ -120,7 +119,7 @@ int main(int argc, char *argv[]) |
120 | 119 |
|
121 | 120 | case 'm': |
122 | 121 | cwk_path_get_absolute(cedev, "./meta/makefile.mk", buffer, sizeof buffer); |
123 | | - if (str_has_whitespace(buffer, sizeof buffer)) |
| 122 | + if (is_valid_path(buffer, sizeof buffer)) |
124 | 123 | { |
125 | 124 | fprintf(stderr, "The CE C Toolchain is installed in a directory containing\n"); |
126 | 125 | fprintf(stderr, "spaces. This does not work properly with the \'make\' command.\n"); |
|
0 commit comments