From 919f7b12ad4cd6e4b6745e7ea647b9bf0e58c70c Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 3 Mar 2009 16:40:34 +0000 Subject: 26671: various minor attribute tidy ups --- ChangeLog | 6 ++- Completion/Zsh/Command/_zattr | 2 +- Doc/Zsh/.distfiles | 89 ++++++++++++++++++++++++++++++++++--------- Src/Modules/attr.c | 34 ++++++++--------- 4 files changed, 93 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9560be129..445e80cca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2009-03-03 Peter Stephenson + * 26671: Completion/Zsh/Command/_zattr, Doc/Zsh/.distfiles, + Src/Modules/attr.c: various minor tidy-ups (tidies up?) for + 26670. + * Mikael Magnusson: 26670: configure.ac, Completion/Command/Zsh/.distfiles, Completion/Zsh/Command/_zattr, Doc/Makefile.in, Doc/Zsh/.distfiles, Doc/Zsh/mod_attr.yo, @@ -11304,5 +11308,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.4592 $ +* $Revision: 1.4593 $ ***************************************************** diff --git a/Completion/Zsh/Command/_zattr b/Completion/Zsh/Command/_zattr index e3836f247..56c754be6 100644 --- a/Completion/Zsh/Command/_zattr +++ b/Completion/Zsh/Command/_zattr @@ -29,6 +29,6 @@ _arguments \ esac if [[ $state = attrs ]]; then - zlistattr $line[1] REPLY + zlistattr $~line[1] REPLY _wanted attrs expl 'attribute' compadd ${(0)REPLY} fi diff --git a/Doc/Zsh/.distfiles b/Doc/Zsh/.distfiles index 95764875b..dcca24e07 100644 --- a/Doc/Zsh/.distfiles +++ b/Doc/Zsh/.distfiles @@ -1,21 +1,72 @@ DISTFILES_SRC=' - .cvsignore .distfiles - arith.yo builtins.yo calsys.yo compat.yo - compctl.yo compsys.yo compwid.yo cond.yo - contrib.yo exec.yo expn.yo filelist.yo - files.yo func.yo grammar.yo index.yo - intro.yo invoke.yo jobs.yo manmodmenu.yo - manual.yo metafaq.yo mod_attr.yo mod_cap.yo - mod_clone.yo - mod_compctl.yo mod_complete.yo mod_complist.yo mod_computil.yo - mod_curses.yo mod_datetime.yo mod_deltochar.yo mod_example.yo - mod_files.yo mod_langinfo.yo modlist.yo mod_mapfile.yo - mod_mathfunc.yo modmenu.yo mod_newuser.yo mod_parameter.yo - mod_pcre.yo mod_regex.yo mod_sched.yo mod_socket.yo - mod_stat.yo mod_system.yo mod_tcp.yo mod_termcap.yo - mod_terminfo.yo modules.yo mod_zftp.yo mod_zleparameter.yo - mod_zle.yo mod_zprof.yo mod_zpty.yo mod_zselect.yo - mod_zutil.yo options.yo params.yo prompt.yo - redirect.yo restricted.yo roadmap.yo seealso.yo - tcpsys.yo zftpsys.yo zle.yo +.cvsignore +.distfiles +arith.yo +builtins.yo +calsys.yo +compat.yo +compctl.yo +compsys.yo +compwid.yo +cond.yo +contrib.yo +exec.yo +expn.yo +filelist.yo +files.yo +func.yo +grammar.yo +index.yo +intro.yo +invoke.yo +jobs.yo +manmodmenu.yo +manual.yo +metafaq.yo +mod_attr.yo +mod_cap.yo +mod_clone.yo +mod_compctl.yo +mod_complete.yo +mod_complist.yo +mod_computil.yo +mod_curses.yo +mod_datetime.yo +mod_deltochar.yo +mod_example.yo +mod_files.yo +mod_langinfo.yo +modlist.yo +mod_mapfile.yo +mod_mathfunc.yo +modmenu.yo +mod_newuser.yo +mod_parameter.yo +mod_pcre.yo +mod_regex.yo +mod_sched.yo +mod_socket.yo +mod_stat.yo +mod_system.yo +mod_tcp.yo +mod_termcap.yo +mod_terminfo.yo +modules.yo +mod_zftp.yo +mod_zleparameter.yo +mod_zle.yo +mod_zprof.yo +mod_zpty.yo +mod_zselect.yo +mod_zutil.yo +options.yo +params.yo +prompt.yo +redirect.yo +restricted.yo +roadmap.yo +seealso.yo +tcpsys.yo +zftpsys.yo +zle.yo ' diff --git a/Src/Modules/attr.c b/Src/Modules/attr.c index 3355d5c6b..b6f9d7084 100644 --- a/Src/Modules/attr.c +++ b/Src/Modules/attr.c @@ -37,10 +37,10 @@ static int bin_getattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) { int ret = 0; - int len; + int len, slen; char value[256]; - unmetafy(*argv, NULL); + unmetafy(*argv, &slen); unmetafy(*(argv+1), NULL); if (listxattr(*argv, NULL, 0) > 0) { if (0 < (len = getxattr(*argv, *(argv+1), value, 255))) { @@ -51,8 +51,8 @@ bin_getattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) else printf("%s\n", value); } - } else { - zwarnnam(nam, "%s: %e", metafy(*argv, -1, META_NOALLOC), errno); + } else if (len < 0) { + zwarnnam(nam, "%s: %e", metafy(*argv, slen, META_NOALLOC), errno); ret = 1; } } @@ -62,13 +62,13 @@ bin_getattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) static int bin_setattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) { - int ret = 0; - - unmetafy(*argv, NULL); + int ret = 0, slen; + + unmetafy(*argv, &slen); unmetafy(*(argv+1), NULL); unmetafy(*(argv+2), NULL); if (setxattr(*argv, *(argv+1), *(argv+2), strlen(*(argv+2)), 0)) { - zwarnnam(nam, "%s: %e", metafy(*argv, -1, META_NOALLOC), errno); + zwarnnam(nam, "%s: %e", metafy(*argv, slen, META_NOALLOC), errno); ret = 1; } return ret; @@ -77,25 +77,25 @@ bin_setattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) static int bin_delattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) { - int ret = 0; - - unmetafy(*argv, NULL); + int ret = 0, slen; + + unmetafy(*argv, &slen); unmetafy(*(argv+1), NULL); if (removexattr(*argv, *(argv+1))) { - zwarnnam(nam, "%s: %e", metafy(*argv, -1, META_NOALLOC), errno); + zwarnnam(nam, "%s: %e", metafy(*argv, slen, META_NOALLOC), errno); ret = 1; } return ret; } - + static int bin_listattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) { int ret = 0; - int len, i = 1; + int len, slen; char value[256]; - unmetafy(*argv, NULL); + unmetafy(*argv, &slen); if (0 < (len = listxattr(*argv, value, 256))) { if (len < 256) { char *p = value; @@ -106,8 +106,8 @@ bin_listattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func)) p += strlen(p) + 1; } } - } else { - zwarnnam(nam, "%s: %e", metafy(*argv, -1, META_NOALLOC), errno); + } else if (len < 0) { + zwarnnam(nam, "%s: %e", metafy(*argv, slen, META_NOALLOC), errno); ret = 1; } return ret; -- cgit 1.4.1