xref: /csrg-svn/usr.bin/f77/libU77/getarg_.c (revision 47944)
1*47944Sbostic /*-
2*47944Sbostic  * Copyright (c) 1980 The Regents of the University of California.
3*47944Sbostic  * All rights reserved.
42525Sdlw  *
5*47944Sbostic  * %sccs.include.proprietary.c%
623019Skre  */
723019Skre 
8*47944Sbostic #ifndef lint
9*47944Sbostic static char sccsid[] = "@(#)getarg_.c	5.2 (Berkeley) 04/12/91";
10*47944Sbostic #endif /* not lint */
11*47944Sbostic 
1223019Skre /*
132525Sdlw  * return a specified command line argument
142525Sdlw  *
152525Sdlw  * calling sequence:
162525Sdlw  *	character*20 arg
172525Sdlw  *	call getarg(k, arg)
182525Sdlw  * where:
192525Sdlw  *	arg will receive the kth unix command argument
202525Sdlw */
212525Sdlw 
getarg_(n,s,ls)222525Sdlw getarg_(n, s, ls)
232525Sdlw long int *n;
242525Sdlw register char *s;
252525Sdlw long int ls;
262525Sdlw {
272525Sdlw extern int xargc;
282525Sdlw extern char **xargv;
292525Sdlw register char *t;
302525Sdlw register int i;
312525Sdlw 
322525Sdlw if(*n>=0 && *n<xargc)
332525Sdlw 	t = xargv[*n];
342525Sdlw else
352525Sdlw 	t = "";
362525Sdlw for(i = 0; i<ls && *t!='\0' ; ++i)
372525Sdlw 	*s++ = *t++;
382525Sdlw for( ; i<ls ; ++i)
392525Sdlw 	*s++ = ' ';
402525Sdlw }
41