version 1.22, 2001/01/29 01:58:24 |
version 1.23, 2001/02/28 22:58:52 |
|
|
#include <dump_entry.h> |
#include <dump_entry.h> |
#include <transform.h> |
#include <transform.h> |
|
|
MODULE_ID("$From: tset.c,v 0.48 2000/11/04 22:50:15 tom Exp $") |
MODULE_ID("$From: tset.c,v 0.49 2001/02/24 23:29:33 tom Exp $") |
|
|
extern char **environ; |
extern char **environ; |
|
|
|
|
static void |
static void |
cat(char *file) |
cat(char *file) |
{ |
{ |
register int fd, nr, nw; |
register int fd, nr; |
char buf[BUFSIZ]; |
char buf[BUFSIZ]; |
|
|
if ((fd = open(file, O_RDONLY, 0)) < 0) |
if ((fd = open(file, O_RDONLY, 0)) < 0) |
failed(file); |
failed(file); |
|
|
while ((nr = read(fd, buf, sizeof(buf))) > 0) |
while ((nr = read(fd, buf, sizeof(buf))) > 0) |
if ((nw = write(STDERR_FILENO, buf, (size_t) nr)) == -1) |
if (write(STDERR_FILENO, buf, (size_t) nr) == -1) |
failed("write to stderr"); |
failed("write to stderr"); |
if (nr != 0) |
if (nr != 0) |
failed(file); |
failed(file); |
|
|
static const char * |
static const char * |
get_termcap_entry(char *userarg) |
get_termcap_entry(char *userarg) |
{ |
{ |
int rval, errret; |
int errret; |
char *p; |
char *p; |
const char *ttype; |
const char *ttype; |
#if HAVE_GETTTYNAM |
#if HAVE_GETTTYNAM |
|
|
ttype = askuser(0); |
ttype = askuser(0); |
} |
} |
/* Find the terminfo entry. If it doesn't exist, ask the user. */ |
/* Find the terminfo entry. If it doesn't exist, ask the user. */ |
while ((rval = setupterm((NCURSES_CONST char *) ttype, STDOUT_FILENO, |
while (setupterm((NCURSES_CONST char *) ttype, STDOUT_FILENO, &errret) |
&errret)) != OK) { |
!= OK) { |
if (errret == 0) { |
if (errret == 0) { |
(void) fprintf(stderr, "tset: unknown terminal type %s\n", |
(void) fprintf(stderr, "tset: unknown terminal type %s\n", |
ttype); |
ttype); |