Newsgroups: comp.sys.apple2.gno Path: blue.weeg.uiowa.edu!news.uiowa.edu!hobbes.physics.uiowa.edu!math.ohio-state.edu!howland.reston.ans.net!gatech!newsxfer.itd.umich.edu!nntp.cs.ubc.ca!unixg.ubc.ca!quartz.ucs.ualberta.ca!kakwa.ucs.ualberta.ca!myrias!gdr From: gdr@myrias.ab.ca (Devin Reade) Subject: Init/Next WildcardGS bug Message-ID: <785575691.22933@myrias.ab.ca> Organization: Myrias Computer Technologies Inc. Date: Wed, 23 Nov 94 07:28:09 GMT Lines: 74 I'm mailing this to Jawaid, but others may have interest as well: It seems that under Gno/gsh, subdirectories are not expanded when using the InitWildcardGS/NextWildcardGS calls, even though the appropriate flag is set to 0x2000 | 0x1000. The following test program illustrates this. It _should_ list all files in all subdirectories in and below the directory from which it is called. Under Gno it only lists files in the current directory. BTW, behavior is as expected normal under the Orca shell. /* * This file demonstrates a bug with Gno's InitWildcardGS/NextWildcardGS * shell calls: Directories are not expanded. */ #include #include #include #include #include #include #include #include #include #define TESTSTR "=" Next_WildcardGSPB NextWild; /* for handling ORCA/Shell style wildcards */ Init_WildcardGSPB InitWild; int main(int argc,char *argv[]) { static GSString255 gsp; static ResultBuf255 rsp; char *currentfile; NextWild.pCount = 1; InitWild.pCount = 2; rsp.bufSize = 259; NextWild.pathName = &rsp; InitWild.wFile = &gsp; InitWild.flags = 0x8000 | 0x2000 | 0x1000; strncpy(gsp.text,TESTSTR,strlen(TESTSTR)); gsp.length = strlen(TESTSTR); InitWildcardGS (&InitWild); for (;;) { NextWildcardGS (&NextWild); if (toolerror()) { fprintf(stderr,"toolerr on NextWildcardGS()\n"); exit(1); } /* No further files found by NextWildcardGS */ if(!rsp.bufString.length) break; if((currentfile = calloc(1,rsp.bufString.length + 1)) == NULL) { perror("calloc failed"); exit (1); } strncpy(currentfile, rsp.bufString.text,rsp.bufString.length); currentfile[rsp.bufString.length] = '\0'; printf("%s\n",currentfile); free(currentfile); } return 0; } -- Devin Reade gdr@myrias.ab.ca