Changeset 491af07 in mainline


Ignore:
Timestamp:
2009-01-22T07:20:03Z (15 years ago)
Author:
Tim Post <echo@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
721d3a27
Parents:
d752cf4
Message:

Update the mknewcmd script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/cmds/mknewcmd

    rd752cf4 r491af07  
    4747  -h, --help-entry   Entry function for command help (def: help_cmd_${def})
    4848  -a, --alias        Alias (nickname) for this command (def: none)
    49   -r, --restrict     Restriction level (interactive, non-interactive, both)
    50                      (def: module is both, builtin is interactive only)
    5149  -t, --type         Type of command (module or builtin) (def: module)
    5250  -H, --help         This help summary
     
    6866
    6967  The example would generate a modular command named 'foo', which is also
    70   reached by typing 'bar' and available in either interactive or noninteractive
    71   mode.
     68  reached by typing 'bar'.
    7269
    7370  Skeletal files do *not* depend on the autoconf generated "config.h" unless you
     
    9895        &${CMDENTRY},
    9996        &${HELPENTRY},
    100         ${CMDRESTRICT}
    10197},
    10298
     
    108104        &${CMDENTRY},
    109105        &${HELPENTRY},
    110         ${CMDRESTRICT}
    111106},
    112107
     
    168163#include "cmds.h"
    169164
    170 static char *cmdname = "${CMDNAME}";
     165static const char *cmdname = "${CMDNAME}";
    171166
    172167/* Dispays help for ${CMDNAME} in various levels */
     
    235230[ $# = 0 ] && usage && exit 1;
    236231
    237 TEMP=$(getopt -o n:d:e:h:a:r:t:HV \
    238 --long name:,desc:,entry:,help-entry:,alias:,restrict:,type:,help,version \
     232TEMP=$(getopt -o n:d:e:h:a:t:HV \
     233--long name:,desc:,entry:,help-entry:,alias:,type:,help,version \
    239234-- "$@") || {
    240235        echo "Try $PROGNAME --help for help"
     
    267262        -a | --alias)
    268263                CMDALIAS="$2"
    269                 shift 2
    270                 continue
    271         ;;
    272         -r | --restrict)
    273                 CMDRESTRICT="$2"
    274264                shift 2
    275265                continue
     
    306296[ -n "$OUTDIR" ] || OUTDIR="${CMDTYPE}s/${CMDNAME}"
    307297
    308 # Builtins typically only need to be available in interactive mode,
    309 # set the default accordingly.
    310 [ -n "$CMDRESTRICT" ] || {
    311         [ "$CMDTYPE" = "module" ] && CMDRESTRICT="both"
    312         [ "$CMDTYPE" = "builtin" ] && CMDRESTRICT="interactive"
    313 }
    314 
    315 # Set the restriction level as the structure expects to see it
    316 case "$CMDRESTRICT" in
    317         0 | both)
    318                 CMDRESTRICT="0"
    319         ;;
    320         1 | non-interactive)
    321                 CMDRESTRICT="1"
    322         ;;
    323         -1 | interactive)
    324                 CMDRESTRICT="-1"
    325         ;;
    326         *)
    327                 usage
    328                 exit 1
    329         ;;
    330 esac
    331298
    332299# Do a little sanity
Note: See TracChangeset for help on using the changeset viewer.