wte.c: move makros to wte.h, add wte.h
This commit is contained in:
parent
64d5fb6f89
commit
05bc9d24d3
2 changed files with 34 additions and 18 deletions
21
src/wte.c
21
src/wte.c
|
@ -1,21 +1,6 @@
|
||||||
#include <stdio.h>
|
#include <time.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#ifdef DEBUG
|
#include "wte.h"
|
||||||
#define dbg(format, ...) do { \
|
|
||||||
printf("\033[1;35m[DEBUG] (func: %s) msg:\033[0;35m " format "\033[0m\n",__func__, __VA_ARGS__); \
|
|
||||||
} while(0)
|
|
||||||
#else
|
|
||||||
#define dbg(format, ...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define c_red "\033[1;31m"
|
|
||||||
#define c_green "\033[1;32m"
|
|
||||||
#define c_yellow "\033[1;33m"
|
|
||||||
#define c_end "\033[0m"
|
|
||||||
|
|
||||||
#define error(format, ...) do {\
|
|
||||||
fprintf(stderr, c_red "[ERROR] "format c_end"\n", __VA_ARGS__); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
|
|
||||||
static int get_proposition()
|
static int get_proposition()
|
||||||
|
|
31
src/wte.h
Normal file
31
src/wte.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#define error(format, ...) do {\
|
||||||
|
fprintf(stderr, c_red "[ERROR] "format c_end"\n", __VA_ARGS__); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define dbg(format, ...) do { \
|
||||||
|
printf("\033[1;35m[DEBUG] (func: %s) msg:\033[0;35m " format "\033[0m\n",__func__, __VA_ARGS__); \
|
||||||
|
} while(0)
|
||||||
|
#else
|
||||||
|
#define dbg(format, ...)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define c_red "\033[1;31m"
|
||||||
|
#define c_green "\033[1;32m"
|
||||||
|
#define c_yellow "\033[1;33m"
|
||||||
|
#define c_end "\033[0m"
|
||||||
|
|
||||||
|
/* path to data storage */
|
||||||
|
#define DATA_DIR "/.local/share/wte"
|
||||||
|
|
||||||
|
/* get full path to data storage (with "/home/$USER/"-prefix) */
|
||||||
|
char *get_path();
|
||||||
|
|
||||||
|
/* data storage creation / deletion */
|
||||||
|
int create_data_dir();
|
||||||
|
int remove_data_dir();
|
||||||
|
|
||||||
|
/* operating on data storage */
|
||||||
|
int insert_choice();
|
||||||
|
int remove_choice();
|
Loading…
Add table
Add a link
Reference in a new issue