createrepo_c library
C library for metadata manipulation
 Vše Třídy Funkce Proměnné Definice typů Výčty Hodnoty výčtu Skupiny Stránky
Miscellaneous useful functions and macros.

Datové struktry

struct  cr_EVR
struct  cr_Version
struct  cr_HeaderRangeStruct

Definice maker

#define CR_UNUSED(x)   (void)(x)

Funkce

const char * cr_flag_to_str (gint64 flags)
struct cr_EVR cr_str_to_evr (const char *string, GStringChunk *chunk)
char * cr_compute_file_checksum (const char *filename, cr_ChecksumType type)
struct cr_HeaderRangeStruct cr_get_header_byte_range (const char *filename)
const char * cr_checksum_name_str (cr_ChecksumType type)
char * cr_get_filename (const char *filepath)
void cr_download (CURL *handle, const char *url, const char *destination, char **error)
int cr_copy_file (const char *src, const char *dst)
int cr_compress_file (const char *src, const char *dst, cr_CompressionType compression)
int cr_better_copy_file (const char *src, const char *dst)
int cr_remove_dir (const char *path)
char * cr_normalize_dir_path (const char *path)
struct cr_Version cr_str_to_version (const char *str)
int cr_cmp_version_str (const char *str1, const char *str2)
void cr_null_log_fn (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
void cr_log_fn (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)

Detailní popis


Dokumentace k definicím maker

#define CR_UNUSED (   x)    (void)(x)

Macro for supress compiler warning about unused param.

Definice je uvedena na řádku 39 v souboru misc.h.


Dokumentace funkcí

int cr_better_copy_file ( const char *  src,
const char *  dst 
)

Better copy file. Source (src) could be remote address (http:// or ftp://).

Parametry:
srcsource filename
dstdestination (if dst is dir, filename of src is used)
Návratová hodnota:
CR_COPY_OK or CR_COPY_ERR on error
const char* cr_checksum_name_str ( cr_ChecksumType  type)

Return checksum name.

Parametry:
typechecksum type
Návratová hodnota:
constant null terminated string with checksum name or NULL on error
int cr_cmp_version_str ( const char *  str1,
const char *  str2 
)

Compare two version string.

Parametry:
str1first version string
str2second version string
Návratová hodnota:
0 - versions are same, 1 - first string is bigger version, 2 - second string is bigger version
int cr_compress_file ( const char *  src,
const char *  dst,
cr_CompressionType  compression 
)

Compress file.

Parametry:
srcsource filename
dstdestination (If dst is dir, filename of src + compression suffix is used. If dst is NULL, src + compression suffix is used)
compressiontype of compression
Návratová hodnota:
CR_COPY_OK or CR_COPY_ERR on error
char* cr_compute_file_checksum ( const char *  filename,
cr_ChecksumType  type 
)

Compute file checksum.

Parametry:
filenamefilename
typetype of checksum
Návratová hodnota:
malloced null terminated string with checksum or NULL on error
int cr_copy_file ( const char *  src,
const char *  dst 
)

Copy file.

Parametry:
srcsource filename
dstdestination (if dst is dir, filename of src is used)
Návratová hodnota:
CR_COPY_OK or CR_COPY_ERR on error
void cr_download ( CURL *  handle,
const char *  url,
const char *  destination,
char **  error 
)

Download a file from the URL into the in_dst via curl handle. If *error == NULL then download was successfull.

Parametry:
handleCURL handle
urlsource url
destinationdestination (if destination is dir, filename from the url is used)
errorpointer to string pointer for error message (mandatory argument!)
const char* cr_flag_to_str ( gint64  flags)

Convert flags from RPM header to a string representation.

Parametry:
flagsflags
Návratová hodnota:
flags as constant string
char* cr_get_filename ( const char *  filepath)

Return pointer to the rest of string after last '/'. (e.g. for "/foo/bar" returns "bar")

Parametry:
filepathpath
Návratová hodnota:
pointer into the path
struct cr_HeaderRangeStruct cr_get_header_byte_range ( const char *  filename)
read

Return header byte range.

Parametry:
filenamefilename
Návratová hodnota:
header range (start = end = 0 on error)
void cr_log_fn ( const gchar *  log_domain,
GLogLevelFlags  log_level,
const gchar *  message,
gpointer  user_data 
)

Createrepo_c library standard logging function.

Parametry:
log_domainlogging domain
log_levellogging level
messagemessage
user_datauser data
char* cr_normalize_dir_path ( const char *  path)

Normalize path (Path with exactly one trailing '/').

Parametry:
pathpath
Návratová hodnota:
mallocated string with normalized path or NULL
void cr_null_log_fn ( const gchar *  log_domain,
GLogLevelFlags  log_level,
const gchar *  message,
gpointer  user_data 
)

Logging function with no output.

Parametry:
log_domainlogging domain
log_levellogging level
messagemessage
user_datauser data
int cr_remove_dir ( const char *  path)

Recursively remove directory.

Parametry:
pathfilepath
Návratová hodnota:
0 on success, nonzero on failure (errno is set)
struct cr_EVR cr_str_to_evr ( const char *  string,
GStringChunk *  chunk 
)
read

Convert epoch-version-release string into cr_EVR structure. If no GStringChunk passed, all non NULL items in returned structure are malloced and in that case, you have to free all non-NULL element yourself.

Parametry:
stringNULL terminated n-v-r string
chunkstring chunk for strings (optional - could be NULL)
Návratová hodnota:
filled NVR
struct cr_Version cr_str_to_version ( const char *  str)
read

Convert version string into cr_Version struct.

Parametry:
strversion string
Návratová hodnota:
cr_Version