HEX
Server: Apache/2.4.62 (Debian)
System: Linux MIA-VPS-VM01781 5.10.0-32-amd64 #1 SMP Debian 5.10.223-1 (2024-08-10) x86_64
User: webmaster (1001)
PHP: 8.2.29
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/lib/python3.9/__pycache__/mailcap.cpython-39.pyc
a

��;`��@s�dZddlZddlZddgZdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
ddgfdd�Zd dd�Zgfdd�Z
dd�Zdd�Zdd�Zedkr�e�dS)!z%Mailcap file handling.  See RFC 1524.�N�getcaps�	findmatchcCsd|vrd|dfSdSdS)N�linenor)�r�)�entryrr�/usr/lib/python3.9/mailcap.py�lineno_sort_key	sr	c	Cs�i}d}t�D]�}zt|d�}Wnty6YqYn0|�t||�\}}Wd�n1s`0Y|��D]*\}}||vr�|||<qr|||||<qrq|S)a�Return a dictionary containing the mailcap database.

    The dictionary maps a MIME type (in all lowercase, e.g. 'text/plain')
    to a list of dictionaries corresponding to mailcap entries.  The list
    collects all the entries for that MIME type from all available mailcap
    files.  Each dictionary contains key-value pairs for that MIME type,
    where the viewing command is stored with the key "view".

    r�rN)�listmailcapfiles�open�OSError�_readmailcapfile�items)�capsrZmailcap�fpZmorecaps�key�valuerrrrs


,
cCsPdtjvr"tjd}|�tj�}n*dtjvr8tjd}nd}|ddddg}|S)z7Return a list of all mailcap files found on the system.ZMAILCAPS�HOME�.z	/.mailcapz/etc/mailcapz/usr/etc/mailcapz/usr/local/etc/mailcap)�os�environ�split�pathsep)ZpathstrZmailcapsZhomerrrr-s


�rcCs t�dtd�t|d�\}}|S)z?Read a mailcap file and return a dictionary keyed by MIME type.z2readmailcapfile is deprecated, use getcaps instead�N)�warnings�warn�DeprecationWarningr)rr�_rrr�readmailcapfile?s
�rc	Cs�i}|��}|sq�|ddks|��dkr,q|}|dd�dkrb|��}|sPd}|dd�|}q0t|�\}}|r|sxq|dur�||d<|d	7}|�d
�}tt|��D]}||��||<q�d
�|���}||vr�||�|�q|g||<q||fS)a�Read a mailcap file and return a dictionary keyed by MIME type.

    Each MIME type is mapped to an entry consisting of a list of
    dictionaries; the list will contain more than one such dictionary
    if a given MIME type appears more than once in the mailcap file.
    Each dictionary contains key-value pairs for that MIME type, where
    the viewing command is stored with the key "view".
    r�#����Nz\
�
rr�/)	�readline�strip�	parseliner�range�len�join�lower�append)	rrr�lineZnextliner�fields�types�jrrrrGs0	
rc
Cs�g}dt|�}}||kr>t|||�\}}|�|�|d}qt|�dkrNdS|d|d|dd�}}}d|i}|D]V}|�d�}|dkr�|}d}	n$|d|���}||dd���}	||vr�qz|	||<qz||fS)	z�Parse one entry in a mailcap file and return a dictionary.

    The viewing command is stored as the value with the key "view",
    and the rest of the fields produce key-value pairs in the dict.
    rrr�NNN�view�=r!)r)�
parsefieldr,�findr&)
r-r.�i�n�fieldrr2�restZfkeyZfvaluerrrr'ps*

 

r'cCsP|}||kr<||}|dkr q<q|dkr2|d}q|d}q|||���|fS)z/Separate one key-value pair in a mailcap entry.�;�\rr)r&)r-r6r7�start�crrrr4�s

r4r2z	/dev/nullc	Csbt|||�}|D]L}d|vr@t|d||�}|r@t�|�dkr@qt|||||�}||fSdS)aFind a match for a mailcap entry.

    Return a tuple containing the command line, and the mailcap entry
    used; (None, None) if no match is found.  This may invoke the
    'test' command of several matching entries before deciding which
    entry to use.

    �testrr1)�lookup�substr�system)	r�MIMEtyper�filename�plist�entries�er>�commandrrrr�s	cslg}||vr|||}|�d�}|dd}||vrB|||}�dur\�fdd�|D�}t|td�}|S)Nr$rz/*csg|]}�|vr|�qSrr)�.0rF�rrr�
<listcomp>��zlookup.<locals>.<listcomp>rI)r�sortedr	)rrBrrEZ	MIMEtypesrrIrr?�s
r?c
Csd}dt|�}}||k�r||}|d}|dkr^|dkrT|||d�}|d}||}q||}|d}|dkr�||}q|dkr�||}q|dkr�||}q|dkr�|}||kr�||d	kr�|d}q�|||�}	|d}|t|	|�}q|d|}q|S)
Nr!rr�%r;�s�t�{�})r)�	findparam)
r8rBrCrD�resr6r7r=r<�namerrrr@�s0





r@cCsF|��d}t|�}|D](}|d|���|kr||d�SqdS)Nr3r!)r+r))rTrDr7�prrrrR�srRc	Cs�ddl}t�}|jdd�s(t|�dStdt|j�d�D]�}|j||d�}t|�dkrjtd�dS|d}|d}t||d|�\}}|s�tdt�q:td|�t	�
|�}t	�|�}|r:td|�q:dS)	Nrrrz"usage: mailcap [MIMEtype file] ...r2zNo viewer found forz
Executing:zExit status:)�sysr�argv�showr(r)�printr�typerrA�waitstatus_to_exitcode)	rVrr6�argsrB�filerGrF�stsrrrr>�s(


r>cCs�td�t�D]}td|�qt�|s0t�}td�t�t|�}|D]H}t|�||}|D].}t|�}|D]}td|||�qrt�qbqJdS)NzMailcap files:�	zMailcap entries:z  %-15s)rYrrrL)r�fnZckeysrZrErF�keys�krrrrXs
rX�__main__)N)�__doc__rr�__all__r	rrrrr'r4rr?r@rRr>rX�__name__rrrr�<module>s$
)