[pass] [PATCH] Add find/search command

Brian Mattern rephorm at rephorm.com
Thu Apr 4 18:34:17 CEST 2013


Alexis,

I actually almost sent a nearly identical patch as you did (although,
you probably want !(pattern && patmatch(...) == 1). (patmatch passes the
pattern on to strchr, which requires a nul terminated string as the
first parameter, so will likely segfault if given a NULL pointer.)

Anyway, see the more complete patch I sent to the list.

Brian

On Thu, 04 Apr 2013, Alexis wrote:

> Hi Jason,
> I'm happy to hear that the feature will land and I like your
> improvements to the wording in the help and man page.
> 
> I somewhat dislike the extra echo, that prints the search terms,
> since these are still visible as the commandline arguments.
> Or is this only for debugging purposes at the moment?
> 
> I do agree, that not matching directory names is a shortcoming.
> A quick look at the tree.c reveals that the following
> simple patch allows tree to also list directories that match the
> given pattern and prune the ones that don't.
> 
> When a directory matches the given pattern should only the directory
> or even all of it's files shown by tree?
> 
> diff --git a/tree.c b/tree.c
> index 19cf368..5eea9a5 100644
> --- a/tree.c
> +++ b/tree.c
> @@ -745,7 +745,7 @@ struct _info **getfulltree(char *d, u_long lev,
> dev_t dev, off_t *size, char **e
>   saveino((*dir)->inode, (*dir)->dev);
>   (*dir)->child =
> getfulltree(path,lev+1,dev,&((*dir)->size),&((*dir)->err));
>        }
> -      if (pruneflag && (*dir)->child == NULL) {
> +      if (pruneflag && (*dir)->child == NULL && patmatch((*dir)->name,pattern) == 0) {
>   sp = *dir;
>   for(p=dir;*p;p++) *p = *(p+1);
>   n--;
> 
> This patch is obviously far from finished, and yet it shows
> that commandline options to include directory names when
> matching with -P or -I are feasible.
> I'll dig a little deeper...
> 
> 
> Alexis
> _______________________________________________
> Password-Store mailing list
> Password-Store at lists.zx2c4.com
> http://lists.zx2c4.com/listinfo.cgi/password-store-zx2c4.com



More information about the Password-Store mailing list