~ubuntu-branches/ubuntu/vivid/postfix/vivid-proposed

« back to all changes in this revision

Viewing changes to src/util/printable.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2005-02-27 09:33:07 UTC
  • Revision ID: james.westby@ubuntu.com-20050227093307-cn789t27ibnlh6tf
Tags: upstream-2.1.5
ImportĀ upstreamĀ versionĀ 2.1.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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-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
 
 
42
char   *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 (!ISPRINT(ch))
 
49
            *cp = replacement;
 
50
    return (string);
 
51
}