* Returns the length of a line, without trailing spaces. * * If the line ends with newline, it will be removed too. */
| 1066 | * If the line ends with newline, it will be removed too. |
| 1067 | */ |
| 1068 | static size_t cleanup(char *line, size_t len) |
| 1069 | { |
| 1070 | while (len) { |
| 1071 | unsigned char c = line[len - 1]; |
| 1072 | if (!isspace(c)) |
| 1073 | break; |
| 1074 | len--; |
| 1075 | } |
| 1076 | |
| 1077 | return len; |
| 1078 | } |
| 1079 | |
| 1080 | /* |
| 1081 | * Remove empty lines from the beginning and end |