trim leading and trailing spaces */
| 27 | |
| 28 | /* trim leading and trailing spaces */ |
| 29 | static void |
| 30 | trim_space(char *str) |
| 31 | { |
| 32 | char *start, *end; |
| 33 | |
| 34 | for (start = str; *start; start++) { |
| 35 | if (!isspace((unsigned char) start[0])) |
| 36 | break; |
| 37 | } |
| 38 | |
| 39 | for (end = start + strlen(start); end > start + 1; end--) { |
| 40 | if (!isspace((unsigned char) end[-1])) |
| 41 | break; |
| 42 | } |
| 43 | |
| 44 | *end = 0; |
| 45 | |
| 46 | /* Shift from "start" to the beginning of the string */ |
| 47 | if (start > str) |
| 48 | memmove(str, start, (end - start) + 1); |
| 49 | } |
| 50 | |
| 51 | static bool |
| 52 | starts_with(const char *str, const char *pre) |
no test coverage detected