delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/04/09/18:26:26

Message-Id: <9604092217.AA10421@vlsi3>
To: djgpp-workers AT delorie DOT com
Cc: paik AT vlsi1 DOT 3dfx DOT com
Subject: Long command lines
Date: Tue, 09 Apr 1996 15:15:54 -0700
From: Sam Paik <paik AT 3dfx DOT com>

DJ asked me to forward this to this list.  I'm not on this list,
so I won't see any discussion unless you explicitly cc me.

==

Is there any particular reason why DJGPP doesn't use a system
for long file names compatible with Win95?

Win95's long command line support works like this:
 
If command line is greater than 126 characters, put 127 in the
length byte of the psp tail, put 126 characters, followed by
0x0d.  Put the full command line in the CMDLINE environment
variable.
 
I did a quick hack of dosexec.c to do this, and it seems to work.
(at least, I was able to spawn msvc with a command line > 126
chars)

This probably should be added on the input side too, to pick up
args too.

Sam Paik
paik AT 3dfx DOT com

Here is a context diff:

*** dosexec.c	Mon Apr  8 19:09:18 1996
--- dosexec.org	Thu Nov 30 06:58:08 1995
***************
*** 79,119 ****
  
    dosmemput(progname, proglen, program_la);
    
!   if (strlen(args) > 126) {
!     arg_header[0] = 127;
!     arg_header[1] = '\r';
!     dosmemput(arg_header, 1, arg_la);
!     dosmemput(args, 126, arg_la+1);
!     dosmemput(arg_header+1, 1, arg_la+127);
!   } else {
!     arg_header[0] = strlen(args);
!     arg_header[1] = '\r';
!     dosmemput(arg_header, 1, arg_la);
!     dosmemput(args, strlen(args), arg_la+1);
!     dosmemput(arg_header+1, 1, arg_la+1+strlen(args));
!   }
  
    do {
      env_la = talloc(1);
    } while (env_la & 15);
    talloc(-1);
!   if (strlen(args) > 126) {
!     for (i=0; envp[i]; i++)
!     {
!       if (strncmp(envp[i],"CMDLINE=",8)!=0) {
!         env_e_la = talloc(strlen(envp[i])+1);
!         dosmemput(envp[i], strlen(envp[i])+1, env_e_la);
!       }
!     }
!     env_e_la = talloc(strlen(args)+8+1);
!     dosmemput("CMDLINE=",8,env_e_la);
!     dosmemput(args,strlen(args)+1,env_e_la+8);
!   } else {
!     for (i=0; envp[i]; i++)
!     {
!       env_e_la = talloc(strlen(envp[i])+1);
!       dosmemput(envp[i], strlen(envp[i])+1, env_e_la);
!     }
    }
    arg_header[0] = 0;
    arg_header[1] = 1;
--- 79,98 ----
  
    dosmemput(progname, proglen, program_la);
    
!   arg_header[0] = strlen(args);
!   arg_header[1] = '\r';
!   dosmemput(arg_header, 1, arg_la);
!   dosmemput(args, strlen(args), arg_la+1);
!   dosmemput(arg_header+1, 1, arg_la+1+strlen(args));
  
    do {
      env_la = talloc(1);
    } while (env_la & 15);
    talloc(-1);
!   for (i=0; envp[i]; i++)
!   {
!     env_e_la = talloc(strlen(envp[i])+1);
!     dosmemput(envp[i], strlen(envp[i])+1, env_e_la);
    }
    arg_header[0] = 0;
    arg_header[1] = 1;
***************
*** 171,187 ****
      arglen += strlen(argv[i]) + 1;
    args = (char *)alloca(arglen+1);
    argp = args;
- #if 1
-   for (i=1; argv[i]; i++)
-   {
-     const char *p = argv[i];
-     *argp++ = ' ';
-     while (*p)
-     {
-       *argp++ = *p++;
-     }
-   }
- #else
    for (i=1; argv[i]; i++)
    {
      const char *p = argv[i];
--- 150,155 ----
***************
*** 195,201 ****
        *argp++ = *p++;
      }
    }
- #endif
    *argp = 0;
    
    return direct_exec_tail(program, args, envp);
--- 163,168 ----

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019