Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: help with command completion



Sven Wischnowsky wrote:

> Then we can just start generating the printer names in this `if'. One
> possibility is something like:
> 
>   compadd - "${(@)${(@s:|:)${(@)${(@f)$(< /etc/printcap)}:#[    \#]*}%%:*}%%[   ]*}"

I was just looking into trying to adapt this to work on AIX aswell. AIX
lists the print queues in /etc/qconfig.

The following works there:
_lp_cache=( ${${(f)"$(</etc/qconfig)"}%%[:\*[:blank:]]*} )

I am a little unsure what format the /etc/printcap file is supposed to
be in - printcap(5) suggests that | separates alternate names for the
queues but the only printcap file I have access to has entries like
lp|Generic dot-matrix printer entry:\

What are the possible queue names in this case - just lp, lp and Generic
or lp and Generic\ dot-matrix\ printer\ entry? My tests imply that it is
just lp. Sven's pattern would imply the answer is lp and Generic. I
can't properly test it because there aren't any real printers attached
to the one Linux machine I have access to. Does anyone know the answer
to this? The following pattern will work for AIX and I think it behaves
the same as Sven's pattern under Linux:
${(s:|:)${${(f)"$(<$file[1])"}%%[:\#\*[:blank:]]*}}

I'll not send a patch to _lp though until I've looked at IRIX at home
and established what Linux does about those spaces.

Oliver Kiddle



Messages sorted by: Reverse Date, Date, Thread, Author