[comp.sys.amiga] ZC 1.01 argc problems

GWO110%URIACC.BITNET@brownvm.brown.edu (F. Michael Theilig) (06/02/90)

     I have discovered what seems to be a bug in ZC ver 1.01 from Fred
 Fish disk 314.  Here is some sample code.

 ---

/**/
#include <stdio.h>

main(argc,argv)
int argc;
char *argv[];
{
int i;
printf("argc: %dn",argc);
for (i=0;i<argc;i++)  printf("Argument number %d is %s.n",i,argv[i]);
}

 ---

     Now for the sample output!

 ---

>> test
argc: 1
Argument number 0 is test.
>> test 1
argc: 3
Argument number 0 is test.
Argument number 1 is 1.
Argument number 2 is .
>> test 1 2
argc: 4
Argument number 0 is test.
Argument number 1 is 1.
Argument number 2 is 2.
Argument number 3 is .
>> test 1 2
argc: 4
Argument number 0 is test.
Argument number 1 is 1.
Argument number 2 is 2.
Argument number 3 is 3.
>> test 1 2 3 4
argc: 5
Argument number 0 is test.
Argument number 1 is 1.
Argument number 2 is 2.
Argument number 3 is 3.
Argument number 4 is 4.

 ---

     Apparently, when a program has one or two arguments, argc gets set
 wrong.

 ----
      F. Michael Theilig  -  The University of Rhode Island at Little Rest
                            GWO110 at URIACC.Bitnet
                            GKZ117 at URIACC.Bitnet

"Gooooood coffee."

GWO110%URIACC.BITNET@brownvm.brown.edu (F. Michael Theilig) (06/02/90)

     I understand the problem I reported earlier reguarding argc.
 Apparently, argc is one too big when there are trailing spaces on
 the command line.  I do that a lot because I have no space bar, and
 I rely hevily on command history.  None-the-less, it has nothing to
 do with declairing argv as *argv[] or **argv.

     What is the proper address for reporting bugs?  There is one
 given in the doc file, but that person is apparently not responsible
 for the current version of ZC.  Overall, I like the compiler.

 ----
      F. Michael Theilig  -  The University of Rhode Island at Little Rest
                            GWO110 at URIACC.Bitnet
                            GKZ117 at URIACC.Bitnet

"Gooooood coffee."