changeset 2141:c6d0d31840f6

Fixes for Windows, ported from 1.X branch
author bert <bert>
date Thu, 19 May 2005 20:57:20 +0000
parents 1f26f7801840
children 4cbc9285235e
files conversion/Acr_nema/file_io.c
diffstat 1 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/conversion/Acr_nema/file_io.c
+++ b/conversion/Acr_nema/file_io.c
@@ -6,7 +6,16 @@
 @CREATED    : November 9, 1993 (Peter Neelin)
 @MODIFIED   : 
  * $Log: file_io.c,v $
- * Revision 6.7  2005-03-04 00:09:00  bert
+ * Revision 6.8  2005-05-19 20:57:20  bert
+ * Fixes for Windows, ported from 1.X branch
+ *
+ * Revision 6.7.2.2  2005/05/16 22:39:30  bert
+ * Insert conditionals to get it building under Windows
+ *
+ * Revision 6.7.2.1  2005/05/12 21:15:30  bert
+ * Initial checkin
+ *
+ * Revision 6.7  2005/03/04 00:09:00  bert
  * Lose private and public
  *
  * Revision 6.6  2005/02/16 19:22:32  bert
@@ -97,7 +106,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
-#include <unistd.h>
 #include <errno.h>
 #include <limits.h>
 #include <acr_nema/file_io.h>
@@ -444,8 +452,14 @@
    /* Do tracing */
    if (afp->do_trace) {
       if (afp->tracefp == NULL) {
-         (void) strcpy(trace_file, Input_trace_file);
+#if HAVE_MKSTEMP
+         (void) strcpy(trace_file, Input_trace_file);          
          afp->tracefp = fdopen(mkstemp(trace_file), "w");
+#endif
+#if HAVE_TMPNAM
+         tmpnam(trace_file);
+         afp->tracefp = fopen(trace_file, "w");
+#endif
          if (afp->tracefp != NULL) {
             (void) fprintf(stderr, "Opened input trace file %s.\n", 
                            trace_file);
@@ -558,8 +572,14 @@
       /* Do trace, if needed */
       if (afp->do_trace) {
          if (afp->tracefp == NULL) {
+#if HAVE_MKSTEMP
             (void) strcpy(trace_file, Output_trace_file);
             afp->tracefp = fdopen(mkstemp(trace_file), "w");
+#endif
+#if HAVE_TMPNAM
+            tmpnam(trace_file);
+            afp->tracefp = fopen(trace_file, "w");
+#endif
             if (afp->tracefp != NULL) {
                (void) fprintf(stderr, "Opened output trace file %s.\n", 
                               trace_file);
@@ -866,6 +886,7 @@
 ---------------------------------------------------------------------------- */
 int acr_stdio_ismore(void *io_data)
 {
+#ifdef O_NONBLOCK
    FILE *fp;
    int val;
    int old_flags, new_flags;
@@ -898,6 +919,7 @@
    else if (ferror(fp) && (errno != EAGAIN)) {
       return -1;
    }
+#endif /* O_NONBLOCK defined */
    return 0;
 
 }