]> Dogcows Code - chaz/tar/commitdiff
(cut_path_elements): New functon.
authorSergey Poznyakoff <gray@gnu.org.ua>
Thu, 4 Sep 2003 15:47:26 +0000 (15:47 +0000)
committerSergey Poznyakoff <gray@gnu.org.ua>
Thu, 4 Sep 2003 15:47:26 +0000 (15:47 +0000)
src/names.c

index 8301a3e2b48e6209ab4545caf408354c820eb969..ee68749bb921be22ce3b13bcfeb3a4e8be8be205 100644 (file)
@@ -1043,6 +1043,23 @@ safer_name_suffix (char const *file_name, bool link_target)
   return (char *) p;
 }
 \f
+char const *
+cut_path_elements (char const *file_name, size_t num)
+{
+  char const *p = file_name;
+  if (ISSLASH (*p))
+    p++;
+  for (; *p; p++)
+    {
+      if (ISSLASH (*p))
+       {
+         if (--num == 0)
+           return p + 1;
+       }
+    }
+  return NULL;
+}
+\f
 /* Return nonzero if NAME contains ".." as a path name component.  */
 bool
 contains_dot_dot (char const *name)
This page took 0.034216 seconds and 4 git commands to generate.