File: //lib64/python2.7/Tools/scripts/which.pyc
�
{�fc           @   sz   d  d l  Z  e  j d d	 k r, e  j d =n  d  d l  Z  d  d l Z d  d l Td �  Z d �  Z e d k rv e �  n  d S(
   i����Ni    t   .t    (   t   *c         C   s   t  j j |  d � d  S(   Ns   
(   t   syst   stderrt   write(   t   str(    (    s+   /usr/lib64/python2.7/Tools/scripts/which.pyt   msg
   s    c    
      C   s�  t  j d j t  j � }  d } d } t j d rc t j d d  d k rc t j d } t j d =n  x]t j d D]N} d } x"|  D]} t  j j | | � } y t  j | � } Wn t  j	 k
 r� q� n Xt
 | t � s� t | d � np t
 | t � } | d @rO| s| GH| d	  } q]| d	  | k r8d
 }	 n d }	 t |	 | � n t | d � | r� t  j d
 | d | � } | r�t d t | � � q�q� q� W| sq t | d � d } qq qq Wt j | � d  S(   Nt   PATHi    R   i   i   s   -ls   : not a disk fileiI   i   s	   same as: s   also: s   : not executables   ls t    s   "ls -l" exit status: s   : not found(    (   t   ost   environt   splitt   pathsepR   t   argvt   patht   joint   statt   errort   S_ISREGt   ST_MODER   t   S_IMODEt   systemt   reprt   exit(
   t   pathlistt   stst   longlistt   progt   identt   dirt   filenamet   stt   modet   s(    (    s+   /usr/lib64/python2.7/Tools/scripts/which.pyt   main   sD    $
	 
t   __main__(   R    R   (   R   R   R
   R   R   R#   t   __name__(    (    (    s+   /usr/lib64/python2.7/Tools/scripts/which.pyt   <module>   s    
		+