From 12d7f9b45303fb458cb21a3e0e430af96c781d8b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 24 Mar 2025 22:58:14 +0100 Subject: First commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- common.h | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 common.h (limited to 'common.h') 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#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); -- cgit v1.2.3-70-g09d2