home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 3 Comm
/
03-Comm.zip
/
TE2HOST.ZIP
/
TYPEFILE.SCR
< prev
next >
Wrap
Text File
|
1990-12-27
|
2KB
|
87 lines
;; --------------------------------------------------------------------------
;;
;; TypeFile.scr -- Host mode script suite for TE/2
;; Copyright 1990, Oberon Software, All rights reserved
;;
;; --------------------------------------------------------------------------
global string CmdStack
global string FileSpec
global string DfltSpec
global integer WatchUser
integer FileHandle
string buffer
integer count
integer KeyIn
;; ------------------------------------------------------------------------
;; Display a text file at the remote. This function is also used
;; internally; if "CmdStack" is not empty, we skip the user prompt
;; and go right to the file. As in subroutine DiskDirectory, this
;; does not now, but probably should, limit lower priv users to the
;; current directory.
subroutine TypeFile
if strlen(CmdStack) == 0
transmit("^M^JType a File")
DfltSpec = ""
run("getfspec.scr")
else
FileSpec = CmdStack
CmdStack = ""
endif
if strlen(FileSpec) > 0
if strstr(FileSpec, "*") or strstr(FileSpec, "?")
transmit("^M^JSorry. This function does not handle wildcards^M^J")
else
FileHandle = fopen(FileSpec, "r")
if (FileHandle & 0xffff)
termecho(FALSE)
localecho(FALSE)
transmit("^[[2J")
message("^M^JUser is typing file [%s]", FileSpec)
buffer = fgets(FileHandle)
count = 1
do while strlen(buffer)
transmit("%s^M", buffer)
count = count + 1
if count == ScrLength
transmit("Press any key to continue...")
KeyIn = rgetc(30, 1)
if KeyIn == 27 or timedout
transmit("^M^J")
break
endif
count = 1
transmit("^[[2J")
endif
buffer = fgets(FileHandle)
loop
fclose(FileHandle)
if WatchUser
termecho(TRUE)
localecho(TRUE)
endif
else
transmit("^M^JCannot open file [%s]^M^J", FileSpec)
endif
endif
transmit("^M^JPress any key to continue...")
rgetc(30, 1)
endif
endsub
program
gosub TypeFile
end