aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'common.h')
-rw-r--r--common.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/common.h b/common.h
new file mode 100644
index 0000000..db3bae2
--- /dev/null
+++ b/common.h
@@ -0,0 +1,51 @@
+/* See LICENSE file for copyright and license details. */
+#include "libgeome.h"
+
+#include <sys/wait.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <math.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+
+#ifndef TZDIR
+# define TZDIR "/usr/share/zoneinfo"
+#endif
+
+#ifndef TZFILE
+# define TZFILE "/etc/localtime"
+#endif
+
+#ifndef GEOFILE
+# define GEOFILE "/etc/geolocation"
+#endif
+
+
+struct location {
+ double latitude;
+ double longitude;
+};
+
+struct spawn_join_info {
+ pid_t pid;
+ int ignore_sigchld;
+};
+
+
+char *libgeome_util_areadlink(struct libgeome_context *ctx, const char *path);
+int libgeome_util_safe_pipe(struct libgeome_context *ctx, int fds[2]);
+int libgeome_util_spawn_async_read(struct libgeome_context *ctx, const char *path, const char *const *argv,
+ unsigned int alarm_seconds, struct spawn_join_info *info_out, int *fd_out);
+void libgeome_util_spawn_async_kill(struct libgeome_context *ctx, const struct spawn_join_info *info, int signum);
+int libgeome_util_spawn_async_join(struct libgeome_context *ctx, const struct spawn_join_info *info, int *status_out);
+uint64_t libgeome_util_parse_xml(char *s, struct location *location_out);
+uint64_t libgeome_util_parse_json(char *s, struct location *location_out);
+uint64_t libgeome_util_parse_plain(char *s, struct location *location_out);
+uint64_t libgeome_util_parse_output(char *s, struct location *location_out);