Diff
Not logged in

Differences From:

File src/file.c part of check-in [9236f0c086] - Get cloning working for local files without the use of network I/O. Ticket b3482d580e. by drh on 2008-10-05 12:34:14. [view]

To:

File src/file.c part of check-in [e146d800ac] - Add the "mv" and "rename" commands (aliases for the same thing). by drh on 2008-11-09 19:22:06. [view]

@@ -51,8 +51,21 @@
   if( stat(zFilename, &buf)!=0 ){
     return -1;
   }
   return buf.st_mtime;
+}
+
+/*
+** Return the tail of a file pathname.  The tail is the last component
+** of the path.  For example, the tail of "/a/b/c.d" is "c.d".
+*/
+const char *file_tail(const char *z){
+  const char *zTail = z;
+  while( z[0] ){
+    if( z[0]=='/' ) zTail = &z[1];
+    z++;
+  }
+  return zTail;
 }
 
 /*
 ** Copy the content of a file from one place to another.