4 !!LICENCE!! Public Domain
5 !!AUTHOR!! Groepaz/Hitmen
9 this test reproduces a bug that prevented the testsuites directory
10 reading stuff for the c64 from working before. the bug appears to
11 only occur when optimizations are enabled. it also disappears if
12 the buffers inside the readdir function are declared static or
16 /*#define STANDALONE*/
21 #define OPENTEST() outfile=stdout;
37 char d_name[XNAME_MAX+1];
39 unsigned short d_reclen;
41 unsigned char d_namlen;
48 char name[XNAME_MAX+1];
52 unsigned char b2[0x10]={" \"test\" "};
54 struct Xdirent *Xreaddir(XDIR *dir)
56 unsigned char buffer[0x40];
60 static struct Xdirent entry;
62 static unsigned char ch;
66 /* basic line-link / file-length */
70 entry.d_reclen=254*(buffer[2]+(buffer[3]<<8));
73 memcpy(buffer,b2,0x10);
77 printf("Xreaddir: '%s'\n",buffer);
79 /* skip until either quote (file) or b (blocks free => end) */
84 /* something went wrong...this shouldnt happen! */
87 else if(temp=='\"') i++;
93 printf("Xreaddir: '%s'\n",buffer);
95 /* process file entry */
97 i=0; temp=buffer[ii];ii++;
101 temp=buffer[ii];ii++;
113 char mydirname[XNAME_MAX+1]=".";
115 struct Xdirent *mydirent;
119 if((mydirent=Xreaddir(&mydir))==NULL)
125 printf("=%s\n",mydirent->d_name);