mň %U˛Ic@s`dZddgZdZdZdZdZdZdZd Zd Z d Z d Z d Z dZ dZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZeƒZha d„Z!dZ"d Z#d!d"„Z$d!d#„Z%d$„Z&d%„Z'd&„Z(d'„Z)d(„Z*d)„Z+d*„Z,d+„Z-e.d,jo e-ƒnd-S(.s!Gopher protocol client interface.t send_selectort send_querys1/sgopher.micro.umn.eduiFt0t1t2t3t4t5t6t7t8t9t+tstetcthtTtMtItwtqtgt:t;tx;tD]/}|d djo|dtt|ƒ((R t get_directory`s<     cCsg}t||iƒ|S(s@Get a text file as a list of lines, with trailing CRLF stripped.N(tlinestget_alt_textfileR<RC(R<RF((R t get_textfile€scCs˘x›|iƒ}|p dGHPn|dtjo|d }n |dtjo|d }n|djoPn|d djo|d}n||ƒqWdS( sNGet a text file and pass each line to a function, with trailing CRLF stripped.is(Unexpected EOF from server)iţ˙˙˙i˙˙˙˙R9is..N(R<R=R>R1tfunc(R<RIR>((R RG†s   cCs|iƒ}|S(s*Get a binary file as one solid data block.N(R<treadtdata(R<RK((R t get_binary—s cCs1x*|i|ƒ}|pPn||ƒqWdS(s4Get a binary file and pass each block to a function.iN(R<RJt blocksizeRKRI(R<RIRMRK((R tget_alt_binaryœsc CsĘdk}dk}|i|iddƒ\} }t}|d}t}|o|d}|d}n|oŠ|d}|d}t |ƒdjo|d|}}n&d}|o|d}|d}nd}|o|d}|d}q÷n|t jot |||ƒ} nt||ƒ} |tjo&t| ƒ} x| D] } | GHqIWnk|tt fjo&t| ƒ}xH|D] } | GHq‚Wn2t| ƒ}dGt |ƒGdGt|d ƒd GHdS( sTrivial test program.NiR"is binary data:sbytes:idi((tsystgetopttargvtoptstargst DEF_SELECTORR0R+tDEF_HOSTR&RBR4tA_INDEXRR<RtA_TEXTRHRFtitemtA_MENURER;RLRKtrepr( R;R4RPR+RSR0ROR&RKR<RFRXRR((R ttest¤sL               t__main__N(/t__doc__t__all__RTRUR*RWRYtA_CSOtA_ERRORt A_MACBINHEXt A_PCBINHEXt A_UUENCODEDRVtA_TELNETtA_BINARYt A_DUPLICATEtA_SOUNDtA_EVENTt A_CALENDARtA_HTMLtA_TN3270tA_MIMEtA_IMAGEtA_WHOIStA_QUERYtA_GIFtA_WWWt A_PLUS_IMAGEt A_PLUS_MOVIEt A_PLUS_SOUNDtdirRRR!R1R@RRR7R8RERHRGRLRNR[t__name__(+R`R_RrRpRRnRURcRsR^RNRRkRjRaRER!R@R[RmRHRhRoRqRGRRtR1RWR*RgRbR8RlRTRiR7RVRdRLReRfRY((R t?s^           (