From owner-freebsd-current Thu Sep 14 6:58:30 2000 Delivered-To: freebsd-current@freebsd.org Received: from guru.mired.org (zoom2-053.telepath.com [216.14.2.53]) by hub.freebsd.org (Postfix) with SMTP id 3182337B423 for ; Thu, 14 Sep 2000 06:58:22 -0700 (PDT) Received: (qmail 63109 invoked by uid 100); 14 Sep 2000 13:57:41 -0000 From: Mike Meyer MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14784.55637.790917.142533@guru.mired.org> Date: Thu, 14 Sep 2000 08:57:41 -0500 (CDT) To: Poul-Henning Kamp Cc: Ben Smithurst , Peter Pentchev , Julian Elischer , Chris Costello , hackers@FreeBSD.ORG, current@FreeBSD.ORG Subject: Re: Fdescfs updates--coming to a devfs near you! In-Reply-To: <56645.968935026@critter> References: <20000914115342.I77593@strontium.scientia.demon.co.uk> <56645.968935026@critter> X-Mailer: VM 6.72 under 21.1 (patch 10) "Capitol Reef" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Poul-Henning Kamp writes: > In message <20000914115342.I77593@strontium.scientia.demon.co.uk>, Ben Smithurs > t writes: > >Poul-Henning Kamp wrote: > > > >> I must admit that I think in general that /dev/std{in,out,err} and /dev/fd > >> is bogus. It looks like something which happened "because we can" more > >> than something which has a legitimate need. > >You think adding a hack to every program to support "-" to mean > >stdout/stdin is better? > The majority of these programs could be handled by adding knowledge > of "-" as a magic filename to fopen(3). Ugh. So what happens when you *really* want to read a filed called "-"? Adding magic characters to low-level calls is a bad idea. I believe /dev/fd originated in Unix v8 (or maybe plan 9) to provide a uniform mechanism to get a class of process-internal objects where they can be manipulated by shell scripts. If that's the case, it's provenance is impeccable. > At the same time I would really love if we implemented "|.*" to mean > "do an popen(3)" instead. Again, putting magic character recognition in a low-level call is a bad idea. Worse yet, this kind of thing is really useful in shells (which don't generally have the ability to manipulate fd's). Consider trying to use that syntax in the shell? Which is why modern shells that implement this kind of thing use a different syntax. Of course, they depend on something like /dev/fd or named pipes to provide this feature. > But of course, this is bikeshed material... Most certainly. If you really want to make C programming look like Perl programming, could you do it by adding new library calls, instead of changing the semantics of existing ones?