clear.c revision 174993
18549Sjkh/**************************************************************************** 28549Sjkh * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * 38549Sjkh * * 48549Sjkh * Permission is hereby granted, free of charge, to any person obtaining a * 58549Sjkh * copy of this software and associated documentation files (the * 68549Sjkh * "Software"), to deal in the Software without restriction, including * 733132Sjkh * without limitation the rights to use, copy, modify, merge, publish, * 88549Sjkh * distribute, distribute with modifications, sublicense, and/or sell * 98549Sjkh * copies of the Software, and to permit persons to whom the Software is * 108549Sjkh * furnished to do so, subject to the following conditions: * 118549Sjkh * * 128549Sjkh * The above copyright notice and this permission notice shall be included * 138549Sjkh * in all copies or substantial portions of the Software. * 148549Sjkh * * 158549Sjkh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 168881Srgrimes * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 178881Srgrimes * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 188549Sjkh * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 198549Sjkh * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 208549Sjkh * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 218549Sjkh * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 228549Sjkh * * 238549Sjkh * Except as contained in this notice, the name(s) of the above copyright * 248549Sjkh * holders shall not be used in advertising or otherwise to promote the * 258549Sjkh * sale, use or other dealings in this Software without prior written * 268549Sjkh * authorization. * 278549Sjkh ****************************************************************************/ 288549Sjkh 298549Sjkh/**************************************************************************** 308549Sjkh * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * 318549Sjkh * and: Eric S. Raymond <esr@snark.thyrsus.com> * 328549Sjkh * and: Thomas E. Dickey 1996-on * 338549Sjkh ****************************************************************************/ 348549Sjkh 358549Sjkh/* 368549Sjkh * clear.c -- clears the terminal's screen 378549Sjkh */ 388549Sjkh 398549Sjkh#define USE_LIBTINFO 4010882Speter#include <progs.priv.h> 4110882Speter 428549SjkhMODULE_ID("$Id: clear.c,v 1.11 2007/10/13 22:16:02 tom Exp $") 438549Sjkh 448549Sjkhstatic int 458549Sjkhputch(int c) 468549Sjkh{ 478549Sjkh return putchar(c); 488549Sjkh} 498549Sjkh 508549Sjkhint 518549Sjkhmain( 528622Sjkh int argc GCC_UNUSED, 538549Sjkh char *argv[]GCC_UNUSED) 548549Sjkh{ 558702Sjkh setupterm((char *) 0, STDOUT_FILENO, (int *) 0); 568549Sjkh ExitProgram((tputs(clear_screen, lines > 0 ? lines : 1, putch) == ERR) 578672Sjkh ? EXIT_FAILURE 5812661Speter : EXIT_SUCCESS); 598549Sjkh} 6012661Speter