cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/09/10:51:10

Date: Sun, 9 Mar 1997 17:37:02 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Ben Shadwick <ben DOT shadwick AT search DOT van DOT wa DOT us>
cc: djgpp AT delorie DOT com
Subject: Re: Output to the Printer
In-Reply-To: <331EFDE9.1867@search.van.wa.us>
Message-ID: <Pine.SUN.3.91.970309173628.26812F-100000@is>
MIME-Version: 1.0

On Thu, 6 Mar 1997, Ben Shadwick wrote:

> > Nope, it's "COMx" and "LPTx" (no colons).  The short program that I
> > posted in this thread also fails for "LPT1:", but works for "LPT1".
> > 
> > Generally, DOS disallows file names with a colon (except as part of
> > d:pathname), so it's not surprising that the colon doesn't work in
> > device names.
>
> That must have to do with DJGPP or something then. Try (from a DOS
> prompt) doing:
> dir > prn
> dir > con
> dir > lpt1:
> dir > lpt1

This example only proves that COMMAND.COM stops parsing the filename
at the first delimiter (colon is a delimiter) when it handles the
redirection syntax.  DOS itself has nothing to do with that.  That's
why I posted a small test program: using it you can say exactly what
is and what isn't the correct name of the device as far as DOS is
considered.

If you want more proof, try the undocumented command TRUENAME:

	C:\DOS> TRUENAME \MSDOS.SYS

	C:\MSDOS.SYS

	C:\DOS> TRUENAME LPT1

	C:/LPT1

	C:\DOS> TRUENAME LPT1:

	File not found - LPT1:

See?  TRUENAME (which is just a wrapper for function 60h of DOS
Interrupt 21h) prints the name of devices with a forward slash whereas
files and directories are printed with backslash.  But `LPT1:' (with
the colon) is an illegal name, so TRUENAME fails, although it won't
fail for a non-existing file with legal name, like so:

	C:\DOS> TRUENAME XYZZY.FOO

	C:\DOS\XYZZY.FOO

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019