Changeset 6279151 in mainline for uspace/app/bdsh/README


Ignore:
Timestamp:
2008-09-14T15:49:50Z (16 years ago)
Author:
Tim Post <echo@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
40cb3996
Parents:
809813d
Message:

Update README and mknewcmd to reflect changes in command entry points

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/README

    r809813d r6279151  
    5858
    5959/* Types for module command entry and help */
    60 typedef int * (* mod_entry_t)(char **);
    61 typedef void * (* mod_help_t)(unsigned int);
     60typedef int (* mod_entry_t)(char **);
     61typedef void (* mod_help_t)(unsigned int);
    6262
    6363/* Built-in commands need to be able to modify cliuser_t */
    64 typedef int * (* builtin_entry_t)(char **, cliuser_t *);
    65 typedef void * (* builtin_help_t)(unsigned int);
     64typedef int (* builtin_entry_t)(char **, cliuser_t *);
     65typedef void (* builtin_help_t)(unsigned int);
    6666
    6767As you can see, both modular and builtin commands expect an array of
     
    1541542: Change your "usage()" command as shown:
    155155     -- void usage(...)
    156      ++ void * help_cmd_foo(unsigned int level)
    157      -- return;
    158      ++ retrn CMD_VOID;
     156     ++ void help_cmd_foo(unsigned int level)
    159157
    160158     'level' is either 0 or 1, indicating the level of help requested.
     
    1641623: Change the programs "main()" as shown:
    165163     -- int main(int argc, char **argv)
    166      ++ int * cmd_foo(char **argv)
     164     ++ int cmd_foo(char **argv)
    167165     -- return 1;
    168166     ++ return CMD_FAILURE;
     
    170168     ++ return CMD_SUCCESS;
    171169
    172      If main() returns an int that is not 1 or 0 (e.g. 127), cast it as
    173      such:
    174 
    175      -- return 127;
    176      ++ return (int *) 127;
    177 
    178      NOTE: _ONLY_ the main and help entry points need to return int * or
    179      void *, respectively. Also take note that argc has changed. The type
    180      for entry points may soon change.
    181 
    182170     NOTE: If main is void, you'll need to change it and ensure that its
    183171     expecting an array of arguments, even if they'll never be read or
     
    185173
    186174     -- void main(void)
    187      ++ int * cmd_foo(char **argv)
    188 
    189      Similararly, do not try to return CMD_VOID within the modules main
    190      entry point. If somehow you escape the compiler yelling at you, you
    191      will surely see pretty blue and yellow fireworks once its reached.
     175     ++ int cmd_foo(char **argv)
    192176
    1931774: Don't expose more than the entry and help points:
Note: See TracChangeset for help on using the changeset viewer.