10e3d5408SPeter Wemm /**************************************************************************** 25ca44d1cSRong-En Fan * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * 30e3d5408SPeter Wemm * * 40e3d5408SPeter Wemm * Permission is hereby granted, free of charge, to any person obtaining a * 50e3d5408SPeter Wemm * copy of this software and associated documentation files (the * 60e3d5408SPeter Wemm * "Software"), to deal in the Software without restriction, including * 70e3d5408SPeter Wemm * without limitation the rights to use, copy, modify, merge, publish, * 80e3d5408SPeter Wemm * distribute, distribute with modifications, sublicense, and/or sell * 90e3d5408SPeter Wemm * copies of the Software, and to permit persons to whom the Software is * 100e3d5408SPeter Wemm * furnished to do so, subject to the following conditions: * 110e3d5408SPeter Wemm * * 120e3d5408SPeter Wemm * The above copyright notice and this permission notice shall be included * 130e3d5408SPeter Wemm * in all copies or substantial portions of the Software. * 140e3d5408SPeter Wemm * * 150e3d5408SPeter Wemm * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 160e3d5408SPeter Wemm * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 170e3d5408SPeter Wemm * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 180e3d5408SPeter Wemm * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 190e3d5408SPeter Wemm * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 200e3d5408SPeter Wemm * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 210e3d5408SPeter Wemm * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 220e3d5408SPeter Wemm * * 230e3d5408SPeter Wemm * Except as contained in this notice, the name(s) of the above copyright * 240e3d5408SPeter Wemm * holders shall not be used in advertising or otherwise to promote the * 250e3d5408SPeter Wemm * sale, use or other dealings in this Software without prior written * 260e3d5408SPeter Wemm * authorization. * 270e3d5408SPeter Wemm ****************************************************************************/ 280e3d5408SPeter Wemm 290e3d5408SPeter Wemm /**************************************************************************** 300e3d5408SPeter Wemm * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 * 310e3d5408SPeter Wemm * and: Eric S. Raymond <esr@snark.thyrsus.com> * 324a1a9510SRong-En Fan * and: Thomas E. Dickey 1996-on * 330e3d5408SPeter Wemm ****************************************************************************/ 340e3d5408SPeter Wemm 350e3d5408SPeter Wemm /* 360e3d5408SPeter Wemm * clear.c -- clears the terminal's screen 370e3d5408SPeter Wemm */ 380e3d5408SPeter Wemm 395ca44d1cSRong-En Fan #define USE_LIBTINFO 400e3d5408SPeter Wemm #include <progs.priv.h> 410e3d5408SPeter Wemm 425ca44d1cSRong-En Fan MODULE_ID("$Id: clear.c,v 1.11 2007/10/13 22:16:02 tom Exp $") 430e3d5408SPeter Wemm 444a1a9510SRong-En Fan static int 454a1a9510SRong-En Fan putch(int c) 460e3d5408SPeter Wemm { 470e3d5408SPeter Wemm return putchar(c); 480e3d5408SPeter Wemm } 490e3d5408SPeter Wemm 504a1a9510SRong-En Fan int 514a1a9510SRong-En Fan main( 520e3d5408SPeter Wemm int argc GCC_UNUSED, 530e3d5408SPeter Wemm char *argv[]GCC_UNUSED) 540e3d5408SPeter Wemm { 550e3d5408SPeter Wemm setupterm((char *) 0, STDOUT_FILENO, (int *) 0); 564a1a9510SRong-En Fan ExitProgram((tputs(clear_screen, lines > 0 ? lines : 1, putch) == ERR) 570e3d5408SPeter Wemm ? EXIT_FAILURE 584a1a9510SRong-En Fan : EXIT_SUCCESS); 590e3d5408SPeter Wemm } 60