2024-06-20 03:34:32 +03:00
|
|
|
#pragma once
|
2024-07-31 21:16:19 +03:00
|
|
|
#include "pool.h"
|
|
|
|
|
2024-07-08 05:47:13 +03:00
|
|
|
#include <archive.h>
|
2024-06-21 01:36:56 +03:00
|
|
|
#include <libintl.h>
|
2024-06-28 20:51:56 +03:00
|
|
|
#include <netinet/in.h>
|
2024-06-21 01:36:56 +03:00
|
|
|
#include <stdbool.h>
|
2024-06-23 01:55:01 +03:00
|
|
|
#include <stdio.h>
|
2024-06-20 03:34:32 +03:00
|
|
|
|
|
|
|
#define _(x) gettext(x)
|
2024-08-08 02:30:51 +03:00
|
|
|
#define BINARY(b) \
|
|
|
|
(b & 128 ? '1' : '0'), (b & 64 ? '1' : '0'), (b & 32 ? '1' : '0'), (b & 16 ? '1' : '0'), (b & 8 ? '1' : '0'), \
|
|
|
|
(b & 4 ? '1' : '0'), (b & 2 ? '1' : '0'), (b & 1 ? '1' : '0')
|
2024-06-20 03:34:32 +03:00
|
|
|
|
|
|
|
bool contains(char *str, char s);
|
|
|
|
bool eq(char *s1, char *s2);
|
|
|
|
bool is_letter(char c);
|
|
|
|
bool is_digit(char c);
|
2024-07-01 06:43:20 +03:00
|
|
|
|
2024-06-23 01:55:01 +03:00
|
|
|
bool copy_from_buffer(void *dst, void *buffer, size_t size, ssize_t *total, ssize_t *used);
|
2024-07-01 06:43:20 +03:00
|
|
|
bool copy_to_buffer(void *buffer, void *src, size_t size, ssize_t *total, ssize_t *used);
|
|
|
|
|
2024-07-11 07:31:36 +03:00
|
|
|
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);
|
2024-08-04 13:11:25 +03:00
|
|
|
bool exists(char *path, struct stat *st);
|
2024-07-31 21:16:19 +03:00
|
|
|
bool is_empty(char *p);
|
2024-08-03 22:23:32 +03:00
|
|
|
bool is_dir_empty(char *p);
|
|
|
|
bool rmrf(char *p);
|
2024-08-09 22:13:43 +03:00
|
|
|
int digits(int n);
|
2024-07-01 06:43:20 +03:00
|
|
|
|
|
|
|
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, ...);
|
2024-08-08 02:30:51 +03:00
|
|
|
void pdebug_binary(char *data, size_t len);
|
|
|
|
|
2024-07-01 06:43:20 +03:00
|
|
|
bool parse_host(char *addr, char *host, uint16_t *port);
|
2024-07-08 05:47:13 +03:00
|
|
|
bool copy_blocks(struct archive *w, struct archive *r);
|
2024-07-01 06:43:20 +03:00
|
|
|
bool extract_archive(char *dst, char *src);
|
2024-06-28 20:51:56 +03:00
|
|
|
bool mkdir_ifnot(char *path);
|
2024-07-01 06:43:20 +03:00
|
|
|
|
|
|
|
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);
|