This repository has been archived on 2021-06-27. You can view files and clone it, but cannot push or open issues or pull requests.
modetw/src/file_t.h

48 lines
892 B
C

#ifndef FILE_T_H
#define FILE_T_H
#include "exception_t.h"
/**
* Wrapper to file
*/
typedef struct file_t {
char *name; /**< Absolute path to file */
unsigned char *hash; /**< MD5sum hash */
char *hash_str; /**< MD5sum hash as char* */
} file_t;
/**
* @brief Initialise file_t
* Adds $HOME to @filename and sets MD5 strings to NULL
* @param filename Relative path () to file
* @param e Exception
* @return Pointer to file_t
*/
file_t*
file_init(const char *filename, exception_t *e, const char *env);
/**
* Destroy file_t
* @param Pointer to file_t
*/
void
file_close(file_t *file);
/**
* Generate MD5sum hash from file
* @return MD5sum hash of file
*/
unsigned char*
file_md5_gen(file_t *f, exception_t *e);
/**
* Convert MD5sum hash to string
* @param md5 MD5sum hash
* @return NULL-terminated string
*/
char*
file_md5_str(file_t *f, exception_t *e);
#endif