Details
COLE_MAJOR_VERSION
#define COLE_MAJOR_VERSION 2 |
COLE_MINOR_VERSION
#define COLE_MINOR_VERSION 0 |
COLE_MICRO_VERSION
#define COLE_MICRO_VERSION 1 |
cole_major_version
extern int cole_major_version; |
cole_minor_version
extern int cole_minor_version; |
cole_micro_version
extern int cole_micro_version; |
cole_version
extern char *cole_version; |
cole_host_info
extern char *cole_host_info; |
enum COLERRNO
enum COLERRNO {
/* & = means that you can use perror(3) call to print an error message */
/* you can always use cole_perror to print an error message */
COLE_EFIRST, /* Leave this at first place */
/*&*/ COLE_EMEMORY, /* Failed malloc(3) or realloc(3) */
/*&*/ COLE_EOPENFILE, /* Failed fopen(3) */
/*&*/ COLE_ECLOSEFILE, /* Failed fclose(3) */
/*&*/ COLE_EREAD, /* Failed fread(3) */
/*&*/ COLE_EWRITE, /* Failed fwrite(3) */
/*&*/ COLE_EREMOVE, /* Failed remove(3) */
/*&*/ COLE_ETMPNAM, /* Failed tmpnam(3) */
/*&*/ COLE_ESEEK, /* Failed fseek(3) */
/*&*/ COLE_EERRNO, /* Some system call failed */
COLE_ENOFILESYSTEM, /* File is not a filesystem */
COLE_EINVALIDFILESYSTEM,/* Filesystem is broken, it's invalid */
COLE_EISNOTDIR, /* Directory entry is not a directory */
COLE_EISNOTFILE, /* Directory entry is not a file */
COLE_EFILENOTFOUND, /* Doesn't exist a file with the given name */
COLE_EOF, /* End of file has been reached */
COLE_EMEMBERISNOTDIR, /* A member of the filename is not
a directory */
COLE_EBROKENFILENAME, /* The filename is not right written */
COLE_EFILENAMEISNOTFILE,/* Filename is not a file */
COLE_EFSEEKDELTA, /* Delta argument is not valid */
COLE_EFSEEKFLAG, /* Flag argument is not valid */
COLE_EUNKNOWN, /* An unknown error ocurred, can be a bug */
COLE_ELAST /* Leave this at last place */
}; |
cole_perror ()
void cole_perror (const char *s,
COLERRNO colerrno); |
Prints a message on the standard error output, describing the error
colerrno, preceding it with the string s, a semicolon and a space.
It handles COLE_EERRNO value too, calling perror(3).
struct COLEFS
struct COLEFS {
/* This structure is for internal use only, not for the public API */
pps_entry *tree;
U32 root; /* entry root, root pps_entry */
U8 *BDepot;
U8 *SDepot;
FILE *sbfile;
char *sbfilename;
FILE *file; /* actual file (the filesystem) */
}; |
struct COLEDIR
struct COLEDIR {
/* This structure is for internal use only, not for the public API */
U32 entry;
struct _COLEDIRENT visited_entry;
struct _COLEFS *fs; /* father */
}; |
struct COLEDIRENT
struct COLEDIRENT {
/* This structure is for internal use only, not for the public API */
U32 entry;
struct _COLEDIR *dir; /* father */
}; |
struct COLEFILE
struct COLEFILE {
/* This structure is for internal use only, not for the public API */
U32 entry;
FILE *file; /* actual extracted file */
char *filename; /* actual extracted file's name */
U32 filesize; /* actual extracted file size */
struct _COLEFS *fs; /* father */
U32 pos; /* file pointer position */
}; |
cole_mount ()
Mounts the filesystem which is in filename.
cole_umount ()
Umounts the filesystem colefilesystem.
cole_print_tree ()
Prints on the standard output the tree of files and directories contained
in colefilesystem.
Currently this call always success.
cole_locate_filename ()
int cole_locate_filename (COLEFS *colefilesystem,
char *filename,
void *info,
COLE_LOCATE_ACTION_FUNC *action,
COLERRNO *colerrno); |
Locate the filename in the filesystem colefilesystem, calling action when
it's found. info is arbitrary pointer passed to action.
Currently, filename must begin with a '/' character, it means filename is
the absolute filename.
cole_recurse_tree ()
int cole_recurse_tree (COLEFS *colefilesystem,
void *info,
COLE_RECURSE_DIR_FUNC *inroot,
COLE_RECURSE_DIRENT_FUNC *indirentry,
COLE_RECURSE_DIR_FUNC *indir,
COLE_RECURSE_DIR_FUNC *outdir,
COLE_RECURSE_VISIT_DIR_FUNC *visitdir,
COLERRNO *colerrno); |
Recurse the filesystem colefilesystem, calling the functions pointed by
inroot, indirentry, indir and outdirectory when start visiting
root directory, start visiting any directory entry (file or directory),
start visiting a directory or end visiting a directory, respectively.
If visitdir returns no zero or it's NULL, the directory is visited,
otherwise is not visited.
info is a arbitrary pointer which is passed to the functions pointed by
inroot, indirentry, indir and outdirectory: it may be used to share
arbitrary information between them.
cole_fopen ()
Opens the file with the name filename in the filesystem colefilesystem.
Currently, filename must begin with a '/' character, it means filename is
the absolute filename.
cole_fopen_direntry ()
Opens a directory entry as file.
cole_fclose ()
Closes the file colefile.
cole_fread ()
size_t cole_fread (COLEFILE *colefile,
void *ptr,
size_t size,
COLERRNO *colerrno); |
Reads size bytes from colefile and store them in the location given
by ptr. If not success, the file position indicator is not changed.
cole_feof ()
Tests if the end of file has been reached in colefile.
cole_ftell ()
Get the current value of the file position indicator for the file
colefile.
cole_fseek ()
int cole_fseek (COLEFILE *colefile,
size_t delta,
COLE_SEEK_FLAG direction,
COLERRNO *colerrno); |
Sets the value of the file position indicator for the file colefile
delta bytes from the beginning of the file, forward from the current
position, backward from the current position, or from the end of the
file, if direction is COLE_SEEK_SET, COLE_SEEK_BACKWARD,
COLE_SEEK_FORWARD or COLE_SEEK_END, respectively.
The file position indicator will always be <= colefile->filesize.
If you delta is such that the previous line would not true, cole_fseek
fails.
cole_frewind ()
Sets the value of the file position indicator for the file colefile
in the beginning of the file.
cole_opendir_rootdir ()
Opens the root directory of the filesystem colefilesystem as directory.
cole_opendir_direntry ()
Opens a directory entry as directory.
cole_closedir ()
Closes the directory coledir.
Currently this call always success.
cole_direntry_isdir ()
int cole_direntry_isdir (COLEDIRENT *coledirentry); |
Tests if the directory entry coledirentry is a directory.
cole_direntry_isfile ()
int cole_direntry_isfile (COLEDIRENT *coledirentry); |
Tests if the directory entry coledirentry is a file.
cole_dir_getname ()
char* cole_dir_getname (COLEDIR *coledir); |
cole_dir_getsize ()
size_t cole_dir_getsize (COLEDIR *coledir); |
cole_dir_getsec1 ()
long cole_dir_getsec1 (COLEDIR *coledir); |
cole_dir_getsec2 ()
long cole_dir_getsec2 (COLEDIR *coledir); |
cole_dir_getdays1 ()
long cole_dir_getdays1 (COLEDIR *coledir); |
cole_dir_getdays2 ()
long cole_dir_getdays2 (COLEDIR *coledir); |
cole_direntry_getname ()
char* cole_direntry_getname (COLEDIRENT *coledirentry); |
cole_direntry_getsize ()
size_t cole_direntry_getsize (COLEDIRENT *coledirentry); |
cole_direntry_getdays1 ()
long cole_direntry_getdays1 (COLEDIRENT *coledirentry); |
cole_direntry_getsec1 ()
long cole_direntry_getsec1 (COLEDIRENT *coledirentry); |
cole_direntry_getdays2 ()
long cole_direntry_getdays2 (COLEDIRENT *coledirentry); |
cole_direntry_getsec2 ()
long cole_direntry_getsec2 (COLEDIRENT *coledirentry); |