wte.c: move makros to wte.h, add wte.h

This commit is contained in:
xesc 2024-10-12 21:06:18 +02:00
parent 64d5fb6f89
commit 05bc9d24d3
2 changed files with 34 additions and 18 deletions

View file

@ -1,21 +1,6 @@
#include <stdio.h>
#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"
#define error(format, ...) do {\
fprintf(stderr, c_red "[ERROR] "format c_end"\n", __VA_ARGS__); \
} while(0)
#include <time.h>
#include <stdlib.h>
#include "wte.h"
static int get_proposition()

31
src/wte.h Normal file
View 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();