Changeset 88944695 in mainline
- Timestamp:
- 2008-08-28T08:32:06Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a56f4b2
- Parents:
- 69145dae
- Location:
- uspace/app/bdsh
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/exec.c
r69145dae r88944695 49 49 char *found; 50 50 51 static char *find_command(char *); 52 static unsigned int try_access(const char *); 53 51 54 /* work-around for access() */ 52 unsigned int try_access(const char *f)55 static unsigned int try_access(const char *f) 53 56 { 54 57 int fd; … … 64 67 /* Returns the full path of "cmd" if cmd is found, else just hand back 65 68 * cmd as it was presented */ 66 char *find_command(char *cmd)69 static char *find_command(char *cmd) 67 70 { 68 71 char *path_tok; -
uspace/app/bdsh/exec.h
r69145dae r88944695 4 4 #include <task.h> 5 5 6 extern char *find_command(char *);7 6 extern unsigned int try_exec(char *, char **); 8 extern unsigned int try_access(const char *);9 10 7 #endif -
uspace/app/bdsh/input.c
r69145dae r88944695 44 44 extern volatile unsigned int cli_interactive; 45 45 46 /* Not exposed in input.h */ 47 static void cli_restricted(char *); 48 static void read_line(char *, int); 49 46 50 /* More than a macro than anything */ 47 void cli_restricted(char *cmd)51 static void cli_restricted(char *cmd) 48 52 { 49 53 printf("%s is not available in %s mode\n", cmd, … … 82 86 } 83 87 84 /* Check what kind of command argv[0] might be, TODO: move this to 85 * a function */ 88 /* Its a builtin command */ 86 89 if ((i = (is_builtin(cmd[0]))) > -1) { 90 /* Its not available in this mode, see what try_exec() thinks */ 87 91 if (builtin_is_restricted(i)) { 88 92 rc = try_exec(cmd[0], cmd); 89 93 if (rc) 94 /* No external matching it could be found, tell the 95 * user that the command does exist, but is not 96 * available in this mode. */ 90 97 cli_restricted(cmd[0]); 91 98 goto finit; 92 99 } 100 /* Its a builtin, its available, run it */ 93 101 rc = run_builtin(i, cmd, usr); 94 102 goto finit; 103 /* We repeat the same dance for modules */ 95 104 } else if ((i = (is_module(cmd[0]))) > -1) { 96 105 if (module_is_restricted(i)) { … … 103 112 goto finit; 104 113 } else { 114 /* Its not a module or builtin, restricted or otherwise. 115 * See what try_exec() thinks of it and just pass its return 116 * value back to the caller */ 105 117 rc = try_exec(cmd[0], cmd); 106 118 goto finit; … … 119 131 120 132 /* Borrowed from Jiri Svoboda's 'cli' uspace app */ 121 void read_line(char *buffer, int n)133 static void read_line(char *buffer, int n) 122 134 { 123 135 char c; … … 145 157 } 146 158 159 /* TODO: 160 * Implement something like editline() / readline(), if even 161 * just for command history and making arrows work. */ 147 162 void get_input(cliuser_t *usr) 148 163 { -
uspace/app/bdsh/input.h
r69145dae r88944695 5 5 6 6 /* prototypes */ 7 8 extern void get_input(cliuser_t *); 7 9 extern int tok_input(cliuser_t *); 8 extern void get_input(cliuser_t *);9 extern void cli_restricted(char *);10 extern void read_line(char *, int);11 10 12 11 #endif -
uspace/app/bdsh/scli.h
r69145dae r88944695 11 11 char *cwd; 12 12 char *prompt; 13 uint64_t lasterr;13 int lasterr; 14 14 } cliuser_t; 15 15
Note:
See TracChangeset
for help on using the changeset viewer.