It is operating system specific. I guess you are on Linux or some other Posix system. Read first Advanced Linux Programming. Read also about globbing. Be aware that your Unix shell is expanding the arguments (and after expansion calling the execve(2) system call....). If you shell is bash
(and actually that behavior is mandated by POSIX) read about Shell Operation then about Shell expansions. Read also the Program Arguments chapter of libc
documentation. See also my answer on "good habits for designing command line arguments?".
The main
function (of signature int main(int argc, char**argv);
, and such a [possible] signature is defined by the C standards) - of the program started by execve
- gets the positive argument count and a NULL
terminated array of strings. So in your case (./testmt signal1 3 5 1 1
) you get argc=6
and argv[0]
is "./testmt"
, argv[1]
is "signal"
, argv[2]
is "3"
, etc... argv[5]
is the last "1"
and argv[6]
is NULL
.
So dive into your code, and look for main
.
PS. AFAIK, on Windows the behavior is probably different. The program (not the shell) is expanding the arguments (actually, probably done in startup files, before they call main
). But I know nothing about Windows. See also Operating Systems: Three easy pieces.