From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17959 invoked by alias); 18 Jul 2018 09:09:33 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 43183 Received: (qmail 18436 invoked by uid 1010); 18 Jul 2018 09:09:33 -0000 X-Qmail-Scanner-Diagnostics: from rcpt-expgw.biglobe.ne.jp by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(133.208.98.4):SA:0(-2.6/5.0):. Processed in 1.138186 secs); 18 Jul 2018 09:09:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: takimoto-j@kba.biglobe.ne.jp X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Biglobe-Sender: From: Jun T Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [PATCH] fix '_ttys -o', and use it in _gdb and _pgrep Message-Id: <89BD8CC6-ABBB-4D07-A2DA-F5A1F92D3E9C@kba.biglobe.ne.jp> Date: Wed, 18 Jul 2018 18:09:29 +0900 To: zsh-workers@zsh.org X-Mailer: Apple Mail (2.3273) X-Biglobe-Spnum: 61180 The option '-o' (open ttys only) I added recently to _ttys does not work on Linux since 'ps -a' does not include session leaders. We need to use 'ps -Ao tty=3D' and discard '?' or '??'. _gdb and _pgrep are modified to use the option '-o'. diff --git a/Completion/Unix/Command/_gdb b/Completion/Unix/Command/_gdb index 510e6f1fa..18f797633 100644 --- a/Completion/Unix/Command/_gdb +++ b/Completion/Unix/Command/_gdb @@ -5,12 +5,12 @@ local cur=3D"$words[CURRENT]" prev w list ret=3D1 expl [[ "$PREFIX" =3D --* ]] && _arguments -- '*=3D(CORE|SYM)FILE:core file:_files' \ '*=3DEXECFILE:executable:_files -g \*\(-\*\)' \ - '*=3DTTY:terminal device:_ttys' && return 0 + '*=3DTTY: :_ttys -o' && return 0 =20 if compset -P '-(cd|directory)=3D'; then _files -/ elif compset -P '-tty=3D'; then - _wanted devices expl 'terminal device' _ttys + _ttys -o elif compset -P '-(exec|se)=3D'; then _description files expl executable _files "$expl[@]" -g '*(-*)' diff --git a/Completion/Unix/Command/_pgrep = b/Completion/Unix/Command/_pgrep index b6020e5a9..86aef3462 100644 --- a/Completion/Unix/Command/_pgrep +++ b/Completion/Unix/Command/_pgrep @@ -40,7 +40,7 @@ arguments=3D( # _signals is OK here =E2=80=94 we do it differently below '(ss)--signal=3D[specify signal to send to process]: :_signals -s' '-T+[match only on specified routing table]:routing table' - '(-t --terminal)'{-t+,--terminal=3D}'[match only on specified = controlling terminals]:terminal device:_sequence _ttys -d' + '(-t --terminal)'{-t+,--terminal=3D}'[match only on specified = controlling terminals]: :_sequence _ttys -do' '(-U --uid)'{-U+,--uid=3D}'[match only on specified real user IDs]: = :_sequence _users' '(-u --euid)'{-u+,--euid=3D}'[match only on specified effective user = IDs]: :_sequence _users' '(-v --inverse)'{-v,--inverse}'[negate matching]' diff --git a/Completion/Unix/Type/_ttys b/Completion/Unix/Type/_ttys index 7408395c8..3c40466cb 100644 --- a/Completion/Unix/Type/_ttys +++ b/Completion/Unix/Type/_ttys @@ -12,7 +12,7 @@ local stripdev optdev open zparseopts -D -K -E d=3Dstripdev D=3Doptdev o=3Dopen =20 if [[ -n $open ]]; then - ttys=3D( ${(u)${(f)"$(_call_program open-ttys ps -ao tty=3D)"}%% *} ) + ttys=3D( ${(u)${${(f)"$(_call_program open-ttys ps -Ao = tty=3D)"}:#\?*}%% *} ) _description open-ttys expl 'open tty' else ttys=3D( /dev/tty?*(N) /dev/pts/^ptmx(N) )