version 1.59, 2018/05/07 13:39:09 |
version 1.60, 2018/10/18 07:57:57 |
|
|
[TTYC_SMCUP] = { TTYCODE_STRING, "smcup" }, |
[TTYC_SMCUP] = { TTYCODE_STRING, "smcup" }, |
[TTYC_SMKX] = { TTYCODE_STRING, "smkx" }, |
[TTYC_SMKX] = { TTYCODE_STRING, "smkx" }, |
[TTYC_SMSO] = { TTYCODE_STRING, "smso" }, |
[TTYC_SMSO] = { TTYCODE_STRING, "smso" }, |
|
[TTYC_SMULX] = { TTYCODE_STRING, "Smulx" }, |
[TTYC_SMUL] = { TTYCODE_STRING, "smul" }, |
[TTYC_SMUL] = { TTYCODE_STRING, "smul" }, |
[TTYC_SMXX] = { TTYCODE_STRING, "smxx" }, |
[TTYC_SMXX] = { TTYCODE_STRING, "smxx" }, |
[TTYC_SS] = { TTYCODE_STRING, "Ss" }, |
[TTYC_SS] = { TTYCODE_STRING, "Ss" }, |
|
|
return (xstrdup(buf)); |
return (xstrdup(buf)); |
} |
} |
|
|
|
static char * |
|
tty_term_override_next(const char *s, size_t *offset) |
|
{ |
|
static char value[BUFSIZ]; |
|
size_t n = 0, at = *offset; |
|
|
|
if (s[at] == '\0') |
|
return (NULL); |
|
|
|
while (s[at] != '\0') { |
|
if (s[at] == ':') { |
|
if (s[at + 1] == ':') { |
|
value[n++] = ':'; |
|
at += 2; |
|
} else |
|
break; |
|
} else { |
|
value[n++] = s[at]; |
|
at++; |
|
} |
|
if (n == (sizeof value) - 1) |
|
return (NULL); |
|
} |
|
if (s[at] != '\0') |
|
*offset = at + 1; |
|
else |
|
*offset = at; |
|
value[n] = '\0'; |
|
return (value); |
|
} |
|
|
static void |
static void |
tty_term_override(struct tty_term *term, const char *override) |
tty_term_override(struct tty_term *term, const char *override) |
{ |
{ |
const struct tty_term_code_entry *ent; |
const struct tty_term_code_entry *ent; |
struct tty_code *code; |
struct tty_code *code; |
char *next, *s, *copy, *cp, *value; |
size_t offset = 0; |
|
char *cp, *value, *s; |
const char *errstr; |
const char *errstr; |
u_int i; |
u_int i; |
int n, remove; |
int n, remove; |
|
|
copy = next = xstrdup(override); |
s = tty_term_override_next(override, &offset); |
|
if (s == NULL || fnmatch(s, term->name, 0) != 0) |
s = strsep(&next, ":"); |
|
if (s == NULL || next == NULL || fnmatch(s, term->name, 0) != 0) { |
|
free(copy); |
|
return; |
return; |
} |
|
|
|
while ((s = strsep(&next, ":")) != NULL) { |
while ((s = tty_term_override_next(override, &offset)) != NULL) { |
if (*s == '\0') |
if (*s == '\0') |
continue; |
continue; |
value = NULL; |
value = NULL; |
|
|
|
|
if (remove) |
if (remove) |
log_debug("%s override: %s@", term->name, s); |
log_debug("%s override: %s@", term->name, s); |
|
else if (*value == '\0') |
|
log_debug("%s override: %s", term->name, s); |
else |
else |
log_debug("%s override: %s=%s", term->name, s, value); |
log_debug("%s override: %s=%s", term->name, s, value); |
|
|
|
|
|
|
free(value); |
free(value); |
} |
} |
free(s); |
|
} |
} |
|
|
struct tty_term * |
struct tty_term * |