home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / unixlib / !UnixLib / test / c / fstattest < prev    next >
Encoding:
Text File  |  1994-03-08  |  967 b   |  32 lines

  1. /* fstattest.c (c) Copyright 1990 H.Rogers */
  2.  
  3. /* This program tests the fstat() system call. */
  4. /* For full information on fstat(), read the appropriate entry
  5.  * in section 2 of the UNIX Programmer's Manual. */
  6.  
  7. #include <stdio.h>        /* standard I/O and UNIX */
  8. #include <time.h>        /* time functions */
  9.  
  10. #include "sys/stat.h"        /* file status */
  11. #include "unistd.h"        /* UNIX system calls */
  12.  
  13. int
  14. main ()
  15. {
  16.   struct stat buf[1];        /* file status structure */
  17.  
  18.   fstat (1, buf);        /* get status of terminal */
  19.   printf ("dev: %d\n", buf->st_dev);
  20.   printf ("ino: %x\n", buf->st_ino);
  21.   printf ("mode: %o\n", buf->st_mode);
  22.   printf ("nlink: %d\n", buf->st_nlink);
  23.   printf ("uid: %d\n", buf->st_uid);
  24.   printf ("gid: %d\n", buf->st_gid);
  25.   printf ("rdev: %d\n", buf->st_rdev);
  26.   printf ("size: %x\n", buf->st_size);
  27.   printf ("atime: %s", ctime (&buf->st_atime));
  28.   printf ("mtime: %s", ctime (&buf->st_mtime));
  29.   printf ("ctime: %s", ctime (&buf->st_ctime));
  30.   return 0;
  31. }
  32.