Rune - Fix array passing, optimize constant array indices
[rune.git] / tests / dup.d
1 #!/usr/local/bin/rune -x
2 #
3
4 import "sys";
5 import <stdio>;
6
7 int
8 main(int ac, char **av)
9 {
10         Fs fs;
11
12         if (fs.dup(1) < 0)
13                 stdio.stdout->format("Failed to dup fd 1\n");
14         else
15                 stdio.stdout->format("Succssfully dupped fd 1 to %d\n", fs.fd);
16         fs.close();
17
18         if (fs.dup2(1, 55) < 0)
19                 stdio.stdout->format("Failed to dup2 fd 1\n");
20         else
21                 stdio.stdout->format("Succssfully dupped fd 1 to %d (55)\n",
22                                      fs.fd);
23
24         fs.close();
25
26 }