1 /* $NetBSD: allspace.c,v 1.1.1.1 2009/06/23 10:08:58 tron Exp $ */
2
3 /*++
4 /* NAME
5 /* allspace 3
6 /* SUMMARY
7 /* predicate if string is all space
8 /* SYNOPSIS
9 /* #include <stringops.h>
10 /*
11 /* int allspace(buffer)
12 /* const char *buffer;
13 /* DESCRIPTION
14 /* allspace() determines if its argument is an all-space string.
15 /*
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 /*--*/
29
30 /* System library. */
31
32 #include <sys_defs.h>
33 #include <ctype.h>
34
35 /* Utility library. */
36
37 #include "stringops.h"
38
39 /* allspace - return true if string is all space */
40
allspace(const char * string)41 int allspace(const char *string)
42 {
43 const char *cp;
44 int ch;
45
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);
52 }
53