[brlcad-commits] CVS: brlcad/src/lgt do_options.c,14.19,14.20
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: Sean M. <br...@us...> - 2007-12-14 13:33:03
|
Update of /cvsroot/brlcad/brlcad/src/lgt In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19101 Modified Files: do_options.c Log Message: use bu_temp_file() for the batch file instead of assumping /tmp Index: do_options.c =================================================================== RCS file: /cvsroot/brlcad/brlcad/src/lgt/do_options.c,v retrieving revision 14.19 retrieving revision 14.20 diff -w -u -r14.19 -r14.20 --- do_options.c 21 Nov 2007 20:49:09 -0000 14.19 +++ do_options.c 14 Dec 2007 13:33:05 -0000 14.20 @@ -679,39 +679,22 @@ anti_aliasing = FALSE; return 1; } -/* Disgusting hack to avoid the compiler warnings about tmpnam(), - * and yet not rewrite lgt. - */ -char * -lgt_tmp_name(void) -{ - char *template; - int tmp_fd; - template = bu_strdup( "/tmp/lgt_tmp.XXXXXX" ); - if( (tmp_fd=mkstemp( template ) ) == -1 ) { - bu_bomb( "Unable to open tmp file!!!\n" ); - } - close( tmp_fd ); - return( template ); -} - -#ifndef L_tmpnam /* Alliant has bogus "tmpnam" implementation. */ -#define L_tmpnam 20 -#endif /* f _ B a t c h ( ) */ /*ARGSUSED*/ static int f_Batch(HMitem *itemp, char **args) { static char *batch_com[8]; - char *script; -#ifdef cray - bu_log( "Sorry, no batch queue on the Cray yet.\n" ); - return 1; -#else - script = lgt_tmp_name(); + char script[MAXPATHLEN]; + FILE *fp = NULL; + + fp = bu_temp_file(script, MAXPATHLEN); + if (!fp) { + return -1; + } + batch_com[0] = "batch"; batch_com[1] = "-m"; batch_com[2] = "-t"; @@ -720,13 +703,18 @@ batch_com[5] = "/bin/sh"; batch_com[6] = script; batch_com[7] = NULL; + if( make_Script( script ) == -1 ) return -1; + (void) exec_Shell( batch_com ); + if (fp) { + fclose(fp); + fp = NULL; + } (void) unlink( script ); - bu_free( (char *)script, "lgt temporary file name" ); + return 1; -#endif } #ifdef UP |