24 " -V log level: LOG_INFO, LOG_NOTICE, LOG_ERR, LOG_DEBUG\n"
28void process_args(
int argc,
char** argv) {
37 while ((getoptret = getopt(argc, argv,
"hvV:")) != EOF) {
40 fprintf(stderr,
"Date de compilation : %s a %s.\n", __DATE__, __TIME__);
43 if (!strncmp(
"LOG_NULL", optarg, 5)) {
46 if (!strncmp(
"LOG_NOTICE", optarg, 6)) {
49 if (!strncmp(
"LOG_INFO", optarg, 7)) {
52 if (!strncmp(
"LOG_ERR", optarg, 5)) {
55 if (!strncmp(
"LOG_DEBUG", optarg, 5)) {
58 fprintf(stderr,
"%s n'est pas un niveau de log valide.\n", optarg);
69 fprintf(stderr,
"\n Missing log level\n");
70 }
else if (optopt ==
'p') {
71 fprintf(stderr,
"\n Missing port\n");
72 }
else if (optopt !=
's') {
73 fprintf(stderr,
"\n Unknow missing option %c\n", optopt);
87int main(
int argc,
char** argv) {
89 process_args(argc, argv);
111 printf(
"Found node at (");
115 printf(
") with data: %d\n", *(
int*)result->
data_ptr);
117 printf(
"Node not found or has no data.\n");
#define LOG_DEBUG
debug-level messages
#define LOG_ERR
error conditions
void set_log_level(const int log_level)
Set the global log level value ( static int LOG_LEVEL )
#define LOG_NOTICE
normal but significant condition
#define LOG_NULL
no log output
#define LOG_INFO
informational
print_func print
pointer to print function
COORD_VALUE y
Y coordinate.
QUADTREE_NODE * root
tree list first node
void * data_ptr
Pointer to data, can be NULL.
COORD_VALUE x
X coordinate.
void free_quadtree(QUADTREE_NODE *root)
Function to free the quad tree.
QUADTREE_NODE * search(QUADTREE *qt, QUADTREE_NODE *root, COORD_VALUE x, COORD_VALUE y)
Function to search for a point in the quad tree.
void insert(QUADTREE *qt, QUADTREE_NODE **root, COORD_VALUE x, COORD_VALUE y, void *data_ptr)
Function to insert a point into the quad tree.
QUADTREE * create_quadtree(int coord_type)
Function to create a new quad tree.
structure of a quad tree node
Union to store the coordinate values.
Common headers and low-level functions & define.
N_STR and string function declaration.