1 /* This file is part of NIT ( http://www.nitlanguage.org ).
3 * Copyright 2004-2008 Jean Privat <jean@pryen.org>
4 * Copyright 2008 Floréal Morandat <morandat@lirmm.fr>
5 * Copyright 2008 Jean-Sébastien Gélinas <calestar@gmail.com>
7 * This file is free software, which comes along with NIT. This software is
8 * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
10 * PARTICULAR PURPOSE. You can modify it is you want, provided this header
11 * is kept unaltered, and a notification of the changes is added.
12 * You are allowed to redistribute it and sell it, alone or is a part of
16 #define _POSIX_C_SOURCE 1
21 #include <sys/types.h>
24 int string_NativeString_NativeString_file_exists_0(char *f
){
25 FILE *hdl
= fopen(f
,"r");
32 void *to_nit_file_stat(struct stat
* st
){
33 struct stat
* stat_element
;
34 stat_element
= malloc(sizeof(struct stat
));
35 return memcpy(stat_element
, st
, sizeof(struct stat
));
38 void *string_NativeString_NativeString_file_stat_0(char *f
){
40 if(stat(f
, &buff
) != -1)
41 return to_nit_file_stat(&buff
);
45 void *file_NativeFile_NativeFile_file_stat_0(FILE *f
){
47 if(fstat(fileno(f
), &buff
) != -1)
48 return to_nit_file_stat(&buff
);
52 extern int string_NativeString_NativeString_file_delete_0(char *f
){
53 return (remove(f
) == 0);