X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstring%2Fstrerror.c;h=2fdacdba5431bfc1eb73215bd612f477a5c50d22;hb=96c55f60f49ceb842cf30e0018bb963ef9ed7d1c;hp=252671413656e57060d022a22cf1d93ce9e41f0a;hpb=d1472915f1f94028ccbf407e7c4f858c1e1c0b20;p=pdclib.old 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; + } } -*/