From 98d327753f4a8e6dd98e6e25c612460bfd9c67de Mon Sep 17 00:00:00 2001 From: Michael Mikonos <127171689+mknos@users.noreply.github.com> Date: Mon, 8 Jan 2024 12:37:59 +0800 Subject: [PATCH] primes: error for bad start-stop range * OpenBSD version prints an error if start>stop, which seems better than silently exiting * Also, remove redundant comments when the POD contains duplicate info --- bin/primes | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bin/primes b/bin/primes index 77913816..e7f5ec97 100755 --- a/bin/primes +++ b/bin/primes @@ -13,10 +13,6 @@ License: perl =cut -# primes - generate primes -# Written for the PPT initiative by Jonathan Feinberg. -# The algorithm was substantially modified by Benjamin Tilly. -# See docs for license. use strict; #use integer; # faster, but cuts the maxint down $|++; @@ -37,6 +33,7 @@ for ($start, $end) { s/^\s*\+?(\d{1,10}).*/$1/ || die "$0: $_: illegal numeric format\n"; $_ > 2**32 - 1 && die "$0: $_: Numerical result out of range\n"; } +die "$0: start value must be less than stop value\n" if ($end < $start); primes ($start, $end); exit 0;