1/*++ 2/* NAME 3/* allascii 3 4/* SUMMARY 5/* predicate if string is all ASCII 6/* SYNOPSIS 7/* #include <stringops.h> 8/* 9/* int allascii(buffer) 10/* const char *buffer; 11/* DESCRIPTION 12/* allascii() determines if its argument is an all-ASCII string. 13/* 14/* Arguments: 15/* .IP buffer 16/* The null-terminated input string. 17/* LICENSE 18/* .ad 19/* .fi 20/* The Secure Mailer license must be distributed with this software. 21/* AUTHOR(S) 22/* Wietse Venema 23/* IBM T.J. Watson Research 24/* P.O. Box 704 25/* Yorktown Heights, NY 10598, USA 26/*--*/ 27 28/* System library. */ 29 30#include <sys_defs.h> 31#include <ctype.h> 32 33/* Utility library. */ 34 35#include "stringops.h" 36 37/* allascii - return true if string is all ASCII */ 38 39int allascii(const char *string) 40{ 41 const char *cp; 42 int ch; 43 44 if (*string == 0) 45 return (0); 46 for (cp = string; (ch = *(unsigned char *) cp) != 0; cp++) 47 if (!ISASCII(ch)) 48 return (0); 49 return (1); 50} 51