libmp/include/util.h

27 lines
842 B
C

#pragma once
#include "types.h"
#include <libintl.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <stdio.h>
#define _(x) gettext(x)
void pdebug(const char *func, const char *fmt, ...);
bool parse_host(char *addr, char *host, uint16_t *port);
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);