date and time created 87/05/31 14:34:17 by minshall
authorGregory Minshall <minshall@ucbvax.Berkeley.EDU>
Mon, 1 Jun 1987 05:34:17 +0000 (21:34 -0800)
committerGregory Minshall <minshall@ucbvax.Berkeley.EDU>
Mon, 1 Jun 1987 05:34:17 +0000 (21:34 -0800)
SCCS-vsn: usr.bin/tn3270/api/astosc.c 1.1

usr/src/usr.bin/tn3270/api/astosc.c [new file with mode: 0644]

diff --git a/usr/src/usr.bin/tn3270/api/astosc.c b/usr/src/usr.bin/tn3270/api/astosc.c
new file mode 100644 (file)
index 0000000..aa1d536
--- /dev/null
@@ -0,0 +1,29 @@
+#include "astosc.h"
+#include "state.h"
+
+#include "../ctlr/function.h"
+
+struct astosc astosc[256] = {
+#include "astosc.out"
+};
+
+
+/*
+ * This routine takes a string and returns an integer.  It may return
+ * STATE_NULL if there is no other integer which corresponds to the
+ * string.  STATE_NULL implies an error.
+ */
+
+int
+ascii_to_index(string)
+register char *string;
+{
+    register struct astosc *this;
+
+    for (this = astosc; this <= &astosc[highestof(astosc)]; this++) {
+       if ((this->name[0] == string[0]) && (strcmp(this->name, string) == 0)) {
+           return this-astosc;
+       }
+    }
+    return STATE_NULL;
+}