1 /*****************************************************************************
2 * intf_console.c: generic console for interface
4 *****************************************************************************/
6 /*****************************************************************************
8 *****************************************************************************/
13 /*****************************************************************************
14 * intf_console_t: console descriptor
15 *****************************************************************************
16 * Generic console object. This object will have a representation depending of
18 *****************************************************************************/
19 typedef struct intf_console_s
21 /* Text and history arrays - last line/command has indice 0 */
22 char * psz_text[INTF_CONSOLE_MAX_TEXT];
23 char * psz_history[INTF_CONSOLE_MAX_HISTORY];
26 /*****************************************************************************
28 *****************************************************************************/
30 /*****************************************************************************
31 * intf_ConsoleCreate: create console
32 *****************************************************************************
33 * This function will initialize the console object.
34 * It returns NULL on error.
35 *****************************************************************************/
36 intf_console_t *intf_ConsoleCreate( void )
38 intf_console_t *p_console;
40 p_console = malloc( sizeof( intf_console_t ) );
44 /*****************************************************************************
46 *****************************************************************************
47 * Destroy the console instance initialized by intf_ConsoleCreate.
48 *****************************************************************************/
49 void intf_ConsoleDestroy( intf_console_t *p_console )
54 /*****************************************************************************
55 * intf_ConsoleClear: clear console
56 *****************************************************************************
58 *****************************************************************************/
59 void intf_ConsoleClear( intf_console_t *p_console )
64 /*****************************************************************************
65 * intf_ConsolePrint: print a message to console
66 *****************************************************************************
67 * Print a message to the console.
68 *****************************************************************************/
69 void intf_ConsolePrint( intf_console_t *p_console, char *psz_str )
75 /*****************************************************************************
76 * intf_ConsoleExec: execute a command in console
77 *****************************************************************************
78 * This function will run a command and print its result in console.
79 *****************************************************************************/
80 void intf_ConsoleExec( intf_console_t *p_console, char *psz_str )
85 /* following functions are local */