dhesi@bsu-cs.UUCP (Rahul Dhesi) (07/25/87)
I have discovered truly bizarre behavior in C for VAX/VMS. The command-line arguments are folded to all lowercase. The only way of preserving case seems to be to enclose arguments in double quotes. Thus a command like tr a-z A-Z won't work. How does one tell it not to do it? I could find no references to this in the index of the VMS C manual. -- Rahul Dhesi UUCP: {ihnp4,seismo}!{iuvax,pur-ee}!bsu-cs!dhesi
tli@sargas.usc.edu (Tony Li) (07/26/87)
In article <880@bsu-cs.UUCP> dhesi@bsu-cs.UUCP (Rahul Dhesi) writes:
I have discovered truly bizarre behavior in C for VAX/VMS. The
command-line arguments are folded to all lowercase. The only way of
preserving case seems to be to enclose arguments in double quotes.
Thus a command like
tr a-z A-Z
won't work.
How does one tell it not to do it? I could find no references to this
in the index of the VMS C manual.
It's not C at all. It's DCL. This is a ?feature?. Yes, you've
discovered the only workaround is to use double quotes.
;-)
Tony Li - USC University Computing Services "Fene mele kiki bobo"
Uucp: oberon!tli -- Joe Isuzu
Bitnet: tli@uscvaxq, tli@ramoth
Internet: tli@sargas.usc.edu
ted@blia.BLI.COM (Ted Marshall) (07/27/87)
In article <3639@oberon.USC.EDU>, tli@sargas.usc.edu (Tony Li) writes: > In article <880@bsu-cs.UUCP> dhesi@bsu-cs.UUCP (Rahul Dhesi) writes: > I have discovered truly bizarre behavior in C for VAX/VMS. The > command-line arguments are folded to all lowercase. The only way of > preserving case seems to be to enclose arguments in double quotes. > It's not C at all. It's DCL. This is a ?feature?. Yes, you've > discovered the only workaround is to use double quotes. Actually, it's both DCL and the VAX C RTL. DCL folds all non-quoted input to UPPER case. The VAX C implementors knew that this would cause problems for almost all Unix programs that use the argument vector. They coped as best they could (I guess) by re-folding the un-quoted text to lower case. -- Ted Marshall ...!ucbvax!mtxinu!blia!ted <or> mtxinu!blia!ted@Berkeley.EDU Britton Lee, Inc., 14600 Winchester Blvd, Los Gatos, Ca 95030 (408)378-7000 The opinions expressed above are those of the poster and not his employer.
carl@CITHEX.CALTECH.EDU (Carl J Lydick) (07/28/87)
> I have discovered truly bizarre behavior in C for VAX/VMS. The > command-line arguments are folded to all lowercase. The only way of > preserving case seems to be to enclose arguments in double quotes. > Thus a command like > > tr a-z A-Z > > won't work. > > How does one tell it not to do it? I could find no references to this > in the index of the VMS C manual. This is not bizarre behavior on the part of C; it is well-documented behavior on the part of both DCL and C. Quoting from page 11-31 of "Programming in VAX C": DCL converts most arguments on the command line to uppercase letters. However, VAX C internally parses and midifies the altered command line to make VAX C argument access compatible with C programs developed on other systems. All alphabetic arguments in the commnd line are delimited by spaces or tabs. Arguments that have embedded spaces or tabs must be enclosed in quotation marks (" "). Uppercase characters in arguments are converted to lowercase, but arguments within quotation marks are left unchanged.
LEICHTER-JERRY@YALE.ARPA (07/29/87)
I have discovered truly bizarre behavior in C for VAX/VMS. The command-line arguments are folded to all lowercase. The only way of preserving case seems to be to enclose arguments in double quotes. Thus a command like tr a-z A-Z won't work. How does one tell it not to do it? I could find no references to this in the index of the VMS C manual. You didn't look in the index very hard, did you? It took me about 30 seconds to find the index entry "Main function, syntax of". A quick look at the single section that points to makes it clear that this is the place to find the details. Reading on, we find (page 11-31 in Programming in VAX C - the V2.0-V2.2 version): DCL converts most arguments on the command line to uppercase letters. However, VAX C internally parses and modifies the altered command line to make VAX C argument access compatible with C programs on other systems. All alphabetic arguments in the command line are delimited by spaces or tabs. Arguments that have embedded spaces or tabs must be enclosed in quotation marks (" "). Uppercase characters in arguments are converted to lowercase, but arguments within quotation marks are left unchanged. This is NOT a bug in C; in fact, it has as little to do with C as the fact that the Unix shells will interpret various metacharacters unless you quote them. There is no way to prevent DCL from forcing all the unquoted letters to upper case, and there is nothing VAX C can do to restore the original case - the information is simply not available to it. VAX C does the best it can by converting everything to lower case because (a) most Unix command options are lower case; (b) file specs on VMS don't distinguish case, so changing the case of file specs doesn't matter. Hence, most Unix program interfaces will work unchanged. tr happens to be a special case. (grep would be, too. But note that on VMS, unlike Unix, you don't have to use quotes to pass "*" when in regular expressions.) Now, repeat 10 times: I will not assume something isn't in the manual until I've looked. I will not assume something is a bug because I don't understand it. I will not assume something is a bug because it's not exactly like Unix. -- Jerry -------
dhesi@bsu-cs.UUCP (Rahul Dhesi) (07/31/87)
Summary: In article <880@bsu-cs.UUCP> I wrote: >I have discovered truly bizarre behavior in C for VAX/VMS. The >command-line arguments are folded to all lowercase. Thanks to all who sent email setting me straight. The problem lies in the VAX/VMS command interpreter, which folds the command line to uppercase. I was also given to understand by several people that this is a desirable feature rather than a bug. The work-around is to put double quotes around arguments. Aside: I was intrigued to find that $ dir "*.doc" won't give me a directory listing. Without the double quotes it works fine. -- Rahul Dhesi UUCP: {ihnp4,seismo}!{iuvax,pur-ee}!bsu-cs!dhesi
dboyes@uoregon.UUCP (David Boyes) (07/31/87)
In article <8707291008.AA17919@ucbvax.Berkeley.EDU> <LEICHTER-JERRY@YALE.ARPA> writes: > > I have discovered truly bizarre behavior in C for VAX/VMS. The . . . > [... a perfectly valid question about a really DUMB feature of > VMS...] > > How does one tell it not to do it? I could find no references to this > in the index of the VMS C manual. > >You didn't look in the index very hard, did you? It took me about 30 seconds Thanks for the grace and charm, bucko. Remind me to return the favor sometime when YOU need a question answered. >to find the index entry "Main function, syntax of". A quick look at the >single section that points to makes it clear that this is the place to find >the details. Reading on, we find (page 11-31 in Programming in VAX C - the >V2.0-V2.2 version): > > DCL converts most arguments on the command line to uppercase > letters. However, VAX C internally parses and modifies the > altered command line to make VAX C argument access compatible > with C programs on other systems. > Seems like a pretty dumb thing to do -- it's one of the most non-intuitive things I've ever seen. Jeez, even IBM doesn't muck with the case of command line arguments(unless you ask it to). > >This is NOT a bug in C; in fact, it has as little to do with C as the fact >that the Unix shells will interpret various metacharacters unless you quote >them. > >There is no way to prevent DCL from forcing all the unquoted letters to upper >case, Why not? >and there is nothing VAX C can do to restore the original case - the >information is simply not available to it. Then why do they do it in the first place? > >Now, repeat 10 times: > > I will not assume something isn't in the manual until I've looked. Sigh. Like IBM, DEC manuals are badly written, poorly indexed, and really require you to know what you're looking for before you start looking for it. Also, since a full set of VMS manuals now costs upwards of $5K, did you consider the possibility that the manual might not have been available to him? It's not an uncommon thing at universities to have the manuals locked away somewhere where only the gurus can get at them. Cut him some slack, ok? > I will not assume something is a bug because I don't understand it. C'mon, guy. Even YOU have to admit that this sort of behavior for argument processing makes very little sense, especially since VMS provides no way to get at the unmodified command line. Besides, isn't this newsgroup intended to provide information about working and programming under VMS? He knew enough to ask about behavior he didn't understand -- let's give the fellow credit for being willing to stand up and admit confusion. You remember confusion -- that stuff you felt when first faced with an unexplainable weirdness in a program or OS? > I will not assume something is a bug because it's not exactly like > Unix. This can be expanded to ANY OS. I could say the same about VMS, or Unix, or MVS for that matter. The behavior he has observed is certifiably silly -- how tough is it to provide one more syscall to the 1x10e9 that VMS already has to get the unmunged command line? Give us a break, ok? In summary, lighten up. At least this fellow is trying. -- David Boyes ARPA: 556%OREGON1.BITNET@WISCVM.WISC.EDU Systems Division BITNET: 556@OREGON1 University of Oregon Computing Center UUCP: dboyes@uoregon.UUCP