Reworked some headers, make project buildable.

This commit is contained in:
Max Holleman 2023-08-04 09:53:37 +02:00
parent 6125824f3d
commit 76aa27a126
4 changed files with 6 additions and 12 deletions

View File

@ -1,4 +1,5 @@
add_executable(netex add_executable(netex
"list.h"
"main.c" "main.c"
"exp_list.c") "exp_list.c")
target_include_directories(netex PRIVATE ${CMAKE_SOURCE_DIR}/src/include) target_include_directories(netex PRIVATE ${CMAKE_SOURCE_DIR}/src/include)

View File

@ -1,6 +1,6 @@
#include "stdlib.h" #include "stdlib.h"
#include "string.h" #include "string.h"
#include "cexp.h" #include "list.h"
#include "netex.h" #include "netex.h"
#define INCREMENT_SIZE 5 #define INCREMENT_SIZE 5
@ -16,7 +16,7 @@ static struct exp_data* list = NULL;
void list_add(char* name, char* command, int (*exp_func) (void*)) void list_add(char* name, char* command, int (*exp_func) (void*))
{ {
if (alloc_list() != 0) if (alloc_list() != 0)
{ TRACE_ERROR("Unable to allocate memory!"); return; } { ERROR("Unable to allocate memory!"); return; }
list[list_index_count].name = name; list[list_index_count].name = name;
list[list_index_count].command = command; list[list_index_count].command = command;
list[list_index_count].func_ptr = exp_func; list[list_index_count].func_ptr = exp_func;

View File

@ -1,5 +1,4 @@
target_sources(netex PUBLIC target_sources(netex PUBLIC
"net.h" "net.h"
"netex.h" "netex.h"
"cexp.h"
"sockets.h") "sockets.h")

View File

@ -1,5 +1,5 @@
#ifndef CEXP_H #ifndef LIST_H
#define CEXP_H #define LIST_H
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
@ -15,10 +15,4 @@ void print_list_items();
struct exp_data* get_command(char* command); struct exp_data* get_command(char* command);
struct exp_data* get_from_list(int index); struct exp_data* get_from_list(int index);
void clear_list(); void clear_list();
#endif
// Tracing
#define PRINT_LINE(msg, args...) fprintf(stdout, msg "\n", ##args)
#define TRACE_WARN(msg, args...) fprintf(stdout, "[Warning]: " msg "\n", ##args)
#define TRACE_ERROR(msg, args...) fprintf(stderr, "[ERROR]: " msg "\n", ##args)
#endif