
Původně odeslal
jedik
AFAIR tohle proste v ANSI C neni.
Nevím, co je přesně v ANSI C (sám neprogramuju
), ale GNU clear vypadá takto:
Kód:
/*
* clear.c -- clears the terminal's screen
*/
#include <progs.priv.h>
MODULE_ID("$Id: clear.c,v 1.9 2005/09/25 00:46:43 tom Exp $")
static int putch(int c)
{
return putchar(c);
}
int main(
int argc GCC_UNUSED,
char *argv[] GCC_UNUSED)
{
setupterm((char *) 0, STDOUT_FILENO, (int *) 0);
return (tputs(clear_screen, lines > 0 ? lines : 1, putch) == ERR)
? EXIT_FAILURE
: EXIT_SUCCESS;
}