Commit | Line | Data |
---|---|---|
840ed54d DW |
1 | /* |
2 | char id_getarg[] = "@(#)getarg_.c 1.1"; | |
3 | * | |
4 | * return a specified command line argument | |
5 | * | |
6 | * calling sequence: | |
7 | * character*20 arg | |
8 | * call getarg(k, arg) | |
9 | * where: | |
10 | * arg will receive the kth unix command argument | |
11 | */ | |
12 | ||
13 | getarg_(n, s, ls) | |
14 | long int *n; | |
15 | register char *s; | |
16 | long int ls; | |
17 | { | |
18 | extern int xargc; | |
19 | extern char **xargv; | |
20 | register char *t; | |
21 | register int i; | |
22 | ||
23 | if(*n>=0 && *n<xargc) | |
24 | t = xargv[*n]; | |
25 | else | |
26 | t = ""; | |
27 | for(i = 0; i<ls && *t!='\0' ; ++i) | |
28 | *s++ = *t++; | |
29 | for( ; i<ls ; ++i) | |
30 | *s++ = ' '; | |
31 | } |