Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!wuarchive!swbatl!texbell!texsun!newstop!sun!imagen!qmsseq!pipkins From: pipkins@qmsseq.imagen.com (Jeff Pipkins) Newsgroups: comp.sys.ibm.pc Subject: Re: Why is comma delimiter in batch files? Keywords: batch MSDOS Message-ID: <74@qmsseq.imagen.com> Date: 4 Jan 90 17:59:44 GMT References: <3445@cbnewsl.ATT.COM> <2646@jolnet.ORPK.IL.US> Reply-To: pipkins@qmsseq.UUCP (Jeff Pipkins) Organization: QMS Inc., Mobile, Alabama Lines: 30 In article <2646@jolnet.ORPK.IL.US> b-cox2@uiuc.edu writes: >In article <3445@cbnewsl.ATT.COM> rl@cbnewsl.ATT.COM (roger.h.levy) writes: >> >>I've noticed that batch files regard both blanks and commas as delimiters >>whereas c programs regard only blanks as a delimeter (If it matters, I'm >>using DOS 3.2). For example: [example deleted] >>My question: Is there a way to convince batch files to think of the comma >>as part of the parameter, i.e. to regard only blanks as delimiters so as >>to be consistent with c programs? > >No, unless you want to patch DOS. [correct. Or write your own command.com...] >An alternative, if you want to do it and >have source to your C startup code, is to patch that (Turbo C Pro comes with >this source, Microsoft may/may not -- Turbo C's name is "c0?.obj" where the ? >is the memory model) to parse a comma as a delimiter. Incidently, the command tail is not parsed by c0?.obj, but by a function that it calls. I don't remember its name right now. Same goes for MSC, the name is setargv() I think. You can link in your own version of this function if you want. The command tail is stored in the program's PSP at offset 80h. MSC has a global _psp that has the segment address of the PSP. { char far *p; FP_SEG(p) = _psp; FP_OFF(p) = 0x80; } The byte at 80h has the length of the string, which actually starts at 81h. The first byte (at 81h) is always a blank, and the string always has a 0x0D byte at the end. { p[*p] = 0; p++; printf("command tail is %s\n", p); } Hope this helps.