Hello!
> print > "/dev/stderr" works in gawk, and mawk (at least).
>
> Oddly enough this also works under DOS ports of these --
> where I consider it to be an idiom (since DOS doesn't have a
> /dev directory and doesn't have any notion of a device
> node in a directory).
I've always considered it an idiom, and a bad one at that.
There is no "/dev/stderr" (and all the "/dev/*" mentioned
in the gawk manpage) on *nix systems (well at least there's
non with HP--SUX and Linux) and (in io.c) the name of the
file to be opened is checked if it's in a list of all those
"/dev/*"--special names and whether to handle it specially
or not.
IMHO this is confusing, since these ``special'' files look
like real ones existing somewhere in the directory tree,
puzzle people who know that there are no such files (e.g.
MSDOS users who know more than how to unpack Windows) and
will bomb on all awks having `<'/`>' IO--redirection but
not these gnuish special names built in. And if they don't
bomb they'll cause serious pain by creating new or abusing
existing files.
Why couldn't they have used reserved words?
Clemens
--
----------------------------------------------------------------------------
> Wo ist denn der Objoke ??? Clemens Meier
Bei Clemens? Nie!! Ok, ok, aber fast nie. clm...@lili.uni-bielefeld.de
GO C+ UL P- L+>++>+++ 3$ E++>+++ N++ R+>+++ G'''' !tv b++ D f?
| Oddly enough this also works under DOS ports of these --
| where I consider it to be an idiom (since DOS doesn't have a
| /dev directory and doesn't have any notion of a device
| node in a directory).
??? Try something like "type filename > /dev/lpt" and you will learn
something new about DOS. Note that I used to do this a few years ago
and don't have a DOS machine handy to try it at this instant, but it
really worked for lpt, con, com1 and com2 at least.
There is on NetBSD, which is the One True Unix Other Than V10.
But apart from that, it is a distasteful and bad idiom; certainly
not portable.
-s
--
Peter Seebach - se...@solon.com || se...@intran.xerox.com --
C/Unix proto-wizard -- C/Unix questions? Send mail for help. No, really!
Copyright 1995 Peter Seebach. -- High energy particle theology
The *other* C FAQ - ftp taniemarie.solon.com /pub/c/afq
So how do you feel about "> /proc/self/fd/2" ?
: But apart from that, it is a distasteful and bad idiom; certainly
: not portable.
--
>In article <jadestar...@netcom.com>, JaDe <jade...@netcom.com> wrote:
>??? Try something like "type filename > /dev/lpt" and you will learn
>something new about DOS.
Small chance. You might also try /usr/home/dak/lpt. Guess what? It
will never make a file *anywhere* on the file system with a device name.
So you better *never* name a file you intend to transfer to a DOS
system lpt, prn, nul, com1, com2, or any other lot of device names.
Thgere are a lot of hidden device drivers (things like clock$ or
such), fortunately, they usually have at least a few strange characters
in them, so the chance for inadvertous confusion is smaller.
--
David Kastrup, Goethestr. 20, D-52064 Aachen Tel: +49-241-72419
Email: d...@pool.informatik.rwth-aachen.de Fax: +49-241-79502
Actually any Linux with /proc has /dev/stderr --
# ln -s /proc/self/2 /dev/stderr
--
Doug Quale
qu...@msn.fullfeed.com
:polu...@ICSI.Net (Richard Polunsky) writes:
:>Apparently this 'feature' has been deleted from DOS 6.22.
:>When I try: type filename > /dev/lpt
:>I get: Invalid Switch - /dev
:Well, of course we were talking Unix idioms and not paying too close
:attention to all the appropriate DOSisms, like reverse slashes whenever
:you use a wilful tool or some inbuilt pain in DOS.
:Try it with :type filename > \dev\lpt
:or with :type filename > \usr\tmp\con
:or with :type filename > \usr\source\drv\makefile\nul
While we're bandying about DOS idioms here's one
that's actually useful
IF EXIST X:\NUL ECHO Drive X: exists
and: IF EXIST X:\FOO\NUL ECHO Directory X:\FOO exists.
This works for all versions of DOS that I've tested (from
DOS 3.1 through DOS 6.22 and including DR 5, 6 and 7).
It also used to work even with Netware drivers -- however the
introduction of VLM's seems to have broken that. Should still
work for users of NETX, though.
--
/> JaDe | Star <\
/< \|/ >\
*[/////|:::====================- --*-- -=====================:::|\\\\\]*
\< /|\ >/
\> jade...@netcom.com | star...@netcom.com </
Actually it's worse than that. Try /whatever/lpt.xxx, or whatever
other extensions to device names. DOS will just ignore the extensions
and assumes it's a device.
regards,
.sabre
--
sa...@sabri.pc.my ~~\ Information Technology /~~ sa...@hq.jkr.gov.my
+60 (0)10-2184925 (H) \____ in Construction ____/ +60 (0)3-4407776 (O)
~~\ http://corp.jkr.gov.my/jln/people/sabre/sabre.htm /~~
~~~~~~~~\__________ Standard Disclaimer Applies __________/~~~~~~~~