--- ray/src/common/expandarg.c 1992/10/17 08:41:37 2.1 +++ ray/src/common/expandarg.c 2003/06/27 06:53:21 2.7 @@ -1,22 +1,28 @@ -/* Copyright (c) 1992 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: expandarg.c,v 2.7 2003/06/27 06:53:21 greg Exp $"; #endif - /* * Get additional command arguments from file or environment. + * + * External symbols declared in rtio.h */ -#include "standard.h" +#include "copyright.h" +#include "rtio.h" + +#include "rtmisc.h" + +#include + #define MAXARGEXP 512 /* maximum argument expansion */ /* set the following to suit, -1 to disable */ int envexpchr = '$'; /* environment expansion character */ -int filexpchr = '^'; /* file expansion character */ +int filexpchr = '@'; /* file expansion character */ +int expandarg(acp, avp, n) /* expand list at argument n */ int *acp; register char ***avp; @@ -26,6 +32,8 @@ int n; char *ave[MAXARGEXP]; char **newav; /* check argument */ + if (n >= *acp) + return(0); errno = 0; if ((*avp)[n][0] == filexpchr) { /* file name */ ace = wordfile(ave, (*avp)[n]+1); @@ -42,11 +50,11 @@ int n; if (newav == NULL) return(-1); /* copy preceeding arguments */ - bcopy((char *)*avp, (char *)newav, n*sizeof(char *)); + bcopy((void *)*avp, (void *)newav, n*sizeof(char *)); /* copy expanded argument */ - bcopy((char *)ave, (char *)(newav+n), ace*sizeof(char *)); + bcopy((void *)ave, (void *)(newav+n), ace*sizeof(char *)); /* copy trailing arguments + NULL */ - bcopy((char *)(*avp+n+1), (char *)(newav+n+ace), (*acp-n)*sizeof(char *)); + bcopy((void *)(*avp+n+1), (void *)(newav+n+ace), (*acp-n)*sizeof(char *)); /* free old list */ bfree((char *)*avp, (*acp+1)*sizeof(char *)); /* assign new list */