[comp.sys.atari.st] Latest version of uuslave for the ST

sansom@trwrb.UUCP (04/15/87)

This is the latest version of uuslave for the ST.  This version contains a
number of features which were missing from the first version, including the
ability to set the baud rate with a command line option.

Here is an "ls -l" of what will be in the next two postings:

-rw-r--r--  1 sansom        277 Apr 14 23:27 d_trwrbs.9c2
-rw-r--r--  1 sansom        447 Apr 14 23:27 logfile
-rw-r--r--  1 sansom      31496 Apr 14 23:17 uuslava.uue
-rw-r--r--  1 sansom      51753 Apr 14 23:23 uuslave.c
-rw-r--r--  1 sansom         67 Apr 14 23:28 x_trwrba.9c3

"uuslava.uue" is a "Dumas'" uuencoded uuslave.ttp, "uuslave.c" is the
source file, "logfile" is a sample log file generated by uuslave on the ST,
"d_trwrbs.9c2" is the data file transferred by our BSD 4.2 system, and
"x_trwrba.9c3" is the uuxqt command file.

You uucp system administrators will notice that the data and command files
have been "munged" by the ST in transit.  This is due to the MS/DOS flavored
filename conventions used by the ST.  There is a routine in uuslave.c -
munge_filename() - which converts the UNIX filename to one which is
acceptable on the the target machine.  This is the best idea I could come up
with for maintaining the original filename as much as possible, and still be
a "legal" GEMDOS filename.  If anyone out there has any better ideas, please
pass them on.

What you need to do:

    1) save this, and the next two uuslave postings
    2) using your favorite editor, extract all of the files
    3) uudecode the uuslava.uue file (preferably with Dumas' uudecode)
    4) get your uucp administrator to add a line to your site's L.sys
       file which looks something like this:

	    sitename Any ACU 1200 5555555 ogin: uucp\n ssword: s8000\n

       where "sitename" is the name you want your ST system to go by, 
       "Any" means that it's ok to call your system anytime there's work
       for it, "1200" is the default baud rate (you may change this if
       both you and your site have a faster line available), and "5555555"
       is your ST's phone number.

    5) queue up a file by mailing a letter to your ST system using a header
       similar to the following:

	    To: sitename!root
	    Subject: test

    6) execute uuslave on your ST with the following command:

	    uuslave -l [-bn]

       where "-l" specifies that uuslave is to mimic a UNIX login process, 
       and the "[-bn]" is an optional baud rate specification where "n"
       _must_ be one of the following:

	    0 = 19200 baud
	    1 =  9600 baud
	    2 =  4800 baud
	    3 =  3600 baud
	    4 =  2400 baud
	    5 =  2000 baud
	    6 =  1800 baud
	    7 =  1200 baud (default)

If you have any problems, execute uucico on your UNIX machine with the
following command:

	    uucico -r1 -ssitename -x9 >& uucico_out &

If you can't figure out what the problem is, go ahead and send me the
"uucico_out" file, and I'll see what I can do.

Many thanks to Martin Minow for his help with the Rsconf() call, and with
the Iorec() stuff.

Enjoy.

-Rich
-- 
   /////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  /// Richard E. Sansom                   TRW Electronics & Defense Sector \\\
  \\\ {decvax,ucbvax,ihnp4}!trwrb!sansom  Redondo Beach, CA                ///
   \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////

sansom@trwrb.UUCP (04/15/87)

Directions: search for each of the "cut here" lines, extract the named
files.

--- cut here, extract file uuslava.uue ---
table
 !"#$%&'()*+,-./0123456789:;<=>?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
begin 644 uuslave.ttp
M8!H  $9(   - @  L98                  "IO  0@;0 8T>T '"1M "Q"a
M@")(2A)G4"**)DHD64H:9OPBBDH29SP,&P!!9NP,&P!29N8,&P!'9N ,&P!6a
M9MH,&P ]9@I*$V<&(\L  %+Z0ID@"2**)DHD64H:9OPBBDH29O(F &8R0ID@a
M"2+\  !3'D7M ( 4&DB"0C(@ '(@%!IG%K0!9_A32B+*%!IG"K0!9OA"*O__a
M8.9"F2()T_D  %,@(\$  %,@+DDK20 $+PTCR   2&PO""\ DH#D@5-!/P&3a
MS2\)+PU"9S\\ $I.0=[\  Q*@V8N/SP !#\\  ).N0  ,N@^@$ZY   S-C]\a
M  (  D)73KD  #+H/H!.N0  ,S983YS.3KD   T(WOP "C\ 3KD  #&Z/SP a
M3$Y!3E8  ")\  $$>B!Y  $$SD'H "(Q(3(\  <A(5')__P_.0  4^ _.0  a
M]!0_.0  X_P_.0  4^)"9W $/P!P#S\ 3D[>_  .0F=.N0  ,;I43TY>3G5.a
M5O_X2-<@@# N  A^ "IN  J^;@ .;"AP 3\ < @_ $Y-6$]*@&?P$!5(@#\ a
M< $_ ' #/P!.35Q/4D=2C6#2, =,UR" 3EY.=4Y6   @>0  2+(CT   2*I.a
M7DYU3E8  $IN  AG*B\\   !PG F/P!.3EQ/,"X ",#\ ,A(0$) 2$#0N0  a
M2*HCP   2*Y@!D*Y  !(KDY>3G5.5O_\+P<O/  !!)9.N0  &1983TI 9P9Pa
M_V   *IP'C\ 3KD   '65$]P C\ < $_ $Y-6$]*@&<>< (_ ' "/P!.35A/a
M H    #_#$   V8&3KD   $B< $_ ' !/P!.35A/2H!G(D)G3KD   '65$]Pa
M 3\ < (_ $Y-6$\"@    /\^ # '8#Q*N0  2*YGF"\\   !PG F/P!.3EQ/a
M(#D  $BJL+D  $BN;0#_?' !/P O/  !!)9.N0  &21<3V  _V8N'TY>3G5.a
M5O_X2-< &' 0$\   ./^,"X "!/   #D # N  C@0!/   #D 4)$&#D  .0"a
M0D,6.0  Y %"01(Y  #D $) $#D  ./_- &U0#0#M4 T!+5 $\   .0#< $Sa
MP   X_I"0$S7 !A.7DYU3E8  ' )$\   ./_#'G__P  ]%1G## Y  #T5 ! a
M !!@"C Y  #T4 !  " 3P   Y )P_S/   #T5$)!$CD  .0",#RJJI!!/P!.a
MN0   N!43TY>3G5.5@  < D3P   X_\P+@ ($\   .0"0D$2.0  Y (P/*JJa
MD$$_ $ZY   "X%1/3EY.=4Y6__H,>0 !  #C^F803KD   702D!G!G !8  !a
M,#\Y  $$S"\\  #D!$ZY   74%Q/,#D  $CX$\   ./_,CD  016YTDP+@ .a
M[4C00=!Y  #T4!/   #D C N  X,0  "9P@,0  #9QA@;# N  RP>0 !!,QOa
M!DZY   7G' &8%(P.0 !!,R0;@ ,/4#_^@QN  '_^FP&3KD  !><< <]0/_\a
M#&X ?__Z;@PP+O_Z$\   .0$8" P+O_Z $  @!/   #D!# N__KN0!/   #Da
M!7 (/4#__#\N  PP+O_\2, &@   X_XO "\N  A.N0  %W3>_  */SD  03,a
M+SP  .0$3KD   K07$\SP   ]%)"0! Y  #D K%Y  #T4C \JJJ0>0  ]%(]a
M0/_^,#D  0164D "0  ',\   016/R[__DZY   "X%1/3EY.=4Y6_^Y(UR# a
M*FX "#XN  Q";O_\3KD   (4/4#__@Q __]G=# N__Q2;O_\,$#1_   D_ Pa
M+O_^ D  ?Q" ,"[__+!';<XP!U- /  P+O_\4T ]0/_Z2D9M+#!&T<T,$  Ja
M9R(P;O_ZT?P  )/P0D$2$#!&T<T0$$B L$%F"%-&4V[_^F#02D9M"C!&T<T,a
M$  J9H!"0& .,&[__-'\  "3\$(0< %,UR# 3EY.=4Y6[]A(UP"8</\]0/_Ra
M2GD  01\9R!">0 !!'Q";O_\2F[_\FT !+Q3;O_R;$A*;O_\9@ $KD) $#D a
M ./_2,#CB"! T?P  $C\,!!<0#X /P<O/   X_X_.0  4^Q.N0   7A03SU a
M__0P+O_TL$=GJF  !((@;O_N4J[_[D) $! ]0/_^,"[__ Q   5B  ..Y4@Pa
M0-'\  !&9"!03M!@ /]^#&X $/_^9@#_=# N__Q2;O_\,$#1_   D_!P$!" a
M8 #_7 QN  G__FX&2F[__F8(+SP  $FS8!XP+O_^2,#CB"! T?P  $C\#% 0a
M &\  * O/   2;].N0  ()A83R\\  !)VDZY   @F%A/?@&^;O_\;&XP1]'\a
M  "3\ P0 !!F7$IN__)G'C N__R01]%N__(P+O_\D$<@;O_ND, M2/_N8 #^a
MU# N__R01S\ 2&[OY# '2, &@   D_ O $ZY   7=-[\  I![N_D+4C_[C Na
M__R01SU __)@ /Z<4D=@C$IN__)M /ZJ8 #^C# N__Q2;O_\,$#1_   D_ Pa
M+O_^$( P+O_^2,#CB"! T?P  $C\,]   01Z,#D  01Z7$ ]0/_Z8 #^5# Na
M__Q2;O_\,$#1_   D_ P+O_^$( P+O_^[$ "0  #,\   %/D,"[__N9  D  a
M!S/   !3YC N__X"0  ',\   %/N,#D  %/D#$   V( _@+E2#! T?P  $94a
M8 #^<$IY  $$>F<*+SP  $GP8 #^O# Y  !3YE5 #$   F( _=+E2#! T?P a
M $9(8 #^0"\\  !* 6  _I0P.0 !!%930 )   >P>0  4^YG /VD+SP  $H.a
M8 #^="\\  !*(6  _FI*>0 !!'IF"B\\  !*,6  _E@P.0  4^:0>0  ]% "a
M0  'L'D  $CT;QX_.0  ]% _.0  4^8O/   2D1.N0  ()A03V  _BHP.0 !a
M!%930 )   >P>0  4^YG /TR+SP  $IG8 #^ C N__Q2;O_\,$#1_   D_ Pa
M+O_^$(!"1!@Y  "3\4)#%CD  )/R0D$2.0  D_-"0! Y  "3]#0!M4 T [5 a
M- 2U0+!N__YG"B\\  !*>F  _;!"01(Y  "3\D) $#D  )/SX4C003U __A*a
M>0  4^1F=D)!$CD  )/T,#RJJI!!/4#_]C N__BP;O_V9PHO/   2HE@ /UJa
M,#D  %/F#$   F<(#$  !&8  30P.0 !!%:0>0  4^X"0  'L'D  $CZ;Q8_a
M.0 !!%8_.0  4^XO/   2II@ /[\,_D  %/N  $$WF   /@P.0 !!%:0>0  a
M4^X"0  'L'D  $CZ;Q8_.0 !!%8_.0  4^XO/   2KY@ /[ ,_D  %/N  $$a
MWF  _ 0P+O_\4F[__#! T?P  )/P,"[__A" ,"[__+!N__IM /OB/SD  03,a
M+SP  )/V3KD   K07$\SP   ]%)"0! Y  "3]+%Y  #T4C \JJJ0>0  ]%(]a
M0/_V,"[_^+!N__9G(# Y  !3YE- ,\   /14/R[_]C\N__@O/   2N5@ /XPa
M,#D  /104D!(P('\  A(0+!Y  !3YF<6/SD  /10/SD  %/F+SP  $L*8 #^a
M C/Y  !3Y@  ]%!">0  X_I"0& 63KD   (4/4#__@QN_____F8 ^Y)P 4S7a
M )A.7DYU3E;_[$C7(/ J;@ (/BX #'S_> !*1FP&XTY21F "XTXZ!D) $!T"a
M0 #_W$ P!K] V$"\16($, 2Q1E-';M8P!DS7(/!.7DYU3E8  $IY  #C^F8&a
M3KD   -*3KD   702D!G!' !8#0P.0  4^0,0  #8MCE2#! T?P  $9\(%!.a
MT&#(0D!@%# Y  !3Y@Q   )GN Q   1GLF#(3EY.=4Y6__Q";O_^0F[__$)Ya
M  #T4' !,\   0160GD  03></\SP   ]%1*;@ (9P1"0& "< $SP  !!'Q*a
M;@ (9@  JE)N__XP+O_^#$  "FX  /A.N0  !=!*0&8  (A*>0  4^1F?C Na
M__Q(P..(($#1_   26(P.0  4^:P4&9D,#D  %/F6T ,0  "8ESE2#! T?P a
M $:,(%!.T&!,,_D  %/N  !(^F! ,#D  %/N4D SP   2/@P.0  2/A(P..(a
M($#1_   2/PST  !!,P,>1    $$S&\04WD  %/N9LA@!G#_/4#__# N__Q2a
M0 Q   -B/N5(,$#1_   1I@@4$[08"XP.0  2/0 0  X8!@P.0  2/930 ! a
M #!@"C Y  !(] !  "@_ $ZY   #H%1/4F[__# N__P,0  ";P#_ $) 8 )Pa
M 4Y>3G5.5@  #'D  0  X_IF#DZY   %T$I 9P1P 6 J< @_ $ZY   #H%1/a
M3KD   702D!FYDIY  !3Y&<*#'D  0  4^9FV$) 3EY.=4Y6__YP 3U __Y3a
M;@ (6*X "DIN  AG-")N  H@40P0 "UF  '0(&X "B!0$"@  4B ('P  $:Ha
M,CP !& "6$BP6%?)__H@4$[08+YP 3\ +SP  $LI3KD  #0"7$\SP  !!*)La
M-' !/P O/   2S%.N0  ,H9<3S/   $$HFP:+SP  $LY3KD  !B(6$]P C\ a
M3KD  #&Z5$]*;O_^9P@O/   2'!@!B\\  $$TB\\  !+3$ZY   6E%!/0F=Pa
M#C\ 3DY83R/   $$SB!Y  $$SD/H "(@?  !!'HQ(3(\  <A(5')__PB?   a
M2*H@>0 !!,Y!Z  B,2$R/  '(2%1R?_\</\_ '#_/P!P_S\ /SP F$)G/SD a
M $B&< \_ $Y.WOP #B/   !3Z" Y  !3Z."(0D!(0 *     _S/   !3XB Ya
M  !3Z$) 2$ "@    /\SP   X_P@.0  4^C@B *     _S/   #T%" Y  !3a
MZ *     _S/   !3X' E/P!.3E1/<"4_ $Y.5$\_+O_^3KD   _.5$]*;O_^a
M9P#_&G #/P!.N0  &3143T)G3KD  #&Z5$]@."!N  H@4$AH  ).N0  &!A8a
M3S/   !(ADIY  !(AFP _BX,>0 '  !(AF\ _B)@"$)N__Y@ /X8+SP  $M4a
M+SP  %&^3KD  ""R4$\O/   2W(O/   4;Y.N0  (+)03R\\  !+GR\\  !1a
MODZY   @LE!/+SP  $N_+SP  %&^3KD  ""R4$\O/   2^<O/   4;Y.N0  a
M(+)03R\\  !,#R\\  !1ODZY   @LE!/+SP  $PU+SP  %&^3KD  ""R4$\Oa
M/   3&DO/   4;Y.N0  (+)03R\\  !,G"\\  !1ODZY   @LE!/+SP  %/Pa
M3KD  "5X6$]P 3\ 3KD  #&Z5$].7DYU3E8  $IN  AF8' '/P O/   21 _a
M.0  4^Q.N0   7A03W %/P O/   24!.N0  !2)<3TI 9@  TG )/P O/   a
M21@_.0  4^Q.N0   7A03W &/P O/   249.N0  !2)<3TI 9@  HG '/P Oa
M/   22(_.0  4^Q.N0   7A03W $/P O/   24Y.N0  !2)<3TI 9G)P!3\ a
M+SP  $DJ/SD  %/L3KD   %X4$]P!#\ +SP  $DP/SD  %/L3KD   %X4$]Pa
M!#\ +SP  $E43KD   4B7$]*0&8L0F=.N0  "W!43TI 9AXO/   3+@O/   a
M3+5.N0  %I103TZY   0ZDI 9_8O/   3,!.N0  ()A83TY>3G5.5@  0CD a
M /063KD   L82D!F  %D#'D  @  4^1F  %8,'D  01ZT?P  )/V0A O/   a
MD_8O/   ]!9.N0  &9103R\\  "3]DZY   9TEA/L'D  01Z9[ 0.0  ]!9(a
M@"!\  !&QC(\  -@ EA(L%A7R?_Z(%!.T$) 8   _"\\  #T%DZY   34F  a
M .(O/   ]!9.N0  %51@  #2< $_ '!(/P!.N0  $FA83TI 9@  Q$ZY   +a
M&$I 9@  N QY  (  %/D9@  K"\\  !,T"\\  "3]DZY   9JE!/2D!FE$ZYa
M   ,OG )/P O/   238_.0  4^Q.N0   7A03W &/P O/   25I.N0  !2)<a
M3TB < D_ "\\  !)-C\Y  !3[$ZY   !>%!/+SP  $S6+SP  $S33KD  !:4a
M4$]@,A Y  #T%DB /P O/   3.Q.N0  ()A<3T)G$#D  /062( _ $ZY   2a
M:%A/2D!G /\$< %.7DYU3E;_[# N  @=0/_L<%D=0/_M0B[_[DIN  IF'C\Ya
M  !(:C\N  @O/   31)(;O_L3KD  "#*WOP #' "/P!(;O_L3KD  !G26$\_a
M $AN_^Q.N0   ])03TY>3G5.5O_\+PTJ;@ (2GD  $CR9@Q.N0  ,XXSP   a
M2/(O#2\\  !32DZY   9PE!/(#P  %-**E].7DYU3E;_]$C7,( J;@ (+PU.a
MN0  &=)83TC T(TH0'X N<UC* PL "___V<@#$< #&P:#$< !&8$<"Y@" P4a
M "YF!'!?&(!3C%)'8-0@#$S7,(!.7DYU3E;_\$)N__ O/   4]XO/   ] @Oa
M/  !!*0O/   2.8O/  !!(HO/  !!'XO/   4]8O/   31@O+@ (3KD  !H6a
MWOP )"\\  #T%B\\  !-+4ZY   6E%!/+SP  02*3KD  !+^6$\M0/_X+R[_a
M^$ZY   2Q%A/+4#__$JN__QG  %4,#D  %/> $ !@#\ +R[__$ZY   RAEQ/a
M/4#_]&T  31P 3\ <%,_ $ZY   2:%A/2D!F  %$3KD   L82D!F  $X,#D a
M %/D#$   F<*#$   V<(8   AG &8$!"0! Y  "3]@)  (!G(D)!$CD  )/Va
M D$ ?T) $#D  )/W[TB 09%Y  $$>G (8!!"0! Y  "3]I%Y  $$>G '/4#_a
M]DIY  $$>F<T/SD  01Z,"[_]DC !H   )/P+P _+O_T3KD  #7\4$\]0/_Ra
M,"[_\K!Y  $$>F<$4F[_\$IY  $$>F8 _U(_+O_T3KD  #(Z5$\]0/_R2F[_a
M\F<$4F[_\$)N__)*;O_R9P12;O_P2F[_\&<(+SP  $T\8 8O/   34,O/   a
M33=.N0  %I103TIN__!F!G !/P!@ D)G<$,_ $ZY   2:%A/2D!F*D) 8"@Oa
M/   354O/   34U.N0  %I103T)G<%,_ $ZY   2:%A/2D!GUG !3EY.=4Y6a
M__@O/  !!(HO/  !!'XO/   4]8O/   36,O+@ (3KD  !H6WOP %"\N  @Oa
M/   36Q.N0  %I103R\\  $$?DZY   2_EA/+4#__$JN__QG  # 0F<O+O_\a
M3KD  #0"7$\]0/_X;0  JG !/P!P4C\ 3KD  !)H6$]*0&8  +H_.0 !!,POa
M/   ]%8_+O_X3KD  #1F4$\]0/_Z,"[_^K!Y  $$S&8$< )@ G #/P _+O_Za
M+SP  /163KD   /24$]*0&9R2F[_^F:T/R[_^$ZY   R.E1/3KD   L82D!Fa
M5@QY  (  %/D9DQ"0! Y  "3]@Q  $-FWB\\  "3]B\\  !-=DZY   6E%!/a
M0D!@*"\\  !-AR\\  !-@$ZY   6E%!/0F=P4C\ 3KD  !)H6$]*0&?6< %.a
M7DYU3E;_BDAN_Y!.N0  -7A83TAN_Y!.N0  +G)83RU _XQ*>0  2/)F#$ZYa
M   SCC/   !(\B\N  PO+@ (/SD  $CR(&[_C#\H  (@;O^,/R@ !"!N_XP_a
M*  &(&[_C# H  A20#\ +SP  $CF+SP  $V22&[_E$ZY   @RM[\ !Y(;O^4a
M3KD  !G26$\]0/^*/R[_BDAN_Y0_.0 !!*).N0  -?Q03[!N_XIG#' G/P!.a
MN0  ,;I43TY>3G5.5O_T2-<@P"IN  @^+@ ,? "\1VP&0AU21F#V3-<@P$Y>a
M3G5.5O_P2-<PP"IN  @H;@ ,/BX $'P O$=L!AC=4D9@]DS7,,!.7DYU3E;_a
M^$C7 , @+@ $!(      +@!\%4J'9R P1M'\  !-S" ' H     /(D#3_   a
M3;H0D>B'4T9@W'P ,$;1_   3<Q*$&<@, 921C! T?P  $W,$!!(@#\ < (_a
M ' #/P!.35Q/8-1P 3\ 3KD  #($5$],UP# 3EY.=4Y6__!(UR#@*FX "'H a
M?@ 0%4B /  ,0  @9P8,1@ )9@12C6#J#$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"I.0B4P!P*   #__X#N  X\ &<B, <"@   __^ [@ .2$!(0$) a
M2$ @0-'\  !(0AL0/@9@SC\'0F<@7]'\  !(0AL02A5G#"!N  A2K@ ($)U@a
M\" N  A,UR# 3EY.=4Y6_^)(US" *FX "#XN !!)[O__0B1P # '+P O+@ ,a
M3KD  #P44$\M0/_N9R1P # '+P O+@ ,3KD  #Q:4$\@0-'\  !(0AD0+6[_a
M[@ ,8,0@;@ ,T?P  $A"&1!*%&<$&MQ@^" -3-<P@$Y>3G5.5O_T2-<P@"INa
M  @H32\\  !1BB!Y  !1F$Z06$\^  Q __]G"@Q'  IG!!C'8-Y"% Q'__]Fa
M"+G-9@1"@& "( U,US" 3EY.=4Y6__PO#2IN  H,K0  *10 #F8F*WP  "9 a
M  XK?   )PX $D)M  P +0 $ !8[;@ ( !@P+@ (8#X,K0  *H0 #F8**WP a
M "9N  Y@S@RM   O$@ .9@HK?   )K0 #F"Z#*T  "@   YF"BM\   FX@ .a
M8*9P_RI?3EY.=4Y6__PO#2IN  @K?   *10 #BM\   I.  20FT # (M__L a
M%C M !@J7TY>3G5.5O_\+PTJ;@ (*WP  "J$  XK?   +[H $B 5D*T !#M a
M  QO$" M  @&@    @"0E3M   P"+?_[ !8P+0 8*E].7DYU3E;__"\-*FX a
M""M\   O$@ .*WP  # L !)";0 , BW_^P 6,"T &"I?3EY.=4Y6__PO#2INa
M  @K?   *   #B\53KD  !G26$]$0#M   PP+0 8*E].7DYU3E;_^$C7(( ^a
M+@ (*FX "B\-(&T #DZ06$\O#3\'(&T $DZ07$],UR" 3EY.=4Y6__A(US  a
M*FX ""AN  Q*%6<4+PP0%4B /P @;  23I!<3U*-8.A,US  3EY.=4Y6__POa
M#2IN  X@+@ (*H K0  (*WP  "@   Y"+0 6,"X #$1 .T  # QM@ $ #&P0a
M.WQ__P ,*WP  "?F !)@""M\   GO@ 2( TJ7TY>3G5.5O_\+PTJ;@ *4VT a
M#&P(0FT #'#_8 H@55*5,"X "!" *E].7DYU3E;__"\-*FX "B!54I4P+@ (a
M$( J7TY>3G5.5O_\+PTJ;@ (4FT #&\(0FT #'#_8 @@55*50D 0$"I?3EY.a
M=4Y6__PO#2IN  A*K0 (9C 0+0 62( "0  "9A(_/ ( 3KD  #[@5$\K0  (a
M9A(K?   +Q( #BM\   P+  28&X0+0 62( "0  "9C(0+0 72( _ $ZY   Sa
MNE1/2D!G'KO\  !1I&86*WP  "J$  XK?   ,,X $B M  A@)BM\   JA  .a
M*WP  "^Z !(0+0 72( _ $ZY   HVE1/2,#0K0 (*H K0  $0FT #"I?3EY.a
M=4Y6__PO!W !/P!"IS\N  A.N0  ,]I03RX #(#_____9@1"0& ., <"@   a
M__^ _ ( 2$ N'TY>3G5.5O_\+PTJ;@ (+PU.N0  *"983R\-(&T #DZ06$\Ja
M7TY>3G5.5O_X2-<@@#XN  @J;@ *+PU.N0  *"983R\-/P<@;0 23I!<3TS7a
M((!.7DYU3E;__"\-*GP  %(H68T@3;'\  !1V&402I5G\"\53KD  "F46$]@a
MY"I?3EY.=4Y6__A(UR" *FX "! M !9(@ )   %F!'#_8$ O#4ZY   I^%A/a
M/@ 0+0 72( _ $ZY   R.E1/2JT "&<8$"T %DB  D   F8,+RT "$ZY   ^a
M^%A/0BT %C '3-<@@$Y>3G5.5O_X2-<@@"IN  A";0 ,$"T %DB  D  $&9Fa
M(!60K0 $/@!O&C\'+RT !! M !=(@#\ 3KD  #7\4$^P1V8D2D=M'"!M  A!a
MZ ( L=5F#" M  @J@"M   1@!"M5  1"0& @,#D  $AJ2, ,@    "!F"$)Ya
M  !(:F & "T $  6</],UR" 3EY.=4Y6__A(UR" *FX "%)M  QO  "2+PU.a
MN0  *?A83TI 9@  M@RY   PS@  4;9F#B\\  !1I$ZY   I^%A/("T " : a
M   " )"M  0_ "\M  00+0 72( _ $ZY   T9E!/1$ [0  ,#$   69>,#D a
M $AJ2, ,@    "!F"$)Y  !(:F & "T $  60FT #&!&,"T #%)M  P@;0 $a
MD, K2  $(%52E4) $! ^ ! M !9(@ )  "!G#@Q'  UG /],#$< &F<*, =@a
M#DIM  QFP  M  @ %G#_3-<@@$Y>3G5.5O_\+PTJ;@ (2A5G4B\-3KD  !@8a
M6$\3P   4I!*%6<&#!T +F;V+PU.N0  &!A83U- $\   %*/2A5G!@P= "YFa
M]B\-3KD  !@86$]30!/   !2CDH59P8,'0 Z9O9*%6=2+PU.N0  &!A83Q/ a
M  !2E$H59P8,'0 N9O8O#4ZY   8&%A/4T 3P   4I-*%6<&#!T +F;V+PU.a
MN0  &!A83U- $\   %*22A5G!@P= #IF]DH59QHO#4ZY   8&%A/$\   %*,a
M2A5G!@P= #IF]DH59Q0O#4ZY   8&%A/P?P /#/   !2+"I?3EY.=4Y6__A(a
MUS  +SP  %*63KD  #SH6$\J0+OY  !2B&<  *@CS0  4HA"N0  4B@H?   a
M4BY*%6<2#!4 .F<,N?P  %)-9 08W6#J0AQ*%6<&#!T .F;V<#PO "\-3KD a
M !@86$](P"\ 3KD  #R:4$\CP   4BA*%6<&#!T .F;V*'P  %).2A5G$@P5a
M #IG#+G\  !2;60$&-U@ZD(<2A5G!@P= #IF]DHY  !23F<8+SP  %)N3KD a
M "MF6$\O#4ZY   K9EA/3-<P $Y>3G5.5O_L2-<PX"IN  @H;@ ,$"P  DB a
M/ !F"! L  %(@&!2$BP  4B!,"T !I!M  S003X 2D9O$$I';P1?1V#X7D=3a
M1F[Z8"HP+0 *!D ';#\ ,"T "%) /P!.N0  +N!83SH OD5L!%Y'8/A?1U)&a
M;?HP!TS7,.!.7DYU3E;_^$C7(( J;@ (2CD  %).9P  L!(Y  !2CDB!,"T a
M"+!!;0  GA(Y  !2CDB!,"T "+!!9C@O/   4HXO#4ZY   M*%!//@ P+0 &a
ML$=G## M  :P1V]J< %@:!(Y  !2C$B!,"T !+!!;59@ZA(Y  !2DDB!,"T a
M"+!!;=H2.0  4I)(@3 M  BP068T+SP  %*2+PU.N0  +2A03SX ,"T !K!'a
M9PHP+0 &L$=L$F"F$#D  %*,2(!30+!M  1NED) 3-<@@$Y>3G5.5O_X+PU.a
MN0  +%@@;@ ((!"0N0  4B@M0/_\2&[__$ZY   _D%A/*D O $ZY   MI%A/a
M2D!G+G( ,CD  %(L(&X "" 0D+D  %(HT($M0/_\2&[__$ZY   _D%A/*D!Pa
M 3M  ! @#2I?3EY.=4Y6   ,;@ "  AF%#\N  I.N0  /[I43TI 9P1P'6 .a
M,&X "-'\  !2GQ 02(!.7DYU3E;_^B\-*FX " RY   PS@  4;9F#B\\  !1a
MI$ZY   I^%A/0FT #' !/P!(;O_^$"T %TB /P!.N0  -&903PQ __]G-$I a
M9U ,+@ :__YF#! M !9(@ )  "!F/ PN  W__F8,$"T %DB  D  (&:V0D 0a
M+O_^8"@P.0  2&I(P R     (&8(0GD  $AJ8 X +0 0 !9@!@ M  @ %G#_a
M*E].7DYU3E;_^$C7(( ^+@ (*FX "@Q'  IF)! M !9(@ )  "!G&"\-< T_a
M $ZY   ONEQ/#$#__V8$</]@,%-M  QL(B\-3KD  #%,6$]*0&;H("T " : a
M   " )"M  130#M   P@55*5, <0@$S7((!.7DYU3E;_]DC7(( ^+@ (*FX a
M"AU'__X,1P *9B 0+0 62( "0  @9Q0O#7 -/P!.N0  ,"Q<3PQ __]G7D)Ma
M  P0+0 62( "0  09DXO#4ZY   Q3%A/2D!F0' !/P!(;O_^$"T %TB /P!.a
MN0  -?Q03PQ   %F!# '8" P.0  2&I(P R     (&8(0GD  $AJ8 8 +0 0a
M !9P_TS7((!.7DYU3E;_^$C7(( ^+@ (*FX "@Q'  IF)! M !9(@ )  "!Ga
M&"\-< T_ $ZY   PSEQ/#$#__V8$</]@/$)M  P@;0 (0>@" +'59@XO#4ZYa
M   I^%A/2D!FWB!54I4P!Q" #$  "F8.+PU.N0  *?A83TI 9L(P!TS7((!.a
M7DYU3E;__"\-*FX "! M !9(@ )   1G"B\-(&T #DZ06$\@;0 $L=5B#"\-a
M3KD  "GX6$]@-' !/P @%9"M  1(P"\ $"T %TB /P!.N0  ,]I03PR ____a
M_V8$</]@"BM5  1";0 ,0D J7TY>3G5.5@  3KD  "EF/RX "$ZY   R!%1/a
M3EY.=4Y6   O/   4JQ.N0  /TY83W !/P!.N0  ,;I43TY>3G5.5@  3KD a
M #'43EY.=4Y6   _+@ (<$P_ $Y!6$].7DYU3E8  " X!+I.7DYU3E8  "\\a
M   R&' F/P!.3EQ/3EY.=4Y6   ,;@ %  AN$C\N  A.N0  -BA43PQ  $-Ga
M*' _/P _+@ (3KD  #: 6$\_+@ (<#X_ $Y!6$\O $ZY   W'%A/8 )"0$Y>a
M3G5.5O_\+P="9R\N  AP/#\ 3D%03RX ;3HP!TC +@!M$G!&/P P!S\ 3KD a
M #: 6$]@( R'_____6T8#(?_____;A P!S\ 3KD  #:T5$](P"X +P=.N0  a
M-QQ83RX?3EY.=4Y6__PO!S\N  AP13\ 3D%83SX ;! P!TC +P!.N0  -QQ8a
M3V B/RX "$ZY   V*%1//4  "&T./RX "#\'3KD  #: 6$\P!RX?3EY.=4Y6a
M__PO!S\N  @_+@ *<D8_ 4Y!7$\^ $I 9B@_+@ (3KD  #8H5$\]0  (;18_a
M+@ (/RX "DZY   V@%A/,"X "F ., =(P"\ 3KD  #<<6$\N'TY>3G5.5@  a
M2GD  %+T9P@P.0  4O1@%' 1/P!.3E1/ H   '__,\   %+T3EY.=4Y6   _a
M+@ (3KD  #8H5$\,0 !#9@1P 6 "0D!.7DYU3E8  #\N  X_+@ (+RX "G!"a
M/P!.0=[\  HO $ZY   W'%A/3EY.=4Y6__PO!S\N  PO+@ (<#T_ $Y!4$\Na
M &TZ, =(P"X ;1)P1C\ , <_ $ZY   V@%A/8" ,A_____UM& R'_____VX0a
M, <_ $ZY   VM%1/2, N "\'3KD  #<<6$\N'TY>3G5.5O_P2-<@X#\N  A.a
MN0  -BA43PQ  $-F  #,?  0.0  4U=(@#X $#D  %-62(!(P :   !35BI a
M4VX #FT  (Y31VQD<%$3P   4U9".0  4U<O/   4U9P"C\ 3D%<3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@RH   W/@ 49_ @a
M/   4[).7DYU3E;_WDC7(, J;@ (0J[_\D*N__9\ $)N__I"0#U __P]0/_^a
M$!5(@#X #$< (&<&#$< "68(4HT@31 08.@,1P K9PP,1P M9A!P 3U __Y2a
MC2!-$!!(@#X #$< ,&U$#$< .6X^+SP  #FR2&[_\DZY   YTE!/, <$0  Pa
M/P!.N0  .V143R\!+P!(;O_R3KD  #GRWOP #$IN__IGL%-&8*P,1P N9@Y*a
M;O_Z9@AP 3U __I@F Q' &5G!@Q' $5F8D)N__!2C2!-$!!(@#X #$< *V<,a
M#$< +680< $]0/_\4HT@31 02( ^  Q' #!M'@Q' #EN&# N__#!_  */4#_a
M\# '!$  ,-%N__!@TDIN__QG"C N__!$0#U __#<;O_P2D9O'# &4T9*0&=4a
M+SP  #FR2&[_\DZY   YTE!/8.1*1FP\+7Q @   _^HM?     #_[C &4D9*a
M0&P4+SP  #FR2&[_ZDZY   YTE!/8.1(;O_J2&[_\DZY   YRE!/2F[__F<6a
M("[_\B(N__8*@(     M0/_R+4'_]B N__(B+O_V3-<@P$Y>3G5"(       a
M "!\  !$!F 6('P  $/\8 X@?   1.Q@!B!\   Z*DCG'P D2")O !@@;P <a
M3I(BP"*!3-\ ^$YU('P  $0&8!8@?   0_Q@#B!\  !$[& &('P  #HJ2.<?a
M "1((F\ &$'O !Q.DB+ (H%,WP#X3G4@$$A (A%(030 LT+$?(  /P(T/'^ a
M-@(X L1 9P !"L9!9P !!+1$9P !!K9$9P ! -1#E'Q  &4  .ZT?(  8@  a
M[C\"2$!(0>&(X8D(P  ?",$ 'Q H  02*0 $? !Z '@ %BD !>%+%BD !CX#a
MSL!(0Q8H  7A2Q8H  8T \3!WH+=1A0I  ?A2DA Q,#>@MU%%"@ !^%*2$'$a
MP=Z"W45(1S0#Q,'>0DA"W4+;14A#QL#>0TA#W4/;1"0 2$)(0<3!WD)(0MU"a
MVT0T ,3!W$)(0MM"V41"0R0 2$)(0<3!W$)(0MM"V4,V'\+ VD%(0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H3;Z&8S*>AB '#(  a
M   $9 H@%0) __XJ@& 4*H8@!M"-(\   %,D('D  %,D((<@#5B 8&29S$J'a
M9PP@!P) __[0C2I 8 0J;0 $N_D  %,D9HX@#&<&(\P  %,D4GD  %,L,#D a
M %,L#$   F4*4WD  %,L8 #_6"\&3KD  #U,6$\O+@ (3KD  #WP6$\J0%-Ya
M  !3+" -3-<PP$Y>3G5.5@  <  P+@ (+P!.N0  /?!83TY>3G5.5O_X2-<@a
M@" N  A9@"I 2I5F-'X ,$?1_   4RY*$&<@, =21S! T?P  %,N$!!(@#\ a
M< (_ ' #/P!.35Q/8-1.N0  ,@0 E0    %,UR" 3EY.=4Y6__PO#2IN  A*a
M%6<:+SP  %&D$!5(@#\ ('D  %&V3I!<3U*-8.(O/   4:1P"C\ ('D  %&Va
M3I!<3RI?3EY.=4Y6  !93R!N  @O$$ZY  ! )E!/0^@ ""!)+R O($ZY  ! a
M>%!/3EY.=4Y6   P+@ ( D   V8L#&X&+@ (;2 P+@ (2,"!_ !D2$!*0&80a
M,"X "$C @?P!D$A 2D!F!' !8 )"0$Y>3G5.5@  +SP  5& ("X " 2  "4]a
MBR\ 3KD  #R:4$_0K@ ,!(   *C 3EY.=4Y6__@O/  !48 &K@  J,  "" Na
M  @O $ZY   \6E!/+4#__"\\  %1@"\N  A.N0  /!103P:  "4]BRU __A#a
M[O_X0>X ""1()-DDV4Y>3G5.5O_H2-<@^"I\  !3Q"XN  @L+@ ,!H8  *C a
M( 8,@  !48!M" 2&  %1@%*'0FT $' '+P @!U* +P!.N0  /"Y03SM   P@a
M!RH #(  (Q48;T O/  WNTEP9"\ +P=.N0  /)I03P2 "R$E62\ 3KD  #O:a
M4$\J ' $+P O!4ZY   [VE!/(@ @!]"%4H"0@2H ( 4&@   !?0H "\\  ".a
MK7!D+P O!$ZY   \FE!/!(   "^R+P!.N0  .]I03SM   IP9"\ +SP  (ZMa
M,"T "DC +P!.N0  /)I03R\ 3KD  #O:4$^8@"\\  2K42\\   G$"\$3KD a
M #R:4$\O $ZY   [VE!/.T  ""\\   G$"\\  2K43 M  A(P"\ 3KD  #R:a
M4$\O $ZY   [VE!/)@ @!)"#.T  !@QM  X "&T((CP   &M8 )R0" $D($[a
M0  .#&T #0 (;P1P#6 "< &1;0 (#&T  @ (;P8P/!)L8 0P/!)KD6T "@QMa
M  ( "&\4/RT "DZY   _NE1/2D!G!%)M  YP/"\ +P9.N0  /"Y03SJ <#POa
M "\&3KD  #O:4$\L # & H   /__@/P /$A .T   C & H   /__@/P /#M a
M  0$;0=L  I3;0 (( U,UR#X3EY.=4Y6_^!(UR#X*FX "# M  H&0 =L/@ Pa
M+0 (4D \  Q&  )N!E-'!D8 ##0'2,)(0D)",BT !DC!, ;A2$C @(& @@R a
M!BX*#V\:- =(PH7\ 9 R!TC!@_P 9' "D$'00CH 8 )Z '!D+P O/   CJTPa
M!TC +P!.N0  /)I03R\ 3KD  #O:4$\H "\\   G$"\\  2K43 &4D!(P"\ a
M3KD  #R:4$\O $ZY   [VE!/)@ P+0 &T$5(P-"$T(,&@  :0J(M0/_X<#POa
M # M  3!_  \T&T  DC +P!.N0  /)I03R\ ,!5(P-&7(!\M0/_\!JX  *C a
M__P@+O_\#(   5& ;0P$K@ !48#__%*N__A#[O_X0>X ""1()-DDV4S7(/A.a
M7DYU3E;_^$C7 , N+@ (2H=L"" \_____V P2H=F"" Y____!& D4H<@!P) a
M__XN "\'<$@_ $Y!7$\L &?4( ;0AR/ ____!" &3-< P$Y>3G5.5@  ,"X a
M"$C +P!.N0  0Y183TY>3G4@$&<*"$  'V ,(!!F"" 1(BD !$YU*!%F!B(Ha
M  1.=2(H  0J*0 $= !V .. XE+CA.)3L(1B#&8$LH5D!L%$PT7%0TA 2$0La
M/   _P ^!LQ SD2]0+]$@'P! (A\ 0!(0$A$XHCBC.!.X$^\? #_9U:U0V<(a
M1H1$A68"4H2>1F<<1D>^?  X909X 'H 8 [BA.*54<__^GX VX?9A]*%T81*a
M0VH.2H!F,$J!9BQP '( 3G4(   89R;BB.*1?@#3A]&'4@9F&" \?____W+_a
M8!A3!F?8XXGCD @  !=G\@B  !?O3DA&@(9(0H""3G4O#C(1-! V ;5#QGR a
M #\#[DGN2C@\ /_"1,1$LD1G  $DM$1G  $LDD+2? "!;P !(K)\ 0%N  $,a
M)A!G  $&*"@ !'H'XXSCDU'-__H_ 2\$?@ ^ T)#2$.&?(  <  P$2(I  (Ta
M*0 &>@;C2N.1XU!1S?_XP'Q__X!\0 !(0D)">@ _/  $+$]@ C\&+ $\ $A&a
MC,-H%'S_* =(1)B'D$-(0]*#T45G'& >0D!(0R@&. $B!#@'R,9@"E-&F(?2a
M@]% 9@2RA&7RDH2113@N  3(QI2$DX6113@N  +(QDA"E$1(0C@%2$23A)%%a
M:@I31M2N  (V!].#0D-(0TA!, %(0C("0D)3;@  9@#_?C(?2$$R!B ?2$!<a
MCSP?8 131F\NXXGCD&3VO'P _V(4= CB3N*0XI%1RO_X2$" 7TA 8!1P_R( a
MP'Q__]!?2$!@!E2/< !R "Q?3G4   @X   (+@  "#@   ?^   (6   "&( a
M  AB   &=   !I8   GN   )[@  !YX   C*   +6   "S0   M4   +5   a
M# X   P:   ,#@  #'8   QV   ,@@  #)  0@  #L0 3   #O0 8@  #L0 a
M;   #O0 0@  #OP 2   $8H 4@  $7H 4P  $6H 2   $C      '>@ )0  a
M&K8 1   &[0 10  '#@ 1@  '#@ 3@  &\0 3P  &[P 6   &\X 6P  '*  a
M8P  '1( 9   &[@ 90  '#P 9@  '#P ;@  &\@ ;P  &\  <P  '3H >   a
M&](     &Y8     '>@ "0  &I  "@  &I  (   &I  )0  &MX     &K8 a
M"0  '\8 "@  '\8 (   '\8 *P  ']@ +0  ']@ +@  '^@ ,   '_( ,0  a
M'_( ,@  '_( ,P  '_( -   '_( -0  '_( -@  '_( -P  '_( .   '_( a
M.0  '_( 10  ( 8 90  ( 8 "0  ($)[3E5,3'T   !$   BV@!/   C, !5a
M   C$ !8   C- !C   CJ@!D   BB@!E   C. !F   C. !G   C. !O   Ba
MT@!R   CO !S   C; !U   BP@!X   BU@!$   A,# Q,C,T-38W.#E!0D-$a
M148  #9.   V4@  -E8  #<.   W"@  -P8       !697)S:6]N(&AO<'1Oa
M860M,2XQ,0    <  %/P0       $  P    H_I        0 #          a
M              2Z  !):   27   $EW  !)@   28H  $F1  !)EP  29H a
M $F>  !)H0  2:<  $FM+0                   0 "  (  ?__ "  0 " a
M 0 "  0 "  0    ;&]G:6XZ( !087-S=V]R9#H $%-H97)E   04D]+   0a
M4&<    03T]/3T]/3P  =75C< H <S@P,# *   04RH    056<   !/3T]/a
M3T\    '  8 !4-/3E123TP 04Q40TA. $Q/3D=$051! %-(3U)41$%400 Ja
M6D523RH 0TQ/4T4 4DH 4U)* %)2 $E.251# $E.251" $E.251! '!A8VMEa
M="!S:7IE '!A8VME="!T;V\@;&]N9R!F;W(@8G5F9F5R "!B860@:6X@86)Oa
M=F4@<&%C:V5T"@!+('9E<G-U<R!#;VYT<F]L %-22B!R96-E:79E9 !D:61Na
M)W0@86-K(&]U<B!P:W0 04Q40TA.(')E8V5I=F5D $M#3TY44D],('=I=&@@a
M9&%T80!D871A(&]U="!O9B!W:6YD;W<L('AX>#TE9"!R<V5Q/25D &1I9&XGa
M="!A8VL@;W5R('!K= !F<F%M92!C:&5C:W-U;0!C;VYT<F]L(&-H96-K<W5Ma
M %)*+U)2(&]U="!O9B!W:6YD;W<L('EY>3TE9"!W<V5Q/25D &1A=&$@86-Ka
M(&]U="!O9B!W:6YD;W<L('EY>3TE9"!W<V5Q/25D  ID871A(&-H96-K<W5Ma
M(&EN('!A8VME=" E>"P@;W5R<STE> !.;W0@;F5X="!P86-K970@>'AX/25Da
M(')S97$])60 ;&]G9FEL90!L;V=F:6QE $-A;B=T(&]P96X@3$]'1DE,10!5a
M55-,059% '5S86=E.@H*"75U<VQA=F4@6RUB;ET@6RUL70H* '=H97)E("(Ma
M8FXB('-E=',@=&AE(&)A=60@<F%T92!A<R!F;VQL;W=S.@H*  EN(" @($)Aa
M=60@4F%T90H)+2TM+2TM+2TM+2TM+0H "3 @(" @(#$Y,C P"@DQ(" @(" @a
M.38P, H),B @(" @(#0X,# *  DS(" @(" @,S8P, H)-" @(" @(#(T,# *a
M"34@(" @(" R,# P"@ )-B @(" @(#$X,# *"3<@(" @(" Q,C P("AD969Aa
M=6QT*0H* &%N9" B+6PB('-P96-I9FEE<R!T:&%T('5U<VQA=F4@:7,@=&\@a
M;6EM:6,@82!53DE8"@!L;V=I;B!S97%U96YC92!B969O<F4@<W1A<G1I;F<@a
M=75C:6-O(&5M=6QA=&EO;BX*"@!(:70@4D5455).('1O(&-O;G1I;G5E.B  a
M3TL <W1A<G1U<  N+BYA8F]R=&EN9RXN+@H 2%D 3TL 8V]N=F5R<V%T:6]Na
M(&-O;7!L971E  I"860@8V]N=')O;"!P86-K970@='EP92 E8R!R969U<V5Da
M+@H )6-.)60 )7,@)7,@)7,@)7,@)7,@)7,@)6\ 4D5154535$5$ $-/4%D a
M1D%)3$5$ %-50T-%141%1 !215%515-4 $9!24Q%1" M+2!(34T )7,@)7,@a
M)7, 4D5154535$5$ %)%455%4U1%1 !$14Y)140 0T%.)U0@3U!%3@ E<R!Ua
M=7-L879E("@E9"\E9"TE9#HE,#)D+25D*2 E<R H)7,I#0H ,#$R,S0U-C<Xa
M.4%"0T1%1@  57-E<B!A8F]R="!A=" P,# P,# P, T*  !"860@97)R;W(@a
M;G5M8F5R #H@  H =6YA<W-I9VYE9"!E<G)O<B!N=6UB97(   !/)@  3R\ a
M $]!  !/40  3V$  $]K  !/=P  3X(  $^0  !/H0  3ZH  $^V  !/P0  a
M3\\  $_=  !/Z@  3_D  % /  !-_   3?P  $W\  !-_   3?P  $W\  !-a
M_   3?P  $W\  !-_   3?P  $W\  !0(0  4#   %!   !06   4&<  %!Va
M  !0A@  4)0  $W\  !0HP  4+<  $W\  !-_   3?P  $W\  !-_   4-0 a
M $W\  !0[   4/X  $W\  !-_   3?P  $W\  !-_   3?P  $W\  !-_   a
M3?P  $W\  !-_   3?P  $W\  !-_   40P  %$8  !1)P  44, 1&YO(&5Ra
M<F]R &9U;F1A;65N=&%L(&5R<F]R &1R:79E(&YO="!R96%D>0!U;FMN;W=Na
M(&-O;6UA;F0 8W)C(&5R<F]R &)A9"!R97%U97-T '-E96L@97)R;W( =6YKa
M;F]W;B!M961I80!S96-T;W(@;F]T(&9O=6YD &YO('!A<&5R '=R:71E(&9Aa
M=6QT ')E860@9F%U;'0 9V5N97)A;"!E<G)O<@!W<FET92!P<F]T96-T &UEa
M9&EA(&-H86YG90!U;FMN;W=N(&1E=FEC90!B860@<V5C=&]R<R!O;B!F;W)Ma
M870 :6YS97)T(&]T:&5R(&1I<VL 9G5N8W1I;VX@<F%N9V4 9G5N8W1I;VX@a
M9&]M86EN &EN=F%L:60@9G5N8W1I;VX@;G5M8F5R &9I;&4@;F]T(&9O=6YDa
M '!A=&@@;F]T(&9O=6YD &YO(&AA;F1L97,@;&5F= !A8V-E<W,@9&5N:65Da
M &EN=F%L:60@:&%N9&QE &EN<W5F9FEC:65N="!M96UO<GD :6YV86QI9"!Ma
M96UO<GD@8FQO8VL@861D<F5S<P!I;G9A;&ED(&1R:79E('-P96-I9FEE9 !Ca
M<F]S<R!D:7-K(')E;F%M90!N;R!M;W)E(&9I;&5S ')A;F=E(&5R<F]R &ENa
M=&5R;F%L(&5R<F]R &EN=F%L:60@<')O9W)A;2!L;V%D(&9O<FUA= !S971Ba
M;&]C:R!F86EL=7)E(&1U92!T;R!G<F]W=&@@<F5S=')I8W1I;VYS  !"860@a
M9F]R;6%T(&EN('-C86YF"@  "0H@                       I%   *3@Aa
M                         "D4   I."$!                        a
M*10  "DX(P(     48H  %&D  !1O@                              a
M                                                            a
M      X01TU4                                                a
M                                 "TQ+C$N-#HM,2XQ+C$P.C(Z-C Na
M+BXN+BX       ( _P # /\ "0!424U%6D].10  'QP?'A\>'Q\>'QX?66]Ua
M(&UU<W0@8V]M<&EL92!W:71H('1H92 M9B!O<'1I;VX@=&\@:6YC;'5D92!Pa
M<FEN=&8H*2!F;&]A=&EN9R!P;VEN=             !2_D-#05 _/S\_/S\_a
M/S\_/S\_/S\_/S\_/S\_/S\  !P       @              $)A9"!P;VENa
M=&5R(&EN(&9R964N#0H           !,(C(&#C (#@@*#! &%@8&!AA:!A0<a
M!@@0!A8P&" (#@8.!AP*# @(" @2"!8(" P*" @.$@H(#A(($ 8&" 8&$ 8<a
M" H6&! ,%@P*!@8(" 8*"@P*(!HZ-" ((@P.!@8X(AP2#@8(!A) "#H6!@8:a
M%A .!A(*" H4"@H,"@H*" H&"@@&!@8,# H4#@@("!@," X*&@H4!@H(!@8*a
M! H&"@@&!@H$%!@&!@@(!@H4" X*$ @&!@H$!@IJ" 8.$! D" 8($AX,$@8*a
M$@P$" @&# 8("" ,# X,* @2" H*0!X&" P&" @&# X(!@82!@H2!B@0!A(&a
M$ 8.!@P:% H4" 8,% 8&" 8&" 8&" 8&" 8&" 8&" 8&" 8&" 8&" 8,&@8&a
M# 82!@8,!A(&!@P&$ 8&# 8&# 8.# 8&" H&$ 8."@8(!@8(!@@("!X&"@82a
M#@X*!@8,"@8&# 8.!@8(!@8*"@8*"C *"A(.%@@&" 8(&DX&!@8&!@8&"@H&a
M!@@&$!00& X,' X,"@P&# @,#! ,#BH(!@8:$ 8&#A8&!@8*#@8(!AH8#@8*a
M$!0&%@@,"@P&!@P&!@X:# P(!@XJ!@H.% 829! 0$A >C 8($ H*" @&!@@(a
M" 8&0 H>"@AL!A@8#A(R) PNK!@&!@@^8.@."BY.=/(8:IP.2@88'!(!A$90a
M&$(<3 $.$D08"A0H!D *"!X*"@H*"AP()@@^""8*BB0*F X('@P(" X($"XVa
M*B(*#BX2'DHP$"X.! @&)!00= @2"A(*%@@2"A(*%@@6#!0&"@H&!A ># @0a
M$!@(!@IJ+@H2$ @>$A 0"!P@# X,#@P0*!08! @&'$(01AI<(!P2$$ D'$ @a
M* H0!@P0+B(6%C@>#BH.%# 6%!((%A(T-AX.&A(*"A8&!BP&"@HV!@8F& @0a
M# @2"@X(/B8<,CX*' @P+@8L!@8<!@@&!@@0!@IP"A 0H@HF"A(\" @(( @(a
M" $!ZH04# 8(%"! 2@8D# 8&# P,"APD$!HB# X*'!)B+A8L-"00$"H0'@H8a
M"B *8!80M@H>"C1H)!P! 5H$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 8&!@8&a
M!@8&!@8&!@8&!@8&!@8&!@8&!@8&!@8&!@8&!@8&!@8&!@8&!@8&!@8&!@8&a
M!@8.!@8&!@8&!@8&!@8&!@84! 0$! 0B#B $! 0$! 0$! 0$! $! 0$!/ 0$a
M! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$! 0$a
M! 0$! 0$! 0$! 0$! 0$! 0$! 0! 7P$%@06! @$! $<  <!% $* #    !(a
E1@             B @  X H  ):Q                      $*a
 a
end

--- cut here, extract file logfile ---
- uuslave (4/13-22:55-26850) UUSLAVE ()
- uuslave (4/13-22:55-26850) OK (startup)
sansom uuslave (4/13-22:55-26850) REQUESTED (S D.trwrbBJ9c2 D.trwrbSJ9c2 sansom - D.trwrbBJ9c2 0666)
sansom uuslave (4/13-22:55-26850) COPY (SUCCEEDED)
sansom uuslave (4/13-22:55-26850) REQUESTED (S D.trwrbXJ9c0 X.trwrbAJ9c3 sansom - D.trwrbXJ9c0 0666)
sansom uuslave (4/13-22:55-26850) COPY (SUCCEEDED)
sansom uuslave (4/13-22:55-26850) OK (conversation complete)

--- cut here, extract file d_trwrbs.9c2 ---
From sansom  Tue Apr 14 22:54:18 1987 remote from trwrb
From: trwrb!sansom (Richard Sansom)
Full-Name: Richard Sansom
Message-Id: <8704150654.AA19350@trwrb.UUCP>
To: sansom!root
Subject: test
Date: Tue, 14 Apr 87 22:54:17 PST

this is a test of the emergency broadcast system.

--- cut here, extract file x_trwrba.9c3 ---
U sansom trwrb
R sansom
F D.trwrbSJ9c2
I D.trwrbSJ9c2
C rmail root
-- 
   /////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  /// Richard E. Sansom                   TRW Electronics & Defense Sector \\\
  \\\ {decvax,ucbvax,ihnp4}!trwrb!sansom  Redondo Beach, CA                ///
   \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////

sansom@trwrb.UUCP (04/15/87)

--- cut here, extract file uuslave.c ---
/*
 * @(#)uuslave.c	Version hoptoad-1.11	87/03/23
 *
 * (C) Copyright 1987 by John Gilmore.
 * Copying and use of this program are controlled by the terms of the Free
 * Software Foundation's GNU Emacs General Public License.
 *
 * Derived from:
 * i[$]uuslave.c	1.7 08/12/85 14:04:20
 * which came from the ACGNJ BBS system at +1 201 753 9758.  Original
 * author unknown.
 */

char version[] = "Version hoptoad-1.11";

/*
 * Usage:
 * Unix:
 *	uuslave [device]
 *
 * If the device isn't given, uuslave assumes you're logged in
 * and reads from stdin.  You have 60 seconds to get things started.
 *
 * Atari ST:
 *	uuslave [-l] [-bn]
 *
 * where "-l" specifies that uuslave is to mimic a UNIX login
 * sequence.  Uuslave recognizes user "uucp" with password "s8000".
 * Once "login" is complete, the uucico emulation begins.  The baud
 * rate may be changed by specifying the "-bn" option, where "n"
 * is one of the following:
 *
 *	n      Baud Rate
 *	----------------
 *	0	19200
 *	1	9600
 *	2	4800
 *	3	3600
 *	4	2400
 *	5	2000
 *	6	1800
 *	7	1200 (default)
 *			
 * NOTE - uuslave always reads from the AUX port.
 *
 *
 * Compile time configuration options (-Doption if applicable):
 *
 * option		meaning
 * 
 * BSD			Berkeley UNIX 4.x
 * SYSV			UNIX System V
 * UNIX			All UNIX systems
 * CPM			CP/M-80 systems
 * MSDOS		Microsoft DOS systems
 * ST			Atari ST systems
 * 
 * DEBUG		Output debug information
 * LOG			Log uucp activity
 * SUBDIR		BSD UNIX subdirectories
 * 
 * COMPORT		Using COMPORT.ASM/OBJ/H (MSDOS only)
 * DEC_DF224_MODEM	Send initialization string to the Dec Scholar Modem
 * DEBUG		Compile debugging code
 * DEBUG_XGETC		Serious debugging of lowest-level routine
 * BYTE_TIMEOUT		Restart if nothing in BYTE_TIMEOUT seconds.
 *
 */

/*
 * Modified to compile on BSD systems by John Gilmore (hoptoad!gnu), Jan 1987.
 * 
 * Separated into layers and acknowledgement (middle) layer added, Feb 1987,
 * by John Gilmore.
 *
 * Incorporates a few of the "very extensive and brutal hacks by Marcus J.
 * Ranum",  posted to the net 6 Feb 1987 by mjranum@osiris.uucp.
 *
 * Modified to compile on CP/M by Larry Marek (ihnp4!strg8!larry), March '87.
 *
 * Modified to compile with Microsoft C 4.0 by Tim Pozar (hoptoad!pozar),
 * February and March of 1987:
 *
 *    ver 0.1     11.Mar.1987
 *    Since there isn't any bps rate detection at this point, the machine will 
 *    only work with whatever it was last set with.  Also, PC-DOS and IBM's
 *    serial port seem to have a slight problem with buffering and PC-DOS's
 *    stupid way of handling "read file" errors with the com ports.  PC-DOS
 *    isn't graceful in it's handling and will expect an operator to be at
 *    the physical system console to tell it to "retry".  BPS rate detection
 *    and buffered I/O will be the next code to be plugged into this beast. 
 *    
 *    Basically this guy shouldn't be released yet...
 *
 *    ver 0.2     13.Mar.1987
 *    Hacked to support the COMPORT.ASM/OBJ/H to speed up handshaking and 
 *    char interchange without DOS problems.
 *  
 * Changes from trwrb!sansom (Richard Sansom), 14 Apr '87, to get it to 
 * compile and run correctly on the Atari ST.  Many thanks to Martin Minow
 * (pyrtech!decwrl!thundr.dec.com!minow) for help with Rsconf() problems
 * and Lattice C compatibility.
 *
 * Above changes merged back into master sources by John Gilmore, 23Mar87.
 *
 */

/*

This program implements the uucp (Unix-to-Unix CoPy) protocol as a
slave (the recipient of a phone call from another Unix system).  This
protocol is used to transfer mail, files, and Usenet news from Unix
machine to Unix machine.  UUCP comes with Unix (unless you get a
sleazeoid version like Xenix, where they charge you extra for it).  You
can buy a commercial program for MSDOS, called UULINK, which also
implements this protocol.  UULINK costs $300 and you don't get sources,
though.

The protocol requires a full 8-bit data path with no characters inserted
or deleted (e.g. ^S and ^Q are used as DATA characters).  Simple serial
ports and modems do this; most complicated networks do not, at least without
setting up odd modes and such.  Telenet's PC Pursuit works fine though.

The basic flow of the protocol is that the calling machine will send down
a line of text saying what it wants to do (send a file, receive a file,
or hang up).  (The lines of text are encapsulated into packets; see below.)
The called machine responds with a "yes" or "no" answer, and if the answer
was yes, it sends or receives the file.  Files are terminated with a
packet containing 0 bytes of data.  Then the system that received the file
sends a "copy succeeded" or "copy failed" line to the other end, and 
they go back to "what do we do now".  A request to hang up should be
answered "no" if the called machine has some mail or files it wants to
send to the calling machine; the two machines reverse roles and the calling
machine goes into "what do we do now".  If a hangup request is answered "yes",
the call is terminated.

The data flow described above is actually sent in packets containing
checksums and acknowledgements.  Each packet can either hold a short
control message, e.g. an ack, or a data block.  The data blocks are
numbered with a 3-bit counter, and sent with a checksum.  If the sender
has not received an acknowledgement for a data block within a certain
time, it retransmits the block.  The size of a data block is negotiated
at the start of a call.  To send a block with fewer bytes, a "short
data" block is sent, which is just as big as a "long data" block, but
contains a 1- or 2-byte count of "how many bytes in this block are just
padding".  This is a cute trick since it always works (e.g. if you want
to send 1023 out of 1024 bytes, you only need one byte for the count;
while if you want to send 1 byte out of 1024 then you have enough space
for the count to be 2 bytes).

The short control messages are used to start the call and negotiate the
packet size and the "window size", to acknowledge or reject packets,
and to terminate the packet protocol at the end of a call.  The window
size is how many packets one side can send before it will stop and wait
for an acknowledgement from the other side.  A window size of 1 makes
for a half-duplex protocol (which is what uuslave currently
implements), but also makes it easy to implement on micros that don't
handle serial lines with interrupts.  In window 1, you just keep
sending the same packet until the other side acknowledges it.  Unix
always uses a window size of 3, which is the max that can be dealt with
given the 3-bit packet numbers (for reasons that would take more space
than I want to spend here).  This gives much better throughput, but
requires full duplex serial port handling and more complicated
acknowledgement strategies.

At the low level, full 8-bit bytes are sent out and received on an async serial
port.  The received data is scanned for a DLE (hex 10) which indicates the
start of a packet, and the next 5 bytes are read and checked.  If they
pass, this is a good packet and it is acted upon.  (If it's a data
packet, we have to read in and check the data part too.)  If the checks
fail, all the bytes read so far should be scanned for another DLE.

Include files for various supported systems:
Note that NAMESIZE should be the max length of a file name, including
all its directories, drive specifiers, extensions, and the like.
E.g. on a Unix with 14-char file names, NAMESIZE is several hundred
characters, since the 14-char names can be nested.
*/

#ifdef BSD
/* Unix Berserkeley systems */
#include <stdio.h>
#include <ctype.h>
#include <sgtty.h>
#include <sys/param.h>
#include <sys/file.h>
#include <sys/time.h>
#include <signal.h>
#include <setjmp.h>

#define	UNIX
#define	NAMESIZE	MAXPATHLEN
#endif

#ifdef SYSV
/* Unix System V */
#include <stdio.h>
#include <ctype.h>
#include <fcntl.h>
#include <termio.h>
#include <signal.h>
#include <setjmp.h>

#define	UNIX
#endif

#ifdef UNIX
/* Stuff common to all Unix systems */
#define	MULTITASK
#define	STDIN		0
#define	SPOOLDIR	"/usr/spool/uucp"
#define	PUBDIR		"/usr/spool/uucppublic"
#define	LOGFILE		"LOGFILE"
#endif

#ifdef CPM
/* CP/M-80 */
#include <stdio.h>
#include <ctype.h>
#include <fcntl.h>

#define	NAMESIZE	50		/* No directories... */
#endif

#ifdef MSDOS
/* Microsoft DOS */
/* Turn on support for the interrupt driven comm port routines */
#define	COMPORT

#include <stdio.h>
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>
#include <setjmp.h>
#include <dos.h>
#include <conio.h>
#ifdef COMPORT
#include <comport.h>
#endif

typedef struct timetype {
	unsigned hour;
	unsigned minute;
	unsigned sec;
	unsigned hsec;
} TIME, *TIME_PTR;

#define	NAMESIZE	512		/* Pulled out of a hat */
#endif

#ifdef ST
/* Atari ST, Mark Williams & Lattice C (thanks Martin) compilers */

#include <stdio.h>
#include <ctype.h>
#include <osbind.h>
#include <signal.h>
#include <setjmp.h>
#include <time.h>
#include <xbios.h>

/* Rsconf() defines */

#define RSR		(-1)		/* leave as is			*/
#define TSR		(-1)		/* " "     " "			*/
#define SCR		(-1)		/* " "     " "			*/
#define UCR		(0x98)		/* 8-bits, no parity, 2 stops	*/
#define NOFLOW		(0)		/* no flow control		*/
#define B19200		(0)		/* 19200 baud			*/
#define B9600		(1)		/* 9600 baud			*/
#define B4800		(2)		/* 4800 baud			*/
#define B3600		(3)		/* 3600 baud			*/
#define B2400		(4)		/* 2400 baud			*/
#define B2000		(5)		/* 2000 baud			*/
#define B1800		(6)		/* 1800 baud			*/
#define B1200		(7)		/* 1200 baud			*/

/* misc. defines */

#define FALSE		(0)
#define TRUE		(1)

#define O_RDONLY	(0)		/* for read only open()		*/
#define O_WRONLY	(1)		/* for write only open()	*/

#define AUX		(1)		/* rs232 port			*/
#define CON		(2)		/* console			*/

#define NAMESIZE	(12)		/* filename size		*/
#define IBUFSIZ		(0x4000)	/* size of our input buffer	*/
#define OBUFSIZ		(0x4000)	/* size of our ourput buffer	*/

#define CTRL(X)		(X & 037)	/* get a control character	*/

#ifdef LOG
#define LOGFILE		"logfile"	/* our logfile name		*/
#endif

/* typedef for Iorec() stuff (modified & improved by Martin Minow) */
	
typedef struct {
    struct iorec in;			/*  0 Input buffer		*/
    struct iorec out;			/* 14 Output buffer		*/
    char	rsr_status;		/* 28 MFP(0x1C) Receiver status	*/
    char	tsr_status;		/* 29 MFP(0x1D) Transmit status	*/
    char	xoff_sent;		/* 30 TRUE if we sent XOFF	*/
    char	xoff_received;		/* 31 TRUE if we got XOFF	*/
    char	mode;			/* 32 Bit 0 XON, Bit 1 RTS mode	*/
    char	filler;			/* 33 Unused			*/
} IOREC;

/* some global variables */

int st_baud = B1200;			/* baud rate (set to default)	*/

char st_ibuf[IBUFSIZ];			/* our own input buffer		*/
char st_obuf[OBUFSIZ];			/* and our own output buffer	*/

/* most of the Iorec() stuff was redone by Martin Minow (thanks) */

IOREC *st_sysr;				/* ptr to system rs232 record	*/
IOREC st_savr;				/* to save system rs232 record	*/

IOREC st_myiorec = {
     st_ibuf, IBUFSIZ, 0, 0, (IBUFSIZ / 4), (IBUFSIZ / 4) * 3,
     st_obuf, OBUFSIZ, 0, 0, (OBUFSIZ / 4), (OBUFSIZ / 4) * 3,
     0, 0, 0, 0
};

/*
 * Rsconf() returns the "old" parameters in a longword encoded as follows:
 * bits		value
 * 31-24	UCR
 * 23-16	RSR
 * 15- 8	TSR
 *  8- 0	SCR
 *
 * Note that we must redefine the Rsconf() macro.
 */

#undef Rsconf
#define Rsconf(a,b,c,d,e,f)	(unsigned long) xbios(15,a,b,c,d,e,f)


#define	RS_UCR_SHIFT	24
#define RS_RSR_SHIFT	16
#define RS_TSR_SHIFT	 8
#define RS_SCR_SHIFT	 0

unsigned long	old_rsconf;
int		old_ucr, old_rsr, old_tsr, old_scr;

unsigned int st_temp;			/* needed to compute checksums	*/

long prtime = 0L;			/* present time			*/
long alrmtime = 0L;			/* alarm time			*/
long *hz200 = (long *)0x0004ba;		/* address of system 200 hz clk	*/

#endif

#define	MAGIC	0125252		/* checksum is subtracted from this */

/*
 * What is sent from one machine to the other is a control byte and
 * sometimes a data block following.
 * A packet is a just this, with a frame around the control byte and the
 * data, if any, after the frame.  The frame is 6 bytes long, and looks like:
 *	DLE K C0 C1 C X
 * where:
 *	DLE is a literal ASCII DLE (Data Link Escape) character
 *	K is binary, 9 for a control packet, or the packet size log 2, minus 4
 *		e.g. K = 2 means 64 byte packet since  (K+4) is  6 or 64.
 *						      2         2
 *	C0 and C1 are low, high order checksums for the entire data section, or
 *		are low, high order of (MAGIC minus the control byte).
 *	C is the control byte for the message.
 *	X is the xor of K, C0, C1, and C.
 * If a packet does not satisfy all of the above checks, it is invalid.
 */
#define	DLE	0x10		/* Start of packet indicator */

#define	LENBYTE	1		/* Byte offset from DLE to length */
#define	CBYTE	4		/* Byte offset from DLE to control */
#define	FRAMEBYTE 5		/* Byte offset from DLE to end of frame */

#define	KCONTROL 9		/* K value for control packets */

/*
 * A control byte is split into three bit fields: type, x, and y.
 * 	TT XXX YYY
 * Here are the types:
 */
#define	CONTROL	0		/* Control message */
#define	ALTCHN	1		/* Alternate channel message, unused in UUCP */
#define	LONGDATA	2	/* Long data block -- full size spec'd by K */
#define	SHORTDATA	3	/* Short data block -- first byte or two is
				   count.  Full K-size packet is sent, even
				   though the useful data is shorter. */

char *tt_pr[] = {"CONTROL", "ALTCHN", "LONGDATA", "SHORTDATA"};

/* If TT == CONTROL (also K will == KCONTROL) then
   the x field is: 			and the Y field means: */
#define	CLOSE	1	/* End of communication */
#define	RJ	2	/* Reject packet	last good packet # seen */
#define	SRJ	3	/* Selective reject	seq # of bad packet, resend
			   SRJ is not used by UUCP. */
#define	RR	4	/* Receiver Ready	last good packet # seen */
#define	INITC	5	/* Init phase C		window size to hand sender */
#define	INITB	6	/* Init phase B		max data segment size (K val)
						to hand sender */
#define	INITA	7	/* Init phase A		window size to hand sender */

char *ctrl_pr[] = {"*ZERO*",
	"CLOSE", "RJ", "SRJ", "RR", "INITC", "INITB", "INITA"};

/*
 * If TT == LONGDATA or SHORTDATA then x field is the sequence # of this packet
 * and y field is the last good packet # seen.
 *
 * In both data and RJ/RR packets, the "last good packet # seen" starts off
 * as zero.
 */


/*
 * Timeout for raw characters -- if we don't hear a char within BYTE_TIMEOUT
 * seconds, we assume the other side has gone away.  Has nothing to do with
 * retransmission timeouts (if any!).
 */
#ifndef BYTE_TIMEOUT
#ifdef ST
#define BYTE_TIMEOUT	30
#else
#define	BYTE_TIMEOUT	60
#endif
#endif

#define	MAX_PACKET	4096
#define	SLOP		10		/* Frame header, ctrl, slop */
#define	MAX_FLAGS	40

#ifndef LOG
#define	logit(one, two)	/* Nothing */
#endif

extern int errno;

unsigned char	msgi[MAX_PACKET+SLOP],	/* Incoming packet */
		msgo[MAX_PACKET+SLOP];	/* Outgoing packet */

char	ttynam[NAMESIZE],		/* Name of tty we use as serial port */
	cmnd[8],			/* Trashplace to put command letter */
	srcnam[NAMESIZE],		/* Source file name */
	dstnam[NAMESIZE],		/* Dest file name */
	dskbuf[MAX_PACKET],		/* Disk I/O buffer */
	who[NAMESIZE] = "-",		/* Who sent the file */
	flags[MAX_FLAGS],		/* Flags from file xfer cmd */
	temp[NAMESIZE],			/* Temp file name */
	msgbld[(NAMESIZE*4)+SLOP];	/* Top level message storage */
int	fdtty,				/* Terminal line (to unix uucp) file
					   descriptor */
	logfd,				/* file desc of uucp logfile */
	ourpid = 0,			/* Our process ID */
	firstslave,			/* First packet of slave's session */
	mode,				/* File mode from file xfer cmd */
	msgsize,			/* Size of data part of msg */
	tt, xxx, yyy,			/* Fields from control byte */
	rseq,				/* Last good packet # we received */
	his_rseq,			/* Last good packet # HE received */
	wseq;				/* Next packet # we will send */

int	last_op;			/* Last data op: OP_READ or OP_WRITE */
#define	OP_READ		0
#define	OP_WRITE	1

int	reject;				/* Packet # to reject or NOREJECT */
#define	NOREJECT	-1

#ifndef CPM
jmp_buf alarming;			/* For read timeouts */
#endif

#ifdef BSD
	struct sgttyb atermio, btermio;
#endif
#ifdef SYSV
	struct termio atermio, btermio;
#endif

/* Segments are encoded as (log2 length) - 3, except in INITB packet */
int wndsiz = 1;			/* Ask for window of 1 messages flying */
int segsiz = 2;			/* Ask for 64 byte messages */
int sendseg = 2;		/* Size segments other guy wants to see */
int sendwin = 1;		/* Size window other guy wants to see */

int sendbytes;			/* sendseg, in bytes */

int	segbytes[10] = {	/* K value (encoded segment size) */
		-1,		/* 0 */
		32,		/* 1 */
		64,		/* 2 */
		128,		/* 3 */
		256,		/* 4 */
		512,		/* 5 */
		1024,		/* 6 */
		2048,		/* 7 */
		4096,		/* 8 */
		0		/* 9 = KCONTROL */
};

#ifdef MSDOS
char hayesinit[] = "\r\r\rATS0=1\r";
#endif

#ifdef DEC_DF224_MODEM
/*
 * define configuration strings for Dec DF224 (Scholar) modem.
 *
 * df224_online uses factory settings except for "character echo off",
 * and "abbreviated responses on".  See p. 5-12 in DF224 manual.
 * df224_offline resets to factory settings.
 */
char	df224_online[]  = "\001&1,0,0,2,0,0,3,1,1,1,0,0,1,1,0,1\r";
char	df224_offline[] = "\001&1,1,0,2,0,0,3,1,1,1,0,0,1,1,1,1\r";
#endif


/* We print these prompts */
char msgo0[] = "login: ";
char msgo1[] = "Password:";
char msgo2[] = "\20Shere\0";
char msgo3[] = "\20ROK\0";
char msgo3a[]= "\20Pg\0";
char msgo4[] = "\20OOOOOOO\0";

/* We expect to receive these strings */
char msgi0[] = "uucp\n";
char msgi1[] = "s8000\n";
char msgi2[] = "\20S*\0";
char msgi3[] = "\20Ug\0";
char msgi4[] = "OOOOOO";

/*
 * Basement level I/O routines
 *
 * xwrite() writes a character string to the serial port
 * xgetc() returns a character from the serial port, or an EOF for timeout.
 * sigint() restores the state of the serial port on exit.
 */

#ifdef CPM
#define	abort()	exit(1)
extern xgetc(), xwrite(), sioinit();
#endif

sigint()
{
	/* Restore terminal settings on dialout line */
#ifdef BSD
	ioctl(fdtty, TIOCSETN, &atermio);
        close(fdtty);
#endif

#ifdef SYSV
	ioctl(fdtty,TCSETA,&atermio);
        close(fdtty);
#endif

#ifdef MSDOS
#ifndef COMPORT
        close(fdtty);
#else
        uninit_comm();
        reset_tty();
#endif
#endif

#ifdef ST
	/* restore the system's i/o record				*/
	*st_sysr = st_savr;

	/* Replace old RS232 parameters				*/
	Rsconf(B2400, NOFLOW, old_ucr, old_rsr, old_tsr, old_scr);
#endif

	exit(0);
}

#ifdef MSDOS
xwrite(fd,buf,ctr)
int fd;
char *buf;
int ctr;
{
#ifndef COMPORT
	return write(fd,buf,ctr);
#else
	int i;

	for (i=0;i<=ctr;i++) {
		outp_char(buf[i]);
	}
	return ctr;
#endif
}
#endif

#ifdef ST
/*
 * xwrite(dummy, buf, n) - write "n" bytes from buffer "buf" to rs232 port.
 */
xwrite(dummy, buf, n)
	int dummy, n;
	char *buf;
{
	register int i;
	register char *c;

#ifdef DEBUG
	printf("S ");
#endif
    	for (dummy, i = 0, c = buf; i < n; i++, c++) {
		while (Bcostat(AUX) == 0)
			;
#ifdef DEBUG
		printf("\\%03o (%c) ", *c, (isprint(*c) ? *c : ' '));
#endif
		Bconout(AUX, *c);
	}
#ifdef DEBUG
	putchar('\n');
#endif
	return(i);
}
#endif

#ifdef UNIX
#define	xwrite	write		/* Just use write system call */
#endif

/*
 * Serial port reading routines 
 */

#ifdef UNIX
sigalrm()
{
	longjmp(alarming, 1);
}

/*
 * FIXME:  This is really slow; it does 4 system calls per byte!
 */
xgetc()
{
	char data;
	int status;

	signal(SIGALRM,sigalrm);
	alarm(BYTE_TIMEOUT);
	if (setjmp(alarming) == 0) 
	{
		status = read(fdtty,&data,1);
		alarm(0);
		if (status == 1)	/* the read worked, returning 1 char */
			return(data & 0xFF);
	}
	/* Error on serial port, or timeout. */
	return(EOF);
}
#endif

#ifdef MSDOS
xgetc()
{
	char data;

#ifndef COMPORT
	/* Warning: No timeouts... */
	read(fdtty,&data,1);
	return(data & 0xFF);
#else
	int i;
	unsigned s;
	TIME n;

	i = 0;
	get_time(&n);
	s = n.sec;

	/*
	 * Implement timeouts by staring at the clock while we wait.
	 * When the second hand moves, bump our counter.  This is a lot
	 * easier than figuring out the time when we'd time out (in hours,
	 * minutes, and seconds!) and comparing against that, which is
	 * what people tend to do in Unix where the time is just an integer
	 * number of seconds.
	 */
	while (i < BYTE_TIMEOUT) {
		while (s == n.sec) {
			if(inp_cnt() != 0) {
				data = inp_char();
				return (data & 0xFF);
			}
			get_time (&n);
		}
		s = n.sec;
		++i;
	}
	return(EOF);
#endif
}
#endif /* MSDOS */

#ifdef ST
/*
 * Atari ST routines for reading the rs232 (AUX) port.
 *
 * Some of these routines borrow code from J. R. Bammi's "XMDM" (thanks).
 */

/*
 * read200hz() - read the system 200 hz clock.
 */
void read200hz()
{
	prtime = *hz200;
}

/*
 * alarm(n) - set the alarm time to n seconds.
 */
void alarm(n)
	unsigned int n;
{
	if (n) {
		Supexec(read200hz);
		alrmtime = prtime + (long)(200 * n);
	} else
		alrmtime = 0L;
}

/*
 * xgetc() - get a character from the rs232 port, catch timeouts & aborts.
 */
xgetc()
{
	register int		c;

#ifdef DEBUG_XGETC
	printf("\nxgetc: ");
#endif
	if (setjmp(alarming)) {
#ifdef DEBUG_XGETC
		printf("timeout\n");
#endif
		return(EOF);
	}
	alarm(BYTE_TIMEOUT);
	while (TRUE) {
		if (Bconstat(CON)) {
			if ((int) (Bconin(CON) & 0xFF) == CTRL('C')) {
#ifdef DEBUG_XGETC
				printf("<CTRL/C> from console\n");
#endif
				sigint();
			}
		}
		if (Bconstat(AUX)) {
			alarm(0);
			c = Bconin(AUX) & 0xFF;
#ifdef DEBUG_XGETC
			printf("%02X\n", c);
#endif
			return(c);
		} else if (alrmtime) {
			Supexec(read200hz);
			if (prtime >= alrmtime)
				longjmp(alarming, TRUE);
		}
	}
}
#endif

/*
 * Low level output routines.  These send packets without checking
 * whether they got properly received.
 *
 * writeframe():
 *
 * Finish off an outgoing frame in msgo and queue it up to be written
 * to the serial port.
 *
 * This routine is called to send each and every packet.
 */
int
writeframe(cksm)
	int cksm;
{
	
	msgo[0] = DLE;
	msgo[2] = cksm;
	msgo[3] = cksm >> 8;
	msgo[5] = msgo[1] ^ msgo[2] ^ msgo[3] ^ msgo[4];

#ifdef DEBUG
	{
		int tt, xxx, yyy, index, maxlen;

		printf("T ");
		maxlen = segbytes[msgo[LENBYTE]] + 6;
		for (index = 0; index < maxlen; index++)
			printf("%02x  ",msgo[index] & 0xFF);
		putchar('\n');
		tt = msgo[CBYTE] >> 6;
		xxx = (msgo[CBYTE] >> 3) & 7;
		yyy = msgo[CBYTE] & 7;
		if (tt == CONTROL)
			printf("Sent: CONTROL %s %d\n",
				ctrl_pr[xxx], yyy);
		else
			printf("Sent: %s %d %d\n",
				tt_pr[tt], xxx, yyy);
	}
#endif

	/*
	 * In our window=1 implementation, we just queue the packet
	 * up for transmission here (by leaving it in msgo[]).  It
	 * will be written next time we go through inpkt().
	 */
	last_op = OP_WRITE;	/* Remember to avoid overwriting the packet */
	return 0;		/* Never aborts */
}

/* Send an ack */
int
ackmsg()
{

	msgo[1] = KCONTROL;
	if (reject != NOREJECT)
		msgo[4] = (CONTROL << 6) | (RJ << 3) | reject;
	else
		msgo[4] = (CONTROL << 6) | (RR << 3) | rseq;
	reject = NOREJECT;
	return writeframe(MAGIC - msgo[4]);
}


/* Send a control message other than an ack */

int
ctlmsg(byte)
int	byte;
{

	msgo[1] = KCONTROL;
	msgo[4] = (CONTROL << 6) | byte;
	return writeframe(MAGIC - msgo[4]);
}

/*
 * Medium level output routine.  This sends a short or long data packet
 * and figures out when to retransmit and/or insert acknowledgements as
 * needed.
 */
sendpacket(s, n, sorl)
	char *s;
	int n;
	int sorl;			/* SHORTDATA or LONGDATA */
{
	int cksm, offset, difflen;

	if (last_op == OP_WRITE) {
		/* Better get the first one sent and ack'd first */
		/* FIXME, this will change for window > 1 */
		if (inpkt()) return 1;
	}

	bzero(msgo+6, sendbytes);
	msgo[1] = sendseg;
	msgo[4] = (sorl << 6) + (wseq << 3) + rseq;

	switch(sorl) {
	case LONGDATA:
		if (n > sendbytes) abort();
		offset = 6;
		break;

	case SHORTDATA:
		difflen = sendbytes - n;
		if (difflen < 1) abort();
		offset = 7;
		if (difflen <= 127) {
			msgo[6] = difflen;	  /* One byte count */
		} else {
			msgo[6] = 128 | difflen;  /* low byte, with 0x80 on */
			msgo[7] = difflen >> 7;   /* High byte */
			offset = 8;
		}
	}

	bcopy(s, msgo+offset, n);		/* Move the data */

#ifdef ST
	st_temp = (unsigned int)chksum(&msgo[6], sendbytes);
	st_temp ^= (unsigned int)msgo[4];
	cksm = MAGIC - st_temp;
#else
	cksm = MAGIC - (chksum(&msgo[6], sendbytes) ^ (0377 & msgo[4]));
#endif
	wseq = (wseq + 1) & 7;			/* Bump sent pkt sequence # */
	return writeframe(cksm);
}

/*
 * Medium level input routine.
 *
 * Look for an input string for the send-expect sequence.
 * Return 0 for matching string, 1 for timeout before we found it.
 * FIXME:  we only time out if the other end stops sending.  If it
 *	   keeps sending, we keep listening forever.
 */
instr(s,n)
register char *s;
register int n;
{
	int data,count,j;
	register int i;

	count = 0;
#ifdef DEBUG
	printf("Expecting ");
	for (i = 0; i < n; i++)
		printf("%02x%c ",s[i] & 0xFF, isprint(s[i])? s[i]: ' ');
	printf("\nR ");
#endif
	while ((data = xgetc()) != EOF)
	{
		msgi[count++] = data & 0x7F;
#ifdef DEBUG
		printf("%02x%c ",msgi[count-1],
			 isprint(msgi[count-1])? msgi[count-1]: ' ');
#endif
		if (count >= n)
		{
			for (i = n - 1, j = count - 1; i >= 0; i--, j--)
				if (*(s+i) == '*' || *(s+i) != msgi[j])
					break;
			if (i < 0 || *(s+i) == '*')
			{
#ifdef DEBUG
				putchar('\n');
#endif
				return(0);
			}
		}
	}
#ifdef DEBUG
	printf("\naux. port timeout\n");
#endif
	msgi[count] = 0;
	return(1);
}

/*
 * Medium level input routine.
 *
 * Write a packet to the serial port, then read a packet from the serial port.
 * Return 1 if other side went away, 0 if good packet received.
 *
 * With window size of 1, we send a packet and then receive one.
 * FIXME, when we implement a larger window size, this routine will become
 * more complicated and will callers will not be able to depend on msgo[]
 * being sent and acknowledged when it returns.
 */
int
inpkt()
{
	int data,count,need;
	register int i;
	short pktsum, oursum;
	int status;
	/*
	 * Next vars are for re-queueing received chars to rescan them
	 * for a valid packet after an error.
	 */
	int queued = -1;  /* <0: off, 0: just finished, >0: # chars pending */
	unsigned char *qp;
	unsigned char qbuf[sizeof msgi];	/* This can be static if 4K
						   on the stack is too much */
#	define	bad(str) {printf str; goto oops; }

	if (firstslave) {
		firstslave = 0;
		goto again;
	}

xmit:
	i = segbytes[msgo[LENBYTE]] + 6;
	status = xwrite(fdtty,msgo,i);
	if (status != i) {
#ifdef DEBUG
		printf("xmit %d bytes failed, status %d, errno %d", 
			i, status, errno);
#endif
		return 1;		/* Write failed */
	}

again:
	count = 0;

#ifdef DEBUG
	printf("R ");
#endif

	while (1) {
		if (queued >= 0) {
			/*
			 * Process some stuff from a string.
			 * If we just finished the last char queued, and
			 * we are still scanning for a DLE, re-xmit our
			 * last packet before we continue reading.
			 * On the other hand, if we have a valid packet
			 * header accumulating, just keep reading the serial
			 * port.
			 */
			if (--queued < 0)
				if (count == 0) {
#ifdef DEBUG
					printf("End queue.  Re-xmit.\n");
#endif
					goto xmit; /* No packet comin' in */
				} else {
#ifdef DEBUG
					printf("End queue.  Keep reading\n");
#endif
					goto readser; /* Seems to be sumpin' */
				}
			data = *qp++;		/* Just grab from queue */
		} else {
readser:
			data = xgetc();
			if (data == EOF) break;
		}
#ifdef DEBUG
		printf("%02x%c ",data & 0xFF, isprint(data)? data: ' ');
#endif
		switch (count)
		{
		case 0:
			/* Look for DLE */
			if (data == DLE)
				msgi[count++] = DLE;
			break;

		case LENBYTE:
			/* Check length byte */
			if (data > KCONTROL || data == 0)
				bad(("packet size"));
			if (segbytes[data] > MAX_PACKET) {
				bad(("packet too long for buffer"));
		oops:
				printf(" bad in above packet\n");

				/* FIXME, decode packet header here,
				   if enough of it has come in. */

				/* See if any DLEs in the bad packet */
				/* Skip 0, we know that's a DLE */
				for (i = 1; i < count; i++) {
					if (msgi[i] == DLE) {
						/* Reprocess from the DLE.
						 * if queued, back up the q.
						 * if not, make one.
						 */
						if (queued) {
							queued += count - i;
							qp -= count - i;
						} else {
							bcopy(msgi+i, qbuf, 
								count - i);
							qp = qbuf;
							queued = count - i;
						}
#ifdef DEBUG
						printf("Rescan input\n");
#endif
						goto again;
					}
				}

				if (queued >= 0) {
#ifdef DEBUG
					printf("Continue scan\n");
#endif
					goto again;
				} else {
#ifdef DEBUG
					printf("Re-xmit previous packet\n");
#endif
					goto xmit;	/* Xmit then rcv */
				}
			}
			msgi[count++] = data;		/* Save it */
			msgsize = segbytes[data];	/* Save Packet size */
			need = 6 + msgsize;
			break;

		case CBYTE:
			/* Break up control byte as well as storing it */
			msgi[count++] = data;		/* Save it */
			tt = (data >> 6) & 3;
			xxx = (data >> 3) & 7;
			yyy = data & 7;

			/* Now check it a bit */
			switch (tt) {		/* Switch on msg type */
			case CONTROL:
				/* Control msg must have KCONTROL size */
				if (msgsize != 0) bad(("K versus Control"));
				/* We don't implement SRJ, nor does Unix */
				switch (xxx) {
				case SRJ:
					bad(("SRJ received"));
				case RJ:
				case RR:
					if (yyy != (7 & (wseq - 1)))
						bad(("didn't ack our pkt"));
				}
				break;
			
			case ALTCHN:
				bad(("ALTCHN received")); /* Unsupported */

			case SHORTDATA:
			case LONGDATA:
				if (msgsize == 0) bad (("KCONTROL with data"));
				if (((xxx - rseq) & 7) > wndsiz) {
					/* Atari ST cpp has problems with
					 * macro args broken across lines?
					 * That's why funny indent here
					 */
bad (("data out of window, xxx=%d rseq=%d", xxx, rseq));
				}
				/* FIXME, below enforces window size == 1 */
				/* Note that this is also how we guarantee
				   that msgo has been received OK by the time
				   we exit inpkt() too.  Don't change it unless
				   you know what you are doing. */
				if (yyy != (7 & (wseq - 1)))
					bad(("didn't ack our pkt"));
				break;
			}
			break;

		case FRAMEBYTE:
			/* See whole frame, check it a bit. */
			msgi[count++] = data;
			if (data != (msgi[1] ^ msgi[2] ^ msgi[3] ^ msgi[4]))
				bad(("frame checksum"));
			pktsum = msgi[2] + (msgi[3] << 8);

			if (tt == CONTROL) {
				/* Check checksums for control packets */
				oursum = MAGIC - msgi[4];
				if (pktsum != oursum)
					bad(("control checksum"));
				/*
				 * We have a full control packet.
				 * Update received seq number for the ones
				 * that carry one.
				 */
				switch (xxx) {
				case RJ: case RR:
					if (((wseq - yyy) & 7) > sendwin) {
bad (("RJ/RR out of window, yyy=%d wseq=%d", yyy, wseq));
					}
					his_rseq = yyy;
				}
				goto done;
			} else {
				/*
				 * Received frame of data packet.
				 *
				 * Now that the checksum has been verified,
				 * we can believe the acknowledgement (if
				 * any) in it.
				 */
				if (((wseq - yyy) & 7) > sendwin) {
bad (("data ack out of window, yyy=%d wseq=%d", yyy, wseq));
				}
				his_rseq = yyy;
			}
			break;

		default:
			msgi[count++] = data;
			if (count >= need) {
				/* We have received a full data packet */
#ifdef ST
				st_temp = (unsigned int)chksum(&msgi[6], sendbytes);
				st_temp ^= (unsigned int)msgi[4];
				oursum = MAGIC - st_temp;
#else
				oursum = MAGIC - (chksum(&msgi[6], sendbytes)
						  ^ (0377 & msgi[4]));
#endif
				if (pktsum != oursum) {
					/* Send a reject on this pkt */
					reject = xxx - 1;
bad(("\ndata checksum in packet %x, ours=%x", pktsum, oursum));
				}
				/* FIXME, this may change for window>1 */
				if (xxx != (rseq+1)%8 ) {
bad(("Not next packet xxx=%d rseq=%d", xxx, rseq));
				}
				rseq = xxx;	/* We saw this pkt OK */
		done:
#ifdef DEBUG
				putchar('\n');
				if (tt == CONTROL)
					printf("Rcvd: CONTROL %s %d\n",
						ctrl_pr[xxx], yyy);
				else
					printf("Rcvd: %s %d %d\n",
						tt_pr[tt], xxx, yyy);
#endif
				last_op = OP_READ;
				return(0);
			}
			break;
		}
	}
#ifdef DEBUG
	printf(" EOF\n");
#endif
	return(1);
}

int
chksum(s,n)
register unsigned char *s;
register n;
{
	register short sum;
	register unsigned short t;
	register short x;

	sum = -1;
	x = 0;
	do {
		if (sum < 0)
		{
			sum <<= 1;
			sum++;
		}
		else
			sum <<= 1;
		t = sum;
		sum += *s++ & 0377;
		x += sum ^ n;
		if ((unsigned short)sum <= t)
			sum ^= x;
	} while (--n > 0);

	return(sum);
}

/*
 * Medium level packet driver input routine.
 *
 * Read a data packet from the other side.  If called twice in succession,
 * we send an ack of the previous packet.  Otherwise we tend to piggyback
 * the acks on data packets.
 *
 * Result is 0 if we got a data packet, 1 if we got some other kind, or
 * a hangup timeout.
 */
int
indata()
{

	while (1) {
		if (last_op == OP_READ) {
			ackmsg();		/* Send an ack */
		}
		if (inpkt()) return 1;

		switch (tt) {
		case ALTCHN:
			return 1;		/* Unsupported - yet */

		case LONGDATA:
		case SHORTDATA:
			/*
			 * We got a data packet.  That's what we want,
			 * so return.
			 */
			return 0;		/* We are done. */

		case CONTROL:	
			switch (xxx) {
			default:
				return 1;	/* Bad packet type */

			case RJ:		/* Reject prev pkt */
			case RR:		/* OK but no data */
				break;		/* Ack and try again */
			}
		}
	}
}

/*
 * Open a conversation in the g protocol.  Medium level routine.
 * Returns 0 for success, 1 for failure.
 */
int
gpro_open(mastermode)
	int mastermode;
{
	int tries = 0;
	int expect = 0;
	static int which[] = {INITA, INITB, INITC};

	/* initialize protocol globals, e.g. packet sequence numbers */

	rseq = 0;		/* Last good packet # we have seen from him */
	wseq = 1;		/* Next packet # we will send */
	his_rseq = 0;		/* Last good Packet # he has seen from us */
	reject = NOREJECT;	/* Don't reject first packet */
	firstslave = mastermode? 0: 1;	/* About to do first slave packet? */

	if (mastermode) goto master_start;

	while (++tries <= 10) {
		/* Receive an initialization packet and handle it */
		if (inpkt() == 0 && tt == CONTROL && xxx == which[expect]) {
			/* Remember we've seen it, grab value */
			switch (xxx) {
			case INITA:
			case INITC:
				sendwin = yyy;
				break;
			case INITB:	
				/*
				 * Get preferred packet size for other guy,
				 * but don't overrun our buffer space.
				 * The encoded segment size is off-by-1 from
				 * the one used in the K field in each packet.
				 */
				do {
					sendseg = yyy+1;
					sendbytes = segbytes[sendseg];
				} while (sendbytes > MAX_PACKET && --yyy);
				break;
			}
		} else {
			expect = -1;
		}

master_start:
		/*
		 * Transmit an initialization packet.
		 *
		 * Send whichever packet we expected, if we got it.
		 * If we didn't, send INITA.
		 */
		switch (expect) {
		case -1:
		case 0:
			ctlmsg((INITA << 3) | wndsiz);
			break;
		case 1:
			ctlmsg((INITB << 3) | (segsiz - 1));
			break;
		case 2:
			ctlmsg((INITC << 3) | wndsiz);
			break;
		}
		
		if (++expect > 2)
			return 0;		/* We are done */
	}
	return 1;				/* Failure */
}

/*
 * Close a conversation in the G protocol.  Medium level routine.
 */
int
gpro_close()
{

	/* In windowed protocol, we have to check if prev one's been ack'd */
	if (last_op == OP_WRITE) {
		if (inpkt()) return 1;
	}

	do {
		ctlmsg(CLOSE << 3);
		if (inpkt())
			return 1;
	} while (tt != CONTROL && xxx != CLOSE);

	return 0;
}

/*
 * MAIN ROUTINE.
 *
 * This is called at program startup.  It parses the arguments to the
 * program (if any) and sets up to receive a call on the modem.
 *
 * If there are no arguments, we assume the caller is already on standard
 * input, waiting to do uucp protocols (past the login prompt), and we
 * just handle one caller.
 *
 * If there is an argument, it is the name of the tty device where we
 * should listen for multiple callers and handle login and password.
 */
main(argc,argv)
int argc;
char *argv[];
{
	int ontheline = 1;

#ifdef ST
	/* process arguments (if any) */
	for (argc--, argv++; argc; argc--, argv++) {
		if (argv[0][0] == '-') {
			switch (argv[0][1]) {
			case 'B' :
			case 'b' :		/* set baud rate	*/
				st_baud = atoi(&argv[0][2]);
				if (st_baud < B19200 && st_baud > B1200)
					goto usage;
				break;
			case 'L' :
			case 'l' :		/* mimic UNIX login	*/
				ontheline = FALSE;
				break;
			default :
				goto usage;
			}
		} else
			goto usage;
	}
#else
	/* If argument provided, use it as name of comm port */
	if (argc > 1) {
		ontheline = 0;
		strcpy(ttynam, argv[1]);
	}
#endif

#ifdef UNIX
	if (ontheline) {
		if (chdir(SPOOLDIR)) {
			perror("Can't chdir to Spool directory");
			exit(2);
		}
	}
#endif UNIX

#ifdef LOG
#ifdef ST
	if ((logfd = open(LOGFILE, O_WRONLY)) < 0)
		if ((logfd = creat(LOGFILE, O_WRONLY)) < 0) {
			perror("Can't open LOGFILE");
			exit(2);
		}
#else
	if (0 > (logfd = open(LOGFILE, O_CREAT|O_WRONLY|O_APPEND, 0644))) {
		perror("Can't open LOGFILE");
		exit(2);
	}
#endif
	/* Log our presence so we humans reading the logs can find the
	   entries created by uuslave. */
	logit("UUSLAVE", ontheline? version: ttynam);
#endif

#ifdef DEBUG
	if (ontheline) {
		freopen("uuslave.log", "a", stdout);
	}
#endif

#ifdef SYSV
	setbuf(stdout, (char *)NULL);	/* Unbuffered debug output */
#endif

#ifdef BSD
	setbuf(stdout, (char *)NULL);	/* Unbuffered debug output */
#endif

#ifdef MSDOS
	setbuf(stdout, (char *)NULL);	/* Unbuffered debug output */
#endif

#ifdef DEBUG
	{
		long clock;

		time(&clock);
		printf("\014\nuuslave log starting %s", ctime(&clock));
	}
#endif

#ifdef COMPORT
	set_tty();      /* read old settings and set up port
			   so it is a full 8 bit channel at
			   1200 baud. */

	printf("\n Initializing modem.");
	xwrite(fdtty,hayesinit,sizeof(hayesinit)-1);
#endif

	do {
		/*
		 *  Set up serial channel, wait for incoming call. 
		 */

#ifdef DEBUG
		printf("\nrestarting\n");
#endif

#ifdef CPM
		/* FIXME, we should implement ontheline here */
		sioinit();
#endif

#ifdef MSDOS
		/* FIXME, we should implement ontheline here */
#ifndef COMPORT
		if ((fdtty = open(ttynam, O_RDWR)) < 0)
		{
			printf("Cannot open %s for read/write %d\n",
				ttynam, errno);
			exit(1);
		}
#endif
#ifdef COMPORT
		printf("\n Waiting for call.  Strike any key to abort.\n");
		while ((get_msr() & CD) == 0){
			if (kbhit() != 0){
				printf("\nAborting UUSLAVE at user's request.");
				exit(1);
			}
		}
		init_comm();
		inp_flush();
		sleep(3);
#endif
		signal(SIGINT,sigint);
#endif

#ifdef ST
		/* set up our own rs232 input and output buffers */
		st_sysr = (IOREC *)Iorec(0);
		st_savr = *st_sysr;		/* Save system buffer	*/
		*st_sysr = st_myiorec;		/* Set my io buffer	*/

		/*
		 * set up the rs232 port: 2400 baud, no flow control,
		 * 8-bit words with 2 stop bits and no parity.
		 */

		/*
		 * Saving the old Rsconf() parameters, and
		 * adding the 2 Vsync() calls was done by Martin Minow.
		 *
		 * Rsconf(baud, ctrl, usr, rsr, tsr, scr):
		 * baud	New line speed
		 * ctrl	UART control register: 2 stop bits, match speed
		 * rsr	Receiver on
		 * tsr	Transmitter on
		 * scr	Synchronous register ignored.
		 * Rsconf returns the "old" values.
		 */
		old_rsconf = Rsconf(st_baud, NOFLOW, UCR, RSR, TSR, SCR);
		old_ucr = (old_rsconf >> RS_UCR_SHIFT) & 0xFF;
		old_rsr = (old_rsconf >> RS_RSR_SHIFT) & 0xFF;
		old_tsr = (old_rsconf >> RS_TSR_SHIFT) & 0xFF;
		old_scr = (old_rsconf >> RS_SCR_SHIFT) & 0xFF;

		/*
		 * Magic.
		 */
		Vsync();			/* Short delay while	*/
		Vsync();			/* The UART settles	*/
#endif

#ifdef BSD
		/* Berserkeley version */
		if (ontheline) {
			fdtty = STDIN;
		} else if ((fdtty = open(ttynam, O_RDWR)) < 0) {
			perror(ttynam);
			exit(1);
		}
		ioctl(fdtty, TIOCGETP, &atermio);
		btermio = atermio;
		btermio.sg_flags |= RAW;
		btermio.sg_flags &= ~(ECHO|XTABS);
		if (!ontheline)
			btermio.sg_ispeed = btermio.sg_ospeed = B1200;
		ioctl(fdtty, TIOCSETN, &btermio);
		signal(SIGINT,sigint);
#endif

#ifdef SYSV
		/* Missed'em Five version */
		if (ontheline) {
			fdtty = STDIN;
		} else if ((fdtty = open(ttynam, O_RDWR)) < 0) {
			perror(ttynam);
			exit(1);
		}
		ioctl(fdtty,TCGETA,&atermio);
		btermio = atermio;
		btermio.c_iflag = btermio.c_oflag = btermio.c_lflag = 0;
		btermio.c_cc[VMIN] = 1;
		btermio.c_cc[VTIME] = 0;
		if (!ontheline)
			btermio.c_cflag = (btermio.c_cflag & ~CBAUD) | B1200;
		ioctl(fdtty,TCSETA,&btermio);
		signal(SIGINT,sigint);
#endif

#ifdef DEC_DF224_MODEM
		/* set up for Dec Scholar modem */
		xwrite(fdtty, df224_online, (sizeof df224_online) - 1);
#endif

		do_session(ontheline);

#ifdef DEC_DF224_MODEM
		/* shut down for Dec Scholar modem */
		xwrite(fdtty, df224_offline, (sizeof df224_offline) - 1);
#endif

#ifdef UNIX
		(void) close (fdtty);
#endif

#ifdef MSDOS
#ifndef COMPORT
		(void) close (fdtty);
#else
		uninit_comm();
#endif
#endif
	} while (!ontheline);

	sleep(3);		/* Let output drain? makes hangup work? */

#ifdef ST
	exit(0);

usage:
	fprintf(stderr, "usage:\n\n\tuuslave [-bn] [-l]\n\n");
	fprintf(stderr, "where \"-bn\" sets the baud rate as follows:\n\n");
	fprintf(stderr, "\tn    Baud Rate\n\t-------------\n");
	fprintf(stderr, "\t0     19200\n\t1      9600\n\t2      4800\n");
	fprintf(stderr, "\t3      3600\n\t4      2400\n\t5      2000\n");
	fprintf(stderr, "\t6      1800\n\t7      1200 (default)\n\n");
	fprintf(stderr, "and \"-l\" specifies that uuslave is to mimic a UNIX\n");
	fprintf(stderr, "login sequence before starting uucico emulation.\n\n");
	fprintf(stderr, "Hit RETURN to continue: ");
	gets(st_ibuf);
	exit(1);
#endif	
}


/* Handle a single uucp login session */
do_session(ontheline)
	int ontheline;
{

	if (!ontheline) {
		/* output login request, verify uucp */
		xwrite(fdtty,msgo0,sizeof(msgo0)-1);
		if (instr(msgi0,sizeof(msgi0)-1))
			goto bort;

		/* output password request, verify s8000 */
		xwrite(fdtty,msgo1,sizeof(msgo1)-1);
		if (instr(msgi1,sizeof(msgi1)-1))
			goto bort;
	}

	/* output here message, wait for response */
	xwrite(fdtty,msgo2,sizeof(msgo2)-1);
	if (instr(msgi2,sizeof(msgi2)-1))
		goto bort;

	/* output ok message, output protocol request, wait for response */
	xwrite(fdtty,msgo3,sizeof(msgo3)-1);
	xwrite(fdtty,msgo3a,sizeof(msgo3a)-1);
	if (instr(msgi3,sizeof(msgi3)-1))
		goto bort;

	if (gpro_open(0)) goto bort;
	logit("OK", "startup");
	while (1)
		if (top_level()) goto bort;
	/* NOTREACHED */

bort:	
	printf("...aborting...\n");
	;
}

/*
 * Handle a transaction "at top level", as Unix uucp's debug log says.
 * This really means "receive a command from the other side and handle
 * it".  Return 1 to abort, 0 to continue.
 */
int
top_level()
{

	msgbld[0] = '\0';		/* No command yet */
	do {
		if (indata() || tt != LONGDATA)
			return 1;
		msgi[6+msgsize] = '\0';	/* Null terminate packet */
		strcat(msgbld,&msgi[6]);	/* Tack on to command */
	} while (strlen(msgi+6) == msgsize);	/* Loop if no null in pkt */

#ifdef DEBUG
	/* Print it for easy debugging */
	printf("\n\nCommand: %s\n\n", msgbld);
#endif

	switch (msgbld[0]) {
	case 'S' :
		if (send_file(msgbld)) return 1;
		break;
	case 'R' :
		if (receive_file(msgbld)) return 1;
		break;
	case 'H' :
		if (yesno('H', 1))
			return 1;
		if (indata() || tt != LONGDATA)
			return 1;
		if (!strcmp(&msgi[6],"HY"))
		{
			/* Shut down the packet protocol */
			gpro_close();

			/* Write the closing sequence */
			xwrite(fdtty,msgo4,sizeof(msgo4)-1);
			(void) instr(msgi4,sizeof(msgi4)-1);
			xwrite(fdtty,msgo4,sizeof(msgo4)-1);
			logit("OK", "conversation complete");
			return 1;	/* Go byebye */
		}
		break;
	default:
		/* Unrecognized packet from the other end */
		printf("\nBad control packet type %c refused.\n", msgbld[0]);
		if (yesno(msgbld[0], 0))
			return 1;
		break;
	}

	return 0;
}

/* Send a "yes or no" packet with character 'c'. */

int
yesno(c, true)
	int c;
	int true;
{
	char buf[20];

	buf[0] = c;
	buf[1] = 'Y';
	buf[2] = 0;
	/* FIXME, errno might not be the right return code here */
	if (!true) 
		sprintf(buf,"%cN%d", c, errno);

	return sendpacket(buf, strlen(buf), LONGDATA);
}

/*
 * Create a temporary file name for receiving a file into.
 * "name" is the name we will actually eventually want to use for the file.
 * We currently ignore it, but some OS's that can't move files around
 * easily might want to e.g. put the temp file into the same directory
 * that this file is going into.
 */
char *
temp_filename(name)
	register char *name;
{
	static char tname[NAMESIZE];

	/* touch 'name' so MWC won't complain */
	name;
	if (ourpid == 0)
		ourpid = getpid();
#ifdef ST
	/* I'll get to this later */
	strcpy(tname, name);
#else
	sprintf(tname, "TM.u%d", ourpid);
#endif

#ifdef DEBUG
	printf("Using temp file %s\n", tname);
#endif
	return tname;
}


/*
 * Transform a filename from a uucp packet (in Unix format) into a local
 * filename that will work in the local file system.
 */
char *
munge_filename(name)
	register char *name;
{
	register char *p;

#ifdef DEBUG
	printf("Munge_filename  input: %s\n", name);
#endif

#ifdef CPM
	for (p = name + strlen(name); p != name && *(p-1) != '/'; p--) ;
#endif

#ifdef ST
	/*
	 * the ST likes MS/DOS flavored filenames, so
	 * we change filenames of the form "D.siteXXXX" and
	 * change them to "D_site.XXX".
	 */
	{
		register int i;

		p = name + strlen(name);
		for (i=0; p>name && p[-1]!='/' && i<NAMESIZE; p--, i++) {
			if (i == 4)
				*p = '.';
			else if (*p == '.')
				*p = '_';
		}
	}
#endif

#ifdef UNIX
	{static char buffer[NAMESIZE+SLOP];

	/* FIXME: Security checking goes here! */

	if (name[0] == '~') {
		/* Handle user-relative names -- ~ or ~uucp turns to PUBDIR */
		if (name[1] == '/')
			p = &name[1];
		else if (!strncmp("~uucp/", name))
			p = &name[5];
		else {
			p = NULL;		/* Neither of the above */
			goto out;
		}
		strcpy(buffer, PUBDIR);
		strcat(buffer, p);
		p = buffer;
		goto out;
	}
#ifdef SUBDIR
	/* Berkeley Unix subdirectory hack.
	 * Full pathnames go through OK.
	 * D.myname*	-> D.myname/D.myname*
	 * D.*		-> D./D.*
	 * C.*		-> C./C.*
	 * otherwise left alone (e.g. X.*).
	 * FIXME: we punt D.myname since we don't know our own name yet.
	 * FIXME: I hear Honey Danber has a slightly different scheme.
	 */
	if (name[0] != '/') {
		if (name[1] == '.' &&
		    (name[0] == 'C' || name[0] == 'D')) {
			strncpy(buffer, name, 2);
			buffer[2] = '/';
			strcpy(buffer+3, name);
			p = buffer;
			goto out;
		}
	}
#endif

	p = name;		/* Let it through as-is. */
	}
#endif

#ifdef MSDOS
	p = name;		/* FIXME */
#endif

out:
#ifdef DEBUG
	printf("Munge_filename output: %s\n", p);
#endif
	return p;
}

/*
 * Master wishes to send a file to us -- we receive it.
 * Return 1 to abort the call, 0 to continue.
 */
int
send_file(msg)
	char *msg;
{
	char *p, *q;	/* File names */
	int offset;
	int fddsk;	/* Disk file descriptor */
	int status;
	int error = 0;	/* No errors so far */

	sscanf(msg,"%s %s %s %s %s %s %o",
		cmnd, srcnam, dstnam, who, flags, temp, &mode);
	logit("REQUESTED", msgbld);
	q = munge_filename(dstnam);	/* Translate to local customs */
	p = temp_filename(q);		/* Create a handy temp file */
#ifdef ST
	/* NOTE - MWC ignores the mode (for now) */
	if (p && (fddsk = creat(p, mode|0600)) >= 0) {
#else
	if (p && (fddsk = open(p, O_CREAT|O_EXCL|O_WRONLY, mode|0600)) >= 0) {
#endif
		/* FIXME: Are the above permissions right?? */
		/* FIXME: Should we create directories for the file? */
		if (yesno('S',1))		/* Say yes */
			return 1;
		do {
			/* Read a packet, handle the data in it */
			if (indata())
				return 1;

			switch (tt) {
			case LONGDATA:
				/* FIXME, check this write */
				offset = 6;
				goto writeit;
			case SHORTDATA:
				if (msgi[6] & 0x80) {
					msgsize -=
					  (msgi[7] << 7) | (127&msgi[6]);
					offset = 8;
				} else {
					msgsize -= msgi[6];
					offset = 7;
				}

			writeit:
				if (msgsize != 0) {
					status = 
					  write(fddsk, &msgi[offset], msgsize);
					if (status != msgsize) error++;
				}
				break;
			}
		} while (msgsize != 0);
		status = close(fddsk);
		if (status != 0) error++;

		/* Move the file from its temp location to its real loc */
		/* FIXME:  This needs to be able to copy the file, if 
		   a simple rename does not suffice. */
#ifdef ST
		/* no need to rename for now */
		status = 0;
#else
		status = rename(p, q);
#endif
		if (status != 0) {
#ifdef DEBUG	
		printf("Cannot rename file %s to %s, errno=%d\n",
			p, q, errno);
#endif DEBUG
			error++;
		}

		logit("COPY", error? "FAILED": "SUCCEEDED");
		if (yesno('C', error == 0))	/* Send yes or no */
			return 1;
	}
	else
	{
		/* Can't open file -- send error response */
#ifdef DEBUG
		printf("Cannot open file %s (%s) for writing, errno=%d\n",
			p, dstnam, errno);
#endif
		logit("REQUEST", "FAILED -- HMM");
		if (yesno('S', 0))
			return 1;
	}

	return 0;
}

/*
 * Master wants to Recieve a file from us -- we send it.
 * Return 1 to abort the call, 0 to continue.
 */
int
receive_file(msg)
	char *msg;
{
	char *p;
	int count;
	int fddsk;		/* Disk file descriptor */

	sscanf(msg,"%s %s %s",cmnd,srcnam,dstnam);
	logit("REQUESTED", msg);
	p = munge_filename(srcnam);
	if (p && (fddsk = open(p, O_RDONLY)) >= 0) {
		if (yesno('R',1))
			return 1;
		do {
			count = read(fddsk, dskbuf, sendbytes);
			if (sendpacket(dskbuf, count,
				(count == sendbytes)? LONGDATA: SHORTDATA))
					return 1;
		} while (count);
		close(fddsk);
		/* Await the "CY" or "CNddd" packet, and toss it. */
		while (1) {
			if (indata() || tt != LONGDATA)
				return 1;
			if (msgi[6] != 'C') {
#ifdef DEBUG
				printf("\nDidn't get 'CY' or 'CN', got %s\n",
					&msgi[6]);
#endif
			} else {
				logit("REQUESTED", &msgi[6]);
				break;
			}
		}
	} else {
		/* Can't open file for reading; return error packet */
#ifdef DEBUG
		printf("Cannot open file %s (%s) for reading, errno=%d\n",
			p, srcnam, errno);
#endif
		logit("DENIED", "CAN'T OPEN");
		if (yesno('R', 0))
			return 1;
	}

	return 0;
}

#ifdef LOG
/*
 * Log file writing subroutine.
 *
 * Makes incredibly ugly log entries that look *just like* Unix uucp's
 * incredibly ugly log entries.
 *
 * Once we don't care about compatability, we should do this much better.
 */
logit(one, two)
	char *one, *two;
{
	char logbuf[(NAMESIZE*4)+SLOP+50];	/* Temp buffer for logs */
	long clock;
	struct tm *tm;
	int len;

	(void) time(&clock);
	tm = localtime(&clock);
	if (ourpid == 0)
		ourpid = getpid();

#ifdef ST
	sprintf(logbuf, "%s uuslave (%d/%d-%d:%02d-%d) %s (%s)\r\n",
#else
	sprintf(logbuf, "%s uuslave (%d/%d-%d:%02d-%d) %s (%s)\n",
#endif
		who, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min,
		ourpid, one, two);

#ifdef DEBUG
	printf("%s", logbuf);
#endif

	len = strlen(logbuf);
	if (len != write(logfd, logbuf, len)) {
#ifdef DEBUG
		printf("Can't log to logfd, terminating");
		perror(LOGFILE);
#endif
		exit(39);		/* Terminate if we can't log */
	}

}
#endif

#ifndef UNIX
/* CP/M and MSDOS and ST need these routines.  Probably should use
 * the new names, but for now...
 */
bzero(s, cnt)
register char	*s;
register int	cnt;
{
	register int	i;
	for (i = 0; i < cnt; i++) {
		*s++ = '\0';
	}
}

bcopy(from, to, cnt)
register char	*from;
register char	*to;
register int	cnt;
{
	register int	i;
	for (i = 0; i < cnt; i++) {
		*to++ = *from++;
	}
}
#endif

#ifdef COMPORT
/*
 * MSDOS routines for handling the comm port.
 *
 * get_time(n)
 * TIME_PTR n;
 *
 * fills timetype structure n with current time using DOS interrupt 21
 *
 */

get_time(n)
TIME_PTR n;
{
  union REGS inregs;
  union REGS outregs;

  inregs.h.ah = 0x2c;		/* Please make a #define for this, Tim */

  int86(0x21, &inregs, &outregs);/* Please #define the 0x21 too */

  n->hour = outregs.h.ch;
  n->minute  = outregs.h.cl;
  n->sec  = outregs.h.dh;
  n->hsec = outregs.h.dl;

  return(0);
}

sleep(x)
int x;
{
  int i;
  unsigned s;
  TIME n;               /* current time record */

  i = 0;
  get_time(&n);
  s = n.sec;

  while (i < x){
    while (s == n.sec)
      get_time(&n);
    s = n.sec;
    ++i;
  }
}
#endif

--- cut here ---
-- 
   /////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  /// Richard E. Sansom                   TRW Electronics & Defense Sector \\\
  \\\ {decvax,ucbvax,ihnp4}!trwrb!sansom  Redondo Beach, CA                ///
   \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////

sansom@trwrb.UUCP (04/15/87)

In article <1766@trwrb.UUCP> sansom@trwrb.UUCP (Richard Sansom) writes:
>"d_trwrbs.9c2" is the data file transferred by our BSD 4.2 system, and
>"x_trwrba.9c3" is the uuxqt command file.

I don't want to confuse anybody - those two files are the two sample files
mentioned in the logfile.  They have no significance other than to show an
example of what you'll be getting (on your ST) if you use this thing.

-Rich
-- 
   /////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  /// Richard E. Sansom                   TRW Electronics & Defense Sector \\\
  \\\ {decvax,ucbvax,ihnp4}!trwrb!sansom  Redondo Beach, CA                ///
   \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////