mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-06-21 22:38:05 +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>
|
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,
|
* Mikael Magnusson: 26670: configure.ac,
|
||||||
Completion/Command/Zsh/.distfiles, Completion/Zsh/Command/_zattr,
|
Completion/Command/Zsh/.distfiles, Completion/Zsh/Command/_zattr,
|
||||||
Doc/Makefile.in, Doc/Zsh/.distfiles, Doc/Zsh/mod_attr.yo,
|
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
|
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||||
* $Revision: 1.4592 $
|
* $Revision: 1.4593 $
|
||||||
*****************************************************
|
*****************************************************
|
||||||
|
|
|
@ -29,6 +29,6 @@ _arguments \
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ $state = attrs ]]; then
|
if [[ $state = attrs ]]; then
|
||||||
zlistattr $line[1] REPLY
|
zlistattr $~line[1] REPLY
|
||||||
_wanted attrs expl 'attribute' compadd ${(0)REPLY}
|
_wanted attrs expl 'attribute' compadd ${(0)REPLY}
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,21 +1,72 @@
|
||||||
DISTFILES_SRC='
|
DISTFILES_SRC='
|
||||||
.cvsignore .distfiles
|
.cvsignore
|
||||||
arith.yo builtins.yo calsys.yo compat.yo
|
.distfiles
|
||||||
compctl.yo compsys.yo compwid.yo cond.yo
|
arith.yo
|
||||||
contrib.yo exec.yo expn.yo filelist.yo
|
builtins.yo
|
||||||
files.yo func.yo grammar.yo index.yo
|
calsys.yo
|
||||||
intro.yo invoke.yo jobs.yo manmodmenu.yo
|
compat.yo
|
||||||
manual.yo metafaq.yo mod_attr.yo mod_cap.yo
|
compctl.yo
|
||||||
mod_clone.yo
|
compsys.yo
|
||||||
mod_compctl.yo mod_complete.yo mod_complist.yo mod_computil.yo
|
compwid.yo
|
||||||
mod_curses.yo mod_datetime.yo mod_deltochar.yo mod_example.yo
|
cond.yo
|
||||||
mod_files.yo mod_langinfo.yo modlist.yo mod_mapfile.yo
|
contrib.yo
|
||||||
mod_mathfunc.yo modmenu.yo mod_newuser.yo mod_parameter.yo
|
exec.yo
|
||||||
mod_pcre.yo mod_regex.yo mod_sched.yo mod_socket.yo
|
expn.yo
|
||||||
mod_stat.yo mod_system.yo mod_tcp.yo mod_termcap.yo
|
filelist.yo
|
||||||
mod_terminfo.yo modules.yo mod_zftp.yo mod_zleparameter.yo
|
files.yo
|
||||||
mod_zle.yo mod_zprof.yo mod_zpty.yo mod_zselect.yo
|
func.yo
|
||||||
mod_zutil.yo options.yo params.yo prompt.yo
|
grammar.yo
|
||||||
redirect.yo restricted.yo roadmap.yo seealso.yo
|
index.yo
|
||||||
tcpsys.yo zftpsys.yo zle.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))
|
bin_getattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int len;
|
int len, slen;
|
||||||
char value[256];
|
char value[256];
|
||||||
|
|
||||||
unmetafy(*argv, NULL);
|
unmetafy(*argv, &slen);
|
||||||
unmetafy(*(argv+1), NULL);
|
unmetafy(*(argv+1), NULL);
|
||||||
if (listxattr(*argv, NULL, 0) > 0) {
|
if (listxattr(*argv, NULL, 0) > 0) {
|
||||||
if (0 < (len = getxattr(*argv, *(argv+1), value, 255))) {
|
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
|
else
|
||||||
printf("%s\n", value);
|
printf("%s\n", value);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (len < 0) {
|
||||||
zwarnnam(nam, "%s: %e", metafy(*argv, -1, META_NOALLOC), errno);
|
zwarnnam(nam, "%s: %e", metafy(*argv, slen, META_NOALLOC), errno);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,13 +62,13 @@ bin_getattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
|
||||||
static int
|
static int
|
||||||
bin_setattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
|
bin_setattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0, slen;
|
||||||
|
|
||||||
unmetafy(*argv, NULL);
|
unmetafy(*argv, &slen);
|
||||||
unmetafy(*(argv+1), NULL);
|
unmetafy(*(argv+1), NULL);
|
||||||
unmetafy(*(argv+2), NULL);
|
unmetafy(*(argv+2), NULL);
|
||||||
if (setxattr(*argv, *(argv+1), *(argv+2), strlen(*(argv+2)), 0)) {
|
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;
|
ret = 1;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -77,25 +77,25 @@ bin_setattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
|
||||||
static int
|
static int
|
||||||
bin_delattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
|
bin_delattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0, slen;
|
||||||
|
|
||||||
unmetafy(*argv, NULL);
|
unmetafy(*argv, &slen);
|
||||||
unmetafy(*(argv+1), NULL);
|
unmetafy(*(argv+1), NULL);
|
||||||
if (removexattr(*argv, *(argv+1))) {
|
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;
|
ret = 1;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bin_listattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
|
bin_listattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int len, i = 1;
|
int len, slen;
|
||||||
char value[256];
|
char value[256];
|
||||||
|
|
||||||
unmetafy(*argv, NULL);
|
unmetafy(*argv, &slen);
|
||||||
if (0 < (len = listxattr(*argv, value, 256))) {
|
if (0 < (len = listxattr(*argv, value, 256))) {
|
||||||
if (len < 256) {
|
if (len < 256) {
|
||||||
char *p = value;
|
char *p = value;
|
||||||
|
@ -106,8 +106,8 @@ bin_listattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
|
||||||
p += strlen(p) + 1;
|
p += strlen(p) + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (len < 0) {
|
||||||
zwarnnam(nam, "%s: %e", metafy(*argv, -1, META_NOALLOC), errno);
|
zwarnnam(nam, "%s: %e", metafy(*argv, slen, META_NOALLOC), errno);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue