+
+
+unsigned char ctab[256]; /* character translation table */
+
+/* init_buf: open scratch buffer; initialize line queue */
+void
+init_buf()
+{
+ int i = 0;
+
+ if (sbopen() < 0)
+ quit(2);
+ requeue(&line0, &line0);
+ for (i = 0; i < 256; i++)
+ ctab[i] = i;
+}
+
+
+/* translit: translate characters in a string */
+char *
+translit(s, len, from, to)
+ char *s;
+ int len;
+ int from;
+ int to;
+{
+ static int i = 0;
+
+ unsigned char *us;
+
+ ctab[i] = i; /* restore table to initial state */
+ ctab[i = from] = to;
+ for (us = (unsigned char *) s; len-- > 0; us++)
+ *us = ctab[*us];
+ return s;
+}