bebbo / libnix

libnix (v4): a C link library for AmigaOS/m68k
15 stars 9 forks source link

Only the first command line argument works in argv #80

Closed BSzili closed 5 months ago

BSzili commented 5 months ago

I just did a complete rebuild after make clean && make drop-prefix, and I noticed that only argv[0] and argv[1] works in the main function, the rest shows up empty. I made a minimal test case:

#include <stdio.h>
int main(int argc, char *argv[])
{
    printf("argc = %d\n", argc);
    for (int i = 0; i < argc; i++)
        printf("%d: %s\n", i, argv[i]);
    return 0;
}

I compiled the program with m68k-amigaos-gcc -noixemul -o argtest argtest.c then launched it with argtest one two three four on the Amiga side. This is the output I got:

argc = 5
0: argtest
1: one
2: 
3: 
4: 

The GCC version I'm on m68k-amigaos-gcc (GCC) 6.5.0b 240420124408 and I'm using NDK 3.9. I uploaded the source+binary I built here just in case: https://bszili.morphos.me/stuff/argtest https://bszili.morphos.me/stuff/argtest.c

Thanks for the help in advance!

bebbo commented 5 months ago

I just pushed the fix, since it hit me too

bebbo commented 5 months ago

please rebuild libnix and retest

BSzili commented 5 months ago

I did a rebuild, it's now working fine, thanks!