home *** CD-ROM | disk | FTP | other *** search
- /* sendfile - send a file through BT */
-
- /* This is a "prompted" ascii upload script written by Larry Phillips */
- /* It was written to demonstrate the usage of the ONSTRING and the */
- /* OFFSTRING commands. It was also written because Larry feels the */
- /* xprascii.library leaves a lot to be desired. */
-
- options results
-
- myport = openport('BT_msg')
- if myport = 0 then do
- MESSAGE "PORT ALREADY IN USE"
- exit
- end
-
- GETFILENAME
-
- if words(result) < 1 then do
- RESET
- exit
- end
-
- if open(infile,result,'r') ~= 0 then do
- ONSTRING "^M"
- do forever
- x = readln(infile)
- if EOF(infile) then do
- OFFSTRING
- call getout
- end
-
- SEND x
- call waitforit
- end
- end
-
- waitforit:
- packet = getpkt('BT_msg')
- do while packet = '00000000'x
- call waitpkt('BT_msg')
- packet = getpkt('BT_msg')
- end
- arg0 = getarg(packet)
- call reply(packet,0)
- select
- when arg0 = 'OFF' then return
- when arg0 = 'MATCH' then nop
- otherwise nop
- end
- return
-
- getout:
- do until arg0 = 'OFF'
- call waitforit
- end
- MESSAGE "----- File sent -----"
- RESET
- exit
-