Add basic lock/unlock support.
[eco.git] / file.h
blob7444d0cb5e2343e992719942729dd8412cedb270
1 /*
2 * Copyright (C) 2008 Diego Hernan Borghetti.
3 * Eco
4 */
6 #ifndef _ECO_FILE_H
7 #define _ECO_FILE_H
9 typedef struct E_File_Path {
10 /* absolute path to the directory. */
11 char *path;
13 /* absolute path to the file. */
14 char *file;
16 /* lock file. */
17 char *lock_file;
19 /* true if we lock the file. */
20 int locked;
21 } E_File_Path;
23 /* Get the absolute path to a file. */
24 E_File_Path *e_file_get_paths(char *file);
26 /* Check if the file is locked, return 1 if it's locked or zero. */
27 int e_file_is_lock(E_File_Path *paths);
29 /* Lock/Unlock the file. */
30 void e_file_lock(E_File_Path *paths);
31 void e_file_lock_rem(E_File_Path *paths);
33 E_Buffer *e_file_read(char *file, int *status);
34 void e_file_write(E_Eco *ec, E_Buffer *bf);
36 #endif /* _ECO_FILE_H */