1 /* 2 * Copyright (c) 1980 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)getarg_.c 5.1 06/07/85 7 */ 8 9 /* 10 * return a specified command line argument 11 * 12 * calling sequence: 13 * character*20 arg 14 * call getarg(k, arg) 15 * where: 16 * arg will receive the kth unix command argument 17 */ 18 19 getarg_(n, s, ls) 20 long int *n; 21 register char *s; 22 long int ls; 23 { 24 extern int xargc; 25 extern char **xargv; 26 register char *t; 27 register int i; 28 29 if(*n>=0 && *n<xargc) 30 t = xargv[*n]; 31 else 32 t = ""; 33 for(i = 0; i<ls && *t!='\0' ; ++i) 34 *s++ = *t++; 35 for( ; i<ls ; ++i) 36 *s++ = ' '; 37 } 38