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);
211int path_store(
char **destptr,
size_t maxlen,
const char *base,
const char *path);
213#if defined(STASIS_DUMB_TERMINAL)
214#define STASIS_COLOR_RED ""
215#define STASIS_COLOR_GREEN ""
216#define STASIS_COLOR_YELLOW ""
217#define STASIS_COLOR_BLUE ""
218#define STASIS_COLOR_WHITE ""
219#define STASIS_COLOR_RESET ""
222#define STASIS_COLOR_RED "\x1b[1;91m"
224#define STASIS_COLOR_GREEN "\x1b[1;92m"
226#define STASIS_COLOR_YELLOW "\x1b[1;93m"
228#define STASIS_COLOR_BLUE "\x1b[1;94m"
230#define STASIS_COLOR_WHITE "\x1b[1;97m"
232#define STASIS_COLOR_RESET "\x1b[0;37m\x1b[0m"
235#define STASIS_MSG_SUCCESS 0
237#define STASIS_MSG_NOP 1 << 0
239#define STASIS_MSG_ERROR 1 << 1
241#define STASIS_MSG_WARN 1 << 2
243#define STASIS_MSG_L1 1 << 3
245#define STASIS_MSG_L2 1 << 4
247#define STASIS_MSG_L3 1 << 5
249#define STASIS_MSG_RESTRICT 1 << 6
251void msg(
unsigned type,
char *fmt, ...);
275char *
xmkstemp(FILE **fp,
const char *mode);
309int fix_tox_conf(
const char *filename,
char **result,
size_t maxlen);
355int redact_sensitive(
const char **to_redact,
size_t to_redact_size,
char *src,
char *dest,
size_t maxlen);
389int mkdirs(
const char *_path, mode_t mode);
413char *find_version_spec(
char *package_name);
416#define PM_APPEND 1 << 0
417#define PM_PREPEND 1 << 1
418#define PM_ONCE 1 << 2
441void debug_hexdump(
char *data,
size_t len);
478int grow(
size_t size_new,
size_t *size_orig,
char **data);
480int in_ascii_range(
char c,
char lower,
char upper);
482#define GIT_HASH_LEN 40
483int is_git_sha(
char const *hash);
485int check_python_package_dependencies(
const char *srcdir,
struct StrList **out_files,
struct StrList **out_matches);
487void seconds_to_human_readable(
int v,
char *result,
size_t maxlen);
489#define STR_TO_TIMEOUT_NEGATIVE (-1)
490#define STR_TO_TIMEOUT_INVALID_TIME_SCALE (-2)
491int str_to_timeout(
char *s);
493const char *get_random_generator_file();
494int get_random_bytes(
char *result,
size_t maxlen);
503char *center_text(
const char *s,
size_t maxwidth);
int non_format_len(const char *s)
Definition utils.c:1223
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:799
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
int grow(size_t size_new, size_t *size_orig, char **data)
Definition utils.c:988
char * xmkstemp(FILE **fp, const char *mode)
Definition utils.c:501
int is_git_assumed_unchanged(char *filename)
Definition utils.c:1326
char * remove_extras(char *s)
Definition str.c:738
int fix_tox_conf(const char *filename, char **result, size_t maxlen)
Definition utils.c:675
long get_cpu_count()
Definition utils.c:858
int rmtree(char *_path)
Definition utils.c:35
char * expandpath(const char *_path)
Definition utils.c:77
int gen_file_extension_str(char *filename, size_t maxlen, const char *extension)
Definition utils.c:939
int env_manipulate_pathstr(const char *key, char *path, int mode)
Definition utils.c:892
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:766
char * git_rev_parse(const char *path, char *args)
Definition utils.c:395
int is_file_compressed(const char *filename)
Definition utils.c:1274
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:866
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:829
char * path_dirname(char *path)
Definition utils.c:150