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

[PATCH] _sys_calls: analyze recent syscall.h properly



On recent Fedora (at least 27 and 28), and maybe on other
distributions, /usr/include/bits/syscall.h contains lines like

# define SYS_open __NR_open

_sys_calls doesn't work due the space between '#' and 'define'.


diff --git a/Completion/Unix/Type/_sys_calls b/Completion/Unix/Type/_sys_calls
index bd9b34f70..dadf2b1a4 100644
--- a/Completion/Unix/Type/_sys_calls
+++ b/Completion/Unix/Type/_sys_calls
@@ -12,7 +12,7 @@ local -au syscalls
 zparseopts -D -K -E a=all n=none
 
 [[ $OSTYPE = linux* ]] && ifile=/usr/include/bits/syscall.h
-syscalls=( ${${${(M)${(f)"$(<$ifile)"}:#?define[[:blank:]]##SYS_*}#*[[:blank:]]SYS_}%%[[:blank:]]*} ) 2>/dev/null
+syscalls=( ${${${(M)${(f)"$(<$ifile)"}:#\#[[:blank:]]#define[[:blank:]]##SYS_*}#*[[:blank:]]SYS_}%%[[:blank:]]*} ) 2>/dev/null
 [[ -n $all ]] && syscalls+=( all )
 [[ -n $none ]] && syscalls+=( none )
 




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