comparison patches/guile-1.9.14-gnulib-mingw.patch @ 6469:f0ee9df1e3f2

mingw::guile: update for gnulib:canonicalize-lgpl patch.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Tue, 01 Feb 2011 15:24:46 +0100
parents d0006ae646bd
children
comparison
equal deleted inserted replaced
6468:0ea4f16c7d7a 6469:f0ee9df1e3f2
1 --- guile-1.9.14/lib/canonicalize-lgpl.c~ 2011-01-30 15:05:32.398689016 +0100 1 From e8f8f8dc840bfd2c960f86a5e6799420ec755e8c Mon Sep 17 00:00:00 2001
2 +++ guile-1.9.14/lib/canonicalize-lgpl.c 2011-01-30 15:06:45.112470403 +0100 2 From: Jan Nieuwenhuizen <janneke@gnu.org>
3 @@ -76,6 +76,9 @@ 3 Date: Tue, 1 Feb 2011 14:47:50 +0100
4 Subject: [PATCH 6/6] canonicalize-lgpl: Add an implementation for canonicalize_file_name.
5
6 2011-02-01 Jan Nieuwenhuizen <janneke@gnu.org>
7
8 * lib/canonicalize-lgpl.c (__realpath)[__MINGW32__]: Add an
9 implementation for canonicalize_file_name. This marked the first
10 running of guile.exe (1.9) in wine.
11
12 * tests/test-canonicalize-lgpl.c (main)[__MINGW32__]: Do not abort
13 on `nonexistent/..'; in Windows that works fine.
14 ---
15 ChangeLog | 9 ++++
16 lib/canonicalize-lgpl.c | 87 ++++++++++++++++++++++++++++++++++++++++
17 tests/test-canonicalize-lgpl.c | 8 ++++
18 3 files changed, 104 insertions(+), 0 deletions(-)
19
20 diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
21 index 9bfb44f..3c22195 100644
22 --- a/lib/canonicalize-lgpl.c
23 +++ b/lib/canonicalize-lgpl.c
24 @@ -84,6 +84,9 @@
4 #endif 25 #endif
5 26
6 #if !FUNC_REALPATH_WORKS || defined _LIBC 27 #if !FUNC_REALPATH_WORKS || defined _LIBC
7 + 28 +
8 +#ifndef __MINGW32__ 29 +#ifndef __MINGW32__
9 + 30 +
10 /* Return the canonical absolute name of file NAME. A canonical name 31 /* Return the canonical absolute name of file NAME. A canonical name
11 does not contain any `.', `..' components nor any repeated path 32 does not contain any `.', `..' components nor any repeated path
12 separators ('/') or symlinks. All path components must exist. If 33 separators ('/') or symlinks. All path components must exist. If
13 @@ -334,6 +337,81 @@ error: 34 @@ -342,6 +345,90 @@ error:
14 } 35 }
15 return NULL; 36 return NULL;
16 } 37 }
17 + 38 +
18 +#else /* __MINGW32__ */ 39 +#else /* __MINGW32__ */
40 +#include <ctype.h>
19 +#include <direct.h> 41 +#include <direct.h>
20 +#include <windows.h> 42 +#include <windows.h>
21 + 43 +
22 +static char const* 44 +static char const *
23 +slashify (char const *str) 45 +slashify (char const *str)
24 +{ 46 +{
25 + char *p = (char*)str; 47 + char *p = (char*)str;
26 + 48 +
27 + while (*p) 49 + while (*p)
28 + { 50 + {
29 + if (*p == '\\') 51 + if (*p == '\\')
30 + *p = '/'; 52 + *p = '/';
53 + p++;
54 + }
55 + return str;
56 +}
57 +
58 +static char *
59 +strlower (char *str)
60 +{
61 + char *p = str;
62 + while (*p)
63 + {
64 + *p = (char)tolower (*p);
31 + p++; 65 + p++;
32 + } 66 + }
33 + return str; 67 + return str;
34 +} 68 +}
35 + 69 +
68 + } 102 + }
69 + } 103 + }
70 + else 104 + else
71 + rpath = resolved; 105 + rpath = resolved;
72 + 106 +
73 + strncpy (rpath, name, PATH_MAX); 107 + GetFullPathName (name, PATH_MAX, rpath, NULL);
74 + size_t len = strlen (name);
75 + if (len > PATH_MAX)
76 + len = PATH_MAX;
77 + rpath[len] = '\0';
78 +
79 + slashify (rpath); 108 + slashify (rpath);
109 + strlower (rpath);
80 + struct stat st; 110 + struct stat st;
81 + if (lstat (rpath, &st) < 0) 111 + if (lstat (rpath, &st) < 0)
82 + { 112 + {
83 + if (resolved == NULL) 113 + if (resolved == NULL)
84 + free (rpath); 114 + free (rpath);