File: randnum

package info (click to toggle)
athena-jot 9.0-8
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 196 kB
  • sloc: ansic: 433; sh: 175; makefile: 42
file content (53 lines) | stat: -rw-r--r-- 1,455 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Index: athena-jot-9.0/Makefile.in
===================================================================
--- athena-jot-9.0.orig/Makefile.in
+++ athena-jot-9.0/Makefile.in
@@ -20,8 +20,8 @@ ALL_CFLAGS=-I. ${CPPFLAGS} ${CFLAGS}
 
 all: jot
 
-jot: jot.o
-	${CC} ${LDFLAGS} -o jot jot.o ${LIBS}
+jot: jot.o debian/randnum.o
+	${CC} ${LDFLAGS} -o jot jot.o randnum.o ${LIBS}
 
 .c.o:
 	${CC} -c ${ALL_CFLAGS} $<
@@ -35,7 +35,7 @@ install:
 	${INSTALL} -m 444 ${srcdir}/jot.1 ${DESTDIR}${mandir}/man1
 
 clean:
-	rm -f jot.o jot
+	rm -f jot.o jot randnum.o
 
 distclean: clean
 	rm -f config.cache config.log config.status Makefile
Index: athena-jot-9.0/jot.c
===================================================================
--- athena-jot-9.0.orig/jot.c
+++ athena-jot-9.0/jot.c
@@ -58,6 +58,7 @@ static char rcsid[] = "$NetBSD: jot.c,v
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
+#include <limits.h>
 #include "config.h"
 
 #if !defined(HAVE_SRANDOM) || !defined(HAVE_SRANDOM)
@@ -96,6 +97,7 @@ void	getargs(int, char *[]);
 void	getformat(void);
 int	getprec(char *);
 void	putdata(double, long);
+long int pw_random_number(long int max_num);
 
 int
 main(argc, argv)
@@ -114,7 +116,7 @@ main(argc, argv)
 	getargs(argc, argv);
 	if (randomize) {
 		*x = (ender - begin) * (ender > begin ? 1 : -1);
-		srandom((int) s);
+		srandom(pw_random_number(LONG_MAX));
 		range = *x + 1;
 		for (*i = 1; *i <= reps || infinity; (*i)++) {
 			do {