1 /*****************************************************************************
2 * intf_console.c: generic console for interface
3 *****************************************************************************
4 * Copyright (C) 1998, 1999, 2000 VideoLAN
5 * $Id: intf_console.c,v 1.7 2001/03/21 13:42:34 sam Exp $
7 * Authors: Vincent Seguin <seguin@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
29 #include <stdlib.h> /* malloc() */
33 /*****************************************************************************
34 * intf_console_t: console descriptor
35 *****************************************************************************
36 * Generic console object. This object will have a representation depending of
38 *****************************************************************************/
39 typedef struct intf_console_s
41 /* Text and history arrays - last line/command has indice 0 */
42 char * psz_text[INTF_CONSOLE_MAX_TEXT];
43 char * psz_history[INTF_CONSOLE_MAX_HISTORY];
46 /*****************************************************************************
48 *****************************************************************************/
50 /*****************************************************************************
51 * intf_ConsoleCreate: create console
52 *****************************************************************************
53 * This function will initialize the console object.
54 * It returns NULL on error.
55 *****************************************************************************/
56 intf_console_t *intf_ConsoleCreate( void )
58 intf_console_t *p_console;
60 p_console = malloc( sizeof( intf_console_t ) );
64 /*****************************************************************************
66 *****************************************************************************
67 * Destroy the console instance initialized by intf_ConsoleCreate.
68 *****************************************************************************/
69 void intf_ConsoleDestroy( intf_console_t *p_console )
74 /*****************************************************************************
75 * intf_ConsoleClear: clear console
76 *****************************************************************************
78 *****************************************************************************/
79 void intf_ConsoleClear( intf_console_t *p_console )
84 /*****************************************************************************
85 * intf_ConsolePrint: print a message to console
86 *****************************************************************************
87 * Print a message to the console.
88 *****************************************************************************/
89 void intf_ConsolePrint( intf_console_t *p_console, char *psz_str )
95 /*****************************************************************************
96 * intf_ConsoleExec: execute a command in console
97 *****************************************************************************
98 * This function will run a command and print its result in console.
99 *****************************************************************************/
100 void intf_ConsoleExec( intf_console_t *p_console, char *psz_str )
105 /* following functions are local */