recorder/util.h

43 lines
1.3 KiB
C
Raw Normal View History

2015-08-22 06:52:39 -07:00
#ifndef _UTIL_H_INCL_
# define _UTIL_H_INCL_
2015-08-25 09:00:31 -07:00
#ifndef TRUE
# define TRUE (1)
# define FALSE (0)
#endif
2015-08-22 06:52:39 -07:00
#include <time.h>
2015-09-03 23:06:53 -07:00
#include <syslog.h>
2015-08-25 09:00:31 -07:00
#include "json.h"
2016-01-28 01:39:42 -07:00
#include "udata.h"
2015-09-01 08:15:00 -07:00
#include "utstring.h"
2015-08-22 06:52:39 -07:00
2015-09-21 07:07:31 -07:00
#define UB(x) utstring_body(x)
2015-09-01 08:15:00 -07:00
int mkpath(char *path);
2015-09-01 05:05:02 -07:00
int is_directory(char *path);
2015-08-22 06:52:39 -07:00
const char *isotime(time_t t);
2015-11-02 00:37:20 -07:00
const char *disptime(time_t t);
2015-08-25 09:00:31 -07:00
char *slurp_file(char *filename, int fold_newlines);
2015-08-29 13:45:03 -07:00
int json_copy_to_object(JsonNode *obj, JsonNode * object_or_array, int clobber);
int json_copy_element_to_object(JsonNode *obj, char *key, JsonNode *node);
2015-08-25 09:00:31 -07:00
int json_copy_from_file(JsonNode * obj, char *filename);
int splitter(char *s, char *sep, char **parts);
2016-02-19 08:31:32 -07:00
void splitterfree(char **parts);
2015-08-26 10:38:20 -07:00
JsonNode *json_splitter(char *s, char *sep);
2015-08-28 09:21:20 -07:00
int syslog_facility_code(char *facility);
2015-08-29 05:59:46 -07:00
const char *yyyymm(time_t t);
int tac(char *filename, long lines, int (*func)(char *, void *), void *param);
int cat(char *filename, int (*func)(char *, void *), void *param);
FILE *pathn(char *mode, char *prefix, UT_string *user, UT_string *device, char *suffix, time_t epoch);
2015-09-01 08:15:00 -07:00
int safewrite(char *filename, char *buf);
2015-09-03 23:06:53 -07:00
void olog(int level, char *fmt, ...);
void geohash_setprec(int precision);
int geohash_prec(void);
void lowercase(char *s);
2016-01-05 01:40:16 -07:00
double haversine_dist(double th1, double ph1, double th2, double ph2);
2016-01-28 01:39:42 -07:00
void debug(struct udata *, char *fmt, ...);
void chomp(char *s);
2015-08-22 06:52:39 -07:00
#endif