|
|
1.1 ! root 1: #ifndef lint ! 2: static char sccsid[] = "@(#)tttermcap.c 3.6 9/20/85"; ! 3: #endif ! 4: ! 5: /* ! 6: * Copyright (c) 1983 Regents of the University of California, ! 7: * All rights reserved. Redistribution permitted subject to ! 8: * the terms of the Berkeley Software License Agreement. ! 9: */ ! 10: ! 11: #include "tt.h" ! 12: ! 13: char *tgetstr(); ! 14: char *tgoto(); ! 15: char *malloc(); ! 16: ! 17: tttputc(c) ! 18: { ! 19: ttputc(c); ! 20: } ! 21: ! 22: ttxputc(c) ! 23: { ! 24: *tt_strp++ = c; ! 25: } ! 26: ! 27: struct tt_str * ! 28: tttgetstr(str) ! 29: char *str; ! 30: { ! 31: register struct tt_str *s; ! 32: ! 33: if ((str = tgetstr(str, &tt_strp)) == 0) ! 34: return 0; ! 35: if ((s = (struct tt_str *) malloc(sizeof *s)) == 0) ! 36: return 0; ! 37: s->ts_str = str; ! 38: s->ts_n = tt_strp - s->ts_str - 1; ! 39: return s; ! 40: } ! 41: ! 42: struct tt_str * ! 43: ttxgetstr(str) ! 44: char *str; ! 45: { ! 46: register struct tt_str *s; ! 47: char buf[100]; ! 48: char *bufp = buf; ! 49: ! 50: if (tgetstr(str, &bufp) == 0) ! 51: return 0; ! 52: if ((s = (struct tt_str *) malloc(sizeof *s)) == 0) ! 53: return 0; ! 54: s->ts_str = tt_strp; ! 55: tputs(buf, 1, ttxputc); ! 56: s->ts_n = tt_strp - s->ts_str; ! 57: *tt_strp++ = 0; ! 58: return s; ! 59: } ! 60: ! 61: tttgoto(s, col, row) ! 62: struct tt_str *s; ! 63: { ! 64: register char *p = s->ts_str; ! 65: ! 66: ttputs(tgoto(p, col, row)); ! 67: for (p += s->ts_n; *--p == 0;) ! 68: ttputc(0); ! 69: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.