1 /*- 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)getarg_.c 5.2 (Berkeley) 04/12/91"; 10 #endif /* not lint */ 11 12 /* 13 * return a specified command line argument 14 * 15 * calling sequence: 16 * character*20 arg 17 * call getarg(k, arg) 18 * where: 19 * arg will receive the kth unix command argument 20 */ 21 22 getarg_(n, s, ls) 23 long int *n; 24 register char *s; 25 long int ls; 26 { 27 extern int xargc; 28 extern char **xargv; 29 register char *t; 30 register int i; 31 32 if(*n>=0 && *n<xargc) 33 t = xargv[*n]; 34 else 35 t = ""; 36 for(i = 0; i<ls && *t!='\0' ; ++i) 37 *s++ = *t++; 38 for( ; i<ls ; ++i) 39 *s++ = ' '; 40 } 41