deployd/script/include/def.h
Arija A. c368b92071
Make metadata parsing more modular
Signed-off-by: Arija A. <ari@ari.lt>
2025-07-25 20:57:21 +03:00

54 lines
1.3 KiB
C

#ifndef DEPLOYER_DEF_H_
#define DEPLOYER_DEF_H_
#include "conf.h"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <errno.h>
#include <string.h>
#ifndef NULL
#define NULL ((void *)0)
#endif /* NULL */
#ifndef SH_MALLOC
#define SH_MALLOC(size) malloc((size))
#endif /* SH_MALLOC */
#ifndef SH_CALLOC
#define SH_CALLOC(nmemb, size) calloc((nmemb), (size))
#endif /* SH_CALLOC */
#ifndef SH_FREE
#define SH_FREE(ptr) free((ptr))
#endif /* SH_FREE */
#ifndef SH_REALLOC
#define SH_REALLOC(ptr, size) realloc((ptr), (size))
#endif /* SH_REALLOC */
void sh_print_error(const char *msg);
void sh_print_errorf(const char *fmt, ...)
__attribute__((format(printf, 1, 2)));
void sh_print_warn(const char *msg);
void sh_print_warnf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
void sh_print_info(const char *msg);
void sh_print_infof(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
void sh_print_perror(const char *msg);
void sh_print_perrorf(const char *fmt, ...)
__attribute__((format(printf, 1, 2)));
char *sh_strndup(const char *src, size_t length);
bool sh_str_lstrip(const char **ptr);
bool sh_is_valid_identifier(const char *str, size_t length);
bool sh_is_lowstr(const char *str);
const char *sh_strnchr(const char *str, char chr, size_t length);
#endif /* DEPLOYER_DEF_H_ */