summaryrefslogtreecommitdiff
path: root/src/preproc/html/pre-html.cc
diff options
context:
space:
mode:
authorwlemb <wlemb>2001-07-20 14:36:50 +0000
committerwlemb <wlemb>2001-07-20 14:36:50 +0000
commit0c2857af24a536366560a8a13c64fd6ea25f8408 (patch)
tree581239e098ec25f99e3939b5eca17f5054061dbc /src/preproc/html/pre-html.cc
parent8ec25476b88dc3138d74c285cf249a90200ae6ac (diff)
downloadgroff-0c2857af24a536366560a8a13c64fd6ea25f8408.tar.gz
* src/libs/libgroff/tmpname.cc: New file, defining get_tempname().
* src/libs/libgroff/mkstemp.cc: New file. * src/libs/libgroff/mksdir.cc: New file. * src/libs/libgroff/tmpfile.cc [HAVE_MKSTEMP_PROTO]: Removed. (xtmpfile) [!HAVE_MKSTEMP]: Removed. * src/libs/libgroff/Makefile.sub: Updated. * src/include/lib.h: Add mksdir() prototype. * src/include/posix.h: Define S_IXUSR if not yet defined. * src/preproc/html/pre-html.cc (MAX_RETRIES): Removed. (createAllPages): Use mksdir() instead of current code. * src/utils/indxbib/indxbib.cc [HAVE_MKSTEMP_PROTO]: Removed. (main): [!HAVE_MKSTEMP]: Removed. * aclocal.m4 (GROFF_MKSTEMP): Updated to use new mkstemp.cc file. (GROFF_INTTYPES_H, GROFF_UNSIGNED_LONG_LONG, GROFF_UINTMAX_T): New macros. * configure.ac: Add tests for stdint.h, sys/time.h, and gettimeofday(). Call new GROFF_xxx macros. * configure: Regenerated. * Makefile.in: Comments updated.
Diffstat (limited to 'src/preproc/html/pre-html.cc')
-rw-r--r--src/preproc/html/pre-html.cc27
1 files changed, 4 insertions, 23 deletions
diff --git a/src/preproc/html/pre-html.cc b/src/preproc/html/pre-html.cc
index 6f2b9789..399345be 100644
--- a/src/preproc/html/pre-html.cc
+++ b/src/preproc/html/pre-html.cc
@@ -62,7 +62,6 @@ extern "C" const char *Version_string;
#define IMAGE_BOARDER_PIXELS 0
#define MAX_WIDTH 8 // inches
#define INLINE_LEADER_CHAR '\\'
-#define MAX_RETRIES 4096 // number of different page directory names to try before giving up
#define TRANSPARENT "-background \"#FFF\" -transparent \"#FFF\""
@@ -838,32 +837,14 @@ static int createAllPages (void)
{
char buffer[4096];
char *s;
- int retries = MAX_RETRIES;
imagePageStem = xtmptemplate(PAGE_TEMPLATE_LONG, PAGE_TEMPLATE_SHORT);
strcpy(buffer, imagePageStem);
- do {
- if (mktemp(imagePageStem) == NULL) {
- sys_fatal("mktemp");
- return -1;
- }
- if (mkdir(imagePageStem, 0700) == 0) break;
- if (errno == EEXIST) {
- // directory already exists, try another name
- retries--;
- if (retries == 0) {
- // time to give up
- sys_fatal("mkdir");
- return -1;
- }
- } else {
- // another error, quit
- sys_fatal("mkdir");
- return -1;
- }
- strcpy(imagePageStem, buffer);
- } while (1);
+ if (mksdir(imagePageStem) < 0) {
+ sys_fatal("mksdir");
+ return -1;
+ }
s = make_message("echo showpage | "
"gs%s -q -dSAFER -sDEVICE=%s -r%d "