Last change
on this file since 201 was 2, checked in by Rick van der Zwet, 15 years ago |
Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)
|
File size:
836 bytes
|
Rev | Line | |
---|
[2] | 1 | /*
|
---|
| 2 | * Rick van der Zwet
|
---|
| 3 | * 0433373
|
---|
| 4 | * OS Assigment 4 - Part B
|
---|
| 5 | * Licence: BSD
|
---|
| 6 | * $Id: parse-arguments.c 540 2008-04-01 20:51:39Z rick $
|
---|
| 7 | */
|
---|
| 8 |
|
---|
| 9 | /* Input required libaries */
|
---|
| 10 | #include <stdio.h>
|
---|
| 11 | #include <unistd.h>
|
---|
| 12 | #include <stdlib.h>
|
---|
| 13 |
|
---|
| 14 | /* First executed function, called by default, with arguments the
|
---|
| 15 | * arguments and number of arguments ;-)
|
---|
| 16 | */
|
---|
| 17 | int main (int argc, char * argv[]) {
|
---|
| 18 | printf("Process[%d]: parse-arguments in execution ... \n", getpid());
|
---|
| 19 | /* the child's process new program */
|
---|
| 20 | /* This program replaces the parent's program */
|
---|
| 21 | int i;
|
---|
| 22 | printf("Number of arguments %i\n", argc);
|
---|
| 23 | /* Loop trough all arguments */
|
---|
| 24 | for (i = 0; i < argc; i++) {
|
---|
| 25 | printf("Command line argument %i: %s\n", i, argv[i]);
|
---|
| 26 | }
|
---|
| 27 | printf("Process[%d]: parse-arguments, terminating .. \n", getpid());
|
---|
| 28 | return(0);
|
---|
| 29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.