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

Re: PATCH: caps strings



2009/3/3 Mikael Magnusson <mikachu@xxxxxxxxx>:
> 2009/3/3 Peter Stephenson <pws@xxxxxxx>:
>> This should fix string arguments to functions in the caps module as
>> noticed by Mikael.  It looks like all the returned strings are output
>> directly by library calls so aren't affected.
>>
> I think the two zwarnnam calls with *argv needs them to be
> re-metafy()ed. When i didn't do that in attr.c, I got output like
> myutf8file\M-p.

Ie,

diff --git a/Src/Modules/cap.c b/Src/Modules/cap.c
index 4242d44..3fb653b 100644
--- a/Src/Modules/cap.c
+++ b/Src/Modules/cap.c
@@ -72,11 +72,12 @@
     do {
 	char *result = NULL;
 	ssize_t length;
+	unmetafy(*argv, NULL);
 	cap_t caps = cap_get_file(*argv);
 	if(caps)
 	    result = cap_to_text(caps, &length);
 	if (!caps || !result) {
-	    zwarnnam(nam, "%s: %e", *argv, errno);
+	    zwarnnam(nam, "%s: %e", metafy(*argv, slen, META_NOALLOC), errno);
 	    ret = 1;
 	} else
 	    printf("%s %s\n", *argv, result);
@@ -101,7 +102,7 @@
     do {
 	unmetafy(*argv, NULL);
 	if(cap_set_file(*argv, caps)) {
-	    zwarnnam(nam, "%s: %e", *argv, errno);
+	    zwarnnam(nam, "%s: %e", metafy(*argv, slen, META_NOALLOC), errno);
 	    ret = 1;
 	}
     } while(*++argv);


-- 
Mikael Magnusson



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