X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstring%2Fstrerror.c;h=2fdacdba5431bfc1eb73215bd612f477a5c50d22;hp=252671413656e57060d022a22cf1d93ce9e41f0a;hb=19b4cc9a30c2ede7a0cd6c417b5f26851376b708;hpb=419762f3c5da2a601e3c7427e25ae01293a73223 diff --git a/functions/string/strerror.c b/functions/string/strerror.c index 2526714..2fdacdb 100644 --- a/functions/string/strerror.c +++ b/functions/string/strerror.c @@ -5,11 +5,26 @@ // This code is Public Domain. Use, modify, and redistribute at will. // ---------------------------------------------------------------------------- -char * strerror( int errcode ) { /* TODO */ }; +#include -/* PDPC code - unreviewed +char * strerror( int errcode ) { - if (errnum == 0) return ("No error has occurred\n"); - else return ("An error has occurred\n"); + switch ( errcode ) + { + case 0: + return "no error"; + break; + case EDOM: + return "domain error"; + break; + case EILSEQ: + return "illegal sequence"; + break; + case ERANGE: + return "range error"; + break; + default: + return "unknown error"; + break; + } } -*/