xref: /csrg-svn/usr.bin/f77/libU77/getarg_.c (revision 23019)
12525Sdlw /*
2*23019Skre  * Copyright (c) 1980 Regents of the University of California.
3*23019Skre  * All rights reserved.  The Berkeley software License Agreement
4*23019Skre  * specifies the terms and conditions for redistribution.
52525Sdlw  *
6*23019Skre  *	@(#)getarg_.c	5.1	06/07/85
7*23019Skre  */
8*23019Skre 
9*23019Skre /*
102525Sdlw  * return a specified command line argument
112525Sdlw  *
122525Sdlw  * calling sequence:
132525Sdlw  *	character*20 arg
142525Sdlw  *	call getarg(k, arg)
152525Sdlw  * where:
162525Sdlw  *	arg will receive the kth unix command argument
172525Sdlw */
182525Sdlw 
192525Sdlw getarg_(n, s, ls)
202525Sdlw long int *n;
212525Sdlw register char *s;
222525Sdlw long int ls;
232525Sdlw {
242525Sdlw extern int xargc;
252525Sdlw extern char **xargv;
262525Sdlw register char *t;
272525Sdlw register int i;
282525Sdlw 
292525Sdlw if(*n>=0 && *n<xargc)
302525Sdlw 	t = xargv[*n];
312525Sdlw else
322525Sdlw 	t = "";
332525Sdlw for(i = 0; i<ls && *t!='\0' ; ++i)
342525Sdlw 	*s++ = *t++;
352525Sdlw for( ; i<ls ; ++i)
362525Sdlw 	*s++ = ' ';
372525Sdlw }
38