Archive for April, 2008

readable IOMessage errors

Monday, April 21st, 2008

perror() has it’s uses, but sometimes it’s more convenient to just have a string translation for the global error.
awk '/#define/ {
if(match($0,"[/][*][ ]*.+[*][/]"))
{
a=substr($0,RSTART+3,RLENGTH-6)
}
else a="";
printf " case %s : return \"%s - %s\";\n",$2,$2,a;
next
};
/^#/' /usr/include/sys/errno.h

You can make something similar for IOMessages
awk '/#define/ {
printf " case %s : return \"%s\";\n",$2,$2;
next
};' '/Developer/SDKs/MacOSX10.5.sdk/System/Library/
Frameworks/IOKit.framework/Versions/A/Headers/IOMessage.h'

removing meta-annoying

Monday, April 21st, 2008

xattr -l -p com.apple.quarantine ~/Downloads/*