Date problem with drlink

Peter Naulls peter at chocky.org
Thu Aug 1 14:33:50 PDT 2002


In message <3D48217C.4020804 at jeffray.co.uk>
          Ian Jeffray <ian at jeffray.co.uk> wrote:

> The file created has a "0" on the end... note how the error filename printed
> in the error message is missing this.
> 
> If we wind the date back, the filenames end with "z" (for example) because the
> tmpnam name is based on the __time[].  (So, Nick, it is a "rollover" of sorts
> after all ... probably the first time ever tmpnam's made files ending in '0' ;-)

Not quite the first time - I now realise I've seen this before, but
because it's gone away after a while (you can now see why) I've never
been able to chase it.

> So, it kinda smells like unixlib's command parser (which makes the
> argv[] list from the commandline) is bust somehow... ?

Alas.  The problem is that Unixlib gets confused by the redirection:

program .... ccblah0 >ccmmoooo
                   |         |

During the parsing of the command line, Unixlib decides that this
section refers to a redirection.  I think this is appropriate:

diff -u -r1.2.2.12 unix.c
--- unixlib/source/unix/unix.c  31 Jul 2002 14:15:34 -0000      1.2.2.12
+++ unixlib/source/unix/unix.c  1 Aug 2002 21:34:07 -0000
@@ -796,7 +797,7 @@
        {
          /* Don't check for a redirection operator in the first argument
             because that is the program name.  */
-         if (argc != 0 && verify_redirection (cli))
+         if (argc != 0 && isspace(cli[-1]) && verify_redirection (cli))
            {
              /* We don't add redirection operators to the argument list.
                 So skip all characters up until the next real argument.  */
  



-- 
------------------------------------------------------------------------
 Peter Naulls - peter at chocky.org
 Homepage                     -  http://www.chocky.org/
 RISC OS C Programming        -  http://www.riscos.info/
 Unix Programs on RISC OS     -  http://www.chocky.org/unix/
------------------------------------------------------------------------



More information about the gcc mailing list