Annotation of uae/src/cfgfile.c, revision 1.1.1.5

1.1       root        1:  /*
                      2:   * UAE - The Un*x Amiga Emulator
                      3:   *
                      4:   * Config file handling
                      5:   * This still needs some thought before it's complete...
                      6:   *
                      7:   * Copyright 1998 Brian King, Bernd Schmidt
                      8:   */
                      9: 
                     10: #include "sysconfig.h"
                     11: #include "sysdeps.h"
                     12: 
                     13: #include <ctype.h>
                     14: 
                     15: #include "config.h"
                     16: #include "options.h"
                     17: #include "threaddep/penguin.h"
                     18: #include "uae.h"
                     19: #include "autoconf.h"
1.1.1.3   root       20: #include "custom.h"
1.1       root       21: 
                     22: /* @@@ need to get rid of this... just cut part of the manual and print that
                     23:  * as a help text.  */
                     24: struct cfg_lines
                     25: {
                     26:     const char *config_label, *config_help;
                     27: };
                     28: 
                     29: static struct cfg_lines opttable[] =
                     30: {
                     31:     {"help", "Prints this help" },
                     32:     {"config_description", "" },
                     33:     {"use_gui", "Enable the GUI?  If no, then goes straight to emulator" },
                     34:     {"use_debugger", "Enable the debugger?" },
                     35:     {"cpu_speed", "can be max, real, or a number between 1 and 20" },
                     36:     {"cpu_type", "Can be 68000, 68010, 68020, 68020/68881" },
                     37:     {"cpu_compatible", "yes enables compatibility-mode" },
                     38:     {"cpu_24bit_addressing", "must be set to 'no' in order for Z3mem or P96mem to work" },
                     39:     {"autoconfig", "yes = add filesystems and extra ram" },
                     40:     {"accuracy", "emulation accuracy, default is 2" },
                     41:     {"log_illegal_mem", "print illegal memory access by Amiga software?" },
                     42:     {"fastmem_size", "Size in megabytes of fast-memory" },
                     43:     {"chipmem_size", "Size in megabytes of chip-memory" },
                     44:     {"bogomem_size", "Size in megabytes of bogo-memory at 0xC00000" },
                     45:     {"a3000mem_size", "Size in megabytes of A3000 memory" },
                     46:     {"gfxcard_size", "Size in megabytes of Picasso96 graphics-card memory" },
                     47:     {"z3mem_size", "Size in megabytes of Zorro-III expansion memory" },
                     48:     {"gfx_test_speed", "Test graphics speed?" },
                     49:     {"framerate", "Print every nth frame" },
                     50:     {"gfx_width", "Screen width" },
                     51:     {"gfx_height", "Screen height" },
                     52:     {"gfx_lores", "Treat display as lo-res?" },
                     53:     {"gfx_linemode", "Can be none, double, or scanlines" },
                     54:     {"gfx_fullscreen_amiga", "Amiga screens are fullscreen?" },
                     55:     {"gfx_fullscreen_picasso", "Picasso screens are fullscreen?" },
                     56:     {"gfx_correct_aspect", "Correct aspect ratio?" },
                     57:     {"gfx_center_horizontal", "Center display horizontally?" },
                     58:     {"gfx_center_vertical", "Center display vertically?" },
                     59:     {"gfx_colour_mode", "" },
                     60:     {"32bit_blits", "Enable 32 bit blitter emulation" },
                     61:     {"immediate_blits", "Perform blits immediately" },
                     62:     {"gfxlib_replacement", "Use graphics.library replacement?" },
                     63:     {"sound_output", "" },
                     64:     {"sound_frequency", "" },
                     65:     {"sound_bits", "" },
                     66:     {"sound_channels", "" },
                     67:     {"sound_min_buff", "" },
                     68:     {"sound_max_buff", "" },
                     69:     {"parallel_on_demand", "" },
                     70:     {"serial_on_demand", "" },
                     71:     {"joyport0", "" },
                     72:     {"joyport1", "" },
                     73:     {"kickstart_rom_file", "Kickstart ROM image, (C) Copyright Amiga, Inc." },
                     74:     {"kickstart_key_file", "Key-file for encrypted ROM images (from Cloanto's Amiga Forever)" },
                     75:     {"floppy0", "Diskfile for drive 0" },
                     76:     {"floppy1", "Diskfile for drive 1" },
                     77:     {"floppy2", "Diskfile for drive 2" },
                     78:     {"floppy3", "Diskfile for drive 3" },
                     79:     {"hardfile", "access,sectors, surfaces, reserved, blocksize, path format" },
                     80:     {"filesystem", "access,'Amiga volume-name':'host directory path' - where 'access' can be 'read-only' or 'read-write'" }
                     81: };
                     82: 
1.1.1.3   root       83: static const char *csmode[] = { "ocs", "ecs_agnus", "ecs_denise", "ecs", "aga" };
1.1       root       84: static const char *linemode1[] = { "none", "double", "scanlines", 0 };
                     85: static const char *linemode2[] = { "n", "d", "s", 0 };
                     86: static const char *speedmode[] = { "max", "real", 0 };
                     87: static const char *cpumode[] = { "68000", "68000", "68010", "68010",
                     88:                                 "68ec020", "68020", "68ec020/68881", "68020/68881", 0 };
                     89: static const char *portmode[] = { "joy0", "joy1", "mouse", "kbd1", "kbd2", "kbd3", 0 };
                     90: static const char *colormode1[] = { "8bit", "15bit", "16bit", "8bit_dither", "4bit_dither", "32bit", 0 };
                     91: static const char *colormode2[] = { "8", "15", "16", "8d", "4d", "32", 0 };
                     92: static const char *soundmode[] = { "none", "interrupts", "normal", "exact", 0 };
1.1.1.2   root       93: static const char *centermode1[] = { "none", "simple", "smart", 0 };
                     94: static const char *centermode2[] = { "false", "true", "smart", 0 };
1.1       root       95: static const char *stereomode1[] = { "mono", "stereo", 0 };
                     96: static const char *stereomode2[] = { "m", "s", 0 };
                     97: static const char *stereomode3[] = { "1", "2", 0 };
1.1.1.4   root       98: static const char *interpolmode[] = { "none", "rh", "crux", 0 };
1.1       root       99: 
                    100: #define UNEXPANDED "$(FILE_PATH)"
                    101: 
                    102: static int match_string (const char *table[], const char *str)
                    103: {
                    104:     int i;
                    105:     for (i = 0; table[i] != 0; i++)
                    106:        if (strcasecmp (table[i], str) == 0)
                    107:            return i;
                    108:     return -1;
                    109: }
                    110: 
                    111: char *cfgfile_subst_path (const char *path, const char *subst, const char *file)
                    112: {
                    113:     /* @@@ use strcasecmp for some targets.  */
                    114:     if (strlen (path) > 0 && strncmp (file, path, strlen (path)) == 0) {
                    115:        int l;
                    116:        char *p = xmalloc (strlen (file) + strlen (subst) + 2);
                    117:        strcpy (p, subst);
                    118:        l = strlen (p);
                    119:        while (l > 0 && p[l - 1] == '/')
                    120:            p[--l] = '\0';
                    121:        l = strlen (path);
                    122:        while (file[l] == '/')
                    123:            l++;
                    124:        strcat (p, "/"); strcat (p, file + l);
                    125:        return p;
                    126:     }
                    127:     return my_strdup (file);
                    128: }
                    129: 
                    130: void save_options (FILE *f, struct uae_prefs *p)
                    131: {
                    132:     struct strlist *sl;
                    133:     char *str;
                    134:     int i;
                    135: 
                    136:     fprintf (f, "config_description=%s\n", p->description);
                    137: 
                    138:     for (sl = p->unknown_lines; sl; sl = sl->next)
                    139:        fprintf (f, "%s\n", sl->str);
                    140: 
                    141:     fprintf (f, "%s.rom_path=%s\n", TARGET_NAME, p->path_rom);
                    142:     fprintf (f, "%s.floppy_path=%s\n", TARGET_NAME, p->path_floppy);
                    143:     fprintf (f, "%s.hardfile_path=%s\n", TARGET_NAME, p->path_hardfile);
                    144: 
1.1.1.2   root      145:     target_save_options (f, p);
                    146: 
1.1       root      147:     fprintf (f, "use_gui=%s\n", p->start_gui ? "true" : "false");
                    148:     fprintf (f, "use_debugger=%s\n", p->start_debugger ? "true" : "false");
                    149:     str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->romfile);
                    150:     fprintf (f, "kickstart_rom_file=%s\n", str);
                    151:     free (str);
                    152:     str = cfgfile_subst_path (p->path_rom, UNEXPANDED, p->keyfile);
                    153:     fprintf (f, "kickstart_key_file=%s\n", str);
                    154:     free (str);
                    155: 
                    156:     for (i = 0; i < 4; i++) {
                    157:        str = cfgfile_subst_path (p->path_floppy, UNEXPANDED, p->df[i]);
                    158:        fprintf (f, "floppy%d=%s\n", i, str);
                    159:        free (str);
                    160:     }
                    161:     fprintf (f, "parallel_on_demand=%s\n", p->parallel_demand ? "true" : "false");
                    162:     fprintf (f, "serial_on_demand=%s\n", p->serial_demand ? "true" : "false");
                    163: 
                    164:     fprintf (f, "sound_output=%s\n", soundmode[p->produce_sound]);
                    165:     fprintf (f, "sound_channels=%s\n", stereomode1[p->stereo]);
                    166:     fprintf (f, "sound_bits=%d\n", p->sound_bits);
                    167:     fprintf (f, "sound_min_buff=%d\n", p->sound_minbsiz);
                    168:     fprintf (f, "sound_max_buff=%d\n", p->sound_maxbsiz);
                    169:     fprintf (f, "sound_frequency=%d\n", p->sound_freq);
1.1.1.4   root      170:     fprintf (f, "sound_interpol=%s\n", interpolmode[p->sound_interpol]);
1.1       root      171: 
                    172:     fprintf (f, "sound_pri_time=%d\n", p->sound_pri_time);
                    173:     fprintf (f, "sound_pri_cutoff=%d\n", p->sound_pri_cutoff);
                    174: 
                    175:     fprintf (f, "joyport0=%s\n", portmode[p->jport0]);
                    176:     fprintf (f, "joyport1=%s\n", portmode[p->jport1]);
                    177: 
1.1.1.3   root      178:     fprintf (f, "bsdsocket_emu=%s\n", p->socket_emu ? "true" : "false");
1.1       root      179: 
1.1.1.3   root      180:     fprintf (f, "gfx_framerate=%d\n", p->gfx_framerate);
1.1       root      181:     fprintf (f, "gfx_width=%d\n", p->gfx_width);
                    182:     fprintf (f, "gfx_height=%d\n", p->gfx_height);
                    183:     fprintf (f, "gfx_lores=%s\n", p->gfx_lores ? "true" : "false");
                    184:     fprintf (f, "gfx_linemode=%s\n", linemode1[p->gfx_linedbl]);
                    185:     fprintf (f, "gfx_correct_aspect=%s\n", p->gfx_correct_aspect ? "true" : "false");
                    186:     fprintf (f, "gfx_fullscreen_amiga=%s\n", p->gfx_afullscreen ? "true" : "false");
                    187:     fprintf (f, "gfx_fullscreen_picasso=%s\n", p->gfx_pfullscreen ? "true" : "false");
1.1.1.2   root      188:     fprintf (f, "gfx_center_horizontal=%s\n", centermode1[p->gfx_xcenter]);
                    189:     fprintf (f, "gfx_center_vertical=%s\n", centermode1[p->gfx_ycenter]);
1.1       root      190:     fprintf (f, "gfx_colour_mode=%s\n", colormode1[p->color_mode]);
                    191: 
                    192:     fprintf (f, "32bit_blits=%s\n", p->blits_32bit_enabled ? "true" : "false");
                    193:     fprintf (f, "immediate_blits=%s\n", p->immediate_blits ? "true" : "false");
1.1.1.3   root      194:     fprintf (f, "ntsc=%s\n", p->ntscmode ? "true" : "false");
                    195:     if (p->chipset_mask & CSMASK_AGA)
                    196:        fprintf (f, "chipset=aga\n");
                    197:     else if ((p->chipset_mask & CSMASK_ECS_AGNUS) && (p->chipset_mask & CSMASK_ECS_AGNUS))
                    198:        fprintf (f, "chipset=ecs\n");
                    199:     else if (p->chipset_mask & CSMASK_ECS_AGNUS)
                    200:        fprintf (f, "chipset=ecs_agnus\n");
                    201:     else if (p->chipset_mask & CSMASK_ECS_DENISE)
                    202:        fprintf (f, "chipset=ecs_denise\n");
                    203:     else
                    204:        fprintf (f, "chipset=ocs\n");
1.1       root      205: 
                    206:     fprintf (f, "fastmem_size=%d\n", p->fastmem_size / 0x100000);
                    207:     fprintf (f, "a3000mem_size=%d\n", p->a3000mem_size / 0x100000);
                    208:     fprintf (f, "z3mem_size=%d\n", p->z3fastmem_size / 0x100000);
                    209:     fprintf (f, "bogomem_size=%d\n", p->bogomem_size / 0x40000);
                    210:     fprintf (f, "gfxcard_size=%d\n", p->gfxmem_size / 0x100000);
                    211:     fprintf (f, "chipmem_size=%d\n", p->chipmem_size / 0x80000);
                    212: 
1.1.1.3   root      213:     if (p->m68k_speed > 0)
1.1       root      214:        fprintf (f, "cpu_speed=%d\n", p->m68k_speed);
                    215:     else
                    216:        fprintf (f, "cpu_speed=%s\n", p->m68k_speed == -1 ? "max" : "real");
                    217: 
                    218:     fprintf (f, "cpu_type=%s\n", cpumode[p->cpu_level * 2 + !p->address_space_24]);
                    219:     fprintf (f, "cpu_compatible=%s\n", p->cpu_compatible ? "true" : "false");
                    220:     fprintf (f, "autoconfig=%s\n", p->automount_uaedev ? "true" : "false");
                    221: 
                    222:     fprintf (f, "accuracy=%d\n", p->emul_accuracy);
                    223:     fprintf (f, "log_illegal_mem=%s\n", p->illegal_mem ? "true" : "false");
                    224: 
                    225:     fprintf (f, "kbd_lang=%s\n", (p->keyboard_lang == KBD_LANG_DE ? "de"
                    226:                                  : p->keyboard_lang == KBD_LANG_ES ? "es"
                    227:                                  : p->keyboard_lang == KBD_LANG_US ? "us"
                    228:                                  : p->keyboard_lang == KBD_LANG_SE ? "se"
                    229:                                  : p->keyboard_lang == KBD_LANG_FR ? "fr"
                    230:                                  : p->keyboard_lang == KBD_LANG_IT ? "it"
                    231:                                  : "FOO"));
                    232: 
                    233:     write_filesys_config (p->mountinfo, UNEXPANDED, p->path_hardfile, f);
                    234: 
                    235:     /* Don't write gfxlib/gfx_test_speed options.  */
                    236: }
                    237: 
                    238: int cfgfile_yesno (char *option, char *value, char *name, int *location)
                    239: {
                    240:     if (strcmp (option, name) != 0)
                    241:        return 0;
                    242:     if (strcasecmp (value, "yes") == 0 || strcasecmp (value, "y") == 0
                    243:        || strcasecmp (value, "true") == 0 || strcasecmp (value, "t") == 0)
                    244:        *location = 1;
                    245:     else if (strcasecmp (value, "no") == 0 || strcasecmp (value, "n") == 0
                    246:        || strcasecmp (value, "false") == 0 || strcasecmp (value, "f") == 0)
                    247:        *location = 0;
                    248:     else
                    249:        write_log ("Option `%s' requires a value of either `yes' or `no'.\n", option);
                    250:     return 1;
                    251: }
                    252: 
                    253: int cfgfile_intval (char *option, char *value, char *name, int *location, int scale)
                    254: {
                    255:     int base = 10;
                    256:     char *endptr;
                    257:     if (strcmp (option, name) != 0)
                    258:        return 0;
                    259:     /* I guess octal isn't popular enough to worry about here...  */
                    260:     if (value[0] == '0' && value[1] == 'x')
                    261:        value += 2, base = 16;
                    262:     *location = strtol (value, &endptr, base) * scale;
                    263: 
                    264:     if (*endptr != '\0' || *value == '\0')
                    265:        write_log ("Option `%s' requires a numeric argument.\n", option);
                    266:     return 1;
                    267: }
                    268: 
                    269: int cfgfile_strval (char *option, char *value, char *name, int *location, const char *table[], int more)
                    270: {
                    271:     int val;
                    272:     if (strcmp (option, name) != 0)
                    273:        return 0;
                    274:     val = match_string (table, value);
                    275:     if (val == -1) {
                    276:        if (! more)
                    277:            write_log ("Unknown value for option `%s'.\n", option);
                    278:        return 1;
                    279:     }
                    280:     *location = val;
                    281:     return 1;
                    282: }
                    283: 
                    284: int cfgfile_string (char *option, char *value, char *name, char *location, int maxsz)
                    285: {
                    286:     if (strcmp (option, name) != 0)
                    287:        return 0;
                    288:     strncpy (location, value, maxsz - 1);
                    289:     location[maxsz - 1] = '\0';
                    290:     return 1;
                    291: }
                    292: 
                    293: static int getintval (char **p, int *result, int delim)
                    294: {
                    295:     char *value = *p;
                    296:     int base = 10;
                    297:     char *endptr;
                    298:     char *p2 = strchr (*p, delim);
                    299: 
                    300:     if (p2 == 0)
                    301:        return 0;
                    302: 
                    303:     *p2++ = '\0';
                    304: 
                    305:     if (value[0] == '0' && value[1] == 'x')
                    306:        value += 2, base = 16;
                    307:     *result = strtol (value, &endptr, base);
                    308:     *p = p2;
                    309: 
                    310:     if (*endptr != '\0' || *value == '\0')
                    311:        return 0;
                    312: 
                    313:     return 1;
                    314: }
                    315: 
1.1.1.5 ! root      316: static int set_chipset_mask (struct uae_prefs *p, int val)
        !           317: {
        !           318:     p->chipset_mask = (val == 0 ? 0
        !           319:                       : val == 1 ? CSMASK_ECS_AGNUS
        !           320:                       : val == 2 ? CSMASK_ECS_DENISE
        !           321:                       : val == 3 ? CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS
        !           322:                       : CSMASK_AGA | CSMASK_ECS_DENISE | CSMASK_ECS_AGNUS);
        !           323: }
        !           324: 
1.1.1.2   root      325: int cfgfile_parse_option (struct uae_prefs *p, char *option, char *value)
1.1       root      326: {
1.1.1.3   root      327:     int tmpval;
1.1       root      328:     char *section = 0;
                    329:     char *tmpp;
1.1.1.3   root      330: 
1.1       root      331:     for (tmpp = option; *tmpp != '\0'; tmpp++)
                    332:        if (isupper (*tmpp))
                    333:            *tmpp = tolower (*tmpp);
                    334:     tmpp = strchr (option, '.');
                    335:     if (tmpp) {
                    336:        section = option;
                    337:        option = tmpp + 1;
                    338:        *tmpp = '\0';
                    339:        if (strcmp (section, TARGET_NAME) == 0) {
                    340:            /* We special case the various path options here.  */
                    341:            if (cfgfile_string (option, value, "rom_path", p->path_rom, 256)
                    342:                || cfgfile_string (option, value, "floppy_path", p->path_floppy, 256)
                    343:                || cfgfile_string (option, value, "hardfile_path", p->path_hardfile, 256))
                    344:                return 1;
                    345:            return target_parse_option (p, option, value);
                    346:        }
                    347:        return 0;
                    348:     }
                    349:     if (cfgfile_yesno (option, value, "use_debugger", &p->start_debugger)
                    350:        || cfgfile_yesno (option, value, "use_gui", &p->start_gui)
1.1.1.3   root      351:        || cfgfile_yesno (option, value, "bsdsocket_emu", &p->socket_emu)
1.1       root      352:        || cfgfile_yesno (option, value, "immediate_blits", &p->immediate_blits)
                    353:        || cfgfile_yesno (option, value, "32bit_blits", &p->blits_32bit_enabled)
                    354:        || cfgfile_yesno (option, value, "gfx_lores", &p->gfx_lores)
                    355:        || cfgfile_yesno (option, value, "gfx_correct_aspect", &p->gfx_correct_aspect)
                    356:        || cfgfile_yesno (option, value, "gfx_fullscreen_amiga", &p->gfx_afullscreen)
                    357:        || cfgfile_yesno (option, value, "gfx_fullscreen_picasso", &p->gfx_pfullscreen)
1.1.1.3   root      358:        || cfgfile_yesno (option, value, "ntsc", &p->ntscmode)
1.1       root      359:        || cfgfile_yesno (option, value, "cpu_compatible", &p->cpu_compatible)
                    360:        || cfgfile_yesno (option, value, "cpu_24bit_addressing", &p->address_space_24)
                    361:        || cfgfile_yesno (option, value, "autoconfig", &p->automount_uaedev)
                    362:        || cfgfile_yesno (option, value, "parallel_on_demand", &p->parallel_demand)
                    363:        || cfgfile_yesno (option, value, "serial_on_demand", &p->serial_demand)
                    364:        || cfgfile_yesno (option, value, "log_illegal_mem", &p->illegal_mem))
                    365:        return 1;
                    366:     if (cfgfile_intval (option, value, "accuracy", &p->emul_accuracy, 1)
                    367:        || cfgfile_intval (option, value, "sound_min_buff", &p->sound_minbsiz, 1)
                    368:        || cfgfile_intval (option, value, "sound_max_buff", &p->sound_maxbsiz, 1)
                    369:        || cfgfile_intval (option, value, "sound_frequency", &p->sound_freq, 1)
                    370:        || cfgfile_intval (option, value, "sound_bits", &p->sound_bits, 1)
                    371:        || cfgfile_intval (option, value, "sound_pri_cutoff", &p->sound_pri_cutoff, 1)
                    372:        || cfgfile_intval (option, value, "sound_pri_time", &p->sound_pri_time, 1)
1.1.1.3   root      373:        || cfgfile_intval (option, value, "gfx_framerate", &p->gfx_framerate, 1)
1.1       root      374:        || cfgfile_intval (option, value, "gfx_width", &p->gfx_width, 1)
                    375:        || cfgfile_intval (option, value, "gfx_height", &p->gfx_height, 1)
                    376:        || cfgfile_intval (option, value, "fastmem_size", &p->fastmem_size, 0x100000)
                    377:        || cfgfile_intval (option, value, "a3000mem_size", &p->a3000mem_size, 0x100000)
                    378:        || cfgfile_intval (option, value, "z3mem_size", &p->z3fastmem_size, 0x100000)
                    379:        || cfgfile_intval (option, value, "bogomem_size", &p->bogomem_size, 0x40000)
                    380:        || cfgfile_intval (option, value, "gfxcard_size", &p->gfxmem_size, 0x100000)
                    381:        || cfgfile_intval (option, value, "chipmem_size", &p->chipmem_size, 0x80000))
                    382:        return 1;
                    383:     if (cfgfile_strval (option, value, "sound_output", &p->produce_sound, soundmode, 0)
                    384:        || cfgfile_strval (option, value, "sound_channels", &p->stereo, stereomode1, 1)
                    385:        || cfgfile_strval (option, value, "sound_channels", &p->stereo, stereomode2, 1)
                    386:        || cfgfile_strval (option, value, "sound_channels", &p->stereo, stereomode3, 0)
1.1.1.4   root      387:        || cfgfile_strval (option, value, "sound_interpol", &p->sound_interpol, interpolmode, 0)
1.1       root      388:        || cfgfile_strval (option, value, "joyport0", &p->jport0, portmode, 0)
                    389:        || cfgfile_strval (option, value, "joyport1", &p->jport1, portmode, 0)
                    390:        || cfgfile_strval (option, value, "gfx_linemode", &p->gfx_linedbl, linemode1, 1)
                    391:        || cfgfile_strval (option, value, "gfx_linemode", &p->gfx_linedbl, linemode2, 0)
1.1.1.2   root      392:        || cfgfile_strval (option, value, "gfx_center_horizontal", &p->gfx_xcenter, centermode1, 1)
                    393:        || cfgfile_strval (option, value, "gfx_center_vertical", &p->gfx_ycenter, centermode1, 1)
                    394:        || cfgfile_strval (option, value, "gfx_center_horizontal", &p->gfx_xcenter, centermode2, 0)
                    395:        || cfgfile_strval (option, value, "gfx_center_vertical", &p->gfx_ycenter, centermode2, 0)
1.1       root      396:        || cfgfile_strval (option, value, "gfx_colour_mode", &p->color_mode, colormode1, 1)
                    397:        || cfgfile_strval (option, value, "gfx_colour_mode", &p->color_mode, colormode2, 0)
                    398:        || cfgfile_strval (option, value, "gfx_color_mode", &p->color_mode, colormode1, 1)
                    399:        || cfgfile_strval (option, value, "gfx_color_mode", &p->color_mode, colormode2, 0))
                    400:        return 1;
                    401:     if (cfgfile_string (option, value, "floppy0", p->df[0], 256)
                    402:        || cfgfile_string (option, value, "floppy1", p->df[1], 256)
                    403:        || cfgfile_string (option, value, "floppy2", p->df[2], 256)
                    404:        || cfgfile_string (option, value, "floppy3", p->df[3], 256)
                    405:        || cfgfile_string (option, value, "kickstart_rom_file", p->romfile, 256)
                    406:        || cfgfile_string (option, value, "kickstart_key_file", p->keyfile, 256)
1.1.1.2   root      407:        || cfgfile_string (option, value, "config_description", p->description, 256))
1.1       root      408:        return 1;
                    409: 
                    410:     /* Tricky ones... */
1.1.1.3   root      411:     if (cfgfile_strval (option, value, "chipset", &tmpval, csmode, 0)) {
1.1.1.5 ! root      412:        set_chipset_mask (p, tmpval);
1.1.1.3   root      413:        return 1;
                    414:     }
                    415:        
1.1       root      416:     if (cfgfile_strval (option, value, "cpu_type", &p->cpu_level, cpumode, 0)) {
                    417:        p->address_space_24 = !(p->cpu_level & 1);
                    418:        p->cpu_level >>= 1;
                    419:        return 1;
                    420:     }
                    421:     if (cfgfile_strval (option, value, "cpu_speed", &p->m68k_speed, speedmode, 1)) {
                    422:        p->m68k_speed--;
                    423:        return 1;
                    424:     }
                    425:     if (cfgfile_intval (option, value, "cpu_speed", &p->m68k_speed, 1))
                    426:        return 1;
                    427: 
                    428:     if (strcmp (option, "kbd_lang") == 0) {
                    429:        KbdLang l;
                    430:        if ((l = KBD_LANG_DE, strcasecmp (value, "de") == 0)
                    431:            || (l = KBD_LANG_SE, strcasecmp (value, "se") == 0)
                    432:            || (l = KBD_LANG_US, strcasecmp (value, "us") == 0)
                    433:            || (l = KBD_LANG_FR, strcasecmp (value, "fr") == 0)
                    434:            || (l = KBD_LANG_IT, strcasecmp (value, "it") == 0)
                    435:            || (l = KBD_LANG_ES, strcasecmp (value, "es") == 0))
                    436:            p->keyboard_lang = l;
                    437:        else
                    438:            write_log ("Unknown keyboard language\n");
                    439:        return 1;
                    440:     }
                    441: 
                    442:     if (strcmp (option, "filesystem") == 0
                    443:        || strcmp (option, "hardfile") == 0)
                    444:     {
1.1.1.2   root      445:        int secs, heads, reserved, bs, ro;
                    446:        char *aname, *root;
1.1       root      447:        char *tmpp = strchr (value, ',');
1.1.1.2   root      448:        char *str;
1.1       root      449:        if (tmpp == 0)
                    450:            goto invalid_fs;
                    451: 
                    452:        *tmpp++ = '\0';
                    453:        if (strcmp (value, "0") == 0 || strcasecmp (value, "ro") == 0
                    454:            || strcasecmp (value, "readonly") == 0
                    455:            || strcasecmp (value, "read-only") == 0)
1.1.1.2   root      456:            ro = 1;
1.1       root      457:        else if (strcmp (value, "1") == 0 || strcasecmp (value, "rw") == 0
                    458:                 || strcasecmp (value, "readwrite") == 0
                    459:                 || strcasecmp (value, "read-write") == 0)
1.1.1.2   root      460:            ro = 0;
1.1       root      461:        else
                    462:            goto invalid_fs;
1.1.1.2   root      463:        secs = 0; heads = 0; reserved = 0; bs = 0;
1.1       root      464: 
                    465:        value = tmpp;
                    466:        if (strcmp (option, "filesystem") == 0) {
                    467:            tmpp = strchr (value, ':');
                    468:            if (tmpp == 0)
                    469:                goto invalid_fs;
                    470:            *tmpp++ = '\0';
1.1.1.2   root      471:            aname = value;
                    472:            root = tmpp;
1.1       root      473:        } else {
1.1.1.2   root      474:            if (! getintval (&value, &secs, ',')
                    475:                || ! getintval (&value, &heads, ',')
                    476:                || ! getintval (&value, &reserved, ',')
                    477:                || ! getintval (&value, &bs, ','))
1.1       root      478:                goto invalid_fs;
1.1.1.2   root      479:            root = value;
                    480:            aname = 0;
1.1       root      481:        }
1.1.1.2   root      482:        str = cfgfile_subst_path (UNEXPANDED, p->path_hardfile, root);
                    483:        tmpp = add_filesys_unit (p->mountinfo, aname, str, ro, secs,
                    484:                                 heads, reserved, bs);
                    485:        free (str);
                    486:        if (tmpp)
                    487:            write_log ("Error: %s\n", tmpp);
1.1       root      488:        return 1;
                    489: 
                    490:       invalid_fs:
                    491:        write_log ("Invalid filesystem/hardfile specification.\n");
                    492:        return 1;
                    493:     }
                    494: 
                    495:     return 0;
                    496: }
                    497: 
1.1.1.2   root      498: void cfgfile_parse_line (struct uae_prefs *p, char *line)
1.1       root      499: {
                    500:     int i;
                    501:     char *orig_line = my_strdup (line);
                    502:     char *line1, *line2;
                    503: 
                    504:     line1 = line;
                    505:     line2 = strchr (line, '=');
                    506:     if (! line2) {
                    507:        write_log ("CFGFILE: line was incomplete with only %s\n", line1);
                    508:        return;
                    509:     }
                    510: 
                    511:     *line2++ = '\0';
                    512: 
                    513:     /* Get rid of whitespace.  */
1.1.1.2   root      514:     i = strlen (line2);
                    515:     while (i > 0 && (line2[i - 1] == '\t' || line2[i - 1] == ' '
                    516:                     || line2[i - 1] == '\r' || line2[i - 1] == '\n'))
                    517:        line2[--i] = '\0';
1.1       root      518:     line2 += strspn (line2, "\t \r\n");
1.1.1.2   root      519:     i = strlen (line);
                    520:     while (i > 0 && (line[i - 1] == '\t' || line[i - 1] == ' '
                    521:                     || line[i - 1] == '\r' || line[i - 1] == '\n'))
                    522:        line[--i] = '\0';
1.1       root      523:     line += strspn (line, "\t \r\n");
                    524: 
1.1.1.2   root      525:     if (! cfgfile_parse_option (p, line, line2)) {
1.1       root      526:        struct strlist *u = xmalloc (sizeof (struct strlist));
                    527:        u->str = orig_line;
                    528:        u->next = p->unknown_lines;
                    529:        p->unknown_lines = u;
                    530:     } else
                    531:        free (orig_line);
                    532: }
                    533: 
                    534: static void subst (char *p, char *f, int n)
                    535: {
                    536:     char *str = cfgfile_subst_path (UNEXPANDED, p, f);
                    537:     strncpy (f, str, n - 1);
                    538:     f[n - 1] = '\0';
                    539:     free (str);
                    540: }
                    541: 
                    542: int cfgfile_load (struct uae_prefs *p, const char *filename)
                    543: {
                    544:     char *str;
                    545:     int i;
                    546: 
                    547:     FILE *fh;
                    548:     char line[256];
                    549: 
1.1.1.4   root      550:     fh = fopen (filename, "r");
1.1       root      551:     if (! fh)
                    552:        return 0;
                    553: 
                    554:     while (fgets (line, 256, fh) != 0) {
                    555:        line[strcspn (line, "\t \r\n")] = '\0';
                    556:        if (strlen (line) > 0)
1.1.1.2   root      557:            cfgfile_parse_line (p, line);
1.1       root      558:     }
                    559:     fclose (fh);
                    560: 
                    561:     for (i = 0; i < 4; i++)
                    562:        subst (p->path_floppy, p->df[i], sizeof p->df[i]);
                    563:     subst (p->path_rom, p->romfile, sizeof p->romfile);
                    564:     subst (p->path_rom, p->keyfile, sizeof p->keyfile);
                    565: 
                    566:     return 1;
                    567: }
                    568: 
                    569: int cfgfile_save (struct uae_prefs *p, const char *filename)
                    570: {
                    571:     FILE *fh = fopen (filename, "w");
                    572:     if (! fh)
                    573:        return 0;
                    574: 
                    575:     save_options (fh, p);
                    576:     fclose (fh);
                    577:     return 1;
                    578: }
                    579: 
                    580: int cfgfile_get_description (const char *filename, char *description)
                    581: {
                    582:     int result = 0;
                    583:     struct uae_prefs p;
                    584:     default_prefs (&p);
                    585:     strcpy (p.description, "");
                    586:     if (cfgfile_load (&p, filename) && strlen (p.description) != 0) {
                    587:        result = 1;
                    588:        strcpy (description, p.description);
                    589:     }
                    590:     discard_prefs (&p);
                    591:     return result;
                    592: }
                    593: 
                    594: void cfgfile_show_usage (void)
                    595: {
                    596:     int i;
                    597:     fprintf (stderr, "UAE Configuration Help:\n" \
                    598:               "=======================\n");
                    599:     for (i = 0; i < sizeof opttable / sizeof *opttable; i++)
                    600:        fprintf (stderr, "%s: %s\n", opttable[i].config_label, opttable[i].config_help);
                    601: }
1.1.1.4   root      602: 
                    603: /* This implements the old commandline option parsing.  I've re-added this
                    604:    because the new way of doing things is painful for me (it requires me
                    605:    to type a couple hundred characters when invoking UAE).  The following
                    606:    is far less annoying to use.  */
                    607: static void parse_gfx_specs (char *spec)
                    608: {
                    609:     char *x0 = my_strdup (spec);
                    610:     char *x1, *x2;
                    611: 
                    612:     x1 = strchr (x0, ':');
                    613:     if (x1 == 0)
                    614:        goto argh;
                    615:     x2 = strchr (x1+1, ':');
                    616:     if (x2 == 0)
                    617:        goto argh;
                    618:     *x1++ = 0; *x2++ = 0;
                    619: 
                    620:     currprefs.gfx_width = atoi (x0);
                    621:     currprefs.gfx_height = atoi (x1);
                    622:     currprefs.gfx_lores = strchr (x2, 'l') != 0;
                    623:     currprefs.gfx_xcenter = strchr (x2, 'x') != 0 ? 1 : strchr (x2, 'X') != 0 ? 2 : 0;
                    624:     currprefs.gfx_ycenter = strchr (x2, 'y') != 0 ? 1 : strchr (x2, 'Y') != 0 ? 2 : 0;
                    625:     currprefs.gfx_linedbl = strchr (x2, 'd') != 0;
                    626:     currprefs.gfx_linedbl += 2 * (strchr (x2, 'D') != 0);
                    627:     currprefs.gfx_afullscreen = strchr (x2, 'a') != 0;
                    628:     currprefs.gfx_pfullscreen = strchr (x2, 'p') != 0;
                    629:     currprefs.gfx_correct_aspect = strchr (x2, 'c') != 0;
                    630: 
                    631:     if (currprefs.gfx_linedbl == 3) {
                    632:        fprintf (stderr, "You can't use both 'd' and 'D' modifiers in the display mode specification.\n");
                    633:     }
                    634:     
                    635:     free (x0);
                    636:     return;
                    637: 
                    638:     argh:
                    639:     fprintf (stderr, "Bad display mode specification.\n");
                    640:     fprintf (stderr, "The format to use is: \"width:height:modifiers\"\n");
                    641:     fprintf (stderr, "Type \"uae -h\" for detailed help.\n");
                    642:     free (x0);
                    643: }
                    644: 
                    645: static void parse_sound_spec (char *spec)
                    646: {
                    647:     char *x0 = my_strdup (spec);
                    648:     char *x1, *x2 = NULL, *x3 = NULL, *x4 = NULL, *x5 = NULL;
                    649: 
                    650:     x1 = strchr (x0, ':');
                    651:     if (x1 != NULL) {
                    652:        *x1++ = '\0';
                    653:        x2 = strchr (x1 + 1, ':');
                    654:        if (x2 != NULL) {
                    655:            *x2++ = '\0';
                    656:            x3 = strchr (x2 + 1, ':');
                    657:            if (x3 != NULL) {
                    658:                *x3++ = '\0';
                    659:                x4 = strchr (x3 + 1, ':');
                    660:                if (x4 != NULL) {
                    661:                    *x4++ = '\0';
                    662:                    x5 = strchr (x4 + 1, ':');
                    663:                }
                    664:            }
                    665:        }
                    666:     }
                    667:     currprefs.produce_sound = atoi (x0);
                    668:     if (x1) {
                    669:        if (*x1 == 's')
                    670:            currprefs.stereo = 1;
                    671:        else
                    672:            currprefs.stereo = 0;
                    673:     }
                    674:     if (x2)
                    675:        currprefs.sound_bits = atoi (x2);
                    676:     if (x3)
                    677:        currprefs.sound_freq = atoi (x3);
                    678:     if (x4)
                    679:        currprefs.sound_maxbsiz = currprefs.sound_minbsiz = atoi (x4);
                    680:     if (x5)
                    681:        currprefs.sound_minbsiz = atoi (x5);
                    682:     free (x0);
                    683:     return;
                    684: }
                    685: 
                    686: 
                    687: static void parse_joy_spec (char *spec)
                    688: {
                    689:     int v0 = 2, v1 = 0;
                    690:     if (strlen(spec) != 2)
                    691:        goto bad;
                    692: 
                    693:     switch (spec[0]) {
                    694:      case '0': v0 = 0; break;
                    695:      case '1': v0 = 1; break;
                    696:      case 'M': case 'm': v0 = 2; break;
                    697:      case 'A': case 'a': v0 = 3; break;
                    698:      case 'B': case 'b': v0 = 4; break;
                    699:      case 'C': case 'c': v0 = 5; break;
                    700:      default: goto bad;
                    701:     }
                    702: 
                    703:     switch (spec[1]) {
                    704:      case '0': v1 = 0; break;
                    705:      case '1': v1 = 1; break;
                    706:      case 'M': case 'm': v1 = 2; break;
                    707:      case 'A': case 'a': v1 = 3; break;
                    708:      case 'B': case 'b': v1 = 4; break;
                    709:      case 'C': case 'c': v1 = 5; break;
                    710:      default: goto bad;
                    711:     }
                    712:     if (v0 == v1)
                    713:        goto bad;
                    714:     /* Let's scare Pascal programmers */
                    715:     if (0)
                    716: bad:
                    717:     fprintf (stderr, "Bad joystick mode specification. Use -J xy, where x and y\n"
                    718:             "can be 0 for joystick 0, 1 for joystick 1, M for mouse, and\n"
                    719:             "a, b or c for different keyboard settings.\n");
                    720: 
                    721:     currprefs.jport0 = v0;
                    722:     currprefs.jport1 = v1;
                    723: }
                    724: 
                    725: static void parse_filesys_spec (int readonly, char *spec)
                    726: {
                    727:     char buf[256];
                    728:     char *s2;
                    729: 
                    730:     strncpy (buf, spec, 255); buf[255] = 0;
                    731:     s2 = strchr (buf, ':');
                    732:     if (s2) {
                    733:        *s2++ = '\0';
                    734: #ifdef __DOS__
                    735:        {
                    736:            char *tmp;
                    737:  
                    738:            while ((tmp = strchr (s2, '\\')))
                    739:                *tmp = '/';
                    740:        }
                    741: #endif
                    742:        s2 = add_filesys_unit (currprefs.mountinfo, buf, s2, readonly, 0, 0, 0, 0);
                    743:        if (s2)
                    744:            fprintf (stderr, "%s\n", s2);
                    745:     } else {
                    746:        fprintf (stderr, "Usage: [-m | -M] VOLNAME:mount_point\n");
                    747:     }
                    748: }
                    749:  
                    750: static void parse_hardfile_spec (char *spec)
                    751: {
                    752:     char *x0 = my_strdup (spec);
                    753:     char *x1, *x2, *x3, *x4;
                    754: 
                    755:     x1 = strchr (x0, ':');
                    756:     if (x1 == NULL)
                    757:        goto argh;
                    758:     *x1++ = '\0';
                    759:     x2 = strchr (x1 + 1, ':');
                    760:     if (x2 == NULL)
                    761:        goto argh;
                    762:     *x2++ = '\0';
                    763:     x3 = strchr (x2 + 1, ':');
                    764:     if (x3 == NULL)
                    765:        goto argh;
                    766:     *x3++ = '\0';
                    767:     x4 = strchr (x3 + 1, ':');
                    768:     if (x4 == NULL)
                    769:        goto argh;
                    770:     *x4++ = '\0';
                    771:     x4 = add_filesys_unit (currprefs.mountinfo, 0, x4, 0, atoi (x0), atoi (x1), atoi (x2), atoi (x3));
                    772:     if (x4)
                    773:        fprintf (stderr, "%s\n", x4);
                    774: 
                    775:     free (x0);
                    776:     return;
                    777: 
                    778:  argh:
                    779:     free (x0);
                    780:     fprintf (stderr, "Bad hardfile parameter specified - type \"uae -h\" for help.\n");
                    781:     return;
                    782: }
                    783: 
                    784: static void parse_cpu_specs (char *spec)
                    785: {
                    786:     if (*spec < '0' || *spec > '3') {
                    787:        fprintf (stderr, "CPU parameter string must begin with '0', '1', '2' or '3'.\n");
                    788:        return;
                    789:     }
                    790:        
                    791:     currprefs.cpu_level = *spec++ - '0';
                    792:     currprefs.address_space_24 = currprefs.cpu_level < 2;
                    793:     currprefs.cpu_compatible = 0;
                    794:     while (*spec != '\0') {
                    795:        switch (*spec) {
                    796:         case 'a':
                    797:            if (currprefs.cpu_level < 2)
                    798:                fprintf (stderr, "In 68000/68010 emulation, the address space is always 24 bit.\n");
                    799:            else
                    800:                currprefs.address_space_24 = 1;
                    801:            break;
                    802:         case 'c':
                    803:            if (currprefs.cpu_level != 0)
                    804:                fprintf (stderr, "The more compatible CPU emulation is only available for 68000\n"
                    805:                         "emulation, not for 68010 upwards.\n");
                    806:            else
                    807:                currprefs.cpu_compatible = 1;
                    808:            break;
                    809:         default:
                    810:            fprintf (stderr, "Bad CPU parameter specified - type \"uae -h\" for help.\n");
                    811:            break;
                    812:        }
                    813:        spec++;
                    814:     }
                    815: }
                    816: 
                    817: /* Returns the number of args used up (0 or 1).  */
                    818: int parse_cmdline_option (char c, char *arg)
                    819: {
1.1.1.5 ! root      820:     const char arg_required[] = "0123rKpImWSAJwNCZUFcblOdHRv";
1.1.1.4   root      821: 
                    822:     if (strchr (arg_required, c) && ! arg) {
                    823:        fprintf (stderr, "Missing argument for option `-%c'!\n", c);
                    824:        return 0;
                    825:     }
                    826: 
                    827:     switch (c) {
1.1.1.5 ! root      828:     case 'h': usage (); exit (0);
1.1.1.4   root      829: 
1.1.1.5 ! root      830:     case '0': strncpy (currprefs.df[0], arg, 255); currprefs.df[0][255] = 0; break;
        !           831:     case '1': strncpy (currprefs.df[1], arg, 255); currprefs.df[1][255] = 0; break;
        !           832:     case '2': strncpy (currprefs.df[2], arg, 255); currprefs.df[2][255] = 0; break;
        !           833:     case '3': strncpy (currprefs.df[3], arg, 255); currprefs.df[3][255] = 0; break;
        !           834:     case 'r': strncpy (currprefs.romfile, arg, 255); currprefs.romfile[255] = 0; break;
        !           835:     case 'K': strncpy (currprefs.keyfile, arg, 255); currprefs.keyfile[255] = 0; break;
        !           836:     case 'p': strncpy (currprefs.prtname, arg, 255); currprefs.prtname[255] = 0; break;
1.1.1.4   root      837:        /*     case 'I': strncpy (currprefs.sername, arg, 255); currprefs.sername[255] = 0; currprefs.use_serial = 1; break; */
1.1.1.5 ! root      838:     case 'm': case 'M': parse_filesys_spec (c == 'M', arg); break;
        !           839:     case 'W': parse_hardfile_spec (arg); break;
        !           840:     case 'S': parse_sound_spec (arg); break;
        !           841:     case 'R': currprefs.gfx_framerate = atoi (arg); break;
        !           842:     case 'A': currprefs.emul_accuracy = atoi (arg); break;
        !           843:     case 'x': currprefs.no_xhair = 1; break;
        !           844:     case 'i': currprefs.illegal_mem = 1; break;
        !           845:     case 'J': parse_joy_spec (arg); break;
        !           846:     case 'a': currprefs.automount_uaedev = 0; break;
        !           847: 
        !           848:     case 't': currprefs.test_drawing_speed = 1; break;
        !           849:     case 'L': currprefs.x11_use_low_bandwidth = 1; break;
        !           850:     case 'T': currprefs.x11_use_mitshm = 1; break;
        !           851:     case 'w': currprefs.m68k_speed = atoi (arg); break;
1.1.1.4   root      852: 
                    853:        /* case 'g': currprefs.use_gfxlib = 1; break; */
1.1.1.5 ! root      854:     case 'G': currprefs.start_gui = 0; break;
        !           855:     case 'D': currprefs.start_debugger = 1; break;
1.1.1.4   root      856: 
1.1.1.5 ! root      857:     case 'n':
1.1.1.4   root      858:        if (strchr (arg, '3') != 0)
                    859:            currprefs.blits_32bit_enabled = 1;
                    860:        if (strchr (arg, 'i') != 0)
                    861:            currprefs.immediate_blits = 1;
                    862:        break;
                    863: 
1.1.1.5 ! root      864:     case 'v':
        !           865:        set_chipset_mask (&currprefs, atoi (arg));
        !           866:        break;
        !           867: 
        !           868:     case 'C':
1.1.1.4   root      869:        parse_cpu_specs (arg);
                    870:        break;
                    871: 
1.1.1.5 ! root      872:     case 'Z':
1.1.1.4   root      873:        currprefs.z3fastmem_size = atoi (arg) * 0x100000;
                    874:        break;
                    875: 
1.1.1.5 ! root      876:     case 'U':
1.1.1.4   root      877:        currprefs.gfxmem_size = atoi (arg) * 0x100000;
                    878:        break;
                    879: 
1.1.1.5 ! root      880:     case 'F':
1.1.1.4   root      881:        currprefs.fastmem_size = atoi (arg) * 0x100000;
                    882:        break;
                    883: 
1.1.1.5 ! root      884:     case 'b':
1.1.1.4   root      885:        currprefs.bogomem_size = atoi (arg) * 0x40000;
                    886:        break;
                    887: 
1.1.1.5 ! root      888:     case 'c':
1.1.1.4   root      889:        currprefs.chipmem_size = atoi (arg) * 0x80000;
                    890:        break;
                    891: 
1.1.1.5 ! root      892:     case 'l':
1.1.1.4   root      893:        if (0 == strcasecmp(arg, "de"))
                    894:            currprefs.keyboard_lang = KBD_LANG_DE;
                    895:        else if (0 == strcasecmp(arg, "us"))
                    896:            currprefs.keyboard_lang = KBD_LANG_US;
                    897:        else if (0 == strcasecmp(arg, "se"))
                    898:            currprefs.keyboard_lang = KBD_LANG_SE;
                    899:        else if (0 == strcasecmp(arg, "fr"))
                    900:            currprefs.keyboard_lang = KBD_LANG_FR;
                    901:        else if (0 == strcasecmp(arg, "it"))
                    902:            currprefs.keyboard_lang = KBD_LANG_IT;
                    903:        else if (0 == strcasecmp(arg, "es"))
                    904:            currprefs.keyboard_lang = KBD_LANG_ES;
                    905:        break;
                    906: 
1.1.1.5 ! root      907:     case 'O': parse_gfx_specs (arg); break;
        !           908:     case 'd':
1.1.1.4   root      909:        if (strchr (arg, 'S') != NULL || strchr (arg, 's')) {
                    910:            write_log ("  Serial on demand.\n");
                    911:            currprefs.serial_demand = 1;
                    912:        }
                    913:        if (strchr (arg, 'P') != NULL || strchr (arg, 'p')) {
                    914:            write_log ("  Parallel on demand.\n");
                    915:            currprefs.parallel_demand = 1;
                    916:        }
                    917: 
                    918:        break;
                    919: 
1.1.1.5 ! root      920:     case 'H':
1.1.1.4   root      921:        currprefs.color_mode = atoi (arg);
                    922:        if (currprefs.color_mode < 0) {
                    923:            fprintf (stderr, "Bad color mode selected. Using default.\n");
                    924:            currprefs.color_mode = 0;
                    925:        }
                    926:        break;
1.1.1.5 ! root      927:     default:
1.1.1.4   root      928:        fprintf (stderr, "Unknown option `-%c'!\n", c);
                    929:        break;
                    930:     }
                    931:     return !! strchr (arg_required, c);
                    932: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.