from calling exit() when given an unknown terminal type.
From Anton Lindqvist, who also upstreamed the fix.
#include <sys/ioctl.h>
+#include <err.h>
#include <term.h>
#include <termios.h>
{
char *t1, *t2;
char *term;
+ int err;
/*
* Find out what kind of terminal this is.
term = DEFAULT_TERM;
hardcopy = 0;
- if (setupterm(term, 1, NULL) < 0) {
- hardcopy = 1;
+ if (setupterm(term, 1, &err) < 0) {
+ if (err == 1)
+ hardcopy = 1;
+ else
+ errx(1, "%s: unknown terminal type", term);
}
if (hard_copy == 1)
hardcopy = 1;