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