blob: 85c24897c4ea1c18ded1dc9bca2dd0751256df19 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/*++
/* NAME
/* printable 3
/* SUMMARY
/* mask non-printable characters
/* SYNOPSIS
/* #include <stringops.h>
/*
/* char *printable(buffer, replacement)
/* char *buffer;
/* int replacement;
/* DESCRIPTION
/* printable() replaces non-printable characters in its input
/* by the given replacement.
/*
/* Arguments:
/* .IP buffer
/* The null-terminated input string.
/* .IP replacement
/* Replacement value for characters in \fIbuffer\fR that do not
/* pass the isprint(3) test.
/* LICENSE
/* .ad
/* .fi
/* The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/* Wietse Venema
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
/*--*/
/* System library. */
#include "sys_defs.h"
#include <ctype.h>
/* Utility library. */
#include "stringops.h"
char *printable(char *string, int replacement)
{
char *cp;
int ch;
for (cp = string; (ch = *(unsigned char *) cp) != 0; cp++)
if (!ISPRINT(ch))
*cp = replacement;
return (string);
}
|