diff options
author | ewt <devnull@localhost> | 1997-05-07 15:09:39 +0000 |
---|---|---|
committer | ewt <devnull@localhost> | 1997-05-07 15:09:39 +0000 |
commit | 67c8991eb0560035783f1e44ce6b757c61509ec4 (patch) | |
tree | fb17bb92d682f99cb5157cde99d289e53bfcdcfe | |
parent | 9c2a152c85f5c6b97f25ac4b0b355d6a816fe967 (diff) | |
download | librpm-tizen-67c8991eb0560035783f1e44ce6b757c61509ec4.tar.gz librpm-tizen-67c8991eb0560035783f1e44ce6b757c61509ec4.tar.bz2 librpm-tizen-67c8991eb0560035783f1e44ce6b757c61509ec4.zip |
*** empty log message ***
CVS patchset: 1608
CVS date: 1997/05/07 15:09:39
-rw-r--r-- | misc/strerror.c | 22 | ||||
-rw-r--r-- | myrealloc.c | 12 |
2 files changed, 34 insertions, 0 deletions
diff --git a/misc/strerror.c b/misc/strerror.c new file mode 100644 index 000000000..acb81618c --- /dev/null +++ b/misc/strerror.c @@ -0,0 +1,22 @@ +#include<stdlib.h> +#include<errno.h> +#include<stdio.h> + +extern int sys_nerr; +extern char *sys_errlist[]; +static char buf[64]; +char * strerror(int errnum) + +{ + if (errnum < 0 || errnum > sys_nerr) + { + static char fmt[] = "Unknown error %d"; + size_t len = (size_t) sprintf (buf, fmt, errnum); + if (len < (size_t) sizeof(fmt) - 2) + return NULL; + buf[len - 1] = '\0'; + return buf; + } + + return (char *) sys_errlist[errnum]; +} diff --git a/myrealloc.c b/myrealloc.c new file mode 100644 index 000000000..d646d6560 --- /dev/null +++ b/myrealloc.c @@ -0,0 +1,12 @@ +#include <stdio.h> +#include <malloc.h> +#define size_t unsigned + +void *myrealloc(void *ptr, size_t size); + +void *myrealloc(void *ptr, size_t size) { +if (ptr == NULL) + return malloc(size); + else + return realloc(ptr, size); +} |