Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / util / allspace.c
blob11ac1bc91e7f49e75512030a5ee91012afaadd4f
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* allspace 3
6 /* SUMMARY
7 /* predicate if string is all space
8 /* SYNOPSIS
9 /* #include <stringops.h>
11 /* int allspace(buffer)
12 /* const char *buffer;
13 /* DESCRIPTION
14 /* allspace() determines if its argument is an all-space string.
16 /* Arguments:
17 /* .IP buffer
18 /* The null-terminated input string.
19 /* LICENSE
20 /* .ad
21 /* .fi
22 /* The Secure Mailer license must be distributed with this software.
23 /* AUTHOR(S)
24 /* Wietse Venema
25 /* IBM T.J. Watson Research
26 /* P.O. Box 704
27 /* Yorktown Heights, NY 10598, USA
28 /*--*/
30 /* System library. */
32 #include <sys_defs.h>
33 #include <ctype.h>
35 /* Utility library. */
37 #include "stringops.h"
39 /* allspace - return true if string is all space */
41 int allspace(const char *string)
43 const char *cp;
44 int ch;
46 if (*string == 0)
47 return (0);
48 for (cp = string; (ch = *(unsigned char *) cp) != 0; cp++)
49 if (!ISASCII(ch) || !ISSPACE(ch))
50 return (0);
51 return (1);