1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00
Files
amiga-clib2/test_programs/fstat_test.c
Olaf Barthel 36c33073a5 - Added the fstat() test program.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15137 87f5fb63-7c3d-0410-a384-fd976d0f7a62
2006-09-20 19:46:37 +00:00

40 lines
540 B
C

/*
* $Id: fstat_test.c,v 1.1 2006-09-20 19:46:37 obarthel Exp $
*
* :ts=4
*/
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
/****************************************************************************/
int
main(int argc,char ** argv)
{
struct stat st;
int fd;
if(argc <= 1)
return(EXIT_FAILURE);
fd = open(argv[1],O_RDONLY);
if(fd == -1)
{
perror("open");
return(EXIT_FAILURE);
}
if(fstat(fd,&st) == -1)
{
perror("fstat");
return(EXIT_FAILURE);
}
return(EXIT_SUCCESS);
}