[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: OT: alternate .dvi output spec, TeX/LaTeX?



On Wed, Aug 29, 2001 at 04:19:18PM -0700, Karsten M. Self wrote:
| on Wed, Aug 29, 2001 at 07:02:03PM -0400, dman (dsh8290@rit.edu) wrote:
| > On Wed, Aug 29, 2001 at 03:19:07PM -0700, Karsten M. Self wrote:
| > | I'm trying to use TeX in a script.  Problem I've got is convincing TeX
| > | to put its output where I want it to.
| > | 
| > | Anyone got a hint for forcing TeX to create an output DVI file with a
| > | specified name?
| > 
| > I was thinking of making a (script) frontend to LaTeX to get the
| > desired output (PS usually) but *not* have the extra temporary junk
| > lying around.  What I was thinking of was create a temp directory
| > (using some well-tested method) and cd to it.  Run LaTeX from there
| > and then copy out the files I really want to keep.  Then I would clean
| > up the junk afterwards.  Maybe the same sort of option is available
| > for you?
| 
| This is how I'm leaning.  I don't know a good temp*directory* creater,
| a la tempfile.

I don't recall offhand, but IIRC there are C functions (and similar
functions for other languages) to return a _name_ that is good for a
tempfile.  Instead of making a file from it, make a directory instead.

Hold on, I'll check my Linux Programming book to see if I find
mention of it.

Ok, here it is :

    #include <stdio.h>
    FILE* tmpfile( void ) ; /* here is what you are thinking of */
    char* tmpnam( char* s ) ;

    #include <unistd.h>
    int mkstemp( char* template ) ;
    char* mktemp( char* template ) ;


tmpfile() creates and returns a refernce to a file.  You need a dir
instead.  tmpnam() returns a string that is suitable for a temp file,
which could be used to create a dir instead.

The book then says that the functions probably give you a file in /tmp
or /var/tmp and shouldn't be used because those are public (vunerable)
directories.

There may already exist a "program" wrapper that is useable in a shell
script, or you could create one (unless you are already writing a C
app).

-D



Reply to: