Telehack/nlogin.bas
James Paterni c15dfa04d1 add .gitignore, update README, and implement new features in nlogin, path2arg, and scp scripts
* Update nlogin: Better file handling. Allows for future additional files to be copied.
* Add SCP: Efficiently copy files to remote systems
* add path2arg: uupath tool
2024-11-12 23:50:25 -05:00

36 lines
No EOL
974 B
QBasic

INFTP=0
COPYPROGS$="porthack.exe"
1 LASTHOST$ = TH_SED$(TH_HOSTNAME$,"\s.*","")
10 FOR I = 1 TO ARGC%-1
LASTHOST$ = TH_SED$(TH_HOSTNAME$,"\s.*","")
PRINT "Trying " + ARGV$(I) + " ("+STR$(I)+"/"+STR$(ARGC%-1)+")..."
IF TH_HASLOGIN(ARGV$(I)) = 0 THEN GOSUB 1000
21 TH_EXEC "rlogin "+ARGV$(I), DUMP$
GOSUB 2000
30 NEXT I
END
1000 PRINT "No login on " + ARGV$(I)
IF INSTR(DIR$, "porthack", 0) = -1 THEN GOSUB 2000 : REM Download porthack
TH_EXEC("porthack " + ARGV$(I))
RETURN
2000 FOR P=1 TO TH_RE(COPYPROGS$,"[\w.]+",1)
prog$=TH_RE$(COPYPROGS$,"[\w.]+",P)
IF INSTR(DIR$, prog$, 0) = -1 THEN GOSUB 2500
NEXT P
IF INFTP = 1 THEN GOSUB 3100
RETURN
2500 PRINT prog$+" not on " + TH_HOSTNAME$ + ". Trying to fetch it from " + LASTHOST$
IF INFTP = 0 GOSUB 3000
TH_EXEC "get " + prog$
RETURN
3000 TH_EXEC "ftp " + LASTHOST$
INFTP=1
RETURN
3100 TH_EXEC "quit"
INFTP=0
RETURN