aboutsummaryrefslogtreecommitdiffstats
path: root/src/ckutil.h
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-04-29 21:36:52 +0300
committergramanas <anastasis.gramm2@gmail.com>2018-04-29 21:36:52 +0300
commit93eae1c206796d76e930c0c4860e4ead9c8fca14 (patch)
tree239940d27be834bcd16b28d6fcd03db4a00f3072 /src/ckutil.h
parent25ccc84ac00a7b3975dfdb0cc415522ca7793f0f (diff)
downloadck-93eae1c206796d76e930c0c4860e4ead9c8fca14.tar.gz
ck-93eae1c206796d76e930c0c4860e4ead9c8fca14.tar.bz2
ck-93eae1c206796d76e930c0c4860e4ead9c8fca14.zip
linkin park
Diffstat (limited to 'src/ckutil.h')
-rw-r--r--src/ckutil.h38
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