jot.c (d737ec1ad49e1d8c904cfdfd63edd46e22e00776) jot.c (55f965ae6a4d2a48110743c99952a18a811d3628)
1/*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 83 unchanged lines hidden (view full) ---

92void getformat(void);
93int getprec(char *);
94int putdata(double, long);
95static void usage(void);
96
97int
98main(int argc, char **argv)
99{
1/*-
2 * Copyright (c) 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 83 unchanged lines hidden (view full) ---

92void getformat(void);
93int getprec(char *);
94int putdata(double, long);
95static void usage(void);
96
97int
98main(int argc, char **argv)
99{
100 double xd, yd;
101 long id;
102 double *x = &xd;
103 double *y = &yd;
104 long *i = &id;
100 double x, y;
101 long i;
105 unsigned int mask = 0;
106 int n = 0;
107 int ch;
108
109 while ((ch = getopt(argc, argv, "rb:w:cs:np:")) != -1)
110 switch (ch) {
111 case 'r':
112 randomize = 1;

--- 141 unchanged lines hidden (view full) ---

254 mask = 0;
255 break;
256 default:
257 errx(1, "bad mask");
258 }
259 if (reps == 0)
260 infinity = 1;
261 if (randomize) {
102 unsigned int mask = 0;
103 int n = 0;
104 int ch;
105
106 while ((ch = getopt(argc, argv, "rb:w:cs:np:")) != -1)
107 switch (ch) {
108 case 'r':
109 randomize = 1;

--- 141 unchanged lines hidden (view full) ---

251 mask = 0;
252 break;
253 default:
254 errx(1, "bad mask");
255 }
256 if (reps == 0)
257 infinity = 1;
258 if (randomize) {
262 *x = (ender - begin) * (ender > begin ? 1 : -1);
263 for (*i = 1; *i <= reps || infinity; (*i)++) {
264 *y = arc4random() / ((double)UINT32_MAX + 1);
265 if (putdata(*y * *x + begin, reps - *i))
259 x = (ender - begin) * (ender > begin ? 1 : -1);
260 for (i = 1; i <= reps || infinity; i++) {
261 y = arc4random() / ((double)UINT32_MAX + 1);
262 if (putdata(y * x + begin, reps - i))
266 errx(1, "range error in conversion");
267 }
268 } else
263 errx(1, "range error in conversion");
264 }
265 } else
269 for (*i = 1, *x = begin; *i <= reps || infinity; (*i)++, *x += s)
270 if (putdata(*x, reps - *i))
266 for (i = 1, x = begin; i <= reps || infinity; i++, x += s)
267 if (putdata(x, reps - i))
271 errx(1, "range error in conversion");
272 if (!nofinalnl)
273 putchar('\n');
274 exit(0);
275}
276
277int
278putdata(double x, long int notlast)

--- 158 unchanged lines hidden ---
268 errx(1, "range error in conversion");
269 if (!nofinalnl)
270 putchar('\n');
271 exit(0);
272}
273
274int
275putdata(double x, long int notlast)

--- 158 unchanged lines hidden ---