Telehack/path2arg.bas

15 lines
519 B
QBasic
Raw Permalink Normal View History

REM Convert a uupath to arguments (replace bangs with spaces).
REM Optionally if the first argument is a command, run it with the rest of the arguments.
REM Usage: path2arg.bas [command] <path>
IF ARGC% < 2 THEN PRINT "Usage: path2arg.bas [command] <path>" : END
HOSTNAME$=TH_SED$(TH_HOSTNAME$,"\s.*","")
PATH$=TH_SED$(ARG$,HOSTNAME$,"","g")
PATH$=TH_SED$(PATH$,"!"," ","g")
IF ARGV$(1) = "run" THEN GOTO 10
IF TH_RE(DIR$,"[^w]"+ARGV$(1),0) > 0 THEN GOSUB 10
PRINT PATH$
END
10 PRINT "Running "+PATH$
TH_EXEC PATH$
END