Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/fortune/fortune Show residual probability rather than ...



details:   https://anonhg.NetBSD.org/src/rev/1c233bf25e44
branches:  trunk
changeset: 557021:1c233bf25e44
user:      jsm <jsm%NetBSD.org@localhost>
date:      Thu Jan 01 16:01:25 2004 +0000

description:
Show residual probability rather than non-residual in "No place to put
residual probability" error message.  Distribute residual probability
correctly rather than all to one file.  Patch from Mike Castle
<dalgoda%ix.netcom.com@localhost>.

diffstat:

 games/fortune/fortune/fortune.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 3f4fa30158d4 -r 1c233bf25e44 games/fortune/fortune/fortune.c
--- a/games/fortune/fortune/fortune.c   Thu Jan 01 16:00:34 2004 +0000
+++ b/games/fortune/fortune/fortune.c   Thu Jan 01 16:01:25 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fortune.c,v 1.39 2003/08/07 09:37:14 agc Exp $ */
+/*     $NetBSD: fortune.c,v 1.40 2004/01/01 16:01:25 jsm Exp $ */
 
 /*-
  * Copyright (c) 1986, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)fortune.c  8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: fortune.c,v 1.39 2003/08/07 09:37:14 agc Exp $");
+__RCSID("$NetBSD: fortune.c,v 1.40 2004/01/01 16:01:25 jsm Exp $");
 #endif
 #endif /* not lint */
 
@@ -935,7 +935,7 @@
                errx(1, "Probabilities sum to %d%%!", percent);
        else if (percent < 100 && num_noprob == 0)
                errx(1, "No place to put residual probability (%d%%)",
-                   percent);
+                   100 - percent);
        else if (percent == 100 && num_noprob != 0)
                errx(1, "No probability left to put in residual files");
        percent = 100 - percent;
@@ -944,7 +944,7 @@
                        if (num_noprob > 1) {
                                frac = percent / num_noprob;
                                DPRINTF(1, (stderr, ", frac = %d%%", frac));
-                               for (fp = File_list; fp != last; fp = fp->next)
+                               for (fp = File_tail; fp != last; fp = fp->prev)
                                        if (fp->percent == NO_PROB) {
                                                fp->percent = frac;
                                                percent -= frac;



Home | Main Index | Thread Index | Old Index