diff options
Diffstat (limited to 'src/net_structrw.c')
-rw-r--r-- | src/net_structrw.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/net_structrw.c b/src/net_structrw.c index 7380e334..7ed61c24 100644 --- a/src/net_structrw.c +++ b/src/net_structrw.c @@ -24,6 +24,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <ctype.h> #include "doomtype.h" @@ -406,3 +407,23 @@ void NET_WriteMD5Sum(net_packet_t *packet, md5_digest_t digest) } } +// "Safe" version of puts, for displaying messages received from the +// network. + +void NET_SafePuts(char *s) +{ + char *p; + + // Do not do a straight "puts" of the string, as this could be + // dangerous (sending control codes to terminals can do all + // kinds of things) + + for (p=s; *p; ++p) + { + if (isprint(*p)) + putchar(*p); + } + + putchar('\n'); +} + |