gnu@hoptoad.uucp (John Gilmore) (11/09/88)
We have an old terminal here without the "ce" (clear to end of line) feature, so I hacked larn 12.0 a bit to clear the line out with spaces if no "ce" entry exists. Context diff from the 8 Aug 88 net.sources.games posting by condor!noah follows. Sorry for the long lines, they were in the original game. diff -c -r1.1 io.c *** /tmp/,RCSt1a01161 Tue Nov 8 15:26:34 1988 --- io.c Tue Nov 8 15:26:31 1988 *************** *** 638,647 **** exit(); } if (!CE) /* can't find clear to end of line entry */ { ! write(2, "Sorry, for a ",13); write(2, term, strlen(term)); ! write(2,", I can't find the clear to end of line entry in termcap\n",57); ! exit(); } if (!CL) /* can't find clear entire screen entry */ { --- 638,680 ---- exit(); } if (!CE) /* can't find clear to end of line entry */ + /* + * We always clear from column 1, so we can fake CE by + * printing a full width of blanks and a carriage + * return -- if we know the terminal's width. We + * actually only print "full width"-1 to avoid problems + * with automatic margins; the "am" termcap entry is + * not sufficiently precise to let us know if printing + * in the last column will or won't move to another + * line. This may result in a character "sticking" in + * the last column (not being erased) but them's the + * brakes. -- gnu@toad.com, 8Nov88 + */ { ! int cols; char *p; ! ! cols = tgetnum("co"); /* Columns on screen */ ! if (cols != -1) { ! CE = malloc(cols + 2); ! if (CE == 0) { ! p = "Sorry, out of memory.\n"; ! write(2, p, strlen(p)); ! exit(2); ! } else { ! p = CE; ! while (--cols > 0) *p++ = ' '; ! *p++ = '\r'; ! *p = '\0'; ! } ! } else { ! write(2, "Sorry, for a ",13); ! write(2, term, strlen(term)); ! p = ", I can't find the clear to end of line\ ! (cl) entry\n\ ! or the number of columns (co) entry in termcap\n"; ! write(2,p,strlen(p)); ! exit(1); ! } } if (!CL) /* can't find clear entire screen entry */ { -- John Gilmore {sun,pacbell,uunet,pyramid,amdahl}!hoptoad!gnu gnu@toad.com Noriega-Bush in '88 -- a *crack* team. Let's put the white powder (CIA = Cocaine Import Agency) in the white house!