Fosfat
1.0.0
|
#include <inttypes.h>
Go to the source code of this file.
Data Structures | |
struct | fosfat_time_t |
struct | fosfat_att_t |
struct | fosfat_file_t |
Typedefs | |
typedef struct fosfat_s | fosfat_t |
Enumerations | |
enum | fosfat_disk_t { FOSFAT_FD , FOSFAT_HD , FOSFAT_AD , FOSFAT_ED } |
Functions | |
fosfat_t * | fosfat_open (const char *dev, fosfat_disk_t disk, unsigned int flag) |
Load a device compatible Smaky FOS. More... | |
void | fosfat_close (fosfat_t *fosfat) |
Free the memory and close the device properly. More... | |
void | fosfat_logger (int state) |
Change log level (verbosity). More... | |
char * | fosfat_diskname (fosfat_t *fosfat) |
Get the disk's name of a specific device. More... | |
fosfat_file_t * | fosfat_list_dir (fosfat_t *fosfat, const char *location) |
Get file/dir list of a directory in a linked list. More... | |
void | fosfat_free_listdir (fosfat_file_t *var) |
Free the memory for an linked list created by fosfat_list_dir(). More... | |
fosfat_disk_t | fosfat_type (fosfat_t *fosfat) |
Get the disk type. More... | |
int | fosfat_isdir (fosfat_t *fosfat, const char *location) |
Get boolean information on a specific file or folder. More... | |
int | fosfat_islink (fosfat_t *fosfat, const char *location) |
Get boolean information on a specific file or folder. More... | |
int | fosfat_isvisible (fosfat_t *fosfat, const char *location) |
Get boolean information on a specific file or folder. More... | |
int | fosfat_isencoded (fosfat_t *fosfat, const char *location) |
Get boolean information on a specific file or folder. More... | |
int | fosfat_isopenexm (fosfat_t *fosfat, const char *location) |
Get boolean information on a specific file or folder. More... | |
fosfat_file_t * | fosfat_get_stat (fosfat_t *fosfat, const char *location) |
Get some informations on a file or a directory. More... | |
char * | fosfat_symlink (fosfat_t *fosfat, const char *location) |
Get the target of a soft-link. More... | |
int | fosfat_get_file (fosfat_t *fosfat, const char *src, const char *dst, int output) |
Get a file from a location and put this on the user hard drive. More... | |
uint8_t * | fosfat_get_buffer (fosfat_t *fosfat, const char *path, int offset, int size) |
Get a buffer of a file. More... | |
libfosfat public API header.
Definition in file fosfat.h.
enum fosfat_disk_t |
void fosfat_close | ( | fosfat_t * | fosfat | ) |
Free the memory and close the device properly.
[in] | fosfat | disk handle. |
char* fosfat_diskname | ( | fosfat_t * | fosfat | ) |
Get the disk's name of a specific device.
The pointer must be freed when no longer used.
[in] | fosfat | disk handle. |
void fosfat_free_listdir | ( | fosfat_file_t * | var | ) |
Free the memory for an linked list created by fosfat_list_dir().
[in] | var | first file of the linked list. |
uint8_t* fosfat_get_buffer | ( | fosfat_t * | fosfat, |
const char * | path, | ||
int | offset, | ||
int | size | ||
) |
Get a buffer of a file.
Useful to get only a part of a file without save anything on the user hard drive. You can get all the data if you prefer. The pointer must be freed when no longer used.
[in] | fosfat | disk handle. |
[in] | path | file where get data. |
[in] | offset | from where (in bytes) in the data. |
[in] | size | how many bytes. |
int fosfat_get_file | ( | fosfat_t * | fosfat, |
const char * | src, | ||
const char * | dst, | ||
int | output | ||
) |
Get a file from a location and put this on the user hard drive.
You can't get a directory with this function, you must recursively list the directory with fosfat_list_dir() and use fosfat_get_file() with each file entry.
[in] | fosfat | disk handle. |
[in] | src | source location on the FOS disk. |
[in] | dst | destination location on the user hard drive. |
[in] | output | boolean to print copy progression in the terminal. |
fosfat_file_t* fosfat_get_stat | ( | fosfat_t * | fosfat, |
const char * | location | ||
) |
Get some informations on a file or a directory.
File size, attributes, creation date, writing date and use date. Look fosfat_file_t structure for more informations. The pointer must be freed when no longer used.
[in] | fosfat | disk handle. |
[in] | location | file or directory where get informations. |
int fosfat_isdir | ( | fosfat_t * | fosfat, |
const char * | location | ||
) |
Get boolean information on a specific file or folder.
Test if the location is a directory.
[in] | fosfat | disk handle. |
[in] | location | file or directory to test. |
int fosfat_isencoded | ( | fosfat_t * | fosfat, |
const char * | location | ||
) |
Get boolean information on a specific file or folder.
Test if the location is encoded.
[in] | fosfat | disk handle. |
[in] | location | file or directory to test. |
int fosfat_islink | ( | fosfat_t * | fosfat, |
const char * | location | ||
) |
Get boolean information on a specific file or folder.
Test if the location is a soft-link.
[in] | fosfat | disk handle. |
[in] | location | file or directory to test. |
int fosfat_isopenexm | ( | fosfat_t * | fosfat, |
const char * | location | ||
) |
Get boolean information on a specific file or folder.
Test if the location is 'open exclusif' and 'multiple'.
[in] | fosfat | disk handle. |
[in] | location | file or directory to test. |
int fosfat_isvisible | ( | fosfat_t * | fosfat, |
const char * | location | ||
) |
Get boolean information on a specific file or folder.
Test if the location is not hidden.
[in] | fosfat | disk handle. |
[in] | location | file or directory to test. |
fosfat_file_t* fosfat_list_dir | ( | fosfat_t * | fosfat, |
const char * | location | ||
) |
Get file/dir list of a directory in a linked list.
When the list is no longer used, fosfat_free_listdir() must always be called to free the memory.
[in] | fosfat | disk handle. |
[in] | location | directory to list. |
void fosfat_logger | ( | int | state | ) |
Change log level (verbosity).
By default, the internal logger is disabled. Use this function to enable or disable the verbosity. The logger is enabled or disabled for all devices loaded.
[in] | state | boolean, 0 to disable the logger. |
fosfat_t* fosfat_open | ( | const char * | dev, |
fosfat_disk_t | disk, | ||
unsigned int | flag | ||
) |
Load a device compatible Smaky FOS.
The device can be a file or a disk. But with Window$ currently only device are supported. fosfat_close() must always be called to free the memory and close the device.
Linux : specify the location on /dev/... or on a file Window$ : specify the device with 'a' for diskette, 'c' for the first hard disk, etc,...
[in] | dev | device or location. |
[in] | disk | type of disk, use FOSFAT_AD for auto-detection. |
[in] | flag | use F_UNDELETE to load deleted files or 0 for normal. |
char* fosfat_symlink | ( | fosfat_t * | fosfat, |
const char * | location | ||
) |
Get the target of a soft-link.
If the location is a soft-link, then this function will return the location of the target. The pointer must be freed when no longer used.
[in] | fosfat | disk handle. |
[in] | location | soft-link. |
fosfat_disk_t fosfat_type | ( | fosfat_t * | fosfat | ) |
Get the disk type.
FOSFAT_FD for floppy disk FOSFAT_HD for hard disk
[in] | fosfat | disk handle. |