/* 2002-05-16 Anders Brander <anders@brander.dk> */

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

int main(int argc, char **argv)
{
	struct stat st;

	if (argc < 2)
	{
		printf("Usage: %s <file>\n", argv[0]);
		return -1;
	}

	if (stat(argv[1], &st) < 0)
	{
		perror("stat");
		return -2;
	}

	printf("st_dev = %d\n", st.st_dev);
	printf("st_ino = %d\n", st.st_ino);
	printf("st_mode = %d\n", st.st_mode);
	printf("st_size = %d\n", st.st_size);
	printf("st_blksize = %d\n", st.st_blksize);
	printf("st_blocks = %d\n", st.st_blocks);
        
	printf("S_ISREG = %s\n", S_ISREG(st.st_mode) ? "yes" : "no");
	printf("S_ISDIR = %s\n", S_ISDIR(st.st_mode) ? "yes" : "no");
	printf("S_ISLNK = %s\n", S_ISLNK(st.st_mode) ? "yes" : "no");
	printf("S_ISCHR = %s\n", S_ISCHR(st.st_mode) ? "yes" : "no");
	printf("S_ISBLK = %s\n", S_ISBLK(st.st_mode) ? "yes" : "no");
	printf("S_ISSOCK = %s\n", S_ISSOCK(st.st_mode) ? "yes" : "no");
	printf("S_ISFIFO = %s\n", S_ISFIFO(st.st_mode) ? "yes" : "no");

	return 0;
}

