I have a C program that displays it's command-line by iterating through the argv
variable.
#include <stdio.h>
int main(int argc, char *argv[]){
int i = 0;
printf("----------\n");
for(i = 0; i < argc; i++)
printf("%s\n", argv[i]);
return 0;
}
I invoked the program in a folder containing a large C++ source tree like this:
./a.out **/*.h
The output:
zsh: argument list too long: ./a.out
However, programs like ls
and grep
work without any problems when invoked using the **/*.h
glob in the same folder. Why does zsh
fail when invoking my program? How does zsh
go about expanding wildcards?
Edit: I'm using zsh on cygwin.