XF86ConfInputPtr xf86parsePointerSection (void) { char *s, *s1, *s2; int l; int token; parsePrologue (XF86ConfInputPtr, XF86ConfInputRec) while ((token = xf86getToken (PointerTab)) != ENDSECTION) { switch (token) { case COMMENT: ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str); break; case PROTOCOL: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "Protocol"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("Protocol"), val.str); break; case PDEVICE: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "Device"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("Device"), val.str); break; case EMULATE3: ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("Emulate3Buttons"), NULL); break; case EM3TIMEOUT: if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) Error (POSITIVE_INT_MSG, "Emulate3Timeout"); s = xf86uLongToString(val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("Emulate3Timeout"), s); break; case CHORDMIDDLE: ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("ChordMiddle"), NULL); break; case PBUTTONS: if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) Error (POSITIVE_INT_MSG, "Buttons"); s = xf86uLongToString(val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("Buttons"), s); break; case BAUDRATE: if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) Error (POSITIVE_INT_MSG, "BaudRate"); s = xf86uLongToString(val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("BaudRate"), s); break; case SAMPLERATE: if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) Error (POSITIVE_INT_MSG, "SampleRate"); s = xf86uLongToString(val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("SampleRate"), s); break; case PRESOLUTION: if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) Error (POSITIVE_INT_MSG, "Resolution"); s = xf86uLongToString(val.num); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("Resolution"), s); break; case CLEARDTR: ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("ClearDTR"), NULL); break; case CLEARRTS: ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("ClearRTS"), NULL); break; case ZAXISMAPPING: switch (xf86getToken(ZMapTab)) { case NUMBER: if (val.num < 0) Error (ZAXISMAPPING_MSG, NULL); s1 = xf86uLongToString(val.num); if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) { xf86conffree(s1); Error (ZAXISMAPPING_MSG, NULL); } s2 = xf86uLongToString(val.num); l = strlen(s1) + 1 + strlen(s2) + 1; s = xf86confmalloc(l); sprintf(s, "%s %s", s1, s2); xf86conffree(s1); xf86conffree(s2); break; case XAXIS: s = xf86configStrdup("x"); break; case YAXIS: s = xf86configStrdup("y"); break; default: Error (ZAXISMAPPING_MSG, NULL); break; } ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("ZAxisMapping"), s); break; case ALWAYSCORE: break; case EOF_TOKEN: Error (UNEXPECTED_EOF_MSG, NULL); break; default: Error (INVALID_KEYWORD_MSG, xf86tokenString ()); break; } } ptr->inp_identifier = xf86configStrdup(CONF_IMPLICIT_POINTER); ptr->inp_driver = xf86configStrdup("mouse"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("CorePointer"), NULL); #ifdef DEBUG printf ("Pointer section parsed\n"); #endif return ptr; }
XF86ConfInputPtr xf86parseKeyboardSection (void) { char *s, *s1, *s2; int l; int token, ntoken; parsePrologue (XF86ConfInputPtr, XF86ConfInputRec) while ((token = xf86getToken (KeyboardTab)) != ENDSECTION) { switch (token) { case COMMENT: ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str); break; case KPROTOCOL: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "Protocol"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("Protocol"), val.str); break; case AUTOREPEAT: if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER) Error (AUTOREPEAT_MSG, NULL); s1 = xf86uLongToString(val.num); if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER) Error (AUTOREPEAT_MSG, NULL); s2 = xf86uLongToString(val.num); l = strlen(s1) + 1 + strlen(s2) + 1; s = xf86confmalloc(l); sprintf(s, "%s %s", s1, s2); xf86conffree(s1); xf86conffree(s2); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("AutoRepeat"), s); break; case XLEDS: if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER) Error (XLEDS_MSG, NULL); s = xf86uLongToString(val.num); l = strlen(s) + 1; while ((token = xf86getSubToken (&(ptr->inp_comment))) == NUMBER) { s1 = xf86uLongToString(val.num); l += (1 + strlen(s1)); s = xf86confrealloc(s, l); strcat(s, " "); strcat(s, s1); xf86conffree(s1); } xf86unGetToken (token); break; case SERVERNUM: xf86parseWarning(OBSOLETE_MSG, xf86tokenString()); break; case LEFTALT: case RIGHTALT: case SCROLLLOCK_TOK: case RIGHTCTL: xf86parseWarning(OBSOLETE_MSG, xf86tokenString()); break; ntoken = xf86getToken (KeyMapTab); switch (ntoken) { case EOF_TOKEN: xf86parseError (UNEXPECTED_EOF_MSG); CLEANUP (ptr); return (NULL); break; default: Error (INVALID_KEYWORD_MSG, xf86tokenString ()); break; } break; case VTINIT: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "VTInit"); xf86parseWarning(MOVED_TO_FLAGS_MSG, "VTInit"); break; case VTSYSREQ: xf86parseWarning(MOVED_TO_FLAGS_MSG, "VTSysReq"); break; case XKBDISABLE: ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbDisable"), NULL); break; case XKBKEYMAP: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBKeymap"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbKeymap"), val.str); break; case XKBCOMPAT: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBCompat"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbCompat"), val.str); break; case XKBTYPES: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBTypes"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbTypes"), val.str); break; case XKBKEYCODES: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBKeycodes"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbKeycodes"), val.str); break; case XKBGEOMETRY: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBGeometry"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbGeometry"), val.str); break; case XKBSYMBOLS: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBSymbols"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbSymbols"), val.str); break; case XKBRULES: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBRules"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbRules"), val.str); break; case XKBMODEL: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBModel"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbModel"), val.str); break; case XKBLAYOUT: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBLayout"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbLayout"), val.str); break; case XKBVARIANT: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBVariant"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbVariant"), val.str); break; case XKBOPTIONS: if (xf86getSubToken (&(ptr->inp_comment)) != STRING) Error (QUOTE_MSG, "XKBOptions"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("XkbOptions"), val.str); break; case PANIX106: ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("Panix106"), NULL); break; case EOF_TOKEN: Error (UNEXPECTED_EOF_MSG, NULL); break; default: Error (INVALID_KEYWORD_MSG, xf86tokenString ()); break; } } ptr->inp_identifier = xf86configStrdup(CONF_IMPLICIT_KEYBOARD); ptr->inp_driver = xf86configStrdup("keyboard"); ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst, xf86configStrdup("CoreKeyboard"), NULL); #ifdef DEBUG printf ("Keyboard section parsed\n"); #endif return ptr; }