diff options
Diffstat (limited to 'src/ckutil.h')
-rw-r--r-- | src/ckutil.h | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/src/ckutil.h b/src/ckutil.h index 4c873d6..9955440 100644 --- a/src/ckutil.h +++ b/src/ckutil.h @@ -24,7 +24,9 @@ #include <string.h> #define PRINT_ERR(ERROR) \ - printf("--[ Error ]--\n%s", ERROR); + printf("--[ Error ]--\n%s\n", ERROR); + +#define UNUSED(x) (void)(x) /********************/ /* global constants */ @@ -39,6 +41,23 @@ /* String length - Large */ #define STR_L 400 +/********************/ +/* string functions */ +/********************/ + +/* Create the config name to be used when storing a new config to + * the VC or SCRT dir */ +extern void str_make_new_config_name(char *ret, const char *path, + const char *progName); + +/* Joins the two strings into ret, with a '/' in between */ +extern void str_join_dirname_with_basename(char *ret, const char *path, + const char *progName); + +/* Returns 1 if str contains only whitespace, or nothing, + * else returns 0. */ +extern int str_is_empty(const char *s); + /*********************/ /* utility functions */ /*********************/ @@ -49,13 +68,20 @@ extern int util_is_dir(const char *path); /* Returns 1 if file(or dir) exists, else returns 0. */ extern int util_file_exists(const char *path); +/* Returns 1 if file(or dir) is readable and writable, + * else returns 0. */ extern int util_is_file_rw(const char *path); -extern int util_is_cli_flag(); -/* Returns 1 if str contains only whitespace, or nothing, - * else returns 0. */ -extern int util_is_str_empty(); -extern int util_remove_newlibe(); +extern void util_replace_slash_with_uscore(char *s); +/* Wrapper around mkdir with 0775 permissions */ extern void util_mkdir(const char *path); + +/* Moves file from path, to destination + * keeping the same permissions. + * Only deletes original on successful copy */ +extern int util_move_file(const char *path, const char* dest); + +/* Wrapper around symlink() */ +extern int util_symlink_file(const char *path, const char* dest); #endif // CKUTIL_H |