Lines Matching +full:x +full:- +full:mask +full:-

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
33 * jot - print sequential or random data
64 #define is_default(s) (*(s) == 0 || strcmp((s), "-") == 0)
67 static int prec = -1;
90 int mask = 0; in main() local
96 double x, y; in main() local
115 while ((ch = getopt(argc, argv, "b:cnp:rs:w:")) != -1) in main()
123 errx(1, "-%c word too long", ch); in main()
147 argc -= optind; in main()
155 mask |= HAVE_STEP; in main()
163 ender = argv[2][strlen(argv[2])-1]; in main()
164 mask |= HAVE_ENDER; in main()
172 begin = argv[1][strlen(argv[1])-1]; in main()
173 mask |= HAVE_BEGIN; in main()
184 mask |= HAVE_REPS; in main()
195 if (prec == -1) in main()
198 while (mask) /* 4 bit mask has 1's where last 4 args were given */ in main()
199 switch (mask) { /* fill in the 0's by default or computation */ in main()
206 mask |= HAVE_REPS; in main()
209 s = ender > begin ? 1 : -1; in main()
210 mask |= HAVE_STEP; in main()
218 reps = (ender - begin + s) / s; in main()
221 mask = 0; in main()
226 mask |= HAVE_BEGIN; in main()
230 mask = HAVE_REPS | HAVE_ENDER | HAVE_STEP; in main()
237 begin = ender - reps * s + s; in main()
238 mask = 0; in main()
242 mask = HAVE_REPS | HAVE_BEGIN | HAVE_STEP; in main()
248 ender = begin + reps * s - s; in main()
249 mask = 0; in main()
259 s = (ender - begin) / (reps - 1); in main()
261 mask = 0; in main()
266 long t = (ender - begin + s) / s; in main()
272 mask = 0; in main()
275 errx(1, "bad mask"); in main()
306 x = ender - begin; in main()
312 if (putdata(y * x + begin, !(reps - i))) in main()
316 for (i = 1, x = begin; i <= reps || infinity; i++, x += s) in main()
317 if (putdata(x, !(reps - i))) in main()
325 * Send x to stdout using the specified format.
331 putdata(double x, bool last) in putdata() argument
337 if (x <= (double)ULONG_MAX && x >= (double)0) in putdata()
338 printf(format, (unsigned long)x); in putdata()
342 if (x <= (double)LONG_MAX && x >= (double)LONG_MIN) in putdata()
343 printf(format, (long)x); in putdata()
347 if (x <= (double)INT_MAX && x >= (double)INT_MIN) in putdata()
348 printf(format, (int)x); in putdata()
352 if (x <= (double)UINT_MAX && x >= (double)0) in putdata()
353 printf(format, (unsigned int)x); in putdata()
358 printf(format, x); in putdata()
369 "usage: jot [-cnr] [-b word] [-w word] [-s string] [-p precision]", in usage()
392 return (p - q); in getprec()
415 sz = sizeof(format) - strlen(format) - 1; in getformat()
418 errx(1, "-w word too long"); in getformat()
421 errx(1, "-w word too long"); in getformat()
425 errx(1, "-w word too long"); in getformat()
430 * %[#][ ][{+,-}][0-9]*[.[0-9]*]? where ? must be one of in getformat()
431 * [l]{d,i,o,u,x} or {f,e,g,E,G,d,o,x,D,O,U,X,c,u} in getformat()
442 ((*p == '+' || *p == '-') && !(numbers|dot|sign++)) in getformat()
457 case 'o': case 'u': case 'x': case 'X': in getformat()
499 errx(1, "-w word too long"); in getformat()