bug-bison
[Top][All Lists]
Advanced

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

Building and testing Bison 3.0.2 with MinGW [2/5]


From: Eli Zaretskii
Subject: Building and testing Bison 3.0.2 with MinGW [2/5]
Date: Tue, 07 Oct 2014 21:11:29 +0300

Another issue is the use of a literal '/' in functions that take apart
file names.  On Windows, we need to support the backslashes as well.
Here's the patch (it needs a part of the change to system.h I sent in
the previous mail):

--- src/parse-gram.y~0  2013-08-02 18:35:13 +0300
+++ src/parse-gram.y    2014-10-06 14:18:31 +0300
@@ -36,6 +36,7 @@
   #include "c-ctype.h"
   #include "complain.h"
   #include "conflicts.h"
+  #include "dirname.h"
   #include "files.h"
   #include "getargs.h"
   #include "gram.h"
@@ -326,13 +327,14 @@ prologue_declaration:
 | "%skeleton" STRING
     {
       char const *skeleton_user = $2;
-      if (strchr (skeleton_user, '/'))
+      if (strchr (skeleton_user, '/')
+         || (ISSLASH ('\\') && _mbschr (skeleton_user, '\\')))
         {
           size_t dir_length = strlen (current_file);
           char *skeleton_build;
-          while (dir_length && current_file[dir_length - 1] != '/')
+          while (dir_length && !ISSLASH (current_file[dir_length - 1]))
             --dir_length;
-          while (dir_length && current_file[dir_length - 1] == '/')
+          while (dir_length && ISSLASH (current_file[dir_length - 1]))
             --dir_length;
           skeleton_build =
             xmalloc (dir_length + 1 + strlen (skeleton_user) + 1);





reply via email to

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