Open dirkpetersen opened 2 months ago
The fundamental change that I wanted to make to pwalk was to have conditional compiles that would allow me to create many different flavors of the program. The tree walking is done in a single function, fileDir
. When fileProcess
which points to the function printStat
. Line 346 of pwalk.c should look like this:
#ifdef PWALK
fileProcess = &printStat;
#endif
#ifdef REPAIRSHR
fileProcess = &REPARSHR
#endif
Makefile would look something like the following. The core walk feature of pwalk would stay the same, but the function pointer will change.
pwalk: pwalk.c exclude.c fileProcess.c
$(CC) $(CFLAGS) -DPWALK -o pwalk exclude.c fileProcess.c pwalk.c $(LDFLAGS)
repair-shared: pwalk.c exclude.c repairshr.c repexcl.c
$(CC) $(CFLAGS) -DREPAIRSHR -o repair-shared pwalk exclude repairshr.c repexcl.c $(LDFLAGS)
And add a second function pointer to complement fileProcess
; dirProcess. To implement your request to only output directory data, the file_action could be a null pointer, and dir_action would output directory info.
Yes, that would be nice and remove a lot of redundancy ..... Claude starts to become cumbersome if a single code file is longer than 400 lines and ChatGPT prefers < 100 lines
Also on new infrastructure this has incredible performance
As it turns out, Claude actually 'forgot' to take the multi-threading logic from pwalk, ah well, now fixed and added
chmod -R g+rw