Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Search a list of standard Mac error codes for more info' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Search a list of standard Mac error codes for more info
Authored by: discordantus on Jun 09, '03 05:41:30AM
I browsed through the header file, and it seems that there are sometimes more than one definitions for a particular error code -- 42 comes up twice, -1 comes up three times -- and it's impossible for me to tell if only one of these is correct, or all of them. So I'll keep them all in there, unless someone can tell me which ones to keep.

On another note, I also noticed that there are a lot of codes that didn't have commas after the numbers, and a lot that don't have comments after them. the script I posted seems to clear those out. So here is a revised script: it's shorter, works better, and prints even prettier to boot. :)


#!/usr/bin/perl
use warnings; use strict;

# usage: errcode num [num2]

my ($path,$file,$errn,$ferrn);

# set the path to the header file
$path = '/System/Library/Frameworks/'
.'CoreServices.framework/Versions/Current/Frameworks/'
.'CarbonCore.framework/Versions/Current/Headers/MacErrors.h';

# open it and search for each argument.
while($errn=shift){
    $ferrn=" "x(6-length($errn))."($errn): ";
    open $file, '<', $path;
    while(<$file>){
        print $1, $ferrn, $2||"[no description]", "\n"
            if (m!^\s*(\S*\s+)\s=\s$errn[,]?\s+(?:/\*\s?(.*?)\s?\*/\s*)?$!);
    } close $file;
} exit 0;


[ Reply to This | # ]