source: rtems/cpukit/libmisc/shell/shell.h @ 87fb080d

4.104.114.84.95
Last change on this file since 87fb080d was b2712e3, checked in by Joel Sherrill <joel.sherrill@…>, on 05/24/01 at 21:58:39

2000-05-24 Fernando Ruiz Casas <fernando.ruiz@…>

  • monitor/mon-prmisc.c: Correct print line.
  • shell/Makefile.am: Added new file telnetd.c.
  • shell/telnetd.c, shell/telnetd.h, shell/pty.c: New files.
  • shell/shell.c, shell/cmds.c, shell/shell.h: Numerous improvments:
    • The shell_init has a new parameter 'forever' because in /dev/console you need that this process runs forever but in tcp/ip not. (respawn?)
    • A new task for every session opened trought tcp/ip telnet client. (the chargen,daytime and more are possible of implementation but I ask me if they are necesary)
    • Exit from the session delete the task and when the client fails too.
    • More cmds have been implemented. (very reduced version of these) umask, chmod, id, whoami, rm, cat, ...
    • A reduced line edit has been implemented.

Ctrl-C abort the input,
Ctrl-d in the first position gives EOF (logout).
'\b' and DEL makes the rubout operation.
I think that readline() for every session spents a lot of resources.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 *  $Id$
3 */
4
5#ifndef __SHELL_H__
6#define __SHELL_H__
7
8#ifdef __cplusplus
9extern "C" {
10#endif 
11
12#include <rtems.h>     
13#include <stdio.h>     
14#include <termios.h>   
15
16typedef int (*shell_command_t)(int argc,char * argv[]);
17
18struct shell_cmd_tt ;
19typedef struct shell_cmd_tt shell_cmd_t;
20
21struct shell_cmd_tt {
22 char * name;
23 char * usage;
24 char * topic;
25 shell_command_t command;
26 shell_cmd_t * alias;
27 shell_cmd_t * next;
28};
29
30rtems_unsigned32 new_rtems_name(char * rtems_name);
31shell_cmd_t * shell_lookup_cmd(char * cmd);
32shell_cmd_t * shell_add_cmd(char * cmd,
33                            char * topic,
34                            char * usage,
35                            shell_command_t command);
36shell_cmd_t * shell_alias_cmd(char * cmd, char * alias);
37
38int shell_make_args(char * cmd,
39                    int  * pargc,
40                    char * argv[]);
41
42typedef struct  {
43  rtems_name magic; /* 'S','E','N','V': Shell Environment */   
44  char * devname;
45  char * taskname;
46  tcflag_t tcflag;
47  /* user extensions */
48  int  exit_shell; /* logout */
49  int  forever   ; /* repeat login */
50  int  errorlevel;
51  int  mdump_adr;
52} shell_env_t;
53
54int shell_scanline(char * line,int size,FILE * in,FILE * out) ;
55void cat_file(FILE * out,char *name);
56       
57rtems_status_code shell_init(char * task_name      ,
58                              rtems_unsigned32    task_stacksize,/*0 default*/
59                              rtems_task_priority task_priority ,
60                              char * devname      ,
61                              tcflag_t tcflag     ,
62                              int forever         );   
63
64extern shell_env_t global_shell_env,
65                *  current_shell_env;
66/*--------*/
67/* pty.c */
68/*--------*/
69
70char * get_pty(int socket);
71
72
73rtems_device_driver pty_initialize(
74  rtems_device_major_number  major,
75  rtems_device_minor_number  minor,
76  void                      *arg);
77rtems_device_driver pty_open(
78  rtems_device_major_number major,
79  rtems_device_minor_number minor,
80  void                    * arg);
81rtems_device_driver pty_close(
82  rtems_device_major_number major,
83  rtems_device_minor_number minor,
84  void                    * arg);
85rtems_device_driver pty_read(
86  rtems_device_major_number major,
87  rtems_device_minor_number minor,
88  void                    * arg);
89rtems_device_driver pty_write(
90  rtems_device_major_number major,
91  rtems_device_minor_number minor,
92  void                    * arg);
93rtems_device_driver pty_control(
94  rtems_device_major_number major,
95  rtems_device_minor_number minor,
96  void                    * arg);
97
98
99#define PTY_DRIVER_TABLE_ENTRY \
100       { pty_initialize , pty_open , pty_close , \
101         pty_read , pty_write , pty_control }
102/*--------*/
103/* cmds.c */
104/*--------*/
105int str2int(char * s);
106void register_cmds(void);
107 
108#ifdef __cplusplus
109}
110#endif 
111
112#endif
Note: See TracBrowser for help on using the repository browser.