14 {"ENOENT", ENOENT, "No such file of directory."},
15 {"ENOMEM", ENOMEM,"Insufficient memory is available."},
16 {"EACCES", EACCES, "Read or search permission was denied for a component of the pathname."},
17 {"ENOTDIR", ENOTDIR, "Not a directory."},
18 {"EREAD", EREAD, "a read pipe operation failed"},
19 {"EREADPIPE", EREADPIPE, "a pipe used to read from the stdout of a command is broken"},
20 {"ETIMEOUT", ETIMEOUT, "a command is timeouted"},
21 {"EWRITE", EWRITE, "a write operation failed"},
22 {"EWRITEPIPE", EWRITEPIPE, "a pipe used to write to the stdin of a command is broken"},
23 {"EEXEC", EEXEC, "can't execute a command"},
24 {"EWAIT", EWAIT, "wait function failed"},
25 {"ECMDNOTFOUND", ECMDNOTFOUND, "command is not found"},
26 {"EEXITCODENOTMATCH", EEXITCODENOTMATCH, "exit codes don't match"},
27 {"EOUTPUTNOTMATCH", EOUTPUTNOTMATCH, "outputs don't match"},
28 {"ESIGNOTMATCH", ESIGNOTMATCH, "signals don't match"},
29 {"EUNEXPECTEDSIG", EUNEXPECTEDSIG, "unexpected signal caught"},
30 {"ESIGNOTRECEIPT", ESIGNOTRECEIPT, "expected signal not receipt"},
31 {"EFILENOTFOUND", EFILENOTFOUND, "specified tesh file not found"},
32 {"EGETCWD", EGETCWD, "system error : the getcwd() function failed"},
33 {"EDIRNOTFOUND", EDIRNOTFOUND, "specified directory not found"},
34 {"ECHDIR", ECHDIR, "system error : the chdir() function failed"},
35 {"EPROCCMDLINE", EPROCCMDLINE, "process_command_line() failed : internal error"},
36 {"ENOARG", ENOARG, "none optional argument not specified"},
37 {"ENOTPOSITIVENUM", ENOTPOSITIVENUM, "argument option not strictly positive"},
38 {"ESYNTAX", ESYNTAX, "syntax error"},
39 {"EINVALIDTIMEOUT", EINVALIDTIMEOUT, "timeout value specified by metacommand invalid"},
40 {"EINVALIDEXITCODE", EINVALIDEXITCODE, "expected exit code value specified by the metacommand invalid"},
41 {"ESIGNOTSUPP", ESIGNOTSUPP, "signal specified by the metacommand not supported (Windows specific)"},
42 {"ELEADTIME", ELEADTIME, "lead time"},
43 {"EREADMENOTFOUND", EREADMENOTFOUND, "unable to locate the README.txt file"},
44 {"EINCLUDENOTFOUND", EINCLUDENOTFOUND, "include file specified by a metacommand is not found"},
45 {"ESUFFIXTOOLONG", ESUFFIXTOOLONG, "suffix is too long"},
46 {"EFILENOTINSPECDIR", EFILENOTINSPECDIR,"file not found in the specified directories"},
47 {"EFILENOTINCURDIR", EFILENOTINCURDIR,"file not found in the current directory"},
48 {"unkwown", -1, "unknown"}
54 error_to_string(int errcode)
58 for(i = 0; err[i].code != -1; i++)
59 if(err[i].code == errcode)
62 return "unknow error";
66 error_get_at(int pos, int* code)
68 if(pos < 0 || (pos > (sizeof(err)/sizeof(entry_t)) - 2))
74 *code = err[pos].code;