version 1.3, 1997/01/17 07:13:44 |
version 1.4, 1997/07/25 22:13:24 |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
|
#include <err.h> |
#include "extern.h" |
#include "extern.h" |
|
|
char tbuf[1024]; /* Termcap entry. */ |
char tbuf[1024]; /* Termcap entry. */ |
|
|
|
|
/* Find the termcap entry. If it doesn't exist, ask the user. */ |
/* Find the termcap entry. If it doesn't exist, ask the user. */ |
while ((rval = tgetent(tbuf, ttype)) == 0) { |
while ((rval = tgetent(tbuf, ttype)) == 0) { |
(void)fprintf(stderr, |
warnx("terminal type %s is unknown", ttype); |
"tset: terminal type %s is unknown\n", ttype); |
|
ttype = askuser(NULL); |
ttype = askuser(NULL); |
} |
} |
if (rval == -1) |
if (rval == -1) |
err("termcap: %s", strerror(errno ? errno : ENOENT)); |
warnx("termcap: %s", strerror(errno ? errno : ENOENT)); |
*tcapbufp = tbuf; |
*tcapbufp = tbuf; |
return (ttype); |
return (ttype); |
} |
} |
|
|
char *p; |
char *p; |
|
|
/* We can get recalled; if so, don't continue uselessly. */ |
/* We can get recalled; if so, don't continue uselessly. */ |
if (feof(stdin) || ferror(stdin)) { |
if (feof(stdin) || ferror(stdin)) |
(void)fprintf(stderr, "\n"); |
|
exit(1); |
exit(1); |
} |
|
for (;;) { |
for (;;) { |
if (dflt) |
if (dflt) |
(void)fprintf(stderr, "Terminal type? [%s] ", dflt); |
(void)fprintf(stderr, "Terminal type? [%s] ", dflt); |