No empty .Rs/.Re
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / util / neuter.c
blob986ef22a32acc4dae06fefa08d11a07b33ab222d
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* neuter 3
6 /* SUMMARY
7 /* neutralize characters before they can explode
8 /* SYNOPSIS
9 /* #include <stringops.h>
11 /* char *neuter(buffer, bad, replacement)
12 /* char *buffer;
13 /* const char *bad;
14 /* int replacement;
15 /* DESCRIPTION
16 /* neuter() replaces bad characters in its input
17 /* by the given replacement.
19 /* Arguments:
20 /* .IP buffer
21 /* The null-terminated input string.
22 /* .IP bad
23 /* The null-terminated bad character string.
24 /* .IP replacement
25 /* Replacement value for characters in \fIbuffer\fR that do not
26 /* pass the bad character test.
27 /* LICENSE
28 /* .ad
29 /* .fi
30 /* The Secure Mailer license must be distributed with this software.
31 /* AUTHOR(S)
32 /* Wietse Venema
33 /* IBM T.J. Watson Research
34 /* P.O. Box 704
35 /* Yorktown Heights, NY 10598, USA
36 /*--*/
38 /* System library. */
40 #include <sys_defs.h>
41 #include <string.h>
43 /* Utility library. */
45 #include <stringops.h>
47 /* neuter - neutralize bad characters */
49 char *neuter(char *string, const char *bad, int replacement)
51 char *cp;
52 int ch;
54 for (cp = string; (ch = *(unsigned char *) cp) != 0; cp++)
55 if (strchr(bad, ch) != 0)
56 *cp = replacement;
57 return (string);