URI:
       tAdd function to list secrets - safe - password protected secret keeper
  HTML git clone git://git.z3bra.org/safe.git
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit c78fe1cc1ee4a1684eb98c85334011aad6d7b59b
   DIR parent c985b9ecaa5571f5e89066de0fc6a386a3a7e556
  HTML Author: z3bra <contactatz3bradotorg>
       Date:   Wed, 22 May 2019 09:43:27 +0200
       
       Add function to list secrets
       
       Diffstat:
         M safe.c                              |      20 +++++++++++++++++---
       
       1 file changed, 17 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/safe.c b/safe.c
       t@@ -140,6 +140,14 @@ deriv(char *pw, struct safe *s)
                        err(1, "crypto_pwhash");
        }
        
       +void
       +list_secrets(struct safe *s)
       +{
       +        struct secret *tmp;
       +        SLIST_FOREACH(tmp, &s->secrets, entry)
       +                printf("%s\t%s\n", tmp->hex, tmp->name);
       +}
       +
        int
        store_secret(struct safe *s, int fd, char *name)
        {
       t@@ -248,7 +256,7 @@ deinit(struct safe *s)
        int
        main(int argc, char *argv[])
        {
       -        int aflag = 0;
       +        int aflag = 0, lflag = 0;
                char *secret = NULL, *safe = SAFE;
                struct safe s;
        
       t@@ -256,6 +264,9 @@ main(int argc, char *argv[])
                case 'a':
                        aflag = 1;
                        break;
       +        case 'l':
       +                lflag = 1;
       +                break;
                case 's':
                        safe = EARGF(usage());
                        break;
       t@@ -263,7 +274,7 @@ main(int argc, char *argv[])
                        usage();
                } ARGEND
        
       -        if (argc != 1)
       +        if (argc != 1 && !lflag)
                        usage();
        
                if (safe) {
       t@@ -279,7 +290,10 @@ main(int argc, char *argv[])
        
                secret = argv[0];
        
       -        if (aflag) {
       +        if (lflag) {
       +                list_secrets(&s);
       +                return 0;
       +        } else if (aflag) {
                        store_secret(&s, STDIN_FILENO, secret);
                        deinit(&s);
                } else {