1 | /* |
---|
2 | * |
---|
3 | * Instantatiate a new terminal shell. |
---|
4 | * |
---|
5 | * Author: |
---|
6 | * |
---|
7 | * WORK: fernando.ruiz@ctv.es |
---|
8 | * HOME: correo@fernando-ruiz.com |
---|
9 | * |
---|
10 | * Thanks at: |
---|
11 | * Chris John |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef __SHELL_H__ |
---|
17 | #define __SHELL_H__ |
---|
18 | |
---|
19 | #ifdef __cplusplus |
---|
20 | extern "C" { |
---|
21 | #endif |
---|
22 | |
---|
23 | #include <rtems.h> |
---|
24 | #include <stdio.h> |
---|
25 | #include <termios.h> |
---|
26 | |
---|
27 | typedef int (*shell_command_t)(int argc,char * argv[]); |
---|
28 | |
---|
29 | struct shell_cmd_tt ; |
---|
30 | typedef struct shell_cmd_tt shell_cmd_t; |
---|
31 | |
---|
32 | struct shell_cmd_tt { |
---|
33 | char * name; |
---|
34 | char * usage; |
---|
35 | char * topic; |
---|
36 | shell_command_t command; |
---|
37 | shell_cmd_t * alias; |
---|
38 | shell_cmd_t * next; |
---|
39 | }; |
---|
40 | |
---|
41 | rtems_unsigned32 new_rtems_name(char * rtems_name); |
---|
42 | shell_cmd_t * shell_lookup_cmd(char * cmd); |
---|
43 | shell_cmd_t * shell_add_cmd(char * cmd, |
---|
44 | char * topic, |
---|
45 | char * usage, |
---|
46 | shell_command_t command); |
---|
47 | shell_cmd_t * shell_alias_cmd(char * cmd, char * alias); |
---|
48 | |
---|
49 | int shell_make_args(char * cmd, |
---|
50 | int * pargc, |
---|
51 | char * argv[]); |
---|
52 | |
---|
53 | typedef struct { |
---|
54 | rtems_name magic; /* 'S','E','N','V': Shell Environment */ |
---|
55 | char * devname; |
---|
56 | char * taskname; |
---|
57 | tcflag_t tcflag; |
---|
58 | /* user extensions */ |
---|
59 | int exit_shell; /* logout */ |
---|
60 | int forever ; /* repeat login */ |
---|
61 | int errorlevel; |
---|
62 | int mdump_adr; |
---|
63 | } shell_env_t; |
---|
64 | |
---|
65 | int shell_scanline(char * line,int size,FILE * in,FILE * out) ; |
---|
66 | void cat_file(FILE * out,char *name); |
---|
67 | void write_file(char *name,char * content); |
---|
68 | |
---|
69 | rtems_status_code shell_init(char * task_name , |
---|
70 | rtems_unsigned32 task_stacksize,/*0 default*/ |
---|
71 | rtems_task_priority task_priority , |
---|
72 | char * devname , |
---|
73 | tcflag_t tcflag , |
---|
74 | int forever ); |
---|
75 | |
---|
76 | extern shell_env_t global_shell_env, |
---|
77 | * current_shell_env; |
---|
78 | /*--------*/ |
---|
79 | /* cmds.c */ |
---|
80 | /*--------*/ |
---|
81 | int str2int(char * s); |
---|
82 | void register_cmds(void); |
---|
83 | |
---|
84 | #ifdef __cplusplus |
---|
85 | } |
---|
86 | #endif |
---|
87 | |
---|
88 | #endif |
---|