[utils] is_relative_path

This commit is contained in:
Al
2015-03-11 17:31:08 -04:00
parent 5157a0fd8b
commit a5f7c73374
2 changed files with 7 additions and 0 deletions

View File

@@ -32,6 +32,10 @@ char *file_getline(FILE * f)
return ret; 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) { bool file_read_int32(FILE *file, int32_t *value) {
unsigned char buf[4]; unsigned char buf[4];

View File

@@ -6,6 +6,7 @@
extern "C" { extern "C" {
#endif #endif
#include <dirent.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -25,6 +26,8 @@ extern "C" {
char *file_getline(FILE * f); char *file_getline(FILE * f);
bool is_relative_path(struct dirent *ent);
bool file_read_int32(FILE *file, int32_t *value); bool file_read_int32(FILE *file, int32_t *value);
bool file_write_int32(FILE *file, int32_t value); bool file_write_int32(FILE *file, int32_t value);