libcmime  
A lightweight C mime library
Data Structures | Functions
cmime_util.h File Reference

Defines utility functions. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <time.h>
#include <unistd.h>
Include dependency graph for cmime_util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  CMimeInfo_T
 Struct with mime informations. More...
 

Functions

char * cmime_util_get_mimetype (const char *filename)
 Get mimetype of file use the 'file' tool. More...
 
CMimeInfo_Tcmime_util_info_new (void)
 Creates a new CMimeInfo_T object. More...
 
void cmime_util_info_free (CMimeInfo_T *mi)
 free a CMimeInfo_T object More...
 
CMimeInfo_Tcmime_util_info_get_from_string (const char *s)
 Get mime type and encoding from given string. More...
 
CMimeInfo_Tcmime_util_info_get_from_file (const char *filename)
 Get mime type and encoding from file. More...
 
int cmime_util_rand ()
 Generate a random number from 0 to RAND_MAX. More...
 

Detailed Description

Defines utility functions.

Function Documentation

char* cmime_util_get_mimetype ( const char *  filename)

Get mimetype of file use the 'file' tool.

Parameters
filenamepath to file
Returns
mimetype of file
void cmime_util_info_free ( CMimeInfo_T mi)

free a CMimeInfo_T object

Parameters
mia CMimeInfo_T object
CMimeInfo_T* cmime_util_info_get_from_file ( const char *  filename)

Get mime type and encoding from file.

Parameters
filenamefile to check
Returns
a newly allocated CMimeInfo_T object, or NULL on failure
CMimeInfo_T* cmime_util_info_get_from_string ( const char *  s)

Get mime type and encoding from given string.

Parameters
sa string to check
Returns
a newly allocated CMimeInfo_T object, or NULL on failure
CMimeInfo_T* cmime_util_info_new ( void  )

Creates a new CMimeInfo_T object.

Returns
CMimeInfo_T pointer, or NULL on failure
int cmime_util_rand ( )

Generate a random number from 0 to RAND_MAX.

Returns
a random integer from 0 to RAND_MAX