xref: /netbsd-src/external/ibm-public/postfix/dist/src/util/lowercase.c (revision 41fbaed053f8fbfdf9d2a4ee0a7386a3c83f8505)
1*41fbaed0Stron /*	$NetBSD: lowercase.c,v 1.1.1.1 2009/06/23 10:09:00 tron Exp $	*/
2*41fbaed0Stron 
3*41fbaed0Stron /*++
4*41fbaed0Stron /* NAME
5*41fbaed0Stron /*	lowercase 3
6*41fbaed0Stron /* SUMMARY
7*41fbaed0Stron /*	map uppercase characters to lowercase
8*41fbaed0Stron /* SYNOPSIS
9*41fbaed0Stron /*	#include <stringops.h>
10*41fbaed0Stron /*
11*41fbaed0Stron /*	char	*lowercase(buf)
12*41fbaed0Stron /*	char	*buf;
13*41fbaed0Stron /* DESCRIPTION
14*41fbaed0Stron /*	lowercase() replaces uppercase characters in its null-terminated
15*41fbaed0Stron /*	input by their lowercase equivalent.
16*41fbaed0Stron /* LICENSE
17*41fbaed0Stron /* .ad
18*41fbaed0Stron /* .fi
19*41fbaed0Stron /*	The Secure Mailer license must be distributed with this software.
20*41fbaed0Stron /* AUTHOR(S)
21*41fbaed0Stron /*	Wietse Venema
22*41fbaed0Stron /*	IBM T.J. Watson Research
23*41fbaed0Stron /*	P.O. Box 704
24*41fbaed0Stron /*	Yorktown Heights, NY 10598, USA
25*41fbaed0Stron /*--*/
26*41fbaed0Stron 
27*41fbaed0Stron /* System library. */
28*41fbaed0Stron 
29*41fbaed0Stron #include "sys_defs.h"
30*41fbaed0Stron #include <ctype.h>
31*41fbaed0Stron 
32*41fbaed0Stron /* Utility library. */
33*41fbaed0Stron 
34*41fbaed0Stron #include "stringops.h"
35*41fbaed0Stron 
lowercase(char * string)36*41fbaed0Stron char   *lowercase(char *string)
37*41fbaed0Stron {
38*41fbaed0Stron     char   *cp;
39*41fbaed0Stron     int     ch;
40*41fbaed0Stron 
41*41fbaed0Stron     for (cp = string; (ch = *cp) != 0; cp++)
42*41fbaed0Stron 	if (ISUPPER(ch))
43*41fbaed0Stron 	    *cp = TOLOWER(ch);
44*41fbaed0Stron     return (string);
45*41fbaed0Stron }
46