-static int scan_string(char *s, void (*fun)(char *c, void *data, int num),
+/*
+ * Create a string containing the mapped characters provided.
+ */
+static void fun_mkstring(const char *s, void *data, int num)
+{
+ chrwork *arg = data;
+ const char **res, *p = s;
+
+ res = chr_map_input(arg->map, &s, strlen(s));
+ if (*res == (char*) CHR_UNKNOWN)
+ logf(LOG_WARN, "Map: '%s' has no mapping", p);
+ strncat(arg->string, *res, CHR_MAXSTR - strlen(arg->string));
+ arg->string[CHR_MAXSTR] = '\0';
+}
+
+/*
+ * Add a map to the string contained in the argument.
+ */
+static void fun_addmap(const char *s, void *data, int num)
+{
+ chrwork *arg = data;
+
+ assert(arg->map->input);
+ set_map_string(arg->map->input, arg->map->nmem, s, strlen(s), arg->string);
+}
+
+static int scan_string(char *s, void (*fun)(const char *c, void *data, int num),