66 lines
1.3 KiB
Plaintext
66 lines
1.3 KiB
Plaintext
# $OpenBSD: patch-ab,v 1.2 2000/02/06 10:41:13 form Exp $
|
|
|
|
--- todos.c.orig Tue Dec 22 05:50:00 1998
|
|
+++ todos.c Sun Feb 6 16:39:32 2000
|
|
@@ -33,6 +33,7 @@
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <ctype.h>
|
|
+#include <unistd.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#if defined(__MSDOS__) || defined(__OS2__)
|
|
@@ -55,7 +56,6 @@
|
|
char outbuf[NEEDSIZ];
|
|
#endif
|
|
|
|
-extern char *mktemp();
|
|
int RENAME(), decode();
|
|
|
|
#include "alt2koi8.h"
|
|
@@ -63,6 +63,9 @@
|
|
#include "win2koi8.h"
|
|
#include "koi82win.h"
|
|
|
|
+#ifdef HAVE_MKSTEMP
|
|
+int tmpfd;
|
|
+#endif
|
|
char tmp_pat[] = "$1489_XXXXXX";
|
|
char tmp_name[256], out_name[256];
|
|
char **table;
|
|
@@ -251,10 +254,21 @@
|
|
}
|
|
|
|
sprintf(tmp_name, "%s%s%s", outdir, *outdir ? "/" : "", tmp_pat);
|
|
+#ifdef HAVE_MKSTEMP
|
|
+ if ((tmpfd = mkstemp(tmp_name)) < 0) {
|
|
+ perror(tmp_name);
|
|
+ return 1;
|
|
+ }
|
|
+ if ((fout = fdopen(tmpfd, WB)) == NULL) {
|
|
+ perror(tmp_name);
|
|
+ return 1;
|
|
+ }
|
|
+#else
|
|
if ((tmpn = mktemp(tmp_name)) == NULL) {
|
|
perror(tmp_name);
|
|
return 1;
|
|
}
|
|
+#endif
|
|
|
|
while (ac-- > 1) {
|
|
srcn = av[1];
|
|
@@ -267,10 +281,12 @@
|
|
perror(srcn);
|
|
goto usage;
|
|
}
|
|
+#ifndef HAVE_MKSTEMP
|
|
if ((fout = fopen(tmpn, WB)) == NULL) {
|
|
perror(tmpn);
|
|
return 1;
|
|
}
|
|
+#endif
|
|
if (*outdir) {
|
|
sprintf(out_name, "%s/%s", outdir, basename(srcn));
|
|
if (verbose)
|