Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jan 2001 14:17:16 -0800
From:      Jos Backus <josb@cncdsl.com>
To:        hackers@freebsd.org
Subject:   Re: Possible bug in /usr/bin/makewhatis
Message-ID:  <20010122141716.A82292@lizzy.bugworks.com>

next in thread | raw e-mail | index | archive | help
This patch gets rid of the Broken pipe messages.

--- makewhatis.orig	Mon Jan 22 12:54:09 2001
+++ makewhatis	Mon Jan 22 13:01:31 2001
@@ -333,7 +333,8 @@
 
     local($source) = 0;
     local($list);
-    while(<F>) {
+    local($flag) = 0;
+    LOOP: while(<F>) {
 	# ``man'' style pages
 	# &&: it takes you only half the user time, regexp is slow!!!
  	if (/^\.SH/ && /^\.SH[ \t]+["]?($section_name)["]?/) {
@@ -352,7 +353,7 @@
 		    $list .= ' ';
 		}
 	    }
-	    &out($list); close F; return 1;
+	    &out($list); $flag++; last LOOP;
  	} elsif (/^\.Sh/ && /^\.Sh[ \t]+["]?($section_name)["]?/) {
 	    # ``doc'' style pages
 	    local($flag) = 0;
@@ -375,12 +376,15 @@
 		    $list .= ' ';
 		}
 	    }
-	    &out($list); close F; return 1;
+	    &out($list); $flag++; last LOOP;
 
 	} elsif(/^\.so/ && /^\.so[ \t]+man/) {
-	    close F; return 1;
+	    $flag++; last LOOP;
 	}
     }
+    1 while(<F>); # Flush pipe
+    close F;
+    return 1 if $flag;
     if (!$source && $verbose) {
 	warn "\n" if $pointflag;
 	warn "Maybe $file is not a manpage\n" ;

-- 
Jos Backus                 _/  _/_/_/        "Modularity is not a hack."
                          _/  _/   _/                -- D. J. Bernstein
                         _/  _/_/_/             
                    _/  _/  _/    _/
josb@cncdsl.com     _/_/   _/_/_/            use Std::Disclaimer;


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




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