Command line arguments, redirection, etc.

cbk cbk at se-sd.UUCP
Thu Feb 20 09:08:50 AEST 1986


[ Inscribed on the line, in very tiny letters, were the words: EAT ME ]

   Hopefully, this "discussion" about argument passing, redirection, and
such can be put to rest once and for all.  Here's my two cents worth, 
having just completed porting the PCC C compiler to a proprietary,
decidedly non-UNIX (tm) operating system.

1. Redirection of standard I/O is a part of C, piping is not.
   Ref: K&R, chapter 7

   "Finally, the routines are meant to be 'portable', in the sense that
    they will exist *in compatible form* on any system where C exists"...

   The routines mentioned are those which use "standard I/O".  See page
   144... "output can be redirected to a file by using >...", and "On
   the UNIX system, a pipe can also be used..."  This implies that
   redirection is required functionality, whereas piping is a part of
   a particular operating system.

2. Command-line arguments are a part of C.
   Ref: K&R, chapter 5.11

   "In environments that support C, there is a way to pass command-line
    arguments or parameters to a program when it begins executing."

It sounds to me like this whole issue boils down to whether or not someone
has taken the time to *correctly* implement C to provide the functionality
as specified in K&R (or whatever else happens to be your favorite standard).

[ Personal opinion, FLAME ON ]

Any implementation of C that doesn't provide redirection and command-line
argument passing is half-assed at best.

[ FLAME OFF]

You know, I feel better already!  Hey kiddies, get out YOUR copy of K&R and
read, read, read!   

-- Carl Kuck  (apply all standard disclaimers to the preceeding babble)
  
UseNet (west) : {wherever}!sdcsvax!ncr-sd!se-sd!cbk 
       (east) : {wherever}!ihnp4!ncr-sd!se-sd!cbk

PacBell: (619) 450-6271 (w), 944-1705 (h)

Quote #1: Only those who attempt the absurd can achieve the impossible.
Quote #2: 55 mph isn't a good idea, it's just the law...



More information about the Comp.lang.c mailing list