! 10 Mar 89
! Name:		qproto.cmd
! Usage:	used internally by autoq.cmd as: 'do qproto system'
!
! prototype file for automatic file transfer queueing process
! this file can be changed to customize the exact file transfer process

retries 2			! 3 tries total

on abort
	log "\^C operator abort"
	? "^C operator abort"
	logfile close
	return
endon

? "Connecting to $1"
log "Connecting to $1"
iferror CONNECT $1			!* $(nodeext)
	return
endif

iferror STARTSERVER
	noerror HANGUP
	return
endif

wait 1				! required for TERMCRC protocol

! the for loop below reads all requests for this system
! and executes them as term scripts.  The requests typically
! contain a single XFER or GET statement
for request in ($1.*) do
	if tolower(right(request,len(nodeext))) != nodeext
		iferror DO $(request)
		else
			noerror erase $(request)
		endif
	endif
endfor

noerror STOPSERVER
wait 1
noerror HANGUP

return
