1 /*
2  * cmd_reset.c - User command to clear the current work buffer.
3  *
4  * Copyright (C) 1995, 1996 by Scott C. Gray
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, write to the Free Software
18  * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  * You may contact the author :
21  *   e-mail:  gray@voicenet.com
22  *            grays@xtend-tech.com
23  *            gray@xenotropic.com
24  */
25 #include <stdio.h>
26 #include "sqsh_config.h"
27 #include "sqsh_global.h"
28 #include "sqsh_env.h"
29 #include "sqsh_cmd.h"
30 #include "cmd.h"
31 #if defined(USE_READLINE)
32 #include "sqsh_readline.h"
33 #endif
34 
35 /*-- Current Version --*/
36 #if !defined(lint) && !defined(__LINT__)
37 static char RCS_Id[] = "$Id: cmd_reset.c,v 1.3 2013/04/04 10:52:35 mwesdorp Exp $" ;
38 USE(RCS_Id)
39 #endif /* !defined(lint) */
40 
41 
42 /*
43  * cmd_clear:
44  *
45  * sqsh-2.1.7 - Clears the current g_sqlbuf without saving the buffer
46  * in the history.
47  */
48 int cmd_clear( argc, argv )
49 	int    argc ;
50 	char  *argv[] ;
51 {
52 	if( argc != 1 ) {
53 		fprintf( stderr, "Too many arguments to \\clear\n" ) ;
54 		return CMD_FAIL ;
55 	}
56 #if defined(USE_READLINE)
57 	if (g_interactive) {
58 	        _rl_clear_screen ();
59 	}
60 #endif
61 	return CMD_CLEARBUF ;
62 }
63 
64 /*
65  * cmd_reset:
66  *
67  * Clears the current g_sqlbuf.
68  */
cmd_reset(argc,argv)69 int cmd_reset( argc, argv )
70 	int    argc ;
71 	char  *argv[] ;
72 {
73 	if( argc != 1 ) {
74 		fprintf( stderr, "Too many arguments to \\reset\n" ) ;
75 		return CMD_FAIL ;
76 	}
77 
78 	return CMD_RESETBUF ;
79 }
80 
81