white space
Suggested by: wrowe
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@280114
13f79535-47bb-0310-9956-
ffa450edef68
/* parse it */
for (lineno = 1; apr_file_gets(line, BUFSIZ, f) == APR_SUCCESS; lineno++) {
int ws_offset;
- char *last = line + strlen(line) - 1; /* guaranteed that len >= 1 */
+ char *last = line + strlen(line) - 1; /* guaranteed that len >= 1 since an
+ * "empty" line contains a '\n'
+ */
- /* delete newline and potential carriage return */
- if (*last == '\n') {
+ /* delete newline and any other trailing whitespace */
+ while (last >= line
+ && apr_isspace(*last)) {
*last = '\0';
--last;
}
- if (*last == '\r') {
- *last = '\0';
- }
/* skip leading whitespace */
ws_offset = 0;