Commit 895af0a6 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a feature test "term" for having a adm3a term{info|cap} entry

parent ddc11003
......@@ -712,12 +712,32 @@ cmd_delay(CMD_ARGS)
* ignore_unknown_macro
* Do not fail the test if a string of the form ${...} is not
* recognized as a macro.
* term
* Support for ADM3A terminal
*
* Be careful with the last feature, because it may cause a test with a
* misspelled macro to fail silently. You should only need it if you must
* run a test with strings of the form "${...}".
*/
static int
test_term(struct vtclog *vl)
{
FILE *p;
int a, b, c;
p = popen("tput -T adm3a clear 2>&1", "r");
if (p == NULL)
return (0);
a = fgetc(p);
b = fgetc(p);
c = pclose(p);
if (a == 0x1a && b == EOF && c == 0)
return (1);
vtc_log(vl, 3, "No adm3a terminfo entry. (insteall ncurses-term ?)");
return (0);
}
static void
cmd_feature(CMD_ARGS)
{
......@@ -766,6 +786,7 @@ cmd_feature(CMD_ARGS)
FEATURE("user_varnish", getpwnam("varnish") != NULL);
FEATURE("user_vcache", getpwnam("vcache") != NULL);
FEATURE("group_varnish", getgrnam("varnish") != NULL);
FEATURE("term", test_term(vl));
if (!strcmp(*av, "disable_aslr")) {
good = 1;
......
......@@ -320,8 +320,7 @@ process_init_term(int fd)
tt.c_iflag = BRKINT | ICRNL | IMAXBEL | IXON | IXANY;
tt.c_lflag = ICANON | ISIG | IEXTEN;
tt.c_oflag = OPOST | ONLCR;
cfsetispeed(&tt, B9600);
cfsetospeed(&tt, B9600);
AZ(cfsetspeed(&tt, B9600));
tt.c_cc[VEOF] = '\x04'; // CTRL-D
tt.c_cc[VERASE] = '\x08'; // CTRL-H (Backspace)
tt.c_cc[VKILL] = '\x15'; // CTRL-U
......@@ -365,7 +364,7 @@ process_start(struct process *p)
p->pid = fork();
assert(p->pid >= 0);
if (p->pid == 0) {
setenv("TERM", "adm3a", 1);
AZ(setenv("TERM", "adm3a", 1));
assert(dup2(slave, STDIN_FILENO) == STDIN_FILENO);
assert(dup2(slave, STDOUT_FILENO) == STDOUT_FILENO);
assert(dup2(fd2[1], STDERR_FILENO) == STDERR_FILENO);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment