home *** CD-ROM | disk | FTP | other *** search
- #include <stdlib.h>
- #include <stdio.h>
- #include "unixlib.h"
-
- void main (int argc, char *argv[])
- {
- struct stat s;
-
- if (argc <= 1)
- exit (0);
-
- remove_dot_files (argv[1]);
-
- if (stat (argv[1], &s) == -1) {
- fprintf (stderr, "cannot stat '%s'\n", argv[1]);
- exit (1);
- }
-
- printf ("stat:\n");
- printf (" size = %d bytes\n", s.st_size);
- printf (" time = %s\n", asctime (gmtime (&s.st_atime)));
- printf (" is a %s\n", S_ISDIR(s.st_mode) ? "directory" : "file");
- printf (" permissions: ");
- if (s.st_mode & S_IRUSR)
- printf ("read ");
- if (s.st_mode & S_IWUSR)
- printf ("write ");
- if (s.st_mode & S_IXUSR)
- printf ("execute ");
- putchar ('\n');
-
- exit (0);
- }
-