home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / SCRIPTS.ZIP / UPL.T < prev    next >
Encoding:
Text File  |  1995-04-22  |  3.8 KB  |  126 lines

  1.     :: See comments at end of the file Rev Apr 22 95
  2.     open -!tgx %item
  3.     echoc "upl.t: processing %item"
  4.     set s1 ""    : flag indicatng Sysop quota exceeded
  5. cloop:    grab s0
  6.     while "t&&!%s0" grab s0
  7.     ss s0 "^(@)(.*)"
  8.     if "t&&%z1" echof "Command Line: %z2"; obey "%z2"; goback cloop
  9.     closetx
  10.     set ifs "     "        : split on space or tab
  11.     split s0
  12.     if "!%z2" goto failed
  13.     if !f%z2 goto nofile
  14.     if !f%z1 goto nofile
  15.     pat
  16.     pat 0cp " ^Q " "\021"
  17.     pat 1v "\nDL "
  18.     pat 6v "\nLIB %z3"
  19.     pat 7c "(AGREE/<CR>)" "AGREE\r"
  20.     on !c o; fail
  21.     if az3 put "\025DL%z3\r"    : get to proper DL section
  22.     else put "\025DL0\r"
  23.     wait -f40
  24.     if !1&&!6 goto failed
  25.     wait -f1
  26.  
  27.     set typ "bin"
  28.     if jz0,.doc set typ "ascii"
  29.     if jz0,.txt set typ "ascii"
  30.     if %z4 sets typ %z4
  31.  
  32.     echoc "Enabling c mode"
  33.     ena -c
  34.     put "upl %z0/type:%typ/proto:b\r"
  35.     pat 2cv "Replace it" "y\r"
  36.     pat 4cv "File name truncated to " "y\r"
  37.     pat 1v "File name for your computer"
  38.     pat 3v "Please notify the Sy"
  39.     wait -f40
  40.     if 3 set s1 "quota"; goto failed
  41.     if !1 goto failed
  42.     wait -f1
  43.     put "\025\T%z1";  put "\r"
  44.     timestamp
  45.     pat 1v "Description"
  46.     pat 2v "?DO_UPL-ERR"
  47.     wait -f60
  48.     :: CIS uploads the file here (B Protocol)
  49.     echoc "Disabling c mode"
  50.     dis -c
  51.     timestamp
  52.     if 2 goto failed
  53.     if !1 echo "Didn't find pattern 2"; wait -f40
  54.     if 2 goto failed
  55.     if !1 echo "Didn't find pattern 2"; wait -f40
  56.     if 2 goto failed
  57.     wait -f1
  58.     pat 1v "okay"
  59.     pg10; ena -p; pq8; put "\025"
  60.     pat 4c "6 EXIT" "6\r"
  61.     open -g!x %z2
  62.     wait -f40
  63.     ena -t!p
  64.     timestamp
  65.     pv5
  66.     put "\025Y\r"
  67.     pat 5v "soon as"
  68.     wait -f400
  69.     pv0
  70.     timestamp
  71.     if !5 echoc "Timeout (400 seconds!) waiting for completion message.";  goto failed
  72.     if !dv  "!%mv %item cisupl/done"
  73.     if dv "!%rename %item [.cisupl.done]%item"
  74.     goto final
  75. nofile:    echoc "FILE %z0 or %z1 NOT FOUND!!!"
  76. failed:    echoc "Upload (control file %item) failed"
  77.     ena -t!p
  78. final:    nolog closetx
  79.     echoc "upl.t finished with %item"
  80.     pat
  81.     pat 1v "Forum !\b"    :Desired response
  82.     pat 2v "Function: \b"    :Desired response
  83.     put "\r"
  84.     wait -f20
  85.     pe0
  86.     if %s1 fail        : Terminate "expand" if quota problem
  87.     return
  88.  
  89. :: Upload a file to a SIG, assumes we are at the SIG Function: prompt
  90. :: and (hopefully) returns us there.  Gives up on error.
  91. :: This is called by a line such as:
  92.     if %s8 obey "expand upl.t cisupl/%s8*"
  93. :: and expects to find one line CONTROL FILES such as:
  94.  
  95. disinf.txt $p/disinfo.txt /t/yam/disinf.key 0 ascii
  96.  
  97. :: The control file may have any number of optional leading command lines,
  98. ::    @immediate command(s)
  99.  
  100. :: where the first field is the SIG filename, the second field is the
  101. :: pathname on the YAM system, the third field the pathname for the
  102. :: description/key file, the fourth field is the DL section number.
  103. :: Am optional fifth field gives the upload type (ascii), default bin.
  104. ::
  105. :: The descritpion file contains the description (500 char max), a
  106. :: /exit line, the keywords, and the title (sample below):
  107.  
  108. DSZ is optimized to be called from a bulletin board or other comm
  109. program to support YMODEM and fast ZMODEM file transfers.  This version
  110. has buffered XMIT for greater throughput, esp. with multitasking
  111. executives.  Automatic selection of comm port, baud rate, etc with
  112. override.  Supports 32 bit CRC, wild card xfers, recovery from line
  113. disconnects, etc.  See dsz.dqc and the ZCOMM or Pro-YAM user's manual
  114. for more information, also ZMODEM.DOC. (part of ZMODEM.ARC).
  115. /exit
  116. ZMODEM YMODEM CRC-16 FILE-TRANSFER THROUGHPUT XMODEM CRC-32
  117. Program Title (50 chars max)
  118.  
  119. :: This script assumes the SIG editor has been selected, it will not
  120. :: wotk with the line editor.
  121. ::
  122. :: Upon successful upload, the control file is moved to the "done"
  123. :: subdirectory, or the "failed" subdirectory otherwise.
  124. :: File is uploaded as type bin unless it has an extension of .doc or .txt
  125. :: The optional fifth field (if present) overrides the above choice.
  126.