pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp ChangeLog Smake src/data/ChangeLog src/dat...


From: Ben Pfaff
Subject: [Pspp-cvs] pspp ChangeLog Smake src/data/ChangeLog src/dat...
Date: Mon, 19 Feb 2007 18:57:04 +0000

CVSROOT:        /cvsroot/pspp
Module name:    pspp
Changes by:     Ben Pfaff <blp> 07/02/19 18:57:04

Modified files:
        .              : ChangeLog Smake 
        src/data       : ChangeLog file-name.c 

Log message:
        Mingw compatibility fixes for file name code.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/ChangeLog?cvsroot=pspp&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/pspp/Smake?cvsroot=pspp&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/ChangeLog?cvsroot=pspp&r1=1.107&r2=1.108
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/file-name.c?cvsroot=pspp&r1=1.11&r2=1.12

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/ChangeLog,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- ChangeLog   17 Feb 2007 17:24:23 -0000      1.70
+++ ChangeLog   19 Feb 2007 18:57:04 -0000      1.71
@@ -1,3 +1,8 @@
+Mon Feb 19 10:52:21 2007  Ben Pfaff  <address@hidden>
+
+       * Smake (GNULIB_MODULES): Add dirname module, remove canonicalize
+       module.  Corresponds to changes in src/data/file-name.c.
+
 Sat Feb 17 09:22:32 2007  Ben Pfaff  <address@hidden>
 
        * Smake (GNULIB_MODULES): Add tmpfile module, which fixes the use

Index: Smake
===================================================================
RCS file: /cvsroot/pspp/pspp/Smake,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- Smake       17 Feb 2007 17:24:23 -0000      1.47
+++ Smake       19 Feb 2007 18:57:04 -0000      1.48
@@ -9,9 +9,9 @@
        alloca-opt \
        assert \
        byteswap \
-       canonicalize \
        c-ctype \
        c-strtod \
+       dirname \
        exit \
        full-read \
        full-write \

Index: src/data/ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/ChangeLog,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -b -r1.107 -r1.108
--- src/data/ChangeLog  18 Feb 2007 21:29:20 -0000      1.107
+++ src/data/ChangeLog  19 Feb 2007 18:57:04 -0000      1.108
@@ -1,3 +1,19 @@
+Mon Feb 19 10:53:21 2007  John McCabe-Dansted <address@hidden>
+                         Ben Pfaff <address@hidden>
+
+       * file-name.c: Mingw compatibility fixes.
+       (fn_search_path): Use ISSLASH instead of comparing against '/'
+       directly.
+       (fn_dir_name): Use dir_name from gnulib.
+       (fn_is_absolute): Use IS_ABSOLUTE_FILE_NAME from gnulib.
+       (fn_get_identity): Use GetFullPathName instead of canonicalize
+       from gnulib, because the latter does not fully support
+       Windows-style path names.  Use this implementation based on the
+       detected presence of Windows instead of the absence of Unix, since
+       the new implementation is Windows-specific.
+       (fn_compare_file_identities): In Windows implementation, compare
+       names case-insensitively.
+
 Sun Feb 18 13:28:02 2007  Ben Pfaff  <address@hidden>
 
        * make-file.c: Don't include mkstemp.h, because gnulib now causes

Index: src/data/file-name.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/file-name.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- src/data/file-name.c        12 Feb 2007 02:10:55 -0000      1.11
+++ src/data/file-name.c        19 Feb 2007 18:57:04 -0000      1.12
@@ -1,5 +1,5 @@
 /* PSPP - computes sample statistics.
-   Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2006, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -18,21 +18,20 @@
 
 #include <config.h>
 
-#include "file-name.h"
+#include <data/file-name.h>
 
 #include <ctype.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "canonicalize.h"
 #include "intprops.h"
 #include "minmax.h"
-#include "settings.h"
+#include "dirname.h"
 
 #include <libpspp/alloc.h>
 #include <libpspp/message.h>
-#include <libpspp/message.h>
+#include <data/settings.h>
 #include <libpspp/str.h>
 #include <libpspp/verbose-msg.h>
 #include <libpspp/version.h>
@@ -43,6 +42,11 @@
 #include <unistd.h>
 #include <sys/stat.h>
 
+#if defined _WIN32 || defined __WIN32__
+#define WIN32_LEAN_AND_MEAN  /* avoid including junk */
+#include <windows.h>
+#endif
+
 /* Initialization. */
 
 const char *config_path;
@@ -128,7 +132,7 @@
       /* Construct file name. */
       ds_clear (&file);
       ds_put_substring (&file, dir);
-      if (!ds_is_empty (&file) && ds_last (&file) != '/')
+      if (!ds_is_empty (&file) && !ISSLASH (ds_last (&file)))
        ds_put_char (&file, '/');
       ds_put_cstr (&file, base_name);
 
@@ -153,25 +157,7 @@
 char *
 fn_dir_name (const char *file_name)
 {
-  const char *p;
-  char *s;
-  size_t len;
-
-  len = strlen (file_name);
-  if (len == 1 && file_name[0] == '/')
-    p = file_name + 1;
-  else if (len && file_name[len - 1] == '/')
-    p = buf_find_reverse (file_name, len - 1, file_name + len - 1, 1);
-  else
-    p = strrchr (file_name, '/');
-  if (p == NULL)
-    p = file_name;
-
-  s = xmalloc (p - file_name + 1);
-  memcpy (s, file_name, p - file_name);
-  s[p - file_name] = 0;
-
-  return s;
+  return dir_name (file_name);
 }
 
 /* Returns the extension part of FILE_NAME as a malloc()'d string.
@@ -192,7 +178,7 @@
 bool
 fn_is_absolute (const char *name)
 {
-  return name[0] == '/';
+  return IS_ABSOLUTE_FILE_NAME (name);
 }
 
 /* Returns true if FILE_NAME is a virtual file that doesn't
@@ -334,7 +320,7 @@
     return fclose (f);
 }
 
-#ifdef unix
+#if !(defined _WIN32 || defined __WIN32__)
 /* A file's identity. */
 struct file_identity 
 {
@@ -383,7 +369,7 @@
   else
     return a->inode < b->inode ? -1 : a->inode > b->inode;
 }
-#else /* not unix */
+#else /* Windows */
 /* A file's identity. */
 struct file_identity 
 {
@@ -400,10 +386,13 @@
 fn_get_identity (const char *file_name) 
 {
   struct file_identity *identity = xmalloc (sizeof *identity);
-  char *cname = canonicalize_filename_mode (file_name, CAN_MISSING);
-  if (cname == NULL)
-    cname = xstrdup (file_name);
-  identity->normalized_file_name = cname;
+  char cname[PATH_MAX];
+
+  if (GetFullPathName (file_name, sizeof cname, cname, NULL))
+    identity->normalized_file_name = xstrdup (cname);
+  else
+    identity->normalized_file_name = xstrdup (file_name);
+
   return identity;
 }
 
@@ -423,6 +412,6 @@
 fn_compare_file_identities (const struct file_identity *a,
                             const struct file_identity *b) 
 {
-  return strcmp (a->normalized_file_name, b->normalized_file_name);
+  return strcasecmp (a->normalized_file_name, b->normalized_file_name);
 }
-#endif /* not unix */
+#endif /* Windows */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]