All pastes #510805 Raw Edit

Someone

public shellscript v1 · immutable
#510805 ·published 2007-05-26 02:21 UTC
rendered paste body
#!/bin/bashfunction get_listargs(){    unset x ARGS_ARRAY    # Hackish list-parsing    while test $# -gt 0 && test x"${1:0:1}" != x"-"; do        ARGS_ARRAY[x++]="$1"        shift    done    # Do not skip past the next argument    if test $# -gt 0 && test x"${1:0:1}" = x"-";then        DO_SHIFT=false    fi}################################################################################       Process arguments to the script, set up VARS and WORK_DIR             ################################################################################# ***********************************# EXECUTION BEGINS HERE# ***********************************egrep -q 'titleset-mode|switched-mode|menu-only' <<< "$@" && NONAME=:! $NONAME && yecho $"$SCRIPT_NAME"while test $# -gt 0; do    DO_SHIFT=:    case "$1" in        "-files" )            shift            get_listargs "$@"            for f in  ${!ARGS_ARRAY[@]}; do                FILES[f]="$(abspath "${ARGS_ARRAY[f]}")"            done            ;;        "-titleset" )            shift            unset x ARGS_ARRAY            while test $# -gt 0 && test "$1" != "-end-titleset"; do shift ; done            if test $# -gt 0 && test x"${1:0:1}" = x"-";then DO_SHIFT=false; fi            TITLESET_OPTS[y++]="${ARGS_ARRAY[@]}"            DO_TITLESETS=:            ;;       "-vmgm" )            shift            unset x ARGS_ARRAY            # Hackish list-parsing            while test $# -gt 0 && test "$1" != "-end-vmgm"; do                ARGS_ARRAY[x++]="$1"                shift            done            # Do not skip past the next argument            if test $# -gt 0 && test x"${1:0:1}" = x"-";then                DO_SHIFT=false            fi            VMGM_OPTS=( "${ARGS_ARRAY[@]}" )            ;;       "-out" )            shift            OUT_PREFIX="$1"            ;;        "-no-ask" | "-noask" )            NOASK=:            ;;        "-no-warn" | "-nowarn" )            NO_WARN=:            ;;        "-keep-files" | "-keepfiles" )            KEEP_FILES=:            KEEPFILES="-keep-files"            ;;        "-dvd" )            TARGET=dvd            ;;        "-svcd" )            TARGET=svcd            ;;        "-ntsc" )            TV_STANDARD=ntsc            ;;        "-pal" )            TV_STANDARD=pal            ;;# etc etc . . . . .    esac    $DO_SHIFT && shiftdone