This commit is contained in:
cvs
2002-08-22 11:06:28 +00:00
parent b7f5cd8d24
commit ac002aca73
7 changed files with 103 additions and 41 deletions

View File

@@ -1,9 +1,12 @@
program tecs_client
real temp
character device*32, start*80, line*80, cmd*16, par*80, response*1024
character inst*64, host*64, user*1, pcod*1
integer i,j,k,iret,l,port
integer maxfiles
real wait
parameter (maxfiles=10)
integer nfiles/0/, mfiles/0/, idx, luns(0:maxfiles-1)
character cmdpar*128
character prompt*32/'tecs>'/
integer promptlen/6/
@@ -82,8 +85,25 @@
l=0
1 if (oneCommand) goto 99
call sys_rd_line(line, l, prompt(1:promptlen))
if (l .lt. 0) goto 99
if (nfiles .gt. 0) then
read(luns(idx), '(q,a)', err=22,end=22) l, line
print '(x,2a)', prompt(1:promptlen),line(1:max(1,l))
else
call sys_rd_line(line, l, prompt(1:promptlen))
if (l .lt. 0) goto 99
endif
if (line(1:1) .eq. '@') then
nfiles=nfiles+1
idx=mod(nfiles, maxfiles)
if (nfiles .gt. mfiles+maxfiles) then ! close files which are too much nested
close(luns(idx))
mfiles=nfiles-maxfiles
else
call sys_get_lun(luns(idx))
endif
open(luns(idx), name=line(2:), status='old', readonly)
goto 1
endif
11 l=l+1
line(l:l)=' '
cmd=' '
@@ -230,6 +250,10 @@
elseif (cmd .eq. 'watch') then
iret=tecs_watch_log(par)
if (iret .lt. 0) goto 19
elseif (cmd .eq. 'wait') then
read(par, *, err=17,end=17) wait
call sys_wait(wait*60.0)
17 continue
else
iret=tecs_set_par(cmd, par, 2)
if (iret .lt. 0) goto 19
@@ -245,6 +269,18 @@
endif
goto 1
22 continue ! end of file
close(luns(idx))
call sys_free_lun(luns(idx))
nfiles=nfiles-1
if (nfiles .lt. mfiles) then
print *,'too many files nested'
mfiles=0
nfiles=0
endif
idx=mod(nfiles,maxfiles)
goto 1
90 call tecs_write_error(6)
92 call exit(40) ! Abort