Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:07:45 -0000
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r346255 - head/usr.bin/jot
Message-ID:  <201904160041.x3G0fMdq002418@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Tue Apr 16 00:41:22 2019
New Revision: 346255
URL: https://svnweb.freebsd.org/changeset/base/346255

Log:
  Fix 'jot -r 0 start end' to work.
  
  This allows an endless stream of random data within the given bounds.
  It already worked if a seed was provided as the 4th argument but not
  if one was left out.
  
  In collaboration with:	jhb
  MFC after:		2 weeks
  Relnotes:		yes

Modified:
  head/usr.bin/jot/jot.c

Modified: head/usr.bin/jot/jot.c
==============================================================================
--- head/usr.bin/jot/jot.c	Mon Apr 15 21:20:06 2019	(r346254)
+++ head/usr.bin/jot/jot.c	Tue Apr 16 00:41:22 2019	(r346255)
@@ -263,12 +263,15 @@ main(int argc, char **argv)
 			mask = 0;
 			break;
 		case HAVE_REPS | HAVE_BEGIN | HAVE_ENDER:
-			if (reps == 0)
-				errx(1, "infinite sequences cannot be bounded");
-			else if (reps == 1)
-				s = 0.0;
-			else
-				s = (ender - begin) / (reps - 1);
+			if (!randomize) {
+				if (reps == 0)
+					errx(1, "infinite sequences cannot "
+					    "be bounded");
+				else if (reps == 1)
+					s = 0.0;
+				else
+					s = (ender - begin) / (reps - 1);
+			}
 			mask = 0;
 			break;
 		case HAVE_REPS | HAVE_BEGIN | HAVE_ENDER | HAVE_STEP:





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904160041.x3G0fMdq002418>