From a5f7c7337410b7bcdb655b82db5b67269b15cc78 Mon Sep 17 00:00:00 2001 From: Al Date: Wed, 11 Mar 2015 17:31:08 -0400 Subject: [PATCH] [utils] is_relative_path --- src/file_utils.c | 4 ++++ src/file_utils.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/file_utils.c b/src/file_utils.c index 2a2e675a..9cd2d52e 100644 --- a/src/file_utils.c +++ b/src/file_utils.c @@ -32,6 +32,10 @@ char *file_getline(FILE * f) return ret; } +bool is_relative_path(struct dirent *ent) { + return strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0; +} + bool file_read_int32(FILE *file, int32_t *value) { unsigned char buf[4]; diff --git a/src/file_utils.h b/src/file_utils.h index 96ca34db..22536eca 100644 --- a/src/file_utils.h +++ b/src/file_utils.h @@ -6,6 +6,7 @@ extern "C" { #endif +#include #include #include #include @@ -25,6 +26,8 @@ extern "C" { char *file_getline(FILE * f); +bool is_relative_path(struct dirent *ent); + bool file_read_int32(FILE *file, int32_t *value); bool file_write_int32(FILE *file, int32_t value);