SfdZddlZddlZddlZddlZej edgdZGddeZ ddd d Z dd Z d Z ed k(re yy)zImplementation of the UUencode and UUdecode functions. encode(in_file, out_file [,name, mode], *, backtick=False) decode(in_file [, out_file, mode, quiet]) N) )remove)Errorencodedecodec eZdZy)rN)__name__ __module__ __qualname__)/opt/alt/python312/lib64/python3.12/uu.pyrr)srrFbacktickcg} |dk(rtjj}npt|tr`|t j j|}| t j|j}t|d}|j||dk(rtjj}n-t|trt|d}|j||d}|d}|jdd}|jdd }|jd |d z|fzj!d |j#d }t%|dkDrF|jt'j(|||j#d }t%|dkDrF|r|jdn|jd|D]}|j+y#t$rYlwxYw#|D]}|j+wxYw)z Uuencode file-Nrbwbi z\n z\rz begin %o %s iascii-rrs` end s end )sysstdinbuffer isinstancestrospathbasenamestatst_modeAttributeErroropenappendstdoutreplacewriterreadlenbinasciib2a_uuclose)in_fileout_filenamemoder opened_filesdatafs rrr,s L1 c>ii&&G  %|ww''0|777+33D7D)G    ( s?zz((H # &Hd+H    ) <D <D ||D'||D' D5L4*@@HHQR||B$i!m NN8??4(C D<<#D$i!m  NN; ' NN; 'A GGIO&NA GGIs7AG'G7D"G'%G' G$ G'#G$$G''Hcg}|dk(rtjj}n-t|trt |d}|j | |j}|s td|jds0|jdd}t|dk(r|ddk(r t|d d ni||djd jd }t j"j%|rtd||jt j&sYdt j&|vsDt j(rC|jt j(sdt j(|vrtd|d|t|d d }|dk(rtj*j}nEt|tr5t |d}t!j,|||}|j ||j}|rb|j/d dk7rN t1j2|} |j7| |j}|r|j/d dk7rN|s td |D]} | j9y #t$rYwxYw#t0j$rZ} |ddz dzdzdzdz} t1j2|d | } |s"tj4j7d| zYd } ~ d } ~ wwxYw#|D]} | j9wxYw)zDecode uuencoded filerrz'No valid begin line found in input filesbegin rrNs rz Cannot overwrite existing file: z..zRefusing to write to z due to directory traversalrsend ?z Warning: %s zTruncated input file)rrrrrr%r&readliner startswithsplitr+int ValueErrorrstriprrr existssepaltsepr'chmodstripr,a2b_uustderrr)r.) r/r0r2quietr3hdr hdrfieldsfpsr4vnbytesr5s rrrfs L#~))"" GS !w%G$<""$CEFF>>(+ $*I9~"y|x'? ! a(   |**<8??HHww~~h'>xjIJJ##BFF+RVVH )II((3"))%13H:=XYZZ <y|Q'D s?zz((H # &h%B HHXt $H    )    AGGL)V3 :q) NN4   "AAGGL)V3./ /A GGIY"B>> :aDGr>Q.2q8q&z2JJ$$_q%89  :A GGIscAL$*J$9E7L$1J47L$> L$$ J1-L$0J11L$4L!ALL$L!!L$$L=cddl}|jd}|jddddd d |jd d ddd d |j\}}t |dkDr&|j dt jdt jj}t jj}t |dkDr|d}t |dkDr|d}|jrh|jrOt|tr t|d}n2t!t j"ddt jdt||y|jrOt|tr t|d}n2t!t j"ddt jdt%||y)zuuencode/uudecode main programrNz'usage: %prog [-d] [-t] [input [output]])usagez-dz--decoderzDecode (instead of encode)?F store_true)desthelpdefaultactionz-tz--texttextz2data is text, encoded format unix-compatible text?r8zincorrect number of argumentsr9rz: cannot do -t to stdoutrz: cannot do -t from stdin)optparse OptionParser add_option parse_argsr+errorrexitrrr'rrZrrr%printargvr)r[parseroptionsargsinputoutputs rtestrhsl  " ")R " SF dJX uf <<%%UD)chhqk#>? ufr__main__)NN)NNF) __doc__r,rrwarnings _deprecatedr __all__ Exceptionrrrrhr rrrosi4  Xg. ' I 77tHT$L zFr