--- ray/src/util/wrapBSDF.c 2016/02/02 22:34:00 2.18 +++ ray/src/util/wrapBSDF.c 2016/03/06 01:13:18 2.20 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: wrapBSDF.c,v 2.18 2016/02/02 22:34:00 greg Exp $"; +static const char RCSid[] = "$Id: wrapBSDF.c,v 2.20 2016/03/06 01:13:18 schorsch Exp $"; #endif /* * Wrap BSDF data in valid WINDOW XML file @@ -7,6 +7,7 @@ static const char RCSid[] = "$Id: wrapBSDF.c,v 2.18 20 * G. Ward February 2015 */ +#include "platform.h" #include #include "rtio.h" #include "paths.h" @@ -165,7 +166,8 @@ input2str(const char *inpspec) fprintf(stderr, "%s: cannot open\n", inpspec); return ""; } -#ifndef _WIN32 /* XXX somehow broken on Windows */ +#if !defined(_WIN32) && !defined(_WIN64) + /* XXX somehow broken on Windows */ len = lseek(fd, 0L, SEEK_END); if (len > 0) { lseek(fd, 0L, SEEK_SET); @@ -613,6 +615,10 @@ writeBSDF(const char *caller, ezxml_t fl) if (data_file[i].fname != stdin_name && data_file[i].fname[0] != '!') unlink(data_file[i].fname); + if (unlink_datafiles > 1 && mgf_geometry != NULL && + mgf_geometry != stdin_name && + mgf_geometry[0] != '!') + unlink(mgf_geometry); return 1; } @@ -778,7 +784,7 @@ main(int argc, char *argv[]) attr_unit = argv[i]; continue; case 'U': /* unlink data files when done */ - unlink_datafiles = 1; + unlink_datafiles = 1 + (argv[i][2] == 'U'); continue; case 'a': /* angle basis */ if (++i >= argc)