Annotation of 43BSDReno/sys/nfs/TEST/unix-tests/special/fstat.c, revision 1.1.1.1

1.1       root        1: /*     @(#)fstat.c     1.2 90/01/03 NFS Rev 2 Testsuite
                      2:  *     1.3 Lachman ONC Test Suite source
                      3:  *
                      4:  * test statfs for file count
                      5:  */
                      6: #include <sys/param.h>
                      7: #ifdef SVR3
                      8: #include <sys/statfs.h>
                      9: #else
                     10: #include <sys/vfs.h>
                     11: #endif
                     12: #include <stdio.h>
                     13: 
                     14: main(argc, argv)
                     15:        int argc;
                     16:        char *argv[];
                     17: {
                     18:        struct statfs fs;
                     19:        char *name = ".";
                     20: 
                     21:        if (argc > 2) {
                     22:                fprintf(stderr, "usage: %s [path]\n", argv[0]);
                     23:                exit(1);
                     24:        }
                     25:        if (argc == 2) {
                     26:                name = argv[1];
                     27:        }
                     28:        fs.f_files = 0;
                     29:        fs.f_ffree = 0;
                     30: #ifdef SVR3
                     31:        if (statfs(name, &fs, sizeof(fs), 0) < 0) {
                     32: #else
                     33:        if (statfs(name, &fs) < 0) {
                     34: #endif
                     35:                perror(argv[1]);
                     36:                exit(1);
                     37:        }
                     38:        printf("inodes %d free %d\n", fs.f_files, fs.f_ffree);
                     39:        exit(0);
                     40: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.