static Bool parsekey(const char *s, const char *e, Key *k) { const char *p, *q; XPRINTF("Parsing key from: '%s'\n", s); for (p = s; p < e && (isalnum(*p) || isblank(*p) || *p == '_'); p++) ; if (p < e && *p == '+') { k->mod = parsemod(s, p); p++; } else p = s; for (q = p; q < e && (isalnum(*q) || isblank(*q) || *q == '_'); q++) ; if (q < e && *q != '=') q = e; if ((k->keysym = parsesym(p, q)) == NoSymbol) { EPRINTF("Failed to parse symbol from '%s' to '%s'\n", p, q); return False; } if (q < e) k->arg = parsearg(q + 1, e); else if (k->arg) k->arg = strdup(k->arg); return True; }
static tlHandle parsekey(tlBuffer* buf) { trace("parsekey"); char c; do { c = tlBufferReadByte(buf); } while (c && c <= 32); trace("probing: %c", c); if (!c) return null; tlBufferRewind(buf, 1); if (c == '"' || c == '\'') return tlSymFromString(parsestring(buf, c)); return parsesym(buf); }