Sindbad~EG File Manager
�
%ٜg� � �h � d dl Z d dlZd dlZd dlZd dlZe j
Ze j Zd dlmZm Z ej � Z
e
d dk( r@e
d j d� D � cg c]
} e| � �� c} dd gk\ r ej d� Zn ej d� Zd � Zd
� Zd� Zd� ZeZyc c} w )
� N)�error�xauth�Darwin� �.� z*^([-a-zA-Z0-9._/]*):([0-9]+)(\.([0-9]+))?$z)^([-a-zA-Z0-9._]*):([0-9]+)(\.([0-9]+))?$c �F � | � t j j dd� } t j | � }|st j | � �| }|j d� }t |j d� � }|j d� }|rt |� }nd}||||fS )N�DISPLAY� � r � r ) �os�environ�get�
display_re�matchr �DisplayNameError�group�int)�display�m�name�host�dno�screens �D/usr/local/lib/python3.12/site-packages/Xlib/support/unix_connect.py�get_displayr ( s� � ����*�*�.�.��B�/������!�A���$�$�W�-�-��D��7�7�1�:�D�
�a�g�g�a�j�/�C�
�W�W�Q�Z�F�
��V�������s�F�"�"� c � � t d dk( rW|rU|j d� rDt j t j t j � }|j | � n�|rIt j t j t j � }|j |d|z f� nFt j t j t j � }|j d|z � t j |j � t t � |S # t $ r$}t j | t |� � �d }~ww xY w)Nr r �/tmp/ip z/tmp/.X11-unix/X%d)�uname�
startswith�socket�AF_UNIX�SOCK_STREAM�connect�AF_INET�OSErrorr �DisplayConnectionError�str�fcntl�fileno�F_SETFD�
FD_CLOEXEC)�dnamer r �s�vals r �
get_socketr2 = s� � �<��!�H�� �d�t���w�/G��
�
�f�n�n�f�.@�.@�A�A�
�I�I�e�� ��
�
�f�n�n�f�.@�.@�A�A�
�I�I�t�T�C�Z�(�)� �
�
�f�n�n�f�.@�.@�A�A�
�I�I�*�S�0�1�
�K�K����
�G�Z�0��H��
� <��*�*�5�#�c�(�;�;��<�s �C4D% �% E�.E
�
Ec �v � t d dk( r8|r6|j d� r%t j }t j
� }nu|rOt j }| j � d j d� }dj t d� |� � }n$t j }t j
� }t j � } |j |||� S # t j $ r Y nw xY w|t j k( r*|dk( r%t j }t j
� }ny�l) Nr r r r r c �* � t t | � � S )N)�chrr ��xs r �<lambda>znew_get_auth.<locals>.<lambda>b s � �S��Q��[r z )r r )r! r"