int main (int argc, char *argv[]) { int num_children; if (argc == 2) { num_children = atoi (argv[1]); } else { printf ("Usage: fork number_of_children\n"); exit (-1); } }
This is from the fork program I used two assignments ago. To execute this program, you type fork 16 on the command line and it forks 16 children. If you have the wrong number of arguments, it prints a ``Usage'' message telling you what the arguments are supposed to be. This is a fairly standard interface for UNIX programs.
\timecommand instead, which prints slightly different information about your process (thanks to Peter and Jen who discovered this apparently undocumented feature by accident).