unix/ustat                                              unix/ustat

    NAME
        ustat - get file system statistics

    SYNOPSIS
        #include <ustat.h>

        int error = ustat(device, &ustat_buf);
        long device;
        struct ustat ustat_buf;

    FUNCTION
        ustat() is a unix compatible call that returns information
        about a mounted file system.

        If 0 is returned, the call succeeded and the fields will be
        filled in as follows:

            f_tfree         total free size, in Kbytes

            f_tinode        number of free blocks

            f_fname         volume name

            f_fpack         unused, always an empty string

    EXAMPLE
        #include <sys/stat.h>
        #include <ustat.h>
        #include <stdio.h>

        main(argc, argv)
            int argc;
            char *argv[];
        {
            struct stat stat_buf;
            struct ustat ustat_buf;
            int r;

            if( argc != 2 )
                exit(1);

            if( stat(argv[1], &stat_buf) == 0 ) {
                if( ustat(stat_buf.st_dev, &ustat_buf) == 0 )
                    printf("File/directory %s is on volume %s with %ld KB free\n",
                            argv[1], ustat_buf.f_fname, ustat_buf.f_tfree);
                else
                    printf("Can\'t ustat device at %08x\n", stat_buf.st_dev);
            }
            else
                printf("Can\'t stat %s\n", argv[1]);
            exit(0);
        }

    INPUTS
        long device;            device ID (pointer to message port of DOS handler)

        struct ustat *ubuf;     address of ustat structure that will be filled in

    RESULTS
        int error;              0 on success, < 0 on error

    SEE ALSO
        stat, fstat

