📄 config.c
字号:
return strtok(NULL, " "); } else { puts("svgalib: Illegal chipset setting: memory is not a number"); goto chip_us; } } if (mode) vga_setchipset(i); else puts("chipset override from environment denied."); return ptr; } } printf("svgalib: Illegal chipset setting: chipset %s\n", ptr); chip_us: puts("Correct usage: chipset driver [par1 par2]\n" "where driver is one of:"); ptb = "%s"; for (i = 0, tabptr = driver_names; *tabptr; tabptr++, i++) { if (__svgalib_driverspecslist[i] != NULL) { printf(ptb, *tabptr); ptb = ", %s"; } } puts("\npar1 and par2 are river dependant integers.\n" "Example: Chipset VGA or\n" "Chipset VGA 0 512"); return ptr;#ifndef OSKIT case 6: /* oldstyle config: m0-m4 */ case 7: case 8: case 9: case 10: mouse_type = command - 6; break; case 11: /* m9 */ mouse_type = 9; break;#endif /* !OSKIT */ case 12: /* oldstyle config: M0-M6 */ case 13: case 14: case 15: case 16: case 17: case 18: monnum: if (!mode) { mon_deny: puts("Monitor setting from environment denied."); break; } else { __svgalib_horizsync.max = __svgalib_maxhsync[command - 12]; } break; case 19: /*nolinear */ modeinfo_mask &= ~CAPABLE_LINEAR; break; case 20: /*linear */ modeinfo_mask |= CAPABLE_LINEAR; break; case 21: /* oldstyle chipset C0 - C9 */ case 22: case 23: case 24: case 25: case 26: case 27: case 28: case 29: case 30: if (!mode) goto chipdeny; vga_setchipset(command - 21); break; case 31: /* c0-c1 color-text selection */ if (!mode) { coltexdeny: puts("Color/mono text selection from environment denied."); break; } color_text = 0; break; case 32: if (!mode) { puts("Color/mono text selection from environment denied."); break; } color_text = 1; break; case 33: case 34: if (!mode) goto coltexdeny; color_text = command - 32; break;#ifndef OSKIT case 35: /* Mouse type 5 - "PS2". */ mouse_type = 5; break; case 36: mouse_modem_ctl &= ~(MOUSE_CHG_DTR | MOUSE_DTR_HIGH); break; case 37: mouse_modem_ctl &= ~MOUSE_DTR_HIGH; mouse_modem_ctl |= MOUSE_CHG_DTR; break; case 38: mouse_modem_ctl |= (MOUSE_CHG_RTS | MOUSE_RTS_HIGH); break; case 39: mouse_modem_ctl &= ~(MOUSE_CHG_RTS | MOUSE_RTS_HIGH); break; case 40: mouse_modem_ctl &= ~MOUSE_RTS_HIGH; mouse_modem_ctl |= MOUSE_CHG_RTS; break; case 41: mouse_modem_ctl |= (MOUSE_CHG_RTS | MOUSE_RTS_HIGH); break;#endif /* !OSKIT */ case 42: /* grayscale */ __svgalib_grayscale = 1; break; case 43: /* horizsync */ ptr = strtok(NULL, " "); if (check_digit(ptr, digits)) { /* It is a float.. */ f = atof(ptr); if (!mode) goto mon_deny; __svgalib_horizsync.min = f * 1000; } else goto hs_bad; ptr = strtok(NULL, " "); if (check_digit(ptr, digits)) { /* It is a float.. */ f = atof(ptr); if (!mode) goto mon_deny; __svgalib_horizsync.max = f * 1000; } else { hs_bad: printf("svgalib: Illegal HorizSync setting.\n" "Correct usage: HorizSync min_kHz max_kHz\n" "Example: HorizSync 31.5 36.5\n"); } break; case 44: /* vertrefresh */ ptr = strtok(NULL, " "); if (check_digit(ptr, digits)) { /* It is a float.. */ f = atof(ptr); if (!mode) goto mon_deny; __svgalib_vertrefresh.min = f; } else goto vr_bad; ptr = strtok(NULL, " "); if (check_digit(ptr, digits)) { /* It is a float.. */ f = atof(ptr); if (!mode) goto mon_deny; __svgalib_vertrefresh.max = f; } else { vr_bad: printf("svgalib: Illegal VertRefresh setting.\n" "Correct usage: VertRefresh min_Hz max_Hz\n" "Example: VertRefresh 50 70\n"); } break; case 45:{ /* modeline */ MonitorModeTiming mmt; const struct { char *name; int val; } options[] = { { "-hsync", NHSYNC }, { "+hsync", PHSYNC }, { "-vsync", NVSYNC }, { "+vsync", PVSYNC }, { "interlace", INTERLACED }, { "interlaced", INTERLACED }, { "doublescan", DOUBLESCAN } };#define ML_NR_OPTS (sizeof(options)/sizeof(*options)) /* Skip the name of the mode */ ptr = strtok(NULL, " "); if (!ptr) break; ptr = strtok(NULL, " "); if (!ptr) break; mmt.pixelClock = atof(ptr) * 1000;#define ML_GETINT(x) \ ptr = strtok(NULL, " "); if(!ptr) break; \ mmt.##x = atoi(ptr); ML_GETINT(HDisplay); ML_GETINT(HSyncStart); ML_GETINT(HSyncEnd); ML_GETINT(HTotal); ML_GETINT(VDisplay); ML_GETINT(VSyncStart); ML_GETINT(VSyncEnd); ML_GETINT(VTotal); mmt.flags = 0; while ((ptr = strtok(NULL, " "))) { for (i = 0; i < ML_NR_OPTS; i++) if (!strcasecmp(ptr, options[i].name)) mmt.flags |= options[i].val; if (i == ML_NR_OPTS) break; }#undef ML_GETINT#undef ML_NR_OPTS __svgalib_addusertiming(&mmt); return ptr; }#ifndef OSKIT case 46: if (!mode) { puts("Security setting from environment denied."); break; } if ( (ptr = strtok( NULL, " ")) ) { if (!strcasecmp("revoke-all-privs", ptr)) { __svgalib_security_revokeallprivs = 1; break; } else if (!strcasecmp("compat", ptr)) { __svgalib_security_revokeallprivs = 0; break; } } puts("svgalib: Unknown security options\n"); break; case 47: ptr = strtok(NULL," "); if (ptr) { mouse_device = strdup(ptr); if (mouse_device == NULL) {#ifndef SVGA_AOUT nomem:#endif puts("svgalib: Fatal error: out of memory."); exit(1); } } else goto param_needed; break; case 48: /* default_mode */ if ( (ptr = strtok(NULL, " ")) != 0) { int mode = vga_getmodenumber(ptr); if (mode != -1) { __svgalib_default_mode = mode; } else { printf("svgalib: config: illegal mode \'%s\' for \'%s\'\n", ptr, vga_conf_commands[command]); } } else { param_needed: printf("svgalib: config: \'%s\' requires parameter(s)", vga_conf_commands[command]); break; } break; case 49: /* nosigint */ __svgalib_nosigint = 1; break; case 50: /* sigint */ __svgalib_nosigint = 0; break; case 51: /* joystick0 */ case 52: /* joystick1 */ case 53: /* joystick2 */ case 54: /* joystick3 */ if (! (ptr = strtok(NULL, " ")) ) goto param_needed;#ifndef SVGA_AOUT if (__joystick_devicenames[command - 51]) free(__joystick_devicenames[command - 51]); __joystick_devicenames[command - 51] = strdup(ptr); if (!__joystick_devicenames[command - 51]) goto nomem;#else printf("svgalib: No joystick support in a.out version.\n");#endif break;#endif /* !OSKIT */ } leave: return strtok(NULL, " ");}void readconfigfile(void){ if (configfileread) return; configfileread = 1;#ifndef OSKIT mouse_type = -1;#endif /* !OSKIT */ __svgalib_read_options(vga_conf_commands, process_option);#ifndef OSKIT if (mouse_type == -1) { mouse_type = MOUSE_MICROSOFT; /* Default. */ puts("svgalib: Assuming Microsoft mouse."); }#endif /* !OSKIT */ if (__svgalib_horizsync.max == 0U) { /* Default monitor is low end SVGA/8514. */ __svgalib_horizsync.min = 31500U; __svgalib_horizsync.max = 35500U; puts("svgalib: Assuming low end SVGA/8514 monitor (35.5 KHz)."); }#ifdef DEBUG_CONF printf("Mouse is: %d Monitor is: H(%5.1f, %5.1f) V(%u,%u)\n", mouse_type, __svgalib_horizsync.min / 1000.0, __svgalib_horizsync.max / 1000.0, __svgalib_vertrefresh.min, __svgalib_vertrefresh.max); printf("Mouse device is: %s",mouse_device);#endif}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -