| 1 |
/* Glue functions for the minIni library, based on the "FAT Filing System" |
| 2 |
* library by embedded-code.com, now IBEX UK. |
| 3 |
* https://github.com/ibexuk/C_Memory_SD_Card_FAT_Driver |
| 4 |
* |
| 5 |
* By CompuPhase, 2008-2012 |
| 6 |
* This "glue file" is in the public domain. It is distributed without |
| 7 |
* warranties or conditions of any kind, either express or implied. |
| 8 |
* |
| 9 |
* (The "FAT Filing System" library itself is copyright IBEX UK, and licensed |
| 10 |
* at its own terms.) |
| 11 |
*/ |
| 12 |
|
| 13 |
#define INI_BUFFERSIZE 256 /* maximum line length, maximum path length */ |
| 14 |
#include <mem-ffs.h> |
| 15 |
|
| 16 |
#define INI_FILETYPE FFS_FILE* |
| 17 |
#define ini_openread(filename,file) ((*(file) = ffs_fopen((filename),"r")) != NULL) |
| 18 |
#define ini_openwrite(filename,file) ((*(file) = ffs_fopen((filename),"w")) != NULL) |
| 19 |
#define ini_close(file) (ffs_fclose(*(file)) == 0) |
| 20 |
#define ini_read(buffer,size,file) (ffs_fgets((buffer),(size),*(file)) != NULL) |
| 21 |
#define ini_write(buffer,file) (ffs_fputs((buffer),*(file)) >= 0) |
| 22 |
#define ini_rename(source,dest) (ffs_rename((source), (dest)) == 0) |
| 23 |
#define ini_remove(filename) (ffs_remove(filename) == 0) |
| 24 |
|
| 25 |
#define INI_FILEPOS long |
| 26 |
#define ini_tell(file,pos) (ffs_fgetpos(*(file), (pos)) == 0) |
| 27 |
#define ini_seek(file,pos) (ffs_fsetpos(*(file), (pos)) == 0) |