libmobi
C library for handling MOBI format ebook documents
Macros | Functions | Variables
common.h File Reference
#include <stdio.h>
#include <sys/stat.h>

Go to the source code of this file.

Macros

#define ERROR   1
 
#define SUCCESS   0
 
#define STR_HELPER(x)   #x
 
#define STR(x)   STR_HELPER(x)
 
#define ARRAYSIZE(arr)   (sizeof(arr) / sizeof(arr[0]))
 
#define COMPILER   "unknown"
 
#define FULLNAME_MAX   1024
 

Functions

const char * libmobi_msg (const MOBI_RET ret)
 Return message for given libmobi return code. More...
 
int mt_mkdir (const char *filename)
 Portable mkdir. More...
 
void split_fullpath (const char *fullpath, char *dirname, char *basename)
 Parse file name into file path and base name. More...
 
bool dir_exists (const char *path)
 Check whether given path exists and is a directory. 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...
 

Variables

const char separator
 

Detailed Description

Copyright (c) 2016 Bartek Fabiszewski http://www.fabiszewski.net

Licensed under LGPL, either version 3, or any later. See http://www.gnu.org/licenses/

Function Documentation

◆ dir_exists()

bool dir_exists ( const char *  path)

Check whether given path exists and is a directory.

Parameters
[in]pathPath to be tested

◆ libmobi_msg()

const char* libmobi_msg ( const MOBI_RET  ret)

Return message for given libmobi return code.

Parameters
[in]retLibmobi return code

◆ mt_mkdir()

int mt_mkdir ( const char *  filename)

Portable mkdir.

Parameters
[in]filenameFile name

◆ print_exth()

void print_exth ( const MOBIData m)

Print all loaded EXTH record tags.

Parameters
[in]mMOBIData structure

◆ print_summary()

void print_summary ( const MOBIData m)

Print summary meta information.

Parameters
[in]mMOBIData structure

◆ set_decryption_key()

int set_decryption_key ( MOBIData m,
const char *  serial,
const char *  pid 
)

Set key for decryption. Use user supplied pid or device serial number.

Parameters
[in,out]mMOBIData structure
[in]serialSerial number
[in]pidPid

◆ split_fullpath()

void split_fullpath ( const char *  fullpath,
char *  dirname,
char *  basename 
)

Parse file name into file path and base name.

Parameters
[in]fullpathFull file path
[in,out]dirnameWill be set to full dirname
[in,out]basenameWill be set to file basename