delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/23/11:47:38

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: About redirection...
Date: Tue, 21 Jan 1997 19:54:26 -0800
Organization: Two pounds of chaos and a pinch of salt
Lines: 39
Message-ID: <32E58F72.5187@cs.com>
References: <Pine DOT LNX DOT 3 DOT 93 DOT 970121093239 DOT 6000K-100000 AT cinf DOT usm DOT md>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp106.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Adrian Oboroc wrote:
> 
> Sorry men, but I think using redir isn't too comfortable (but it's a
> working solution, of couse), and using DOS-port of BASH is easy only for
> persons with previous experiense in UNIX ( not my case :~(  )

4DOS also can redirect command line arguments Unix-style.  The real
problem is DOS, which cannot easily be worked around.

> Probably the best solution is to rewrite startup code in such a way, that
> it will:
> A) pre-check command line parameters, and pass to main program only
> part before ">", ">&" and "<" combinations
> B) perform the redirection of output from stdout (and stderr for ">&")
> to a file, mentioned after ">" or ">&" operation.
> C) check for "<" sign and redirect file after this symbol to stdin.

Simply put, this is not possible, because DOS gets to see the command
lines before they ever get to the DJGPP startup code, and it's DOS that
processes '>', '<', and '|'.  If you write '>&' in your command line,
DOS tries to redirect stdout to a file named "&", and naturally fails. 
The DJGPP program that would have handled the request never gets run.

> builded with DJGPP. And many of them for shure will try something like
> "someprog.exe /? > info.txt" to get short instructions in text file

Most such programs output the help text to stdout instead of stderr.  At
least, all of mine do.  Stderr is mostly used for (tada!) errors.  ;)

Since DJGPP is a Unix-based compiler, users who are used to DOSisms
really ought to be prepared to expect differences.

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I  |        fighteer AT cs DOT com         |
| Call me for your free AOL disk!  |   http://www.cs.com/fighteer   |
|  Chain letters, work-at-home schemes, free long distance, etc.,   |
|    are ILLEGAL!  Keep the Internet litter-free... don't SPAM.     |
---------------------------------------------------------------------

- Raw text -


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