summaryrefslogtreecommitdiff
path: root/src/libs/libgroff/tmpfile.cc
diff options
context:
space:
mode:
authorwlemb <wlemb>2001-07-04 22:50:37 +0000
committerwlemb <wlemb>2001-07-04 22:50:37 +0000
commit6e50d833f02cc5554d16f43bac0ca610db6b403f (patch)
treedef46fad0d911886e71b5786edb19178e8567510 /src/libs/libgroff/tmpfile.cc
parent189610678466b18c9a9c973cf365b517882c0bff (diff)
downloadgroff-6e50d833f02cc5554d16f43bac0ca610db6b403f.tar.gz
* src/utils/indxbib/dirnamemax.c: Moved to ...
* src/libs/libgroff/maxfilename.cc: Here. s/dir_name_max/file_name_max/. Add copyright. * src/include/lib.h: Add file_name_max. * src/utils/indxbib/indxbib.cc: Updated. * src/utils/indxbib/Makefile.sub, src/libs/libgroff/Makefile.sub: Updated. * src/libs/libgroff/tmpfile.cc (TMPFILE_PREFIX) [__MSDOS__]: Define as empty. (xtmpfile) [_MSC_VER]: Removed -- MSVC has mktemp(). * src/preproc/html/pre-html.cc (PAGE_TEMPLATE, PS_TEMPLATE, REGION_TEMPLATE): New macros. (createAllPages, makeTempFiles): Use them. Include `nonposix.h'. (html_system): New function. (createAllPages, createImage): Use it. Use EXE_EXT. * tmac/www.tmac: Fix typos.
Diffstat (limited to 'src/libs/libgroff/tmpfile.cc')
-rw-r--r--src/libs/libgroff/tmpfile.cc34
1 files changed, 9 insertions, 25 deletions
diff --git a/src/libs/libgroff/tmpfile.cc b/src/libs/libgroff/tmpfile.cc
index cf2bb8b1..8508c595 100644
--- a/src/libs/libgroff/tmpfile.cc
+++ b/src/libs/libgroff/tmpfile.cc
@@ -1,5 +1,6 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001
+ Free Software Foundation, Inc.
Written by James Clark (jjc@jclark.com)
This file is part of groff.
@@ -47,7 +48,11 @@ extern "C" {
# define DEFAULT_TMPDIR "/tmp"
#endif
// Use this as the prefix for temporary filenames.
-#define TMPFILE_PREFIX "groff"
+#ifdef __MSDOS__
+#define TMPFILE_PREFIX ""
+#else
+#define TMPFILE_PREFIX "groff"
+#endif
/*
* Generate a temporary name template with a postfix
@@ -131,8 +136,6 @@ static void add_tmp_file(const char *name)
// Open a temporary file and with fatal error on failure.
-#ifndef _MSC_VER
-
FILE *xtmpfile(char **namep, char *postfix, int do_unlink)
{
char *templ = xtmptemplate(postfix);
@@ -156,28 +159,9 @@ FILE *xtmpfile(char **namep, char *postfix, int do_unlink)
#endif /* not HAVE_MKSTEMP */
if (do_unlink)
add_tmp_file(templ);
- if ((namep != 0) && ((*namep) != 0)) {
+ if ((namep != 0) && ((*namep) != 0))
*namep = templ;
- } else {
+ else
a_delete templ;
- }
- return fp;
-}
-
-#else
-
-// FIXME: does MSVC have mktemp or mkstemp? If so, it should now
-// use the version above, as it no longer removes an open file.
-// The version below will NOT work with grohtml, since grohtml
-// wants to know the name of the file opened by xtmpfile!!
-
-// If you're not running Unix, the following will do:
-FILE *xtmpfile(char **namep, char *postfix, int do_unlink)
-{
- FILE *fp = tmpfile();
- if (!fp)
- fatal("couldn't create temporary file");
return fp;
}
-
-#endif /* _MSC_VER */