while loading bones, strip out text possibly supplied by old player that might accidentally or maliciously disrupt new player's display */
| 195 | /* while loading bones, strip out text possibly supplied by old player |
| 196 | that might accidentally or maliciously disrupt new player's display */ |
| 197 | void |
| 198 | sanitize_name(char *namebuf) |
| 199 | { |
| 200 | int c; |
| 201 | boolean strip_8th_bit = (WINDOWPORT(tty) |
| 202 | && !iflags.wc_eight_bit_input); |
| 203 | |
| 204 | /* it's tempting to skip this for single-user platforms, since |
| 205 | only the current player could have left these bones--except |
| 206 | things like "hearse" and other bones exchange schemes make |
| 207 | that assumption false */ |
| 208 | while (*namebuf) { |
| 209 | c = *namebuf & 0177; |
| 210 | if (c < ' ' || c == '\177') { |
| 211 | /* non-printable or undesirable */ |
| 212 | *namebuf = '.'; |
| 213 | } else if (c != *namebuf) { |
| 214 | /* expected to be printable if user wants such things */ |
| 215 | if (strip_8th_bit) |
| 216 | *namebuf = '_'; |
| 217 | } |
| 218 | ++namebuf; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | /* Give object to a random object-liking monster on or adjacent to x,y |
| 223 | but skipping hero's location. |
no outgoing calls
no test coverage detected