[BACK]Return to tcfstat.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tcfs

Annotation of src/usr.bin/tcfs/tcfstat.c, Revision 1.2

1.1       provos      1: /*
                      2:  *     Transparent Cryptographic File System (TCFS) for NetBSD
                      3:  *     Author and mantainer:   Luigi Catuogno [luicat@tcfs.unisa.it]
                      4:  *
                      5:  *     references:             http://tcfs.dia.unisa.it
                      6:  *                             tcfs-bsd@tcfs.unisa.it
                      7:  */
                      8:
                      9: /*
                     10:  *     Base utility set v0.1
                     11:  */
                     12:
                     13: #include <sys/types.h>
                     14: #include <sys/param.h>
                     15: #include <sys/mount.h>
                     16: #include <sys/wait.h>
                     17: #include <des.h>
1.2     ! fgsch      18: #include <stdio.h>
        !            19: #include <string.h>
        !            20: #include <unistd.h>
1.1       provos     21:
                     22: #include <miscfs/tcfs/tcfs.h>
1.2     ! fgsch      23: #include "tcfslib.h"
1.1       provos     24:
                     25: char *stat_usage= "usage: tcfstat [-p mount-point | fs-label]";
                     26:
                     27: int
                     28: stat_main(int argc, char *argv[], char *envp[])
                     29: {
                     30:        struct tcfs_status st;
                     31:        int e,es,ok=0;
                     32:        char filesystem[MAXPATHLEN];
                     33:
                     34:        if (argc==3 && !strcmp("-p",argv[1])) {
                     35:                strlcpy(filesystem, argv[2], sizeof(filesystem));
                     36:                ok=1;
                     37:        }
                     38:
                     39:        if (argc == 2) {
                     40:                if (!(es = tcfs_getfspath(argv[1],filesystem))) {
                     41:                        fprintf(stderr,"filesystem label not found!\n");
                     42:                        exit(1);
                     43:                }
                     44:                ok = 1;
                     45:        }
                     46:
                     47:        if (ok == 0 || argc < 2 || argc > 3) {
                     48:                 fprintf(stderr, "%s\n", stat_usage);
                     49:                 exit(1);
                     50:         }
                     51:
                     52:
                     53:        e = tcfs_getstatus(filesystem, &st);
                     54:        if (e == -1) {
                     55:                fprintf(stderr,"filesystem %s not mounted\n",filesystem);
                     56:                exit(1);
                     57:        }
                     58:
                     59:        printf("Status: %d; user keys: %d, group keys: %d\n",st.status, st.n_ukey, st.n_gkey);
                     60:        printf("TCFS version: %d, Cipher: %s, keysize: %d, cipher version: %d\n",st.tcfs_version, st.cipher_desc, st.cipher_keysize, st.cipher_version);
                     61:
                     62:        exit(0);
                     63: }
                     64: