Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jul 1999 22:38:12 -0400 (EDT)
From:      sjr@home.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/12768: Compilation warning for fortune.c
Message-ID:  <199907230238.WAA07712@cc158233-a.catv1.md.home.com>

next in thread | raw e-mail | index | archive | help

>Number:         12768
>Category:       bin
>Synopsis:       Compilation warning for fortune.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 22 19:50:00 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Stephen J. Roznowski
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
>Environment:

	

>Description:

    When compiling fortune, the following warning occurs:

    fortune.c: In function `form_file_list':
    fortune.c:404: warning: suggest explicit braces to avoid ambiguous `else'
    fortune.c: In function `init_prob':
    fortune.c:921: warning: suggest explicit braces to avoid ambiguous `else'

    This patch adds the (expected) braces.

>How-To-Repeat:

	

>Fix:
	
--- fortune/fortune.c.orig	Thu Jul 22 22:32:22 1999
+++ fortune/fortune.c	Thu Jul 22 22:32:55 1999
@@ -401,7 +401,7 @@
 	register int	i, percent;
 	register char	*sp;
 
-	if (file_cnt == 0)
+	if (file_cnt == 0) {
 		if (Find_files) {
 			Fortunes_only = TRUE;
 			i = add_file(NO_PROB, FORTDIR, NULL, &File_list,
@@ -411,6 +411,7 @@
 		} else
 			return add_file(NO_PROB, "fortunes", FORTDIR,
 					&File_list, &File_tail, NULL);
+	}
 	for (i = 0; i < file_cnt; i++) {
 		percent = NO_PROB;
 		if (!isdigit((unsigned char)files[i][0]))
@@ -918,7 +919,7 @@
 		exit(1);
 	}
 	percent = 100 - percent;
-	if (Equal_probs)
+	if (Equal_probs) {
 		if (num_noprob != 0) {
 			if (num_noprob > 1) {
 				frac = percent / num_noprob;
@@ -932,6 +933,7 @@
 			last->percent = percent;
 			DPRINTF(1, (stderr, ", residual = %d%%", percent));
 		}
+	}
 	else {
 		DPRINTF(1, (stderr,
 			    ", %d%% distributed over remaining fortunes\n",

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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