Changeset 491af07 in mainline
- Timestamp:
- 2009-01-22T07:20:03Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 721d3a27
- Parents:
- d752cf4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/mknewcmd
rd752cf4 r491af07 47 47 -h, --help-entry Entry function for command help (def: help_cmd_${def}) 48 48 -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)51 49 -t, --type Type of command (module or builtin) (def: module) 52 50 -H, --help This help summary … … 68 66 69 67 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'. 72 69 73 70 Skeletal files do *not* depend on the autoconf generated "config.h" unless you … … 98 95 &${CMDENTRY}, 99 96 &${HELPENTRY}, 100 ${CMDRESTRICT}101 97 }, 102 98 … … 108 104 &${CMDENTRY}, 109 105 &${HELPENTRY}, 110 ${CMDRESTRICT}111 106 }, 112 107 … … 168 163 #include "cmds.h" 169 164 170 static c har *cmdname = "${CMDNAME}";165 static const char *cmdname = "${CMDNAME}"; 171 166 172 167 /* Dispays help for ${CMDNAME} in various levels */ … … 235 230 [ $# = 0 ] && usage && exit 1; 236 231 237 TEMP=$(getopt -o n:d:e:h:a: r:t:HV \238 --long name:,desc:,entry:,help-entry:,alias:, restrict:,type:,help,version \232 TEMP=$(getopt -o n:d:e:h:a:t:HV \ 233 --long name:,desc:,entry:,help-entry:,alias:,type:,help,version \ 239 234 -- "$@") || { 240 235 echo "Try $PROGNAME --help for help" … … 267 262 -a | --alias) 268 263 CMDALIAS="$2" 269 shift 2270 continue271 ;;272 -r | --restrict)273 CMDRESTRICT="$2"274 264 shift 2 275 265 continue … … 306 296 [ -n "$OUTDIR" ] || OUTDIR="${CMDTYPE}s/${CMDNAME}" 307 297 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 it316 case "$CMDRESTRICT" in317 0 | both)318 CMDRESTRICT="0"319 ;;320 1 | non-interactive)321 CMDRESTRICT="1"322 ;;323 -1 | interactive)324 CMDRESTRICT="-1"325 ;;326 *)327 usage328 exit 1329 ;;330 esac331 298 332 299 # Do a little sanity
Note:
See TracChangeset
for help on using the changeset viewer.