[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Various MiNT questions
>4. Has anyone written a clear program to clear the screen. An easy way would
>be to print the clear character to the screen, but to make it work for any
>term driver I guess it would require curses.
Here's an implemenation of "clear" which can also act as "reset" depending
upon the name it's invoked with.
Steve
--
---------------------------------------------------------------------------
Computer Systems Administrator, Dept. of Earth Sciences, Oxford University.
E-Mail: steve@uk.ac.ox.earth (JANET) steve@earth.ox.ac.uk (Internet).
Tel:- Oxford (0865) 282110 (UK) or +44 865 282110 (International).
--8<-- Cut -- Here --8<--
#include <stdio.h>
char *strchr(), *getenv(), *tgetstr();
void writechar();
main(argc, argv)
int argc;
char *argv[];
{
char buffer[1024];
char buffer2[1024];
char *termname, *string;
char *capability;
if (!strcmp("reset", argv[0]))
capability = "rs";
else
capability = "cl";
if ((termname = getenv("TERM")) == NULL)
exit(0);
if (tgetent(buffer, termname) != 1)
exit(0);
string = buffer2;
string = tgetstr("cl", &string);
tputs(string, 1, writechar);
}
void writechar(character)
char character;
{
write(fileno(stdout), &character, 1);
}