.. zsh-module-meta::
   :name: zsh/attr
   :summary: Builtins for manipulating extended attributes (xattr).

The ``zsh/attr`` module is used for manipulating extended attributes.
The ``-h`` option causes all commands to operate on symbolic links instead
of their targets.
The builtins in this module are:

.. index:: single: zgetattr; Function

.. index:: single: extended attributes, xattr, getting from files; Command

``zgetattr`` [ ``-h`` ] :var:`filename` :var:`attribute` [ :var:`parameter` ]
    
    Get the extended attribute :var:`attribute` from the specified
    :var:`filename`. If the optional argument :var:`parameter` is given, the
    attribute is set on that parameter instead of being printed to stdout.
    

.. index:: single: zsetattr; Function

.. index:: single: extended attributes, xattr, setting on files; Command

``zsetattr`` [ ``-h`` ] :var:`filename` :var:`attribute` :var:`value`
    
    Set the extended attribute :var:`attribute` on the specified
    :var:`filename` to :var:`value`.
    

.. index:: single: zdelattr; Function

.. index:: single: extended attributes, xattr, removing, deleting; Command

``zdelattr`` [ ``-h`` ] :var:`filename` :var:`attribute`
    
    Remove the extended attribute :var:`attribute` from the specified
    :var:`filename`.
    

.. index:: single: zlistattr; Function

.. index:: single: extended attributes, xattr, listing; Command

``zlistattr`` [ ``-h`` ] :var:`filename` [ :var:`parameter` ]
    
    List the extended attributes currently set on the specified
    :var:`filename`. If the optional argument :var:`parameter` is given, the
    list of attributes is set on that parameter instead of being printed to stdout.
    

``zgetattr`` and ``zlistattr`` allocate memory dynamically.  If the
attribute or list of attributes grows between the allocation and the call
to get them, they return 2.  On all other errors, 1 is returned.  This
allows the calling function to check for this case and retry.
