ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/expandarg.c
(Generate patch)

Comparing ray/src/common/expandarg.c (file contents):
Revision 2.1 by greg, Sat Oct 17 08:41:37 1992 UTC vs.
Revision 2.6 by greg, Tue May 13 17:58:32 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1992 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Get additional command arguments from file or environment.
6 + *
7 + *  External symbols declared in standard.h
8   */
9  
10 + #include "copyright.h"
11 +
12   #include "standard.h"
13  
14   #define MAXARGEXP       512             /* maximum argument expansion */
15  
16                          /* set the following to suit, -1 to disable */
17   int     envexpchr = '$';                /* environment expansion character */
18 < int     filexpchr = '^';                /* file expansion character */
18 > int     filexpchr = '@';                /* file expansion character */
19  
20  
21 + int
22   expandarg(acp, avp, n)          /* expand list at argument n */
23   int     *acp;
24   register char   ***avp;
# Line 26 | Line 28 | int    n;
28          char    *ave[MAXARGEXP];
29          char    **newav;
30                                          /* check argument */
31 +        if (n >= *acp)
32 +                return(0);
33          errno = 0;      
34          if ((*avp)[n][0] == filexpchr) {                /* file name */
35                  ace = wordfile(ave, (*avp)[n]+1);
# Line 42 | Line 46 | int    n;
46          if (newav == NULL)
47                  return(-1);
48                                          /* copy preceeding arguments */
49 <        bcopy((char *)*avp, (char *)newav, n*sizeof(char *));
49 >        bcopy((void *)*avp, (void *)newav, n*sizeof(char *));
50                                          /* copy expanded argument */
51 <        bcopy((char *)ave, (char *)(newav+n), ace*sizeof(char *));
51 >        bcopy((void *)ave, (void *)(newav+n), ace*sizeof(char *));
52                                          /* copy trailing arguments + NULL */
53 <        bcopy((char *)(*avp+n+1), (char *)(newav+n+ace), (*acp-n)*sizeof(char *));
53 >        bcopy((void *)(*avp+n+1), (void *)(newav+n+ace), (*acp-n)*sizeof(char *));
54                                          /* free old list */
55          bfree((char *)*avp, (*acp+1)*sizeof(char *));
56                                          /* assign new list */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines