#!/usr/local/bin/rune -x # limport "sys"; import "stdio"; int main(int ac, char **av) { FStat st; Fs fs; char buf[Fs.PATH_MAX]; fs.unlink("test.x1"); fs.unlink("test.x2"); fs.unlink("test.x3"); Fs.umask(0077); if (fs.open("test.x1", O_RDWR|O_CREAT|O_TRUNC, 0666) < 0) { stdio.stderr->show("failed to create test.x1 ", fs.error); return 1; } if (fs.symlink("test.x1", "test.x2") < 0) { stdio.stderr->show("failed to symlink test.x2 ", fs.error); return 1; } if (fs.readlink("test.x2", buf) < 0) { stdio.stderr->show("failed to readlink test.x2 ", fs.error); return 1; } stdio.stderr->format("readlink test.x2: %s\n", &buf[0]); if (fs.link("test.x1", "test.x3") < 0) { stdio.stderr->show("failed to link test.x3 ", fs.error); return 1; } if (fs.unlink("test.x1") < 0) { stdio.stderr->show("failed to unlink test.x1 ", fs.error); return 1; } #fs.unlink("test.x2"); #fs.unlink("test.x3"); stdio.stderr->show("all tests succeeded"); }