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

Comparing ray/src/util/rfluxmtx.c (file contents):
Revision 2.32 by greg, Fri Dec 4 22:16:18 2015 UTC vs.
Revision 2.34 by greg, Tue Feb 2 18:02:32 2016 UTC

# Line 11 | Line 11 | static const char RCSid[] = "$Id$";
11   #include <stdlib.h>
12   #include "rtio.h"
13   #include "rtmath.h"
14 < #include "rtprocess.h"
14 > #include "paths.h"
15   #include "bsdf.h"
16   #include "bsdf_m.h"
17   #include "random.h"
# Line 23 | Line 23 | static const char RCSid[] = "$Id$";
23   #define getc    getc_unlocked
24   #endif
25  
26 #ifdef _WIN32
27 #define SPECIALS        " \t\"$*?"
28 #define QUOTCHAR        '"'
29 #else
30 #define SPECIALS        " \t\n'\"()${}*?[];|&"
31 #define QUOTCHAR        '\''
32 #define ALTQUOT         '"'
33 #endif
34
26   #define MAXRCARG        512
27  
28   char            *progname;              /* global argv[0] */
# Line 142 | Line 133 | surf_type(const char *otype)
133          return(ST_NONE);
134   }
135  
145 /* Check if any of the characters in str2 are found in str1 */
146 static int
147 matchany(const char *str1, const char *str2)
148 {
149        while (*str1) {
150                const char      *cp = str2;
151                while (*cp)
152                        if (*cp++ == *str1)
153                                return(*str1);
154                ++str1;
155        }
156        return(0);
157 }
158
136   /* Add arguments to oconv command */
137   static char *
138   oconv_command(int ac, char *av[])
# Line 190 | Line 167 | overrun:
167          fputs(progname, stderr);
168          fputs(": too many file arguments!\n", stderr);
169          exit(1);
193 }
194
195 /* Convert a set of arguments into a command line for pipe() or system() */
196 static char *
197 convert_commandline(char *cmd, const int len, char *av[])
198 {
199        int     match;
200        char    *cp;
201
202        for (cp = cmd; *av != NULL; av++) {
203                const int       n = strlen(*av);
204                if (cp+n >= cmd+(len-3)) {
205                        fputs(progname, stderr);
206                        return(NULL);
207                }
208                if (matchany(*av, SPECIALS)) {
209                        const int       quote =
210 #ifdef ALTQUOT
211                                strchr(*av, QUOTCHAR) ? ALTQUOT :
212 #endif
213                                        QUOTCHAR;
214                        *cp++ = quote;
215                        strcpy(cp, *av);
216                        cp += n;
217                        *cp++ = quote;
218                } else {
219                        strcpy(cp, *av);
220                        cp += n;
221                }
222                *cp++ = ' ';
223        }
224        if (cp <= cmd)
225                return(NULL);
226        *--cp = '\0';
227        return(cmd);
170   }
171  
172   /* Open a pipe to/from a command given as an argument list */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines