Trust uboot's device list only if it does not look suspicious.
[AROS.git] / test / setfilesize.c
blob26f221b344ef07b54843179997becb6cd170227c
1 #include <exec/types.h>
2 #include <dos/dosextens.h>
3 #include <dos/bptr.h>
4 #include <proto/exec.h>
5 #include <proto/dos.h>
6 #include <stdio.h>
7 #include <string.h>
8 #include <stdlib.h>
10 int main(int argc, char **argv) {
11 BPTR fh;
12 LONG size;
14 if (argc != 3) {
15 printf("usage: %s filename newsize\n", argv[0]);
16 return 1;
19 fh = Open(argv[1], MODE_READWRITE);
20 if (fh == BNULL) {
21 PrintFault(IoErr(), "SetFileSize");
22 return 0;
25 size = SetFileSize(fh, atol(argv[2]), OFFSET_BEGINNING);
26 if (size < 0) {
27 PrintFault(IoErr(), "SetFileSize");
28 Close(fh);
29 return 0;
32 Printf("New size is %ld bytes\n", size);
34 Close(fh);
36 return 0;