1 #include "Local.h" /* standard header file */
3 /********************************************************************/
6 /* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */
7 /* Date: 05 Oct 1992 */
8 /* Programmer: ALLAN DARLING */
11 /* Abstract: The stspack2 package contains functions to */
12 /* perform the isalnum through isxdigit functions */
13 /* on strings. The functions come in four forms: */
14 /* those that test NULL delimited strings and are */
15 /* named in the form sxxxxxxx, those that test at */
16 /* most n characters and are named in the form */
17 /* nxxxxxxx, those that search forward in a string */
18 /* and are named in the form nxtyyyyy, and those */
19 /* that search backward in a string and are named */
20 /* in the form lstyyyyy. */
22 /* The xxxxxxx is the name of the test applied to */
23 /* each character in the string, such as isalpha, */
24 /* thus a function to test a NULL delimited string */
25 /* an return a nonzero value if all characters in */
26 /* the string are digits is named sisdigit. */
28 /* The yyyyy is the name of the test applied to */
29 /* characters in a string, minus the 'is' prefix. */
30 /* Thus a function to find the next digit in a NULL */
31 /* delimited string and return a pointer to it is */
34 /* The only exception to the naming rule is for the */
35 /* functions that test for hexadecimal digits. */
36 /* These are named sisxdigi, nisxdigi, nxtxdigi, */
37 /* and lstxdigi because of the eight character */
38 /* function name limitation. */
40 /* The nxxxxxxx class of functions will test up to */
41 /* n characters or the first NULL character */
42 /* encountered, whichever comes first. For all */
43 /* classes of functions, the string sentinal is */
44 /* not included in the test. */
46 /* External Functions Called: */
47 /* isalnum, isalpha, iscntrl, isdigit, isgraph, */
48 /* islower, isprint, ispunct, isspace, isupper, */
51 /* Input: For sxxxxxxx class functions, a pointer to a */
52 /* NULL delimited character string. */
54 /* For nxtyyyyy class functions, a pointer to a */
55 /* NULL delimited character string. */
57 /* for nxxxxxxx class functions, a pointer to a */
58 /* character array, and a positive, nonzero integer.*/
60 /* for lstyyyyy class functions, a pointer to a */
61 /* character array, and a positive, nonzero integer.*/
63 /* Output: A nonzero value if the test is true for all */
64 /* characters in the string, a zero value otherwise.*/
66 /* Modification History: */
69 /********************************************************************/
71 int nisalnum(char *s, int n) {
73 for (; *s && n; s++, n--)
83 int nisalpha(char *s, int n) {
85 for (; *s && n; s++, n--)
95 int niscntrl(char *s, int n) {
97 for (; *s && n; s++, n--)
107 int nisdigit(char *s, int n) {
109 for (; *s && n; s++, n--)
119 int nisgraph(char *s, int n) {
121 for (; *s && n; s++, n--)
131 int nislower(char *s, int n) {
133 for (; *s && n; s++, n--)
143 int nisprint(char *s, int n) {
145 for (; *s && n; s++, n--)
155 int nispunct(char *s, int n) {
157 for (; *s && n; s++, n--)
167 int nisspace(char *s, int n) {
169 for (; *s && n; s++, n--)
179 int nisupper(char *s, int n) {
181 for (; *s && n; s++, n--)
191 int nisxdigi(char *s, int n) {
193 for (; *s && n; s++, n--)