* Copyright (c) 1980, 1988 The Regents of the University of California.
* %sccs.include.redist.c%
"@(#) Copyright (c) 1980, 1988 The Regents of the University of California.\n\
static char sccsid
[] = "@(#)tput.c 5.7 (Berkeley) %G%";
int ch
, exitval
, n
, outc();
char *cptr
, *p
, *term
, buf
[1024], tbuf
[1024];
char *getenv(), *tgetstr(), *realname();
while ((ch
= getopt(argc
, argv
, "T:")) != EOF
)
if (!term
&& !(term
= getenv("TERM"))) {
(void)fprintf(stderr
, "tput: no terminal type specified.\n");
if (tgetent(tbuf
, term
) != 1) {
(void)fprintf(stderr
, "tput: tgetent failure.\n");
for (cptr
= buf
, exitval
= 0; p
= *argv
; ++argv
) {
if (!strcmp(p
, "longname"))
(void)tputs(buf
, 1, outc
);
else if ((n
= tgetnum(p
)) != -1)
for (p
= buf
; *p
&& *p
!= ':'; ++p
);
for (*p
= '\0'; p
>= buf
&& *p
!= '|'; --p
);
(void)printf("%s\n", p
+ 1);
extern int errno
, ospeed
;
if (tcgetattr(STDOUT_FILENO
, &t
) != -1)
ospeed
= cfgetospeed(&t
);
(void)fprintf(stderr
, "usage: tput [-T term] attribute ...\n");