Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1655 | giacomo | 1 | /* |
2 | * |
||
3 | * |
||
4 | * |
||
5 | */ |
||
6 | |||
7 | #include <ll/i386/cons.h> |
||
8 | #include <kernel/func.h> |
||
9 | |||
10 | #include <fs/bdevinit.h> |
||
11 | #include <fs/fsinit.h> |
||
12 | #include <fs/bdev.h> |
||
13 | |||
14 | #include <drivers/keyb.h> |
||
15 | |||
16 | #include <sys/mount.h> |
||
17 | #include <sys/types.h> |
||
18 | #include <fcntl.h> |
||
19 | #include <unistd.h> |
||
20 | #include <errno.h> |
||
21 | #include <string.h> |
||
22 | |||
23 | #include "common.h" |
||
24 | |||
25 | #define FILENAME "/TEMP/TESTW0.TXT" |
||
26 | |||
27 | extern dev_t temp_device; |
||
28 | |||
29 | int main(int argc,char *argv[]) |
||
30 | { |
||
31 | int res; |
||
32 | // int c; |
||
33 | int h; |
||
34 | |||
35 | showmessage("Try to create and truncate a file.\n"); |
||
36 | |||
37 | cprintf("OPENING %s\n",FILENAME); |
||
38 | h=open(FILENAME,O_CREAT|O_WRONLY|O_TRUNC); |
||
39 | if (h!=-1) { |
||
40 | cprintf("CLOSING %s\n",FILENAME); |
||
41 | res=close(h); |
||
42 | if (res!=0) { |
||
43 | cprintf("CLOSE FAILED!\n"); |
||
44 | cprintf("errno: %i '%s'\n",errno,strerror(errno)); |
||
45 | } |
||
46 | } else { |
||
47 | cprintf("FAILED!\n"); |
||
48 | cprintf("errno: %i '%s'\n",errno,strerror(errno)); |
||
49 | } |
||
50 | |||
51 | waitend(); |
||
52 | |||
53 | return 0; |
||
54 | } |