Bug 23321

Summary: [PATCH] reduce redundant code in /bin/cat
Product: Base System Reporter: richards+bsd <richards+bsd>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.2-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description richards+bsd 2000-12-06 10:10:00 UTC
	The code for iterating over argv and emitting the
corresponding files should not depend on whether cat is in cooked or
raw mode.  However the current code uses, depending on the mode, one
of two nearly identical functions for that purpose.

Fix: Summary: Use the raw-mode function for iterating over argv as
the basis for a new, generic iterator, which takes as a parameter a
pointer to either the cooked- or raw-mode function for emitting a
file.  The cooked-mode file emitter is thus altered to accept an fd
and to obtain the necessary buffered stream using fdopen().

	A patch follows.
Comment 1 iedowse freebsd_committer freebsd_triage 2001-11-18 15:35:52 UTC
State Changed
From-To: open->closed


A similar change has already been made in revision 1.17 of cat.c. 
(it also has the benefit that we now have a function called cook_cat 
in the source tree :-)