Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!umd5!brl-adm!adm!rbj@cmr.icst.nbs.gov From: rbj@cmr.icst.nbs.gov (Root Boy Jim) Newsgroups: comp.unix.wizards Subject: /dev/stdin Message-ID: <16305@brl-adm.ARPA> Date: 27 Jun 88 23:25:20 GMT Sender: news@brl-adm.ARPA Lines: 30 ? From: Tom Newcomb? So, if all you want is the TTY input, why not use /dev/tty? It's worked ? beautifully in all the cases I've tried. So, what am I missing? Can anybody ? come up with a case where /dev/stdin would NOT be /dev/tty, besides shell ? scripts? (I already know this won't work for scripts run from a shell whose ? input has been redirected.) In a C program, also, you can just do an ? fdopen(3) on descriptor 0 (and that ALWAYS works). The point is that stdin is not always /dev/tty. And not all commands support the (considered by some) ugly kluge of `-' == stdin. One guy wanted to print a file, even lines in the first column, odd lines in the second column; he tried "cat file | pr -2 - -". Unfortunately, pr does not support `-' as a synonym for stdin. Replacing `-' by `/dev/stdin' should produce the desired results. Another (mis?)use is to compile programs from stdin. First, we do `ln -s /dev/stdin x.c', then `cc -c x.c'. I'm sure one can find really useful uses for stdin being a real file, but personally, I have never felt enough need to install it. I'm sure the authors have better arguments. ? Tom Newcomb | WEST, v. West is what wabbits do when they ? newcomb@cory.Berkeley.EDU | get tired of wunning awound. (Root Boy) Jim Cottrell National Bureau of Standards Flamer's Hotline: (301) 975-5688 The opinions expressed are solely my own and do not reflect NBS policy or agreement Careful with that VAX Eugene!