Article View: comp.sources.bugs
Article #74Puts replaced by printf? (Was: Re: Bug in csh (history, "!a%100s"))
From: Jeff Beadles
Date: Tue, 11 Jul 1989 15:06
Date: Tue, 11 Jul 1989 15:06
26 lines
1271 bytes
1271 bytes
In article <774@sbsvax.UUCP> greim@sbsvax.UUCP (Michael Greim) writes:
>As to "puts() will never be slower than printf()": I recall reading
>somewhere that some people think about implementing puts() using printf().
You ARE kidding, right? Puts can be something ridiculously simple.
Something like this would work:
(I know that it's not "correct" but the concept is. :-)
puts(string)
char string
register char *cp = string;
while(*cp)
putchar(*cp++);
putchar('\n');
Why use printf for something this simple?
Would they do something like:
#define puts(x) printf("%s\n", x);
Ack.
-Jeff
--
Jeff Beadles Utek Sustaining Engineering, Tektronix Inc.
jeff@quark.WV.TEK.COM
Technical Details
Message-ID:
<3845@orca.WV.TEK.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!zephyr!tektronix!orca!quark!jeffReferences:
<774@sbsvax.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!zephyr!tektronix!orca!quark!jeff From: jeff@quark.WV.TEK.COM (Jeff Beadles) Newsgroups: comp.sources.bugs Subject: Puts replaced by printf? (Was: Re: Bug in csh (history, "!a%100s")) Keywords: csh history format-string bug fix Message-ID: <3845@orca.WV.TEK.COM> Date: 11 Jul 89 15:06:35 GMT References: <774@sbsvax.UUCP> Sender: nobody@orca.WV.TEK.COM Reply-To: jeff@quark.WV.TEK.COM (Jeff Beadles) Organization: Tektronix, Inc., Wilsonville, OR Lines: 26