This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: New rename(2) function
On Aug 10 11:56, Corinna Vinschen wrote:
> Here's an example using a FAT filesystem under Linux:
>
> $ uname -a
> Linux vmrhel4.vinschen.de 2.6.9-55.0.2.EL #1 Tue Jun 12 17:47:10 EDT 2007 i686 athlon i386 GNU/Linux
> $ mount -t vfat /dev/sdb1 /mnt
> $ cd /mnt
> $ touch q
> $ stat q
> File: `q'
> Size: 0 Blocks: 0 IO Block: 8192 regular empty file
> Device: 811h/2065d Inode: 114 Links: 1
> Access: (0755/-rwxr-xr-x) Uid: ( 500/ corinna) Gid: ( 100/ users)
> Access: 2007-08-10 11:33:47.282195512 +0200
> Modify: 2007-08-10 11:33:47.282195512 +0200
> Change: 2007-08-10 11:33:47.282195512 +0200
> $ stat Q
> File: `Q'
> Size: 0 Blocks: 0 IO Block: 8192 regular empty file
> Device: 811h/2065d Inode: 114 Links: 1
> Access: (0755/-rwxr-xr-x) Uid: ( 500/ corinna) Gid: ( 100/ users)
> Access: 2007-08-10 11:33:47.282195512 +0200
> Modify: 2007-08-10 11:33:47.282195512 +0200
> Change: 2007-08-10 11:33:47.282195512 +0200
> $ mv q Q
> mv: `q' and `Q' are the same file
Heh, funny enough, the OS has the same problem:
$ cat > rename.c <<EOF
#include <stdio.h>
#include <string.h>
#include <errno.h>
int main(int argc, char **argv)
{
if (rename (argv[1], argv[2]))
{
fprintf (stderr, "rename: errno %d <%s>\n", errno, strerror (errno));
return 2;
}
return 0;
}
EOF
$ gcc -o rename rename.c
$ ./rename q Q
$ ls -l
total 16
-rwxr-xr-x 1 corinna users 0 Aug 10 12:04 q
-rwxr-xr-x 1 corinna users 5189 Aug 10 12:04 rename
-rwxr-xr-x 1 corinna users 245 Aug 10 12:04 rename.c
Looks like Cygwin is smarter than Linux ;)
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat