libmobi
C library for handling MOBI format ebook documents
|
Go to the source code of this file.
Functions | |
const char * | libmobi_msg (const MOBI_RET ret) |
Return message for given libmobi return code. More... | |
void | split_fullpath (const char *fullpath, char *dirname, char *basename, const size_t buf_len) |
Parse file name into file path and base name. Dirname or basename can be skipped by setting to null. More... | |
int | make_directory (const char *path) |
Make directory. More... | |
int | create_subdir (char *newdir, const size_t buf_len, const char *parent_dir, const char *subdir_name) |
Create subfolder in directory. More... | |
int | write_file (const unsigned char *buffer, const size_t len, const char *path) |
Open file descriptor and write buffer to it. More... | |
int | write_to_dir (const char *dir, const char *name, const unsigned char *buffer, const size_t len) |
Write content to file in directory. More... | |
bool | dir_exists (const char *path) |
Check whether given path exists and is a directory. More... | |
void | normalize_path (char *path) |
Make sure we use consistent separators on Windows builds. More... | |
void | print_summary (const MOBIData *m) |
Print summary meta information. More... | |
void | print_exth (const MOBIData *m) |
Print all loaded EXTH record tags. More... | |
int | set_decryption_key (MOBIData *m, const char *serial, const char *pid) |
Set key for decryption. Use user supplied pid or device serial number. More... | |
int | set_decryption_pid (MOBIData *m, const char *pid) |
Set PID for decryption. More... | |
int | set_decryption_serial (MOBIData *m, const char *serial) |
Set device serial number for decryption. More... | |
int | save_mobi (MOBIData *m, const char *fullpath, const char *suffix) |
Save mobi file. More... | |
Variables | |
const char | separator |
bool | outdir_opt |
char | outdir [FILENAME_MAX] |
Copyright (c) 2020 Bartek Fabiszewski http://www.fabiszewski.net
Licensed under LGPL, either version 3, or any later. See http://www.gnu.org/licenses/
int create_subdir | ( | char * | newdir, |
const size_t | buf_len, | ||
const char * | parent_dir, | ||
const char * | subdir_name | ||
) |
Create subfolder in directory.
[in,out] | newdir | Path to created subfolder |
[in] | buf_len | Buffer size fo created subfolder |
[in] | parent_dir | Directory path |
[in] | subdir_name | Subfolder name |
bool dir_exists | ( | const char * | path | ) |
Check whether given path exists and is a directory.
[in] | path | Path to be tested |
const char* libmobi_msg | ( | const MOBI_RET | ret | ) |
Return message for given libmobi return code.
[in] | ret | Libmobi return code |
int make_directory | ( | const char * | path | ) |
Make directory.
[in] | path | Path |
void normalize_path | ( | char * | path | ) |
Make sure we use consistent separators on Windows builds.
[in,out] | path | Path to be fixed |
void print_exth | ( | const MOBIData * | m | ) |
Print all loaded EXTH record tags.
[in] | m | MOBIData structure |
void print_summary | ( | const MOBIData * | m | ) |
Print summary meta information.
[in] | m | MOBIData structure |
int save_mobi | ( | MOBIData * | m, |
const char * | fullpath, | ||
const char * | suffix | ||
) |
Save mobi file.
[in,out] | m | MOBIData struicture |
[in] | fullpath | Full file path |
[in] | suffix | Suffix appended to file name |
int set_decryption_key | ( | MOBIData * | m, |
const char * | serial, | ||
const char * | pid | ||
) |
Set key for decryption. Use user supplied pid or device serial number.
[in,out] | m | MOBIData structure |
[in] | serial | Serial number |
[in] | pid | Pid |
int set_decryption_pid | ( | MOBIData * | m, |
const char * | pid | ||
) |
Set PID for decryption.
[in,out] | m | MOBIData structure |
[in] | pid | Serial number |
int set_decryption_serial | ( | MOBIData * | m, |
const char * | serial | ||
) |
Set device serial number for decryption.
[in,out] | m | MOBIData structure |
[in] | serial | Serial number |
void split_fullpath | ( | const char * | fullpath, |
char * | dirname, | ||
char * | basename, | ||
const size_t | buf_len | ||
) |
Parse file name into file path and base name. Dirname or basename can be skipped by setting to null.
[in] | fullpath | Full file path |
[in,out] | dirname | Will be set to full dirname |
[in,out] | basename | Will be set to file basename |
[in] | buf_len | Size of each ouput buffer: dirname and basename |
int write_file | ( | const unsigned char * | buffer, |
const size_t | len, | ||
const char * | path | ||
) |
Open file descriptor and write buffer to it.
[in] | buffer | Buffer |
[in] | len | Buffer length |
[in] | path | File path |
int write_to_dir | ( | const char * | dir, |
const char * | name, | ||
const unsigned char * | buffer, | ||
const size_t | len | ||
) |
Write content to file in directory.
[in] | dir | Directory path |
[in] | name | File name |
[in] | buffer | Buffer |
[in] | len | Buffer length |