Deleted Added
full compact
jot.c (164023) jot.c (164025)
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

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

38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)jot.c 8.1 (Berkeley) 6/6/93";
43#endif
44#endif
45#include <sys/cdefs.h>
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

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

38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)jot.c 8.1 (Berkeley) 6/6/93";
43#endif
44#endif
45#include <sys/cdefs.h>
46__FBSDID("$FreeBSD: head/usr.bin/jot/jot.c 164023 2006-11-06 08:47:41Z dds $");
46__FBSDID("$FreeBSD: head/usr.bin/jot/jot.c 164025 2006-11-06 09:15:21Z dds $");
47
48/*
49 * jot - print sequential or random data
50 *
51 * Author: John Kunze, Office of Comp. Affairs, UCB
52 */
53
54#include <ctype.h>

--- 37 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{
47
48/*
49 * jot - print sequential or random data
50 *
51 * Author: John Kunze, Office of Comp. Affairs, UCB
52 */
53
54#include <ctype.h>

--- 37 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 ---