function getopt1{2typeset c optstring=$1 options= sep=3shift4while getopts $optstring c5do case $c in6[:?])7exit 28;;9*)10options="$options$sep-$c"11sep=' '12if [[ $optstring == *$c:* ]]13then options=" $options $OPTARG"14fi15#then print -rn -- " -$c" "$OPTARG"16#else print -rn -- " -$c"17;;18esac19done20print -rn -- "$options"21if [[ ${@:$OPTIND-1} != -- ]]22then print -rn -- " --"23fi24if [[ -n ${@:$OPTIND} ]]25then print -r -- " ${@:$OPTIND}"26fi27}282930