remove \n from end of line; remove \r too if one is there */
| 177 | |
| 178 | /* remove \n from end of line; remove \r too if one is there */ |
| 179 | char * |
| 180 | strip_newline(char *str) |
| 181 | { |
| 182 | char *p = strrchr(str, '\n'); |
| 183 | |
| 184 | if (p) { |
| 185 | if (p > str && *(p - 1) == '\r') |
| 186 | --p; |
| 187 | *p = '\0'; |
| 188 | } |
| 189 | return str; |
| 190 | } |
| 191 | |
| 192 | /* return the end of a string (pointing at '\0') */ |
| 193 | char * |
no test coverage detected