Changeset e2ea8d7e in mainline for uspace/app/bdsh/scli.c


Ignore:
Timestamp:
2008-08-27T05:36:12Z (16 years ago)
Author:
Tim Post <echo@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1b4b7b6
Parents:
b510d52
Message:

Housekeeping list, complete lingering things before they get forgotten:

  • cli_*() now sets a global cli_errno, error functions cleaned up
  • Finish internal cli_*() functions in util.c
  • Don't expose cli_init() or cli_finit()
  • Get rid of unused globals
  • Don't set globals in commands themselves
  • Update README files
  • Fix stale comments
File:
1 edited

Legend:

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

    rb510d52 re2ea8d7e  
    4343static cliuser_t usr;
    4444
    45 /* Modified by the 'quit' module, which is compiled before this */
    46 extern unsigned int cli_quit;
    47 
    48 /* Globals that are modified during start-up that modules/builtins should
    49  * be aware of. */
     45/* Globals that are modified during start-up that modules/builtins
     46 * should be aware of. */
     47volatile unsigned int cli_quit = 0;
    5048volatile unsigned int cli_interactive = 1;
    5149volatile unsigned int cli_verbocity = 1;
     
    5553const char *progname = PACKAGE_NAME;
    5654
     55/* These are not exposed, even to builtins */
     56static int cli_init(cliuser_t *usr);
     57static void cli_finit(cliuser_t *usr);
     58
    5759/* (re)allocates memory to store the current working directory, gets
    58  * and updates the current working directory, formats the prompt string */
     60 * and updates the current working directory, formats the prompt
     61 * string */
    5962unsigned int cli_set_prompt(cliuser_t *usr)
    6063{
     
    7881                snprintf(usr->cwd, PATH_MAX, "(unknown)");
    7982
    80         snprintf(usr->prompt,
    81                         PATH_MAX,
    82                         "%s # ",
    83                         usr->cwd);
     83        if (1 < cli_psprintf(&usr->prompt, "%s # ", usr->cwd)) {
     84                cli_error(cli_errno, "Failed to set prompt");
     85                return 1;
     86        }
    8487
    8588        return 0;
    8689}
    8790
    88 int cli_init(cliuser_t *usr)
     91/* Constructor */
     92static int cli_init(cliuser_t *usr)
    8993{
    9094        usr->line = (char *) NULL;
     
    99103
    100104/* Destructor */
    101 void cli_finit(cliuser_t *usr)
     105static void cli_finit(cliuser_t *usr)
    102106{
    103107        if (NULL != usr->line)
Note: See TracChangeset for help on using the changeset viewer.