+ else if (me->beh == MB_OPT_ENUM && me->data != NULL) {
+ const char **names = (const char **)me->data;
+ for (t = 0; names[t] != NULL; t++)
+ if (*(int *)me->var == t && (!no_defaults || (*(int *)me->var ^ default_var(me)))) {
+ strncpy(line, names[t], sizeof(line));
+ goto write_line;
+ }
+ }
+ else if (me->name != NULL && me->generate_name != NULL) {
+ if (!no_defaults || !is_cust_val_default(me)) {
+ strncpy(line, me->generate_name(0, &dummy), sizeof(line));
+ goto write_line;
+ }
+ }
+ else
+ lprintf("config: unhandled write: %i\n", me->id);
+ continue;
+
+write_line:
+ line[sizeof(line) - 1] = 0;
+ mystrip(line);
+ fprintf(fn, "%s = %s" NL, me->name, line);
+ }
+
+ /* input: save device names */
+ for (t = 0; t < IN_MAX_DEVS; t++)
+ {
+ const int *binds = in_get_dev_binds(t);
+ const char *name = in_get_dev_name(t, 0, 0);
+ if (binds == NULL || name == NULL)
+ continue;
+
+ fprintf(fn, "input%d = %s" NL, t, name);
+ }
+
+ /* input: save binds */
+ for (t = 0; t < IN_MAX_DEVS; t++)
+ {
+ const int *binds = in_get_dev_binds(t);
+ const char *name = in_get_dev_name(t, 0, 0);
+ char strbind[16];
+ int count;
+
+ if (binds == NULL || name == NULL)
+ continue;
+
+ sprintf(strbind, "bind%d", t);
+ if (t == 0) strbind[4] = 0;
+
+ count = in_get_dev_info(t, IN_INFO_BIND_COUNT);
+ keys_write(fn, strbind, t, binds, no_defaults);