xref: /csrg-svn/usr.bin/tn3270/api/astosc.c (revision 31240)
1*31240Sminshall #include "astosc.h"
2*31240Sminshall #include "state.h"
3*31240Sminshall 
4*31240Sminshall #include "../ctlr/function.h"
5*31240Sminshall 
6*31240Sminshall struct astosc astosc[256] = {
7*31240Sminshall #include "astosc.out"
8*31240Sminshall };
9*31240Sminshall 
10*31240Sminshall 
11*31240Sminshall /*
12*31240Sminshall  * This routine takes a string and returns an integer.  It may return
13*31240Sminshall  * STATE_NULL if there is no other integer which corresponds to the
14*31240Sminshall  * string.  STATE_NULL implies an error.
15*31240Sminshall  */
16*31240Sminshall 
17*31240Sminshall int
18*31240Sminshall ascii_to_index(string)
19*31240Sminshall register char *string;
20*31240Sminshall {
21*31240Sminshall     register struct astosc *this;
22*31240Sminshall 
23*31240Sminshall     for (this = astosc; this <= &astosc[highestof(astosc)]; this++) {
24*31240Sminshall 	if ((this->name[0] == string[0]) && (strcmp(this->name, string) == 0)) {
25*31240Sminshall 	    return this-astosc;
26*31240Sminshall 	}
27*31240Sminshall     }
28*31240Sminshall     return STATE_NULL;
29*31240Sminshall }
30