Changeset 88944695 in mainline


Ignore:
Timestamp:
2008-08-28T08:32:06Z (16 years ago)
Author:
Tim Post <echo@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a56f4b2
Parents:
69145dae
Message:

More house cleaning, don't expose beyond what's needed

Location:
uspace/app/bdsh
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/exec.c

    r69145dae r88944695  
    4949char *found;
    5050
     51static char *find_command(char *);
     52static unsigned int try_access(const char *);
     53
    5154/* work-around for access() */
    52 unsigned int try_access(const char *f)
     55static unsigned int try_access(const char *f)
    5356{
    5457        int fd;
     
    6467/* Returns the full path of "cmd" if cmd is found, else just hand back
    6568 * cmd as it was presented */
    66 char *find_command(char *cmd)
     69static char *find_command(char *cmd)
    6770{
    6871        char *path_tok;
  • uspace/app/bdsh/exec.h

    r69145dae r88944695  
    44#include <task.h>
    55
    6 extern char *find_command(char *);
    76extern unsigned int try_exec(char *, char **);
    8 extern unsigned int try_access(const char *);
    9 
    107#endif
  • uspace/app/bdsh/input.c

    r69145dae r88944695  
    4444extern volatile unsigned int cli_interactive;
    4545
     46/* Not exposed in input.h */
     47static void cli_restricted(char *);
     48static void read_line(char *, int);
     49
    4650/* More than a macro than anything */
    47 void cli_restricted(char *cmd)
     51static void cli_restricted(char *cmd)
    4852{
    4953        printf("%s is not available in %s mode\n", cmd,
     
    8286        }
    8387
    84         /* Check what kind of command argv[0] might be, TODO: move this to
    85          * a function */
     88        /* Its a builtin command */
    8689        if ((i = (is_builtin(cmd[0]))) > -1) {
     90                /* Its not available in this mode, see what try_exec() thinks */
    8791                if (builtin_is_restricted(i)) {
    8892                                rc = try_exec(cmd[0], cmd);
    8993                                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. */
    9097                                        cli_restricted(cmd[0]);
    9198                                goto finit;
    9299                }
     100                /* Its a builtin, its available, run it */
    93101                rc = run_builtin(i, cmd, usr);
    94102                goto finit;
     103        /* We repeat the same dance for modules */
    95104        } else if ((i = (is_module(cmd[0]))) > -1) {
    96105                if (module_is_restricted(i)) {
     
    103112                goto finit;
    104113        } 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 */
    105117                rc = try_exec(cmd[0], cmd);
    106118                goto finit;
     
    119131
    120132/* Borrowed from Jiri Svoboda's 'cli' uspace app */
    121 void read_line(char *buffer, int n)
     133static void read_line(char *buffer, int n)
    122134{
    123135        char c;
     
    145157}
    146158
     159/* TODO:
     160 * Implement something like editline() / readline(), if even
     161 * just for command history and making arrows work. */
    147162void get_input(cliuser_t *usr)
    148163{
  • uspace/app/bdsh/input.h

    r69145dae r88944695  
    55
    66/* prototypes */
     7
     8extern void get_input(cliuser_t *);
    79extern 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);
    1110
    1211#endif
  • uspace/app/bdsh/scli.h

    r69145dae r88944695  
    1111        char *cwd;
    1212        char *prompt;
    13         uint64_t lasterr;
     13        int lasterr;
    1414} cliuser_t;
    1515
Note: See TracChangeset for help on using the changeset viewer.