23 fprintf( stderr,
" -v version\n"
24 " -V log level: LOG_INFO, LOG_NOTICE, LOG_ERR, LOG_DEBUG\n"
28void process_args(
int argc,
char **argv )
38 while( ( getoptret = getopt( argc, argv,
"hvV:" ) ) != EOF)
43 fprintf( stderr,
"Date de compilation : %s a %s.\n", __DATE__, __TIME__ );
46 if( !strncmp(
"LOG_NULL", optarg, 5 ) )
52 if( !strncmp(
"LOG_NOTICE", optarg, 6 ) )
58 if( !strncmp(
"LOG_INFO", optarg, 7 ) )
64 if( !strncmp(
"LOG_ERR", optarg, 5 ) )
70 if( !strncmp(
"LOG_DEBUG", optarg, 5 ) )
76 fprintf( stderr,
"%s n'est pas un niveau de log valide.\n", optarg );
89 fprintf( stderr,
"\n Missing log level\n" );
91 else if( optopt ==
'p' )
93 fprintf( stderr,
"\n Missing port\n" );
95 else if( optopt !=
's' )
97 fprintf( stderr,
"\n Unknow missing option %c\n", optopt );
113int main(
int argc,
char **argv)
117 process_args( argc, argv );
137 printf(
"Found node at (");
141 printf(
") with data: %d\n", *(
int*)result->
data_ptr);
143 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 hugly functions & define.
N_STR and string function declaration.