Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: root@wombat.hanse.de (Bernd "Bernie" Meyer)
Subject: Re: The big Question
Date: Wed, 11 Jan 1995 13:54:31 GMT	[thread overview]
Message-ID: <D28uMy.27J@wombat.hanse.de> (raw)
In-Reply-To: 3eum8d$5st@portal.gmu.edu

scoile@osf1.gmu.edu (Steve "Stevers!" Coile) writes:

>Holger Veit (veit@borneo.gmd.de) wrote:
>[...]
>>Normally you wouldn't see a command line buffer at all,

>How can you not see a command line buffer.  *Every* command shell in
>existance buffers the command line.  There *has* to be a buffer, else
>where would the input be stored?!

You misunderstood. You don't normally see the command line that is passed on
to the program. Of course, you have your edit buffer, but between it and the
invocation of the program, lots of steps take place

>>                                                        and if so, a real
>>operating system would have allocated it and passed it to the process.
>>The DOS way is quite close to the old CP/M way of having 126 bytes of
>>command line at 0x0080. It is the merit of C library implementations of

>It's still there, and it doesn't grow dynamically.  The maximum length
>of most Unix command line buffers is, what 1K? 

Just checked --- the maximum length of any argument under linux/bash
seems to be 4k (if you type more, it simply dies... uh-oh :-( ). On the
other hand, wildcard expansion and other things the shell does in between at
least work with resulting commandlines of up to 270k; The test with 1.7M is
currently chugging away on another console.

Just succeeded. OK, bash grew up to 11M of size, but hey, who cares, with
swap and all. Seems pretty dynamic to me --- normally, bash doesn't take 11M
:-)

>Sure, you don't reach
>that limit often, but it's there!  Additionally, there's no reason
>a command shell couldn't allocate *less* memory either.  There's
>nothing that prohibits a 128 byte buffer, except practicality.

Sure. But even the static 4k limit of bash is a "per word" limit. And I have
real trouble thinking about any case where I would like to pass more than 4k
as a single argument.

>Note!  C libraries handle the splitting of the command line into argv
>and argc.  Unix doesn't do it inherently?!  Oh my!  Guess that would
>explain why argv and argc are available to DOS C programmers, huh?

But what can the C-library work on under DOS? It has to look at a 128
(wasn't it actually 126?) byte buffer, and that's it. In unix, OTOH, it gets
a pointer to a buffer that has been allocated to hold the expanded
commandline, however many bytes that may require.
There is nothing that necessarily limits the size of command lines in unix.
In DOS, even simple compilers have to start doing dirty tricks to fit their
arguments into those 128 bytes.

>>                     As argc is an int, I don't worry whether the value
>>of it is 20 or 20000, as my program would not look different if it has to
>>process 20 files or 20000 in sequence.

>Your program isn't going to look any different the way DOS does it,
>either.  What's your point?

The problem is that DOS would never be able to get an argc of 20000

>>                                       Argv, BTW, is usually allocated
>>on the stack, so it may be as long as stack size permits (with 16 bit dumb 
>>DOS, it could have been 64K in theory before awfully f*cking around with
>>segments),

>Yes, you have to deal with segments, but that's a limitation of the
>Intel architecture.  Any Intel-based Unix has to deal with it too
>(although, presumably, most hide it from the programmer).

In 386 protected mode, you simply set the segments to 4GB of size and forget
about them. Segments are a restriction of real mode, aka DOS.

>You're confusing the command buffer with argv and argc, me thinks.
>According to you, argv and argc are allocated dynamically, presumably
>at program execution.  The same can be and is done for DOS C programs
>as well.

Why should anybody? The total length of the argv array can't be greater than
128 bytes, so why the hell would you allocate them dynamically under DOS?

>Ummmm...aren't there, like, FIND_FILE() and FIND_NEXT() routines within
>the set of DOS system calls?  Did you, perhaps, forget about those?

Seems MS forgets about them (see other post about glaring inconsistencies,
even when only using MS delivered software).

>Depends on what you want and why.  Besides, you could always replace
>COMMAND.COM with a command interpreter that expanded wildcards, but
>that'd screw up a whole bunch of other programs.

That would screw up any and all programs, because they expect a commandline
of maximal size 128 to be found in a fixed memory position. "DIR *" would
quite often expand to rather more than 128 bytes.

>Some "Unix" commands don't allow wildcards

Pretty stupid comment --- they never see them, so how should they disallow
them? Of course, you could say _no_ unix command allows wildcards :-)
(Yes, I know programs like tar and find _do_ expand wildcards, but in a
different context).

>or multiple files either.

I have yet to find one that does not do this though there would be a
reasonable reaction to it. Of course, "cd" won't accept more than one
argument --- What would be the meaning of the second one?

>That's a non-issue.  As for the "non-intuitive sequence", I suggest
>you read up on your Unix commands.  A great many, such as ls, cp, rm,
>mv, vi, and so on, require that flags, switches, qualifiers, or
>whatever you want to call them, come before the file specifications.
>Try reading the man pages for some of those commands--you might learn
>something.

True for many vendors. Fortunately, GNU tools are setting standards, and GNU
getopt is rather flexible in this regard. This means that "ls * -l" works
flawlessly :-)

Bernie


  parent reply	other threads:[~1995-01-11 13:54 UTC|newest]

Thread overview: 139+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-12-27 18:34 The big Question John Laing Page
1994-12-29 16:50 ` Lee Sailer
1994-12-29  8:12   ` Darko Volaric
1994-12-29 10:19     ` Perry Donham
1994-12-29 21:15     ` cdlevin
1995-01-02 17:07       ` Raymond Shwake
1995-01-02 22:44         ` cdlevin
1995-01-03  6:28           ` b1ff
1995-01-04  2:26             ` joehkim
1995-01-04  7:33         ` Lee Sau Dan ~{@nJX6X~}
1995-01-05 23:36       ` Steve "Stevers!" Coile
1995-01-06  6:05       ` Aaron M. Scarisbrick
1994-12-29 22:27     ` Bob Hetzel
1994-12-30 13:55       ` Frank Slootweg
     [not found]       ` <dvorak-301294081746@192.0.2.1>
1994-12-30 18:12         ` Craig Burley
1995-01-02 18:24         ` John William Chambless
1994-12-31 16:10       ` cdlevin
1995-01-02  4:58         ` Jeff "Obik" Epler
1995-01-02 13:09         ` Stephen Harris
1995-01-02 13:55         ` Steven Buytaert
1995-01-02 19:44           ` Andrew Valencia
1995-01-02 22:23           ` cdlevin
1995-01-04  5:16           ` Ross Morley
1995-01-04 16:04             ` Jim_Mann
1995-01-04 15:18               ` Dan Swartzendruber
1995-01-08 22:11                 ` Wild cards (Was: The big Question) Maynard Hogg
1995-01-05  0:01               ` copy *.doc *.bak (Was: " Rick
1995-01-05  9:25               ` The big Question J.J. Paijmans
1995-01-07 23:48                 ` Ross Morley
     [not found]                   ` <3es3i7$7at@portal.gmu.edu>
1995-01-10 11:59                     ` Bernd "Bernie" Meyer
1995-01-04 17:18             ` WILLIAM WESTON
1995-01-04 20:31               ` Andrew Violette
1995-01-04 23:20                 ` cdlevin
1995-01-04 20:41               ` Mark van Hoeij
1995-01-06  1:09                 ` Steve "Stevers!" Coile
1995-01-06  3:14                   ` Joe Sloan
1995-01-13 22:30                     ` Andreas Helke
1995-01-14  1:16                       ` Joe Sloan
1995-01-04 23:18               ` Steven Pritchard
1995-01-06 20:43               ` Larry Shurr CB7211
1995-01-07  3:52                 ` Doug  Dejulio
1995-01-10 20:38                 ` Phil Edwards
1995-01-06  0:43             ` Steve "Stevers!" Coile
1995-01-06  2:22               ` Andrew M. Langmead
1995-01-06 15:27                 ` Steve "Stevers!" Coile
1995-01-07 23:02                   ` Bernd "Bernie" Meyer
1995-01-09 17:47                     ` cdlevin
1995-01-10 10:55                       ` Bernd "Bernie" Meyer
     [not found]                     ` <3es3cs$7at@portal.gmu.edu>
1995-01-10 11:56                       ` Bernd "Bernie" Meyer
1995-01-19 15:06                         ` Donal K. Fellows
1995-01-20  1:45                           ` Michael I Bushnell
1995-01-20  2:36                             ` Joe Sloan
1995-01-10 20:24                       ` David Gaudine
1995-01-19 19:22                       ` Citrom Rami
1995-01-09 18:18               ` Holger Veit
1995-01-10 19:13                 ` Steve "Stevers!" Coile
1995-01-10 21:13                   ` Paul Smith
1995-01-11 13:54                   ` Bernd "Bernie" Meyer [this message]
1995-01-12 16:28                   ` Matthias Bruestle
1995-01-06 12:52             ` Mark Crafts
1995-01-06 17:49               ` Don Johnson
1995-01-04 23:49           ` Kevin Lentin
1995-01-09 21:18             ` The big Question [Unix solution under DOS!] Joel M. Hoffman
1995-01-05 15:10           ` The big Question Pete Holsberg
1995-01-09 13:23           ` Dan Newcombe
1995-01-02 18:47         ` Matthew Francey
1995-01-03 13:15           ` John Hawksley
1995-01-03 18:11           ` Scot E. Wilcoxon
1995-01-04  7:42           ` Lee Sau Dan ~{@nJX6X~}
1995-01-04 14:02             ` A.Eigenbrood
1995-01-04 17:21               ` Jerry Leslie
1995-01-04 19:09               ` Dave Sherohman
1995-01-06  0:12           ` Steve "Stevers!" Coile
1995-01-07 15:48           ` Jurgen Botz
1995-01-02 21:20         ` Andrea Linussio
1995-01-02 21:48           ` Nigel Bovey
1995-01-04  7:59             ` Lee Sau Dan ~{@nJX6X~}
1995-01-04 18:46               ` Art Stine
1995-01-02 22:16           ` cdlevin
1995-01-03 16:00             ` Charles Owen
1995-01-07  2:16               ` Maynard Hogg
1995-01-06  0:19             ` Steve "Stevers!" Coile
1995-01-03  3:30           ` Fell Swoop
1995-01-07  2:16           ` Maynard Hogg
1995-01-02 22:47         ` Daniel Garcia
1995-01-03  1:11           ` Daniel E. Wilson
1995-01-04  5:10         ` Ross Morley
1995-01-06  0:41           ` Steve "Stevers!" Coile
1995-01-06 15:01             ` Grant Edwards
1995-01-08 22:09           ` Phil Hughes
     [not found]           ` <3eu2mm$dls@ibch10.inf.tu-dresden.de>
     [not found]             ` <cowen.789759278@moosilauke>
1995-01-11  1:31               ` Beelzebubba
1995-01-12  1:42                 ` Paul JY Lahaie
1995-01-04  7:26         ` Lee Sau Dan ~{@nJX6X~}
1995-01-06  0:48           ` Steve "Stevers!" Coile
1995-01-06  1:27             ` Joe Sloan
1995-01-06 15:24               ` Steve "Stevers!" Coile
1995-01-06  7:39             ` Jerry Leslie
1995-01-07 11:12             ` Michael H Procter
1995-01-07 16:54             ` Bernd "Bernie" Meyer
1995-01-09 18:42             ` Holger Veit
1995-01-10 19:20               ` Steve "Stevers!" Coile
1995-01-13 10:55                 ` Holger Veit
1995-01-13 16:22                   ` Dan Newcombe
1995-01-15 21:52                   ` Michel Eyckmans (MCE)
1995-01-17 18:56                     ` Kenneth Stailey
1995-01-08  4:41           ` Andy Stoffel
1995-01-09  3:23             ` Scott A. Laird
1995-01-04  7:31         ` Jason Burrell
1995-01-04  8:45           ` The big Question [was: Does God use DOS or UNIX?] Gordon Matzigkeit
1995-01-06  0:05         ` The big Question Steve "Stevers!" Coile
1995-01-07  2:16         ` Maynard Hogg
1994-12-30  2:05     ` Gary E. Grant
1994-12-30 18:45       ` ivie
     [not found]     ` <Pine.SUN.3.91.941229160417.2653 <3ed10l$1t@geraldo.cc.utexas.edu>
1995-01-05 13:36       ` Frank Slootweg
     [not found]     ` <Pine.SUN.3.91.941229160417.26531C-100000@ansha <3ehvq6$n8r@portal.gmu.edu>
1995-01-07  7:26       ` Bruce Hutchinson
     [not found]     ` <199501120847.AAA23589@uclink2.berkeley.edu>
1995-01-12 18:29       ` cdlevin
1994-12-29 17:11   ` Jack Coats
1994-12-30 18:59   ` Jim_Mann
1994-12-31  2:40     ` Orc
1994-12-31 21:35   ` Maynard Hogg
1995-01-02 23:44     ` Wallace Roberts
1994-12-30  4:23 ` Maynard Hogg
1994-12-30 18:48   ` ivie
1995-01-03 17:19   ` Kai Henningsen
1995-01-08 22:11     ` System 360 (Was: The big Question) Maynard Hogg
     [not found]       ` <1995Jan9.174905.15107@devildog.att.com>
1995-01-12 15:45         ` Arthur D. Jerijian
1995-01-13  1:48           ` Brandon S. Allbery
1995-01-16 16:53           ` Greg Wimpey
1995-01-17 19:29             ` Kenneth Stailey
     [not found]   ` <LAS.95Jan11162719@nmgate.cb.att.com>
1995-01-12 15:49     ` Mace Moneta
1995-01-13 12:53     ` Mark A. Horton KA4YBR
1995-01-03 11:46 ` The big Question Mike Moreton
1995-01-06  0:25   ` Steve "Stevers!" Coile
1995-01-07 16:50     ` Bernd "Bernie" Meyer
1995-01-03 21:39 ` Chris Bitmead
1995-01-07  0:12   ` Wallace Roberts
  -- strict thread matches above, loose matches on Subject: below --
1994-12-29 16:49 vdonisa
     [not found] <199501060533.WAA21754@xmission.xmission.com>
1995-01-06  6:27 ` cdlevin
1995-01-08 17:37   ` Marcus Harkins
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox