blob: 4c873d679f642a91f77b1b9ebaf4d4f10d16902e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/* ckutil.h - utility functions for ck ---------------------------------*- C -*-
*
* This file is part of ck, the config keeper
*
* -----------------------------------------------------------------------------
*
* Copyright (C) 2018 Anastasis Grammenos
* GPLv3 (see LICENCE for the full notice)
*
* -----------------------------------------------------------------------------
*
* Utility funtions and global constants.
*
* -------------------------------------------------------------------------- */
#ifndef CKUTIL_H
#define CKUTIL_H
/*******************/
/* global includes */
/*******************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define PRINT_ERR(ERROR) \
printf("--[ Error ]--\n%s", ERROR);
/********************/
/* global constants */
/********************/
/* String length - Small */
#define STR_S 30
/* String length -Medium */
#define STR_M 100
/* String length - Large */
#define STR_L 400
/*********************/
/* utility functions */
/*********************/
/* Returns 1 if path is a directory, else returns 0. */
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);
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_mkdir(const char *path);
#endif // CKUTIL_H
|