From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 210 invoked from network); 2 Jun 2006 19:09:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.2 (2006-05-25) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.2 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 2 Jun 2006 19:09:14 -0000 Received: (qmail 56794 invoked from network); 2 Jun 2006 19:09:05 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 2 Jun 2006 19:09:05 -0000 Received: (qmail 17749 invoked by alias); 2 Jun 2006 19:09:03 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 22482 Received: (qmail 17737 invoked from network); 2 Jun 2006 19:09:02 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 2 Jun 2006 19:09:02 -0000 Received: (qmail 56518 invoked from network); 2 Jun 2006 19:09:02 -0000 Received: from zoidberg.org (HELO cthulhu.zoidberg.org) (213.133.99.5) by a.mx.sunsite.dk with SMTP; 2 Jun 2006 19:09:01 -0000 Received: from ruri ([::ffff:195.158.181.68]) (AUTH: PLAIN tobias, TLS: TLSv1/SSLv3,256bits,AES256-SHA) by cthulhu.zoidberg.org with esmtp; Fri, 02 Jun 2006 21:08:59 +0200 id 0584D52B.44808CCB.00003603 Date: Fri, 2 Jun 2006 21:08:57 +0200 From: Tobias Gruetzmacher To: zsh-workers@sunsite.dk Subject: PATCH: _cdrecord Message-ID: <20060602190857.GA14534@portfolio16.de> Mail-Followup-To: zsh-workers@sunsite.dk Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=_cthulhu.zoidberg.org-13827-1149275340-0001-2" Content-Disposition: inline User-Agent: Mutt/1.5.11+cvs20060403 This is a MIME-formatted message. If you see this text it means that your E-mail software does not support MIME-formatted messages. --=_cthulhu.zoidberg.org-13827-1149275340-0001-2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Since "cdrecord -scanbus" can be expensive on some systems, this patch caches the response of the call to "cdrecord -scanbus". I don't know if this is the best solution since the device configuration may change very fast (e.g. USB burners). Nevertheless, here's the patch: --- Completion/Unix/Command/_cdrecord 8 Jun 2005 05:33:47 -0000 1.5 +++ Completion/Unix/Command/_cdrecord 2 Jun 2006 18:59:12 -0000 @@ -1,7 +1,7 @@ #compdef cdrecord =20 local curcontext=3D"$curcontext" state line expl ret=3D1 -local devices btypes +local btypes =20 _arguments -C \ '-version[print version information]' \ @@ -89,9 +89,12 @@ =20 case $state in device) - devices=3D( ${(f)"$(_call_program device cdrecord -scanbus 2>/dev/nu= ll \ + if (( ! $+_cdrecord_device )); then + typeset -gH _cdrecord_devices + _cdrecord_devices=3D( ${(f)"$(_call_program device cdrecord -scanb= us 2>/dev/null \ |grep '^ '|cut -c2-6,23-|sed 's/ /:/')"} ) - _describe -t devices device devices && return + fi + _describe -t devices device _cdrecord_devices && return ;; blank) btypes=3D( Greetings, Tobi --=20 GPG-Key 0xE2BEA341 - signed/encrypted mail preferred My, oh so small, homepage: http://portfolio16.de/ http://www.fli4l.de/ - ISDN- & DSL-Router on one disk! Registered FLI4L-User #00000003 --=_cthulhu.zoidberg.org-13827-1149275340-0001-2 Content-Type: application/pgp-signature; name="signature.asc" Content-Transfer-Encoding: 7bit Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) iD8DBQFEgIzJGf7YPOK+o0ERAv00AKDybpO4287zc5lD538ZYMdj+CuChgCcDUQB /MVcSaqfw5RTsiPGeLObV9o= =Rwb0 -----END PGP SIGNATURE----- --=_cthulhu.zoidberg.org-13827-1149275340-0001-2--