No empty .Rs/.Re
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / util / printable.c
blob5693ff53ff11eb8eb0b90c6f85b7a7f0d543dda6
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* printable 3
6 /* SUMMARY
7 /* mask non-printable characters
8 /* SYNOPSIS
9 /* #include <stringops.h>
11 /* char *printable(buffer, replacement)
12 /* char *buffer;
13 /* int replacement;
14 /* DESCRIPTION
15 /* printable() replaces non-ASCII or non-printable characters in its input
16 /* by the given replacement.
18 /* Arguments:
19 /* .IP buffer
20 /* The null-terminated input string.
21 /* .IP replacement
22 /* Replacement value for characters in \fIbuffer\fR that do not
23 /* pass the isprint(3) test.
24 /* LICENSE
25 /* .ad
26 /* .fi
27 /* The Secure Mailer license must be distributed with this software.
28 /* AUTHOR(S)
29 /* Wietse Venema
30 /* IBM T.J. Watson Research
31 /* P.O. Box 704
32 /* Yorktown Heights, NY 10598, USA
33 /*--*/
35 /* System library. */
37 #include "sys_defs.h"
38 #include <ctype.h>
40 /* Utility library. */
42 #include "stringops.h"
44 char *printable(char *string, int replacement)
46 char *cp;
47 int ch;
49 for (cp = string; (ch = *(unsigned char *) cp) != 0; cp++)
50 if (!ISASCII(ch) || !ISPRINT(ch))
51 *cp = replacement;
52 return (string);