view lib/interp @ 11756:b54d740965c9 draft

<oerjan> # Preserve fizzie\'s repaired version//`mk src/hello3.c//const char main[] = "%0000%HELOPPPPPPT]5Hell1E XP5o wo1E$XP5rld!1E(XP4@4J1E,4@4GPZ$AP_^^^^T^\\x0f\\x05XX\\xc3";
author HackEso <hackeso@esolangs.org>
date Thu, 21 Mar 2019 23:50:20 +0000
parents 7b17fe055014
children 9cb638b68832
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
}