Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [wip patch] new zsh/attr module
- X-seq: zsh-workers 26618
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxxxxx>
- Subject: Re: [wip patch] new zsh/attr module
- Date: Fri, 27 Feb 2009 01:48:15 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=qenOWVUCl4l5TEUdY1PBkhbTm3zxmT4hYGt4KCKAJKo=; b=K8ULUocAWT32a4n3NsUFQL2rwa6q2RADvkel5sgmxbrxHyoSTD6Uj959KyNSV3jbu5 lwTg43hOfRmnrzyRggcFGkY41LDYZOl2V9tRAB7TDry7KjUoSEZhC66HChK44H64Vr11 Czt+OI/DXAxZrZTjlTcaQ7jv7NWYih8XTVnAA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=hqR61IloCRD1Lus9Ad8xWJtF//CO5AfUrodhLpBCne67rQbCk60ppUelBUlWM2sHui 0SGXU074Dk6LdOG87ePYiJlHq5O8gcabhS9Afsp8C5QR4yf1XH5JmtOxwpbx2CxEGlNt p8vRVqBYiU8DV6Ryo00Fqk9y+hq5efSpLAuds=
- In-reply-to: <alpine.LNX.2.00.0902262245590.27571@localhost>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <alpine.LNX.2.00.0902262245590.27571@localhost>
2009/2/26 Mikael Magnusson <mikachu@xxxxxxxxx>:
> Hi,
> +static int
> +bin_getattr(char *nam, char **argv, UNUSED(Options ops), UNUSED(int func))
> +{
> + int ret = 0;
> + int len;
> + char value[256];
> +
> + if (listxattr(*argv, NULL, 0) > 0) {
> + if (0 < (len = getxattr(*argv, *(argv+1), value, 255))) {
It seems these *argv and the ones below need to be wrapped in unmeta()
to work with utf-8 filenames/values. Obviously I can't use unmeta()
twice in one function call though, can I call unmetafy() on the argv
values or will something be sad then? Can the length grow when I
unmetafy so I would need to alloc more space?
I also note the cap.c file doesn't unmeta(fy) its arguments so it
probably also doesn't work, but I don't have cap stuff so can't test.
Also, in unmeta() would putting a break; in the initial loop help? ie
for (t = file_name; *t; t++) {
if (*t == Meta) {
meta = 1;
+ break;
}
}
(or I suppose you could have *t && !meta)
My impression from looking at the code is that only metafy()ing can
grow the string, so it should be safe to just unmetafy() the strings,
assuming nothing breaks from me modifying the argv strings?
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author