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

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

unix.superglobalmegacorp.com

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