xref: /csrg-svn/usr.bin/pascal/libpc/ARGV.c (revision 62092)
140865Sbostic /*-
2*62092Sbostic  * Copyright (c) 1979, 1993
3*62092Sbostic  *	The Regents of the University of California.  All rights reserved.
440865Sbostic  *
540865Sbostic  * %sccs.include.redist.c%
640865Sbostic  */
71638Smckusick 
840865Sbostic #ifndef lint
9*62092Sbostic static char sccsid[] = "@(#)ARGV.c	8.1 (Berkeley) 06/06/93";
1040865Sbostic #endif /* not lint */
111638Smckusick 
121638Smckusick #include "h00vars.h"
131638Smckusick 
ARGV(subscript,var,siz)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