Re: dseek()?

From: Adam Bozanich (abozan01_at_ccsf.edu)
Date: 05/29/03


Date: Thu, 29 May 2003 14:28:10 -0700


On Wed, 28 May 2003, Marc Rochkind wrote:

>
> "Adam Bozanich" <abozan01@ccsf.edu> wrote in message
> news:Pine.HPX.4.44.0305281753210.9018-100000@hills.ccsf.cc.ca.us...
> > int
> > myOpendir(DIR *dp,char *path)
> > {
> >
>
> In your dseek function, dirp is called by value, and then the arg (i.e.,
> local variable) is assigned a new value inside the function. Upon return,
> dirp does NOT point to the dirent. It has the same value it had before the
> call.
>
> Either return the pointer so it can be assigned, or pass in a pointer to a
> pointer (i.e., &dirp).
>
> --Marc

Thank you...

struct dirent *dseek(int offset)
{
        struct dirent *dirp;
        ...
        return (dirp);
}
...
...
        while((dirp = dseek(count++))!=NULL)
...

Although it looks like I could still work on my implementation ;)

% cat chdir_output

regular files = 141965, 70.53 %
directories = 57778, 28.70 %
symbolic links = 1467, 0.73 %
char special = 76, 0.04 %
block special = 0, 0.00 %
FIFOs = 0, 0.00 %
sockets = 2, 0.00 %

TOTAL TIME: 27.398438

% cat ftw4_output
regular files = 141964, 87.21 %
directories = 19269, 11.84 %
block special = 0, 0.00 %
char special = 76, 0.05 %
FIFOs = 0, 0.00 %
symbolic links = 1467, 0.90 %
sockets = 2, 0.00 %

TOTAL TIME: 16.921875

Thanks for your help.