Build fix.
[AROS.git] / test / clib / lseek.c
blobeeb14d0d0ed81788df2e7df9da05237e183f2bbe
1 #include <unistd.h>
2 #include <sys/stat.h>
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include "test.h"
7 int fd;
9 int main()
11 struct stat buf;
12 int size = 12345;
13 fd = mkstemp("T:lseekXXXXXX");
15 TEST((lseek(fd, size, SEEK_SET) == size));
16 TEST((fstat(fd, &buf) != -1));
17 TEST((buf.st_size == size));
19 TEST((lseek(fd, 0, SEEK_SET) == 0));
20 TEST((lseek(fd, 100, SEEK_CUR) == 100));
21 TEST((lseek(fd, -100, SEEK_CUR) == 0));
23 TEST((lseek(fd, 0, SEEK_END) == size));
24 TEST((lseek(fd, -size, SEEK_END) == 0));
26 close(fd);
27 return OK;
30 void cleanup()
32 close(fd);