version 1.15, 2001/11/19 19:02:14 |
version 1.16, 2003/04/06 18:41:03 |
|
|
#endif |
#endif |
|
|
static char * |
static char * |
canonical_name(char *ptr, char *buf) |
canonical_name(char *ptr, char *buf, size_t bufl) |
/* extract the terminal type's primary name */ |
/* extract the terminal type's primary name */ |
{ |
{ |
char *bp; |
char *bp; |
|
|
(void) strcpy(buf, ptr); |
(void) strlcpy(buf, ptr, bufl); |
if ((bp = strchr(buf, '|')) != 0) |
if ((bp = strchr(buf, '|')) != 0) |
*bp = '\0'; |
*bp = '\0'; |
|
|
|
|
} |
} |
|
|
static void |
static void |
dump_numeric(int val, char *buf) |
dump_numeric(int val, char *buf, size_t bufl) |
/* display the value of a boolean capability */ |
/* display the value of a boolean capability */ |
{ |
{ |
switch (val) { |
switch (val) { |
case ABSENT_NUMERIC: |
case ABSENT_NUMERIC: |
strcpy(buf, s_absent); |
strlcpy(buf, s_absent, bufl); |
break; |
break; |
case CANCELLED_NUMERIC: |
case CANCELLED_NUMERIC: |
strcpy(buf, s_cancel); |
strlcpy(buf, s_cancel, bufl); |
break; |
break; |
default: |
default: |
sprintf(buf, "%d", val); |
snprintf(buf, bufl, "%d", val); |
break; |
break; |
} |
} |
} |
} |
|
|
static void |
static void |
dump_string(char *val, char *buf) |
dump_string(char *val, char *buf, size_t bufl) |
/* display the value of a string capability */ |
/* display the value of a string capability */ |
{ |
{ |
if (val == ABSENT_STRING) |
if (val == ABSENT_STRING) |
strcpy(buf, s_absent); |
strlcpy(buf, s_absent, bufl); |
else if (val == CANCELLED_STRING) |
else if (val == CANCELLED_STRING) |
strcpy(buf, s_cancel); |
strlcpy(buf, s_cancel, bufl); |
else { |
else { |
sprintf(buf, "'%.*s'", MAX_STRING - 3, TIC_EXPAND(val)); |
snprintf(buf, bufl, "'%.*s'", MAX_STRING - 3, TIC_EXPAND(val)); |
} |
} |
} |
} |
|
|
|
|
case CMP_NUMBER: |
case CMP_NUMBER: |
n1 = e1->tterm.Numbers[idx]; |
n1 = e1->tterm.Numbers[idx]; |
n2 = e2->tterm.Numbers[idx]; |
n2 = e2->tterm.Numbers[idx]; |
dump_numeric(n1, buf1); |
dump_numeric(n1, buf1, sizeof buf1); |
dump_numeric(n2, buf2); |
dump_numeric(n2, buf2, sizeof buf2); |
switch (compare) { |
switch (compare) { |
case C_DIFFERENCE: |
case C_DIFFERENCE: |
if (!((n1 == ABSENT_NUMERIC && n2 == ABSENT_NUMERIC)) && n1 != n2) |
if (!((n1 == ABSENT_NUMERIC && n2 == ABSENT_NUMERIC)) && n1 != n2) |
|
|
switch (compare) { |
switch (compare) { |
case C_DIFFERENCE: |
case C_DIFFERENCE: |
if (capcmp(idx, s1, s2)) { |
if (capcmp(idx, s1, s2)) { |
dump_string(s1, buf1); |
dump_string(s1, buf1, sizeof buf1); |
dump_string(s2, buf2); |
dump_string(s2, buf2, sizeof buf2); |
if (strcmp(buf1, buf2)) |
if (strcmp(buf1, buf2)) |
(void) printf("\t%s: %s, %s.\n", name, buf1, buf2); |
(void) printf("\t%s: %s, %s.\n", name, buf1, buf2); |
} |
} |
|
|
&& ((sp[3 + len] == 'h') || (sp[3 + len] == 'l'))) { |
&& ((sp[3 + len] == 'h') || (sp[3 + len] == 'l'))) { |
char buf3[MAX_TERMINFO_LENGTH]; |
char buf3[MAX_TERMINFO_LENGTH]; |
|
|
(void) strcpy(buf2, (sp[3 + len] == 'h') ? "DEC+" : "DEC-"); |
(void) strlcpy(buf2, (sp[3 + len] == 'h') ? "DEC+" : "DEC-", |
|
sizeof buf2); |
(void) strncpy(buf3, sp + 3, len); |
(void) strncpy(buf3, sp + 3, len); |
len += 4; |
len += 4; |
buf3[len] = '\0'; |
buf3[len] = '\0'; |
|
|
size_t tlen = strlen(ap->from); |
size_t tlen = strlen(ap->from); |
|
|
if (strncmp(ap->from, ep, tlen) == 0) { |
if (strncmp(ap->from, ep, tlen) == 0) { |
(void) strcat(buf2, ap->to); |
(void) strlcat(buf2, ap->to, sizeof buf2); |
found = TRUE; |
found = TRUE; |
break; |
break; |
} |
} |
} |
} |
|
|
if (!found) |
if (!found) |
(void) strcat(buf2, ep); |
(void) strlcat(buf2, ep, sizeof buf2); |
(void) strcat(buf2, ";"); |
(void) strlcat(buf2, ";", sizeof buf2); |
} while |
} while |
((ep = strtok((char *) 0, ";"))); |
((ep = strtok((char *) 0, ";"))); |
buf2[strlen(buf2) - 1] = '\0'; |
buf2[strlen(buf2) - 1] = '\0'; |
|
|
&& sp[2 + len] == 'm') { |
&& sp[2 + len] == 'm') { |
char buf3[MAX_TERMINFO_LENGTH]; |
char buf3[MAX_TERMINFO_LENGTH]; |
|
|
(void) strcpy(buf2, "SGR:"); |
(void) strlcpy(buf2, "SGR:", sizeof buf2); |
(void) strncpy(buf3, sp + 2, len); |
(void) strncpy(buf3, sp + 2, len); |
len += 3; |
len += 3; |
buf3[len] = '\0'; |
buf3[len] = '\0'; |
|
|
size_t tlen = strlen(ap->from); |
size_t tlen = strlen(ap->from); |
|
|
if (strncmp(ap->from, ep, tlen) == 0) { |
if (strncmp(ap->from, ep, tlen) == 0) { |
(void) strcat(buf2, ap->to); |
(void) strlcat(buf2, ap->to, sizeof buf2); |
found = TRUE; |
found = TRUE; |
break; |
break; |
} |
} |
} |
} |
|
|
if (!found) |
if (!found) |
(void) strcat(buf2, ep); |
(void) strlcat(buf2, ep, sizeof buf2); |
(void) strcat(buf2, ";"); |
(void) strlcat(buf2, ";", sizeof buf2); |
} while |
} while |
((ep = strtok((char *) 0, ";"))); |
((ep = strtok((char *) 0, ";"))); |
|
|
|
|
} |
} |
/* now check for scroll region reset */ |
/* now check for scroll region reset */ |
if (!expansion) { |
if (!expansion) { |
(void) sprintf(buf2, "\033[1;%dr", tp->Numbers[2]); |
(void) snprintf(buf2, sizeof buf2, "\033[1;%dr", tp->Numbers[2]); |
len = strlen(buf2); |
len = strlen(buf2); |
if (strncmp(buf2, sp, len) == 0) |
if (strncmp(buf2, sp, len) == 0) |
expansion = "RSR"; |
expansion = "RSR"; |
|
|
|
|
/* now check for home-down */ |
/* now check for home-down */ |
if (!expansion) { |
if (!expansion) { |
(void) sprintf(buf2, "\033[%d;1H", tp->Numbers[2]); |
(void) snprintf(buf2, sizeof buf2, "\033[%d;1H", tp->Numbers[2]); |
len = strlen(buf2); |
len = strlen(buf2); |
if (strncmp(buf2, sp, len) == 0) |
if (strncmp(buf2, sp, len) == 0) |
expansion = "LL"; |
expansion = "LL"; |
|
|
/* couldn't match anything */ |
/* couldn't match anything */ |
buf2[0] = *sp; |
buf2[0] = *sp; |
buf2[1] = '\0'; |
buf2[1] = '\0'; |
(void) strcat(buf, TIC_EXPAND(buf2)); |
(void) strlcat(buf, TIC_EXPAND(buf2), sizeof buf); |
} |
} |
} |
} |
(void) printf("%s\n", buf); |
(void) printf("%s\n", buf); |
|
|
if (entryeq(&qp->tterm, &rp->tterm) && useeq(qp, rp)) { |
if (entryeq(&qp->tterm, &rp->tterm) && useeq(qp, rp)) { |
char name1[NAMESIZE], name2[NAMESIZE]; |
char name1[NAMESIZE], name2[NAMESIZE]; |
|
|
(void) canonical_name(qp->tterm.term_names, name1); |
(void) canonical_name(qp->tterm.term_names, name1, sizeof name1); |
(void) canonical_name(rp->tterm.term_names, name2); |
(void) canonical_name(rp->tterm.term_names, name2, sizeof name2); |
|
|
(void) printf("%s = %s\n", name1, name2); |
(void) printf("%s = %s\n", name1, name2); |
} |
} |
|
|
entries[0] = *qp; |
entries[0] = *qp; |
entries[1] = *rp; |
entries[1] = *rp; |
|
|
(void) canonical_name(qp->tterm.term_names, name1); |
(void) canonical_name(qp->tterm.term_names, name1, sizeof name1); |
(void) canonical_name(rp->tterm.term_names, name2); |
(void) canonical_name(rp->tterm.term_names, name2, sizeof name2); |
|
|
switch (compare) { |
switch (compare) { |
case C_DIFFERENCE: |
case C_DIFFERENCE: |
|
|
name_initializer(const char *type) |
name_initializer(const char *type) |
{ |
{ |
static char *initializer; |
static char *initializer; |
|
static size_t len; |
char *s; |
char *s; |
|
|
if (initializer == 0) |
if (initializer == 0) { |
initializer = (char *) malloc(strlen(entries->tterm.term_names) + 20); |
len = strlen(entries->tterm.term_names) + 20; |
|
initializer = (char *) malloc(len); |
|
} |
|
|
(void) sprintf(initializer, "%s_data_%s", type, entries->tterm.term_names); |
(void) snprintf(initializer, len, "%s_data_%s", type, entries->tterm.term_names); |
for (s = initializer; *s != 0 && *s != '|'; s++) { |
for (s = initializer; *s != 0 && *s != '|'; s++) { |
if (!isalnum(CharOf(*s))) |
if (!isalnum(CharOf(*s))) |
*s = '_'; |
*s = '_'; |
|
|
str = "CANCELLED_NUMERIC"; |
str = "CANCELLED_NUMERIC"; |
break; |
break; |
default: |
default: |
sprintf(buf, "%d", term->Numbers[n]); |
snprintf(buf, sizeof buf, "%d", term->Numbers[n]); |
str = buf; |
str = buf; |
break; |
break; |
} |
} |