37779f01dd
Provided in PR 13012 by Stoned Elipot (Stoned.Elipot@script.jussieu.fr) Minor enhancements made by agc. Bibindex and biblook are programs for fast lookup in BibTeX bibliography data bases. Bibindex converts a .bib file to a .bix file, which is a compact binary representation of the .bib file containing hash tables for fast lookup, as well as byte offset positions into the corresponding .bib file. Biblook provides an interactive lookup facility using the .bix and .bib files.
56 lines
1.2 KiB
Text
56 lines
1.2 KiB
Text
$NetBSD: patch-ac,v 1.1.1.1 2001/05/31 10:54:22 agc Exp $
|
|
|
|
Use mkstemp() in preference to tempnam().
|
|
Note use of snprintf(), as not all platforms have strlcpy().
|
|
|
|
--- biblook.c 2001/05/31 08:55:19 1.1
|
|
+++ biblook.c 2001/05/31 09:02:25
|
|
@@ -1276,6 +1276,8 @@
|
|
putc('\n', ofp);
|
|
}
|
|
|
|
+#include <sys/param.h>
|
|
+
|
|
/* ----------------------------------------------------------------- *\
|
|
| void PrintResults(char *filename)
|
|
|
|
|
@@ -1288,6 +1290,9 @@
|
|
FILE *ofp;
|
|
char *pager;
|
|
char *the_tmpfile = (char*)NULL;
|
|
+#if (defined(BSD) && BSD >= 199306)
|
|
+ char f[MAXPATHLEN];
|
|
+#endif
|
|
#if unix
|
|
int childpid;
|
|
#else
|
|
@@ -1315,8 +1320,19 @@
|
|
}
|
|
else
|
|
{
|
|
+#if (defined(BSD) && BSD >= 199306)
|
|
+ int fd;
|
|
+
|
|
+ (void) snprintf(f, sizeof(f), "/tmp/bibl.XXXXXX");
|
|
+ if ((fd = mkstemp(f)) < 0) {
|
|
+ perror("\tCan't open temp file");
|
|
+ return;
|
|
+ }
|
|
+ ofp = fdopen(fd, "w");
|
|
+#else
|
|
the_tmpfile = (char*)tempnam(NULL, "bibl.");
|
|
ofp = fopen(the_tmpfile, "w");
|
|
+#endif
|
|
if (!ofp)
|
|
{
|
|
perror("\tCan't open temp file");
|
|
@@ -1386,7 +1402,9 @@
|
|
#endif
|
|
|
|
unlink(the_tmpfile);
|
|
+#if !(defined(BSD) && BSD >= 199306)
|
|
free(the_tmpfile); /* malloc'ed by tempnam() */
|
|
+#endif
|
|
putchar('\n');
|
|
}
|
|
}
|