[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.1

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 <stdio.h>
        !            14: #include <sys/types.h>
        !            15: #include <unistd.h>
        !            16: #include <sys/param.h>
        !            17: #include <sys/mount.h>
        !            18: #include <sys/wait.h>
        !            19: #include <des.h>
        !            20:
        !            21: #include <miscfs/tcfs/tcfs.h>
        !            22:
        !            23: char *stat_usage= "usage: tcfstat [-p mount-point | fs-label]";
        !            24:
        !            25: int
        !            26: stat_main(int argc, char *argv[], char *envp[])
        !            27: {
        !            28:        struct tcfs_status st;
        !            29:        int e,es,ok=0;
        !            30:        char filesystem[MAXPATHLEN];
        !            31:
        !            32:        if (argc==3 && !strcmp("-p",argv[1])) {
        !            33:                strlcpy(filesystem, argv[2], sizeof(filesystem));
        !            34:                ok=1;
        !            35:        }
        !            36:
        !            37:        if (argc == 2) {
        !            38:                if (!(es = tcfs_getfspath(argv[1],filesystem))) {
        !            39:                        fprintf(stderr,"filesystem label not found!\n");
        !            40:                        exit(1);
        !            41:                }
        !            42:                ok = 1;
        !            43:        }
        !            44:
        !            45:        if (ok == 0 || argc < 2 || argc > 3) {
        !            46:                 fprintf(stderr, "%s\n", stat_usage);
        !            47:                 exit(1);
        !            48:         }
        !            49:
        !            50:
        !            51:        e = tcfs_getstatus(filesystem, &st);
        !            52:        if (e == -1) {
        !            53:                fprintf(stderr,"filesystem %s not mounted\n",filesystem);
        !            54:                exit(1);
        !            55:        }
        !            56:
        !            57:        printf("Status: %d; user keys: %d, group keys: %d\n",st.status, st.n_ukey, st.n_gkey);
        !            58:        printf("TCFS version: %d, Cipher: %s, keysize: %d, cipher version: %d\n",st.tcfs_version, st.cipher_desc, st.cipher_keysize, st.cipher_version);
        !            59:
        !            60:        exit(0);
        !            61: }
        !            62: