-/* some "globals" shared across this file */
-static char com_fl, del_fl, sq_fl;
-/* these last are pointers to static buffers declared in tr_main */
-static char *poutput, *pvector, *pinvec, *poutvec;
-
-static void convert(void)
-{
- int read_chars = 0, in_index = 0, out_index = 0, c, coded, last = -1;
-
- for (;;) {
- // If we're out of input, flush output and read more input.
-
- if (in_index == read_chars) {
- if (out_index) {
- if (write(1, (char *) poutput, out_index) != out_index)
- bb_error_msg_and_die(bb_msg_write_error);
- out_index = 0;
- }
-
- if ((read_chars = read(0, bb_common_bufsiz1, BUFSIZ)) <= 0) {
- if (write(1, (char *) poutput, out_index) != out_index)
- bb_error_msg(bb_msg_write_error);
- exit(0);
- }
- in_index = 0;
- }
- c = bb_common_bufsiz1[in_index++];
- coded = pvector[c];
- if (del_fl && pinvec[c])
- continue;
- if (sq_fl && last == coded && (pinvec[c] || poutvec[coded]))
- continue;
- poutput[out_index++] = last = coded;
- }
-
- /* NOTREACHED */
-}
-
-static void map(char *string1, unsigned int string1_len,
- char *string2, unsigned int string2_len)
+static void map(char *pvector,
+ unsigned char *string1, unsigned int string1_len,
+ unsigned char *string2, unsigned int string2_len)