MCPcopy Create free account
hub / github.com/NetHack/NetHack / strip_newline

Function strip_newline

src/hacklib.c:179–190  ·  view source on GitHub ↗

remove \n from end of line; remove \r too if one is there */

Source from the content-addressed store, hash-verified

177
178/* remove \n from end of line; remove \r too if one is there */
179char *
180strip_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') */
193char *

Callers 8

onMSNHCommandFunction · 0.85
onPaintFunction · 0.85
can_append_textFunction · 0.85
more_prompt_checkFunction · 0.85
read_tributeFunction · 0.85
doextversionFunction · 0.85
checkfileFunction · 0.85
dowhatdoes_coreFunction · 0.85

Calls 1

strrchrFunction · 0.85

Tested by

no test coverage detected