19#if defined(STASIS_OS_WINDOWS)
20#define PATH_ENV_VAR "path"
23#define LINE_SEP "\r\n"
25#define PATH_ENV_VAR "PATH"
31#if defined(STASIS_OS_LINUX)
32#define STASIS_RANDOM_GENERATOR_FILE "/dev/urandom"
33#elif defined(STASIS_OS_DARWIN)
34#define STASIS_RANDOM_GENERATOR_FILE "/dev/random"
36#define STASIS_RANDOM_GENERATOR_FILE NULL
40#define STASIS_XML_PRETTY_PRINT_PROG "xmllint"
41#define STASIS_XML_PRETTY_PRINT_ARGS "--format"
59int pushd(
const char *path);
104char **file_readlines(
const char *filename,
size_t start,
size_t limit, ReaderFn *readerFn);
135int touch(
const char *filename);
202int path_store(
char **destptr,
size_t maxlen,
const char *base,
const char *path);
204#if defined(STASIS_DUMB_TERMINAL)
205#define STASIS_COLOR_RED ""
206#define STASIS_COLOR_GREEN ""
207#define STASIS_COLOR_YELLOW ""
208#define STASIS_COLOR_BLUE ""
209#define STASIS_COLOR_WHITE ""
210#define STASIS_COLOR_RESET ""
213#define STASIS_COLOR_RED "\x1b[1;91m"
215#define STASIS_COLOR_GREEN "\x1b[1;92m"
217#define STASIS_COLOR_YELLOW "\x1b[1;93m"
219#define STASIS_COLOR_BLUE "\x1b[1;94m"
221#define STASIS_COLOR_WHITE "\x1b[1;97m"
223#define STASIS_COLOR_RESET "\x1b[0;37m\x1b[0m"
226#define STASIS_MSG_SUCCESS 0
228#define STASIS_MSG_NOP 1 << 0
230#define STASIS_MSG_ERROR 1 << 1
232#define STASIS_MSG_WARN 1 << 2
234#define STASIS_MSG_L1 1 << 3
236#define STASIS_MSG_L2 1 << 4
238#define STASIS_MSG_L3 1 << 5
240#define STASIS_MSG_RESTRICT 1 << 6
242void msg(
unsigned type,
char *fmt, ...);
266char *
xmkstemp(FILE **fp,
const char *mode);
300int fix_tox_conf(
const char *filename,
char **result,
size_t maxlen);
346int redact_sensitive(
const char **to_redact,
size_t to_redact_size,
char *src,
char *dest,
size_t maxlen);
380int mkdirs(
const char *_path, mode_t mode);
404char *find_version_spec(
char *package_name);
407#define PM_APPEND 1 << 0
408#define PM_PREPEND 1 << 1
409#define PM_ONCE 1 << 2
420int env_manipulate_pathstr(
const char *key,
char *path,
int mode);
425int gen_file_extension_str(
char *filename,
size_t maxlen,
const char *extension);
430char *remove_extras(
char *s);
432void debug_hexdump(
char *data,
int len);
469int grow(
size_t size_new,
size_t *size_orig,
char **data);
471int in_ascii_range(
char c,
char lower,
char upper);
473#define GIT_HASH_LEN 40
474int is_git_sha(
char const *hash);
476int check_python_package_dependencies(
const char *srcdir);
478void seconds_to_human_readable(
int v,
char *result,
size_t maxlen);
480#define STR_TO_TIMEOUT_NEGATIVE (-1)
481#define STR_TO_TIMEOUT_INVALID_TIME_SCALE (-2)
482int str_to_timeout(
char *s);
484const char *get_random_generator_file();
485int get_random_bytes(
char *result,
size_t maxlen);
492int non_format_len(
const char *s);
494char *center_text(
const char *s,
size_t maxwidth);
int path_store(char **destptr, size_t maxlen, const char *base, const char *path)
Definition utils.c:557
char * find_program(const char *name)
Definition utils.c:262
int redact_sensitive(const char **to_redact, size_t to_redact_size, char *src, char *dest, size_t maxlen)
Definition utils.c:798
int touch(const char *filename)
Definition utils.c:295
int git_clone(struct Process *proc, char *url, char *destdir, char *gitref)
Definition utils.c:309
char * xmkstemp(FILE **fp, const char *mode)
Definition utils.c:501
int fix_tox_conf(const char *filename, char **result, size_t maxlen)
Definition utils.c:674
long get_cpu_count()
Definition utils.c:857
int rmtree(char *_path)
Definition utils.c:35
char * expandpath(const char *_path)
Definition utils.c:77
int pushd(const char *path)
Definition utils.c:9
int isempty_dir(const char *path)
Definition utils.c:539
char * collapse_whitespace(char **s)
Definition utils.c:765
char * git_rev_parse(const char *path, char *args)
Definition utils.c:395
int xml_pretty_print_in_place(const char *filename, const char *pretty_print_prog, const char *pretty_print_args)
Definition utils.c:601
int popd(void)
Definition utils.c:24
int mkdirs(const char *_path, mode_t mode)
Definition utils.c:865
char * git_describe(const char *path)
Definition utils.c:372
char * path_basename(char *path)
Definition utils.c:135
struct StrList * listdir(const char *path)
Definition utils.c:828
char * path_dirname(char *path)
Definition utils.c:150