#include #include #include #include #include #include int main(int argc, char** argv) { int ret1, ret2; char dir[200] = "test"; char file1[200]; char file2[200]; char file3[200]; if (argc > 1) strcpy(dir, argv[1]); sprintf(file1, "%s/test1", dir); /* e.g test/test1 */ sprintf(file2, "%s/test2", dir); /* e.g test/test2 */ sprintf(file3, "%s/test3", dir); /* e.g test/test3 */ mkdir(dir, 0777); ret1 = symlink(file1, file2); if (ret1 == -1) perror("symlink() failed: "); ret2 = rename(file2, file3); if (ret2 == -1) perror("rename() failed: "); printf("Returns %d,%d\n",ret1,ret2); return 0; } /* rename("plc_vpn/.svn/tmp/prop-base/plc_static.key.svn-base", "plc_vpn/.svn/prop-base/plc_static.key.svn-base") = 0 lstat("plc_vpn/.svn/prop-base/plc_static.key.svn-base", {st_mode=S_IFREG|0644, st_size=27, ...}) = 0 chmod("plc_vpn/.svn/prop-base/plc_static.key.svn-base", 0444) = 0 open("plc_vpn/.svn/prop-base/plc_static.key.svn-base", O_RDONLY) = 6 read(6, "K 11\nsvn:special\nV 1\n*\nEND\n", 4096) = 27 close(6) = 0 open("plc_vpn/.svn/prop-base/plc_static.key.svn-base", O_RDONLY) = 6 read(6, "K 11\nsvn:special\nV 1\n*\nEND\n", 4096) = 27 close(6) = 0 lstat("plc_vpn/.svn/tmp/text-base/plc_static.key.svn-base", {st_mode=S_IFREG|0644, st_size=20, ...}) = 0 lstat("plc_vpn/.svn/tmp/text-base/plc_static.key.svn-base", {st_mode=S_IFREG|0644, st_size=20, ...}) = 0 open("plc_vpn/.svn/tmp/text-base/plc_static.key.svn-base", O_RDONLY) = 6 read(6, "link plc_static2.key", 16384) = 20 read(6, "", 16384) = 0 close(6) = 0 symlink("plc_static2.key", "plc_vpn/plc_static.key.tmp") = 0 rename("plc_vpn/plc_static.key.tmp", "plc_vpn/plc_static.key") = -1 ENOENT (No such file or directory) write(3, "\25\3\1\0 \377w\355\20\306Ry?PCEt9\202\255\376\17\353"..., 37) = 37 close(3) = 0 close(4) = 0 */