Branch to refactor and debug (AVLs bugged)
This commit is contained in:
70
src/utils.h
Normal file
70
src/utils.h
Normal file
@ -0,0 +1,70 @@
|
||||
/****************************************************************************
|
||||
* Header file for utility functions *
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file utils.h
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
* @date 29 March 2016
|
||||
* @brief Header file for utility functions.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UTILS_H_
|
||||
#define UTILS_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "obidms.h"
|
||||
|
||||
|
||||
#define ONE_IF_ZERO(x) (((x)==0)?1:(x)) /**< If x is equal to 0, x takes the value 1.
|
||||
*/
|
||||
|
||||
#define MAX_PATH_LEN 4096 /**< Maximum length for the character string defining a
|
||||
* file or directory path.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Internal function getting the full path of a file or a directory from its
|
||||
* path relative to a directory file descriptor.
|
||||
*
|
||||
* @warning The returned pointer has to be freed by the caller.
|
||||
*
|
||||
* @param directory_file_descriptor The file descriptor for the directory to which
|
||||
* path_name is relative.
|
||||
* @param path_name The path name for the file or directory, relative to directory_file_descriptor.
|
||||
*
|
||||
* @returns A pointer to the full path.
|
||||
* @retval NULL if an error occurred.
|
||||
*
|
||||
* @since June 2015
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
char* get_full_path(OBIDMS_p dms, const char* path_name);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Replacement function for opendirat() : open a directory relative to a directory file descriptor.
|
||||
*
|
||||
* @param directory_file_descriptor The file descriptor for the directory in which the directory should be opened.
|
||||
* @param path_name The path name for the directory to be opened, relative to directory_file_descriptor.
|
||||
*
|
||||
* @returns The file descriptor of the opened directory.
|
||||
* @retval NULL if an error occurred.
|
||||
*
|
||||
* @since June 2015
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
DIR* opendir_in_dms(OBIDMS_p dms, const char* path_name);
|
||||
|
||||
|
||||
/*
|
||||
* TODO
|
||||
*/
|
||||
int count_dir(char *dir);
|
||||
|
||||
|
||||
#endif /* UTILS_H_ */
|
Reference in New Issue
Block a user