jayacotton / find

A find command for cp/m written in C
9 stars 1 forks source link

User Area Enhancement Request #8

Closed wwarthen closed 3 years ago

wwarthen commented 3 years ago

Can FIND be enhanced to find files in all user areas?

-Wayne

jayacotton commented 3 years ago

Don't see why not. User area is a byte in the FCB, so the real problem is how to set up the API. -U ? This would find all files on all drives that are in User Area N .... But only in that user area.....

jayacotton commented 3 years ago

Need to rewrite the front end of find, to incorporate the getopt function. The if then else tree is just about outahand.

jayacotton commented 3 years ago

I have rewritten the command processing section of find to allow for use of a getopt alike parser. This will allow for easy expansion in the future.

The side effects are, commands can be in any order, and they can be short handed.

find -name .c -drive c -user 3, can be shorthanded to find -n .c -d c -u 3 and find -u3 -n *.c -d c will produce the same results.

jayacotton commented 3 years ago

code pushed.

wwarthen commented 3 years ago

The new new -user parameter is working as advertised.

However, I wasn't totally clear in my original request. I was hoping for a way to search across all user areas for a given file or wildcard spec. I wonder if you could allow "-user *".

I know... I'm never satisfied. Sorry.

-Wayne

jayacotton commented 3 years ago

Well, that would be interesting to try. Recursive search maybe.

On Wed, May 5, 2021 at 6:25 PM Wayne Warthen @.***> wrote:

The new new -user parameter is working as advertised.

However, I wasn't totally clear in my original request. I was hoping for a way to search across all user areas for a given file or wildcard spec. I wonder if you could allow "-user *".

I know... I'm never satisfied. Sorry.

-Wayne

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/jayacotton/find/issues/8#issuecomment-833157624, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIC7NQQOJUKFZG34W272DYLTMHVXTANCNFSM44DYRLFQ .

wwarthen commented 3 years ago

You can use a '?' in the dr field of the FCB to search for files in any user area. Here is an excerpt from the CP/M 22. manual for function 17:

An ASCII question mark (63 decimal, 3F hexadecimal) in any position from f1 through ex matches the corresponding field of any directory entry on the default or auto-selected disk drive. If the dr field contains an ASCII question mark, the auto disk select function is disabled and the default disk is searched, with the search function returning any matched entry, allocated or free, belonging to any user number. This latter function is not normally used by application programs, but it allows complete flexibility to scan all current directory values. If the dr field is not a question mark, the s2 byte is automatically zeroed.

You would need to use function 14 to establish the disk you are currently searching. You would also need to check each entry returned to see if you got a true allocated entry. Not sure if it would return multiple extents for a given file, so you may also need to check that.

jayacotton commented 3 years ago

New code pushed. Should now handle all user spaces on all drives. This could generate quite a list of file names. With all network drives loaded up.

In the case where you want to collect all the names of the entire file system, you may want to enable terminal logging to a file on your host machine. I have been hitting the memory full message a lot..... On my machine a find . -output log.log is going to run out of ram well before it runs out of files. Then with a terminal log running, you can have any size filesystem list you want. Going to try that now.

wwarthen commented 3 years ago

Thanks Jay! The "-alluser" option seems to work fine. I find this very useful because I frequently use user areas to organize my files.

-Wayne