fts: introduce FTS_VERBATIM
[gnulib.git] / lib / fts.c
index 36f7e0d..9c38c4f 100644 (file)
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -488,12 +488,15 @@ fts_open (char * const *argv,
                 /* *Do* allow zero-length file names. */
                 size_t len = strlen(*argv);
 
-                /* If there are two or more trailing slashes, trim all but one,
-                   but don't change "//" to "/", and do map "///" to "/".  */
-                char const *v = *argv;
-                if (2 < len && v[len - 1] == '/')
-                  while (1 < len && v[len - 2] == '/')
-                    --len;
+                if ( ! (options & FTS_VERBATIM))
+                  {
+                    /* If there are two or more trailing slashes, trim all but one,
+                       but don't change "//" to "/", and do map "///" to "/".  */
+                    char const *v = *argv;
+                    if (2 < len && v[len - 1] == '/')
+                      while (1 < len && v[len - 2] == '/')
+                        --len;
+                  }
 
                 if ((p = fts_alloc(sp, *argv, len)) == NULL)
                         goto mem3;