diff options
-rw-r--r-- | include/proto.h | 11 | ||||
-rw-r--r-- | mbbsd/Makefile | 6 | ||||
-rw-r--r-- | mbbsd/random.c | 5 |
3 files changed, 19 insertions, 3 deletions
diff --git a/include/proto.h b/include/proto.h index a84c2fbb..a6b9104d 100644 --- a/include/proto.h +++ b/include/proto.h @@ -10,6 +10,17 @@ #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); diff --git a/mbbsd/Makefile b/mbbsd/Makefile index f637e95e..1c4b6ee6 100644 --- a/mbbsd/Makefile +++ b/mbbsd/Makefile @@ -17,7 +17,7 @@ OBJS= admin.o announce.o args.o assess.o bbs.o board.o cache.o cal.o card.o\ xyz.o voteboard.o syspost.o var.o passwd.o calendar.o go.o file.o .if defined(DIET) OBJS+= random.o time.o -#CC:= diet -Os $(CC) +DIETCC= diet -Os .endif .if defined(MERGEBBS) @@ -27,13 +27,13 @@ OBJS+= merge.o .SUFFIXES: .c .o .c.o: ../include/var.h - $(CCACHE) $(CC) $(CFLAGS) -c $*.c + $(CCACHE) $(DIETCC) $(CC) $(CFLAGS) -c $*.c all: $(PROG) $(PROG): $(OBJS) sh ../util/newvers.sh - $(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) $(EXT_LIBS) vers.c + $(DIETCC) $(CC) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIBS) $(EXT_LIBS) vers.c ../include/var.h: var.c perl ../util/parsevar.pl < var.c > ../include/var.h diff --git a/mbbsd/random.c b/mbbsd/random.c index 22f9ba59..2405ea92 100644 --- a/mbbsd/random.c +++ b/mbbsd/random.c @@ -67,6 +67,7 @@ struct random_data int rand_sep; /* Distance between front and rear. */ int32_t *end_ptr; /* Pointer behind state table. */ }; +int __random_r (struct random_data *buf, int32_t *result); @@ -703,4 +704,8 @@ __random () return retval; } +long int glibc_random(void) { return __random(); } +void glibc_srandom(unsigned int seed) { __srandom(seed); } +char *glibc_initstate(unsigned int seed, char *state, size_t n) { return __initstate(seed,state,n); } +char *glibc_setstate(char *state) { return __setstate(state); } #endif |