xref: /csrg-svn/usr.bin/pascal/libpc/ARGV.c (revision 40865)
1*40865Sbostic /*-
2*40865Sbostic  * Copyright (c) 1979 The Regents of the University of California.
3*40865Sbostic  * All rights reserved.
4*40865Sbostic  *
5*40865Sbostic  * %sccs.include.redist.c%
6*40865Sbostic  */
71638Smckusick 
8*40865Sbostic #ifndef lint
9*40865Sbostic static char sccsid[] = "@(#)ARGV.c	1.5 (Berkeley) 04/09/90";
10*40865Sbostic #endif /* not lint */
111638Smckusick 
121638Smckusick #include "h00vars.h"
131638Smckusick 
142994Smckusic ARGV(subscript, var, siz)
151638Smckusick 
162994Smckusic 	long		subscript;	/* subscript into argv */
171638Smckusick 	register char	*var;		/* pointer to pascal char array */
182994Smckusic 	long		siz;		/* sizeof(var) */
191638Smckusick {
201638Smckusick 	register char	*cp;
212994Smckusic 	register int	size = siz;
221638Smckusick 
236541Smckusick 	if ((unsigned)subscript >= _argc) {
243867Smckusic 		ERROR("Argument to argv of %D is out of range\n", subscript);
251638Smckusick 		return;
261638Smckusick 	}
271638Smckusick 	cp = _argv[subscript];
281638Smckusick 	do	{
291638Smckusick 		*var++ = *cp++;
301638Smckusick 	} while (--size && *cp);
311638Smckusick 	while (size--)
321638Smckusick 		*var++ = ' ';
331638Smckusick }
34