libmp/include/util.h

27 lines
842 B
C
Raw Normal View History

2024-06-20 00:34:32 +00:00
#pragma once
#include "types.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)
void pdebug(const char *func, const char *fmt, ...);
2024-06-22 04:03:17 +00:00
bool parse_host(char *addr, char *host, uint16_t *port);
2024-06-20 00:34:32 +00:00
bool contains(char *str, char s);
bool eq(char *s1, char *s2);
bool is_letter(char c);
bool is_digit(char c);
bool copy_to_buffer(void *buffer, void *src, size_t size, ssize_t *total, ssize_t *used);
bool copy_from_buffer(void *dst, void *buffer, size_t size, ssize_t *total, ssize_t *used);
bool extract_archive(char *dst, char *src);
bool is_pkg_name_valid(char *name);
bool exists(char *path);
bool is_file(char *path);
bool is_dir(char *path);
bool can_read(char *path);
bool can_write(char *path);
bool mkdir_ifnot(char *path);
void sockaddr_to_str(struct sockaddr *addr, char *str);