I don't know how it works in fortran but, as it's service provided by the OS, similar mechanism must exist. In C, the entry point is always the function called "main", and the system give to this function two parameters: the first one is an integer and the second one is an array of strings, the number of strings in the array is given by the first parameter. The function prototype is:
Code:
int main (int argc, char* argv[]);
The first string of the second parameter is the program name typed in the command line. Then if you type "./a.out -t foo -v bar", then the system will pass to your main function:
argc = 5
argv[0] = "./a.out"
argv[1] = "-t"
argv[2] = "foo"
argv[3] = "-v"
argv[4] = "bar"
The standard C library provide an helper to ease the arguments handling, its name is "getopt", "man 3 getopt" will give you all the details you need.