Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!lll-lcc!pyramid!prls!mips!dce From: dce@mips.UUCP (David Elliott) Newsgroups: net.sources Subject: Re: shell printf - a sensible solution Message-ID: <210@quacky.mips.UUCP> Date: Wed, 18-Mar-87 16:01:03 EST Article-I.D.: quacky.210 Posted: Wed Mar 18 16:01:03 1987 Date-Received: Fri, 20-Mar-87 02:11:08 EST References: <5008@brl-adm.ARPA> Reply-To: dce@quacky.UUCP (David Elliott) Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 47 In article <5008@brl-adm.ARPA> dm@bfly-vax.bbn.com writes: > >John Andrew Rosauer , writes: > >>People should spend a few minutes thinking to see if something can be >>done using available utilities rather than immediately writing >>thousands of lines of C. It's wasting someone's money. > >Having spent that time thinking, one should realize that, like echo, >printf should be faster than starting up awk. To do otherwise is >wasting someone's time. With machine speed increasing all of the time, this argument is becoming obsolete. Until we all have 20% of a 5 mips machine, it's still valid. Then again, how much of a speed difference are you talking about? Did you benchmark it? How often do you use printf? On my system, the command time awk 'BEGIN {printf "hello, world\n" ; exit}' gives 0 for all times. >Look, ``the UNIX philosophy'' does NOT mean bending existing utilities >to do poorly what a simple C program can do well. It is perfectly >fine to prototype the function one wants using the suite of tools that >UNIX comes packaged with. However, once you've done that prototype, On the other hand, there is another type of waste involved, and there is an issue of portability. An object file certainly takes up more disk space than a shell script that uses awk, and it costs to have the source and the makefile and the manual page. It also costs maintenance. If I were to add it to my system product, it would cost in other ways, such as software manufacturing costs. As for portability, I'm not talking about whether or not the printf command is portable, but whether or not I can expect it to always be available. There was a case last year in which our local version of the BSD 'install' command used the local printf command (yes, it's been written a number of times), and I was pressured to add it to our system. I did, and the command worked fine. Later, when we installed it on a clean machine, it was found to be broken. -- David Elliott UUCP: {decvax,ucbvax,ihnp4}!decwrl!mips!dce, DDD: 408-720-1700