diff options
-rw-r--r-- | common/diet/Makefile | 16 | ||||
-rw-r--r-- | common/diet/alloc.c | 3 | ||||
-rw-r--r-- | include/bbs.h | 4 | ||||
-rw-r--r-- | include/cmdiet.h | 17 | ||||
-rw-r--r-- | include/proto.h | 11 |
5 files changed, 39 insertions, 12 deletions
diff --git a/common/diet/Makefile b/common/diet/Makefile new file mode 100644 index 00000000..8eb76a43 --- /dev/null +++ b/common/diet/Makefile @@ -0,0 +1,16 @@ +# $Id$ + +MKLINT:=no +MKPROFILE:=no +MKPIC:=no +NOGCCERROR:=yes + +SRCROOT:= ../.. +.include "$(SRCROOT)/pttbbs.mk" + +SRCS:= alloc.c random.c time.c +LIB:= cmdiet + +install: + +.include <bsd.lib.mk> diff --git a/common/diet/alloc.c b/common/diet/alloc.c index de676ce4..d5710433 100644 --- a/common/diet/alloc.c +++ b/common/diet/alloc.c @@ -1,3 +1,4 @@ +#ifdef __dietlibc__ /* * malloc/free by O.Dreesen * @@ -251,4 +252,4 @@ retzero: return ptr; } void* realloc(void* ptr, size_t size) __attribute__((weak,alias("__libc_realloc"))); - +#endif diff --git a/include/bbs.h b/include/bbs.h index 6e604626..63054477 100644 --- a/include/bbs.h +++ b/include/bbs.h @@ -49,6 +49,10 @@ extern "C" { #include "cmsys.h" #include "cmbbs.h" +#ifdef __dietlibc__ +#include "cmdiet.h" +#endif + #include "ansi.h" #include "visio.h" #include "statistic.h" diff --git a/include/cmdiet.h b/include/cmdiet.h new file mode 100644 index 00000000..ff12d4d8 --- /dev/null +++ b/include/cmdiet.h @@ -0,0 +1,17 @@ +/* $Id$ */ + +#ifndef _CMDIET_H +#define _CMDIET_H + +#ifdef __dietlibc__ +#define random glibc_random +#define srandom glibc_srandom +#define initstate glibc_initstate +#define setstate glibc_setstate +long int random(void); +void srandom(unsigned int seed); +char *initstate(unsigned int seed, char *state, size_t n); +char *setstate(char *state); +#endif + +#endif diff --git a/include/proto.h b/include/proto.h index 76f284b0..c2cc0a67 100644 --- a/include/proto.h +++ b/include/proto.h @@ -10,17 +10,6 @@ #define GCC_NORETURN #endif -#ifdef __dietlibc__ -#define random glibc_random -#define srandom glibc_srandom -#define initstate glibc_initstate -#define setstate glibc_setstate -long int random(void); -void srandom(unsigned int seed); -char *initstate(unsigned int seed, char *state, size_t n); -char *setstate(char *state); -#endif - /* admin */ int m_loginmsg(void); int m_mod_board(char *bname); |