move is_directory() to utils

This commit is contained in:
Jan-Piet Mens
2015-09-01 14:05:02 +02:00
parent 550fd4fc59
commit 7e17535314
3 changed files with 14 additions and 11 deletions
+1 -11
View File
@@ -1,19 +1,9 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include "gcache.h"
static int is_directory(char *path)
{
struct stat sb;
if (stat(path, &sb) != 0)
return (0);
return (S_ISDIR(sb.st_mode));
}
#include "util.h"
struct gcache *gcache_open(char *path, int rdonly)
{
+12
View File
@@ -3,11 +3,23 @@
#include <string.h>
#include <syslog.h>
#include "util.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#ifndef LINESIZE
# define LINESIZE 8192
#endif
int is_directory(char *path)
{
struct stat sb;
if (stat(path, &sb) != 0)
return (0);
return (S_ISDIR(sb.st_mode));
}
const char *isotime(time_t t) {
static char buf[] = "YYYY-MM-DDTHH:MM:SSZ";
+1
View File
@@ -9,6 +9,7 @@
#include <time.h>
#include "json.h"
int is_directory(char *path);
const char *isotime(time_t t);
char *slurp_file(char *filename, int fold_newlines);
int json_copy_to_object(JsonNode *obj, JsonNode * object_or_array, int clobber);