🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #2444

Re: Long command lines

#2444
From: Risto Kankkunen
Date: Sun, 30 Sep 1990 18:27
37 lines
2715 bytes
In article <1990Sep27.044522.8475@nmt.edu> jrwsnsr@nmt.edu (Jonathan R. Watts) writes:
>From article <7658@hydra.Helsinki.FI>, by kankkune@cs.Helsinki.FI (Risto Kankkunen):
>> So, every program written in high level language parses the command
>> lines, and makes lots of unnecessary assumptions, before the program
>> gets them. If the command line is passed in parameters, it is the shell,
>> and ultimately the user that makes the assumptions and decisions.
>
>I use Turbo Pascal 5.5, and while it does have ParamStr to return your
>command line arguments, I decided to write my own command-line parser
>instead.  This way, I can parse the command-line in whatever fashion I
>like.  For example, at the moment, my parser will check if 4DOS is the
>parent shell, and if so, it will use the environment variable CMDLINE
>instead of the passed command-line; the great thing about this is that
>it is completely transparent...if the program wasn't loaded by 4DOS, it
>just ignores the environment, even if a CMDLINE variable is present.

Yes, as I said, it is possible to by-pass the command-line parser in
the run-time library, and in TP it is very easy to do so. But that
wasn't the point. The point was that currently it is the _program_ that
parses the line, whether it is done in the start-up code or in your own
routines. However, the program cannot know how to do this. Your program
would have to know all the shells some day to be used in MS-DOS, and
know which one the user is currently using, to do this right. Your
programs support now COMMAND.COM and 4DOS, but what if someone who is
using ms_sh wants to use your programs? So, every time a new shell
shell is made, or a new syntax is added to an old one, you have to
modify all your programs. All this code to parse the command-line in
tens or hundreds of programs also eats quite a lot of disk space and
RAM..

Wouldn't it be nice, if the shell passed the command-line to your
program pre-parsed to ASCIIZ strings?

-- 
 Risto Kankkunen                   kankkune@cs.Helsinki.FI (Internet)
 Department of Computer Science    rkankkunen@finuh         (Bitnet)
 University of Helsinki, Finland   ..!mcvax!uhecs!kankkune   (UUCP)
Technical Details
Message-ID: <7687@hydra.Helsinki.FI>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!bloom-beacon!eru!hagbard!sunic!news.funet.fi!hydra!kankkune
References: <7658@hydra.Helsinki.FI> <1990Sep27.044522.8475@nmt.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!bloom-beacon!eru!hagbard!sunic!news.funet.fi!hydra!kankkune
From: kankkune@cs.Helsinki.FI (Risto Kankkunen)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Long command lines
Message-ID: <7687@hydra.Helsinki.FI>
Date: 30 Sep 90 18:27:43 GMT
References: <7658@hydra.Helsinki.FI> <1990Sep27.044522.8475@nmt.edu>
Organization: University of Helsinki, Department of Computer Science
Lines: 37