1 /*****************************************************************************
2 * intf_console.c: generic console for interface
3 *****************************************************************************
4 * Copyright (C) 1998, 1999, 2000 VideoLAN
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 *****************************************************************************/
23 /*****************************************************************************
25 *****************************************************************************/
28 #include <stdlib.h> /* malloc() */
32 /*****************************************************************************
33 * intf_console_t: console descriptor
34 *****************************************************************************
35 * Generic console object. This object will have a representation depending of
37 *****************************************************************************/
38 typedef struct intf_console_s
40 /* Text and history arrays - last line/command has indice 0 */
41 char * psz_text[INTF_CONSOLE_MAX_TEXT];
42 char * psz_history[INTF_CONSOLE_MAX_HISTORY];
45 /*****************************************************************************
47 *****************************************************************************/
49 /*****************************************************************************
50 * intf_ConsoleCreate: create console
51 *****************************************************************************
52 * This function will initialize the console object.
53 * It returns NULL on error.
54 *****************************************************************************/
55 intf_console_t *intf_ConsoleCreate( void )
57 intf_console_t *p_console;
59 p_console = malloc( sizeof( intf_console_t ) );
63 /*****************************************************************************
65 *****************************************************************************
66 * Destroy the console instance initialized by intf_ConsoleCreate.
67 *****************************************************************************/
68 void intf_ConsoleDestroy( intf_console_t *p_console )
73 /*****************************************************************************
74 * intf_ConsoleClear: clear console
75 *****************************************************************************
77 *****************************************************************************/
78 void intf_ConsoleClear( intf_console_t *p_console )
83 /*****************************************************************************
84 * intf_ConsolePrint: print a message to console
85 *****************************************************************************
86 * Print a message to the console.
87 *****************************************************************************/
88 void intf_ConsolePrint( intf_console_t *p_console, char *psz_str )
94 /*****************************************************************************
95 * intf_ConsoleExec: execute a command in console
96 *****************************************************************************
97 * This function will run a command and print its result in console.
98 *****************************************************************************/
99 void intf_ConsoleExec( intf_console_t *p_console, char *psz_str )
104 /* following functions are local */