aboutsummaryrefslogtreecommitdiffstats
path: root/src/sysdep.c
diff options
context:
space:
mode:
authorRichard M. Stallman1994-07-27 17:40:29 +0000
committerRichard M. Stallman1994-07-27 17:40:29 +0000
commit2e46c7c6b3dda2fbff007e47070a47e903cbb1f6 (patch)
treee8afdcb5025d059c15ca31323fb8469f627c769f /src/sysdep.c
parent251745a3a7c8b94e10006de94b31c9d1490b4f7b (diff)
downloademacs-2e46c7c6b3dda2fbff007e47070a47e903cbb1f6.tar.gz
emacs-2e46c7c6b3dda2fbff007e47070a47e903cbb1f6.zip
(random, srandom): Obey HAVE_RAND48 flag.
Test that random is not a macro. Don't test USG or BSD4_1.
Diffstat (limited to 'src/sysdep.c')
-rw-r--r--src/sysdep.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index 828ec00f619..c6a3b4f7a82 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -2597,7 +2597,8 @@ bcmp (b1, b2, length) /* This could be a macro! */
2597#endif /* not BSTRING */ 2597#endif /* not BSTRING */
2598 2598
2599#ifndef HAVE_RANDOM 2599#ifndef HAVE_RANDOM
2600#ifdef USG 2600#ifndef random
2601
2601/* 2602/*
2602 * The BSD random returns numbers in the range of 2603 * The BSD random returns numbers in the range of
2603 * 0 to 2e31 - 1. The USG rand returns numbers in the 2604 * 0 to 2e31 - 1. The USG rand returns numbers in the
@@ -2608,32 +2609,26 @@ bcmp (b1, b2, length) /* This could be a macro! */
2608long 2609long
2609random () 2610random ()
2610{ 2611{
2612#ifdef HAVE_RAND48
2613 return rand48 ();
2614#else
2611 /* Arrange to return a range centered on zero. */ 2615 /* Arrange to return a range centered on zero. */
2612 return (rand () << 15) + rand () - (1 << 29); 2616 return (rand () << 15) + rand () - (1 << 29);
2617#endif
2613} 2618}
2614 2619
2615srandom (arg) 2620srandom (arg)
2616 int arg; 2621 int arg;
2617{ 2622{
2623#ifdef HAVE_RAND48
2624 return srand48 ();
2625#else
2618 srand (arg); 2626 srand (arg);
2627#endif
2619} 2628}
2620 2629
2621#endif /* USG */ 2630#endif /* no random */
2622 2631#endif /* not HAVE_RANDOM */
2623#ifdef BSD4_1
2624long random ()
2625{
2626 /* Arrange to return a range centered on zero. */
2627 return (rand () << 15) + rand () - (1 << 29);
2628}
2629
2630srandom (arg)
2631 int arg;
2632{
2633 srand (arg);
2634}
2635#endif /* BSD4_1 */
2636#endif
2637 2632
2638#ifdef WRONG_NAME_INSQUE 2633#ifdef WRONG_NAME_INSQUE
2639 2634