Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
718 | jacekm | 1 | #include |
2 | /* |
||
3 | ** Get command line argument. |
||
4 | ** Entry: n = Number of the argument. |
||
5 | ** s = Destination string pointer. |
||
6 | ** size = Size of destination string. |
||
7 | ** argc = Argument count from main(). |
||
8 | ** argv = Argument vector(s) from main(). |
||
9 | ** Returns number of characters moved on success, |
||
10 | ** else EOF. |
||
11 | */ |
||
12 | getarg(n,s,size,argc,argv) |
||
13 | int n; char *s; int size,argc,argv[]; |
||
14 | {char *str; |
||
15 | int i; |
||
16 | |||
17 | if(n<0 | n>=argc) |
||
18 | {*s=NULL; |
||
19 | return EOF; |
||
20 | } |
||
21 | i=0; |
||
22 | str=argv[n]; |
||
23 | while(i |
||
24 | {if((s[i]=str[i])==NULL) break; |
||
25 | ++i; |
||
26 | } |
||
27 | s[i]=NULL; |
||
28 | return i; |
||
29 | } |