-static void ATTRIBUTE_NORETURN convert(const smalluint flags)
-{
- size_t 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) {
- xwrite(STDOUT_FILENO, (char *)poutput, out_index);
- out_index = 0;
- }
- if ((read_chars = read(STDIN_FILENO, bb_common_bufsiz1, BUFSIZ)) <= 0) {
- if (write(STDOUT_FILENO, (char *)poutput, out_index) != out_index)
- bb_perror_msg(bb_msg_write_error);
- exit(EXIT_SUCCESS);
- }
- in_index = 0;
- }
- c = bb_common_bufsiz1[in_index++];
- coded = pvector[c];
- if ((flags & TR_OPT_delete) && pinvec[c])
- continue;
- if ((flags & TR_OPT_squeeze_reps) && last == coded &&
- (pinvec[c] || poutvec[coded]))
- continue;
- poutput[out_index++] = last = coded;
- }
- /* NOTREACHED */
-}
-
-static void map(unsigned char *string1, unsigned int string1_len,
+static void map(char *pvector,
+ unsigned char *string1, unsigned int string1_len,