X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstring%2Fstrerror.c;h=1cd820cc869946f9e2c3e5a53550d540de0843c0;hp=48dba0df56a1877927f094d3712189ca25633d43;hb=1d9d92ba957a0b8307c9a65c35867fde68e6533b;hpb=34893ecc2200dc7017c36a54cb6c5f4c2378b5ec diff --git a/functions/string/strerror.c b/functions/string/strerror.c index 48dba0d..1cd820c 100644 --- a/functions/string/strerror.c +++ b/functions/string/strerror.c @@ -1,8 +1,30 @@ -// ---------------------------------------------------------------------------- -// $Id$ -// ---------------------------------------------------------------------------- -// Public Domain C Library - http://pdclib.sourceforge.net -// This code is Public Domain. Use, modify, and redistribute at will. -// ---------------------------------------------------------------------------- +/* ---------------------------------------------------------------------------- + * $Id$ + * ---------------------------------------------------------------------------- + * Public Domain C Library - http://pdclib.sourceforge.net + * This code is Public Domain. Use, modify, and redistribute at will. + * --------------------------------------------------------------------------*/ -char * strerror( int errcode ) { /* TODO */ }; +#include + +char * strerror( int errcode ) +{ + 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; + } +}