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.35 by greg, Fri Mar 4 00:21:21 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"
18   #include "triangulate.h"
19   #include "platform.h"
20  
21 #ifdef getc_unlocked            /* avoid horrendous overhead of flockfile */
22 #undef getc
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
21   #define MAXRCARG        512
22  
23   char            *progname;              /* global argv[0] */
# Line 142 | Line 128 | surf_type(const char *otype)
128          return(ST_NONE);
129   }
130  
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
131   /* Add arguments to oconv command */
132   static char *
133   oconv_command(int ac, char *av[])
# Line 190 | Line 162 | overrun:
162          fputs(progname, stderr);
163          fputs(": too many file arguments!\n", stderr);
164          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);
165   }
166  
167   /* Open a pipe to/from a command given as an argument list */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines