mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-06-11 19:18:01 +02:00
26671: various minor attribute tidy ups
This commit is contained in:
parent
d58e5061ad
commit
919f7b12ad
4 changed files with 93 additions and 38 deletions
|
@ -1,5 +1,9 @@
|
|||
2009-03-03 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 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 $
|
||||
*****************************************************
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
'
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue