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>
|
2017-05-31 09:19:09 -07:00
|
|
|
#include <math.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);
|
2015-08-26 10:27:06 -07:00
|
|
|
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);
|
2015-08-29 06:40:36 -07:00
|
|
|
int cat(char *filename, int (*func)(char *, void *), void *param);
|
2016-10-30 11:48:31 -07:00
|
|
|
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, ...);
|
2015-09-07 08:40:50 -07:00
|
|
|
void geohash_setprec(int precision);
|
|
|
|
int geohash_prec(void);
|
2015-09-16 06:30:28 -07:00
|
|
|
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, ...);
|
2016-04-11 22:54:59 -07:00
|
|
|
void chomp(char *s);
|
2017-05-31 09:19:09 -07:00
|
|
|
double number(JsonNode *j, char *element);
|
2022-08-04 02:25:23 -07:00
|
|
|
#ifdef WITH_SHARES
|
|
|
|
char *uuid4(void);
|
2022-08-05 11:16:34 -07:00
|
|
|
char *toursdir(void);
|
|
|
|
FILE *tourfile(struct udata *ud, char *filename, char *mode);
|
2022-08-04 02:25:23 -07:00
|
|
|
#endif
|
2015-08-22 06:52:39 -07:00
|
|
|
|
|
|
|
#endif
|