- while ((cnt = read(dirf, (char *) dirbuf, sizeof dirbuf)) >= sizeof dirbuf[0]) {
- register struct direct *ep = dirbuf;
-
- for (cnt /= sizeof (struct direct); cnt > 0; cnt--, ep++) {
- if (ep->d_ino == 0)
- continue;
- copdent(d_name, ep->d_name);
- if (match(d_name, pattern)) {
- Gcat(gpath, d_name);
- globcnt++;
- }
+ while ((dp = readdir(dirp)) != NULL) {
+ if (dp->d_ino == 0)
+ continue;
+ if (match(dp->d_name, pattern)) {
+ Gcat(gpath, dp->d_name);
+ globcnt++;