From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1044c2,fb87ccfc9e8baf0a X-Google-Attributes: gid1044c2,public X-Google-Thread: f678f,fb87ccfc9e8baf0a X-Google-Attributes: gidf678f,public X-Google-Thread: 1103af,fb87ccfc9e8baf0a X-Google-Attributes: gid1103af,public X-Google-Thread: f66ab,fb87ccfc9e8baf0a X-Google-Attributes: gidf66ab,public X-Google-Thread: f71eb,fb87ccfc9e8baf0a X-Google-Attributes: gidf71eb,public X-Google-ArrivalTime: 1995-01-12 00:17:37 PST Newsgroups: comp.os.linux.misc,comp.os.os2.misc,comp.unix.osf.misc,comp.os.msdos.misc,comp.os.mach Path: nntp.gmd.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!rhein!bnc.net!news.maz.net!news.ppp.de!news.Hanse.DE!wolfhh!wombat!root From: root@wombat.hanse.de (Bernd "Bernie" Meyer) Subject: Re: The big Question Organization: Private uucp site lost in the voids of the black hole Germany is in the Internet Message-ID: References: <3dpmo9$6fh@calvin.st-and.ac.uk> <3dupdf$7i4@hpscit.sc.hp.com> <3dvd4u$rmv@usenet.INS.CWRU.Edu> <1995Jan2.135536.27035@imec.be> <1995Jan4.051639.24693@prpa.philips.com> <3ei3o8$n8r@portal.gmu.edu> <3erum9$7dl@omega.gmd.de> <3eum8d$5st@portal.gmu.edu> Date: Wed, 11 Jan 1995 13:54:31 GMT Xref: nntp.gmd.de comp.os.linux.misc:37924 comp.os.os2.misc:126395 comp.unix.osf.misc:2310 comp.os.msdos.misc:28642 comp.os.mach:3490 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