libmp/include/util.h

48 lines
1.5 KiB
C
Raw Normal View History

2024-06-20 00:34:32 +00:00
#pragma once
2024-07-31 18:16:19 +00:00
#include "pool.h"
2024-07-08 02:47:13 +00:00
#include <archive.h>
2024-06-20 22:36:56 +00:00
#include <libintl.h>
#include <netinet/in.h>
2024-06-20 22:36:56 +00:00
#include <stdbool.h>
#include <stdio.h>
2024-06-20 00:34:32 +00:00
#define _(x) gettext(x)
bool contains(char *str, char s);
bool eq(char *s1, char *s2);
bool is_letter(char c);
bool is_digit(char c);
bool copy_from_buffer(void *dst, void *buffer, size_t size, ssize_t *total, ssize_t *used);
bool copy_to_buffer(void *buffer, void *src, size_t size, ssize_t *total, ssize_t *used);
char *get_md5(char *path);
bool copy_file(char *dst, char *src);
bool can_write(char *path);
bool can_read(char *path);
bool is_file(char *path);
bool is_dir(char *path);
bool exists(char *path);
2024-07-31 18:16:19 +00:00
bool is_empty(char *p);
bool package_parse(char *package, char *name, char *version);
bool package_version_valid(char *name);
bool package_name_valid(char *name);
void pdebug(const char *func, const char *fmt, ...);
bool parse_host(char *addr, char *host, uint16_t *port);
2024-07-08 02:47:13 +00:00
bool copy_blocks(struct archive *w, struct archive *r);
bool extract_archive(char *dst, char *src);
bool mkdir_ifnot(char *path);
int join_multiple(char *res, const char *base, const char *pth, const char *pth2);
int join(char *res, const char *base, const char *pth);
char *join_alloc(const char *base, const char *pth);
bool pkglist_contains(lm_pkg_t *list, lm_pkg_t *pkg);
lm_pkg_t *pkglist_del(lm_pkg_t *list, lm_pkg_t *pkg);
lm_pkg_t *pkglist_add_top(lm_pkg_t *list, lm_pkg_t *pkg);
lm_pkg_t *pkglist_add_end(lm_pkg_t *list, lm_pkg_t *pkg);
void pkglist_free(lm_pkg_t *list);