home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 9
/
FreshFishVol9-CD2.bin
/
bbs
/
disk
/
mkisofs-1.00.7.lha
/
mkisofs
/
unix
/
teststat.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-29
|
702b
|
34 lines
#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);
}