view lib/interp @ 3026:c8ea00fb641d

<shachaf> addquote <mnoqy> the theory\'s probably not bad, but calculus is one of those things that\'s so dang applicable that everyone only ever talks about how to apply it and compute with it and uuuuurgh(barf) <mnoqy> so i stay away from it
author HackBot
date Sun, 02 Jun 2013 04:42:47 +0000
parents 859f9b4339e6
children d6d2d7192923
line wrap: on
line source

#!/bin/sh

export I_CMD="$0"
export I_ARG="$1"
export ARG_FILE="/tmp/input.$$"

get_arg() {
    #if expr "$I_ARG" : "http://" > /dev/null
    #then
    #    wget $WGET_OPTIONS "$I_ARG" -O "$ARG_FILE"
    #else
        printf '%s' "$I_ARG" > "$ARG_FILE"
    #fi
}

clean_arg() {
    rm -f "$ARG_FILE"
}

interp_stdin() {
    get_arg
    $1 < "$ARG_FILE" 2>&1
    clean_arg
}

interp_file() {
    get_arg
    $1 "$ARG_FILE" 2>&1
    clean_arg
}

interp_stdin_java() {
    get_arg
    cd $1
    java $2 < "$ARG_FILE" 2>&1
    clean_arg
}

interp_file_java() {
    get_arg
    cd $1
    java $2 "$ARG_FILE" 2>&1
    clean_arg
}