Mail Archives: djgpp/1995/11/24/07:39:45
On Thu, 23 Nov 1995, A.Appleyard wrote:
> As hereinunder, Messy-DOS's *.BATfile caller goes BATs when it finds an `=' in
> an argument. This may cause obscure trouble for people who call a Gnu C/C++
> program via a *.BAT . I have MS-DOS 6.22 . <-------- marks lines that I typed.
>
> C:\AMZIP>TYPE T$.CC <------------
> #include<stdio.h>
> main(int nargs,char**Arg){int i;
> for(i=0;i<nargs;i++) printf("%4dth arg is `%s'\n",i,Arg[i]);}
> C:\AMZIP>TYPE T$$.BAT <-------------
> t$.exe %1 %2 %3 %4 %5 %6 %7 %8
> C:\AMZIP>t$ cat=and=mouse=games <----------------
> 0th arg is `c:/amzip/t$.exe'
> 1th arg is `cat=and=mouse=games'
>
> C:\AMZIP>t$$ cat=and=mouse=games <------------------
>
> C:\AMZIP>t$.exe cat and mouse games
> 0th arg is `c:/amzip/t$.exe'
> 1th arg is `cat'
> 2th arg is `and'
> 3th arg is `mouse'
> 4th arg is `games'
>
This idiosincrasy of MS-DOG is more or less known, (though I cannot
remember where is it explained in fully to give you folks a pointer),
however, if you need to put one of the line arguments like the example above,
just enclose the whole argument with quotation marks like:
t$$ "cat=and=mouse=games".
This should do the trick.
Incidentally, the root of this behaviour is credited to COMMAN.COM,
probably users of other (replacement) shells for MS-DOG shoud not have
this sort of problem (except if it emulates exactly this behaviour, of
course!).
- Raw text -