316 |
|
} |
317 |
|
|
318 |
|
|
319 |
+ |
int |
320 |
|
r_ies(ac, av) /* convert an IES luminaire file */ |
321 |
|
int ac; |
322 |
|
char **av; |
323 |
|
{ |
324 |
|
int xa0 = 2; |
325 |
< |
char combuf[72]; |
325 |
> |
char combuf[128]; |
326 |
|
char fname[48]; |
327 |
|
char *oname; |
328 |
|
register char *op; |
331 |
|
if (ac < 2) |
332 |
|
return(MG_EARGC); |
333 |
|
(void)strcpy(combuf, "ies2rad"); |
334 |
< |
op = combuf + 7; |
334 |
> |
op = combuf + 7; /* get -m option (must be first) */ |
335 |
|
if (ac-xa0 >= 2 && !strcmp(av[xa0], "-m")) { |
336 |
|
if (!isflt(av[xa0+1])) |
337 |
|
return(MG_ETYPE); |
338 |
|
op = addarg(addarg(op, "-m"), av[xa0+1]); |
339 |
|
xa0 += 2; |
340 |
|
} |
341 |
< |
if (access(av[1], 0) == -1) |
341 |
> |
*op++ = ' '; /* build IES filename */ |
342 |
> |
i = 0; |
343 |
> |
if (mg_file != NULL && |
344 |
> |
(oname = strrchr(mg_file->fname, '/')) != NULL) { |
345 |
> |
i = oname - mg_file->fname + 1; |
346 |
> |
(void)strcpy(op, mg_file->fname); |
347 |
> |
} |
348 |
> |
(void)strcpy(op+i, av[1]); |
349 |
> |
if (access(op, 0) == -1) |
350 |
|
return(MG_ENOFILE); |
342 |
– |
*op++ = ' '; /* IES filename goes last */ |
343 |
– |
(void)strcpy(op, av[1]); |
351 |
|
system(combuf); /* run ies2rad */ |
352 |
|
/* now let's find the output file */ |
353 |
|
if ((op = strrchr(av[1], '/')) == NULL) |