Turkish Q Standard PC105 Keymap
[AROS.git] / test / scantest.c
blobd26ec38784f4751c4948fcc951db341fd27fcfa7
1 #include <dos/dosasl.h>
2 #include <dos/dos.h>
3 #include <proto/dos.h>
4 #include <exec/types.h>
5 #include <exec/memory.h>
6 #include <proto/exec.h>
8 #include <stdio.h>
9 #include <string.h>
11 void ReadAll(BPTR lock)
13 struct FileInfoBlock * FIB = AllocVec(sizeof(struct FileInfoBlock), MEMF_CLEAR);
14 BOOL success;
15 int count = 1;
17 success = Examine(lock, FIB);
18 success = ExNext(lock,FIB);
19 while (success)
21 printf("%s",FIB->fib_FileName);
22 if (FIB->fib_DirEntryType > 0)
24 printf(" (Dir)\n");
25 count++;
26 if (count > 1)
28 char * name = AllocVec(1024,0);
29 BPTR tmplock;
30 NameFromLock(lock,name,1024);
31 AddPart(name,FIB->fib_FileName,1024);
32 printf("Entering %s\n",name);
33 tmplock = Lock(name , ACCESS_READ);
34 ReadAll(tmplock);
35 NameFromLock(lock,name,1024);
36 printf("Returning to %s\n",name);
37 UnLock(tmplock);
38 FreeVec(name);
41 else
43 printf("\n");
45 success = ExNext(lock,FIB);
47 FreeVec(FIB);
50 int main(int argc, char *argv[])
52 BPTR lock;
54 printf("Trying to scan %s \n",argv[1]);
55 lock = Lock(argv[1],ACCESS_READ);
56 if (lock)
58 ReadAll(lock);
59 UnLock(lock);
61 else
62 printf("no such directory/assign!\n");
64 return 0;