delorie.com/djgpp/bugs/show.cgi   search  
Bug 000177

When Created: 10/01/1997 12:58:13
Against DJGPP version: 2.01
By whom: nigel@algor.co.uk
Abstract: Ctrl-Z in command-line response files not handled
If a command-line response file is generated by a program which puts a Ctrl-Z 
(0x1a) at the end of the file (as is common for older DOS programs), 
then the command line processor doesn't spot this and the Ctrl-Z gets passed as
an argument to the program.

This is because the library file lsr/src/libc/crt0/c1args.c uses the 
_read() rather than the read() function to read the file, so it either
needs to use read(), or it needs to explicitly stop processing the file
in parse_arg() when it sees the ctrl-z.

Solution added: 04/15/1999 11:00:55
By whom: eliz@is.elta.co.il
This is solved in WIP and will be in v2.03.  Here's a patch:

*** src/libc/crt0/c1args.c.~1~  Sat Mar 20 23:59:50 1999
--- src/libc/crt0/c1args.c      Thu Apr 15 18:14:20 1999
***************
*** 288,293 ****
--- 288,296 ----
          if (len < 0)
          len = 0;
          _close(f);
+         /* if the last character is ^Z, remove it */
+         if (len > 0 && bytes[len-1] == 0x1a)
+           len--;
        /* assume 'find -print0' if the last char is a '\0' */
        if (len > 0 && bytes[len-1] == '\0')
            al->argv[i]->arg_file = parse_print0(bytes, len);

Fixed in version on 04/22/1999 09:00:34
By whom: eliz@is.elta.co.il



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