-/* $NetBSD: primes.c,v 1.20 2014/10/02 21:36:37 ast Exp $ */
+/* $NetBSD: primes.c,v 1.22 2018/02/03 15:40:29 christos Exp $ */
/*
* Copyright (c) 1989, 1993
#if 0
static char sccsid[] = "@(#)primes.c 8.5 (Berkeley) 5/10/95";
#else
-__RCSID("$NetBSD: primes.c,v 1.20 2014/10/02 21:36:37 ast Exp $");
+__RCSID("$NetBSD: primes.c,v 1.22 2018/02/03 15:40:29 christos Exp $");
#endif
#endif /* not lint */
* By Landon Curt Noll, http://www.isthe.com/chongo/index.html /\oo/\
*
* usage:
- * primes [-d] [-h] [start [stop]]
+ * primes [-dh] [start [stop]]
*
* Print primes >= start and < stop. If stop is omitted,
* the value SPSPMAX is assumed. If start is
* omitted, start is read from standard input.
- * -h: print primes in hexadecimal
* -d: print difference to previous prime, e.g. 3 (1)
+ * -h: print primes in hexadecimal
*
* validation check: there are 664579 primes between 0 and 10^7
*/
argv += optind;
start = 0;
- stop = SPSPMAX;
+ stop = (uint64_t)(-1);
/*
* Convert low and high args. Strtoumax(3) sets errno to
err(1, "%s", argv[1]);
if (*p != '\0')
errx(1, "%s: illegal numeric format.", argv[1]);
- if (stop > SPSPMAX)
- errx(1, "%s: stop value too large (>%" PRIu64 ").",
- argv[1], (uint64_t) SPSPMAX);
break;
case 1:
/* Start on the command line. */
static void
usage(void)
{
- (void)fprintf(stderr, "usage: primes [-d] [-h] [start [stop]]\n");
+ (void)fprintf(stderr, "usage: primes [-dh] [start [stop]]\n");
exit(1);
}