Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on:
push:
branches-ignore:
- main
- "*"
pull_request:
branches:
- main
Expand All @@ -21,7 +21,7 @@ jobs:
- name: Checkout Crux repository as a sibling
uses: actions/checkout@v4
with:
repository: meslab/crux # Replace with actual org/user
repository: meslab/crux
path: crux

- name: Build Crux
Expand Down
5 changes: 3 additions & 2 deletions include/arg_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>

typedef struct Options {
uint16_t tcp_port;
uint8_t verbose;
char *tcp_server;
char *log_level;
char *err_log;
char *out_log;
FILE *err_log;
FILE *out_log;
} Options;

void arguments_parse(int argc, char *argv[], Options *opt);
Expand Down
9 changes: 1 addition & 8 deletions main/csky.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,8 @@ int main(int argc, char *argv[]) {
LinearMemoryArena linear_arena;
linear_arena_init(&linear_arena, 1024 * 1024);

LoggerOptions logger_options = {
.verbose = opts.verbose,
.log_level = opts.log_level,
.err_log = opts.err_log,
.out_log = opts.out_log
};

Logger *logger = (Logger *)linear_arena_alloc(&linear_arena, sizeof(Logger));
logger_init(logger, &logger_options);
logger_init(logger, opts.err_log, opts.out_log, opts.log_level);

ringBuffer *ring_buffer = linear_arena_alloc(&linear_arena, sizeof(ring_buffer));
ring_buffer_init(ring_buffer);
Expand Down
4 changes: 2 additions & 2 deletions src/arg_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ void arguments_parse(int argc, char *argv[], Options *opts) {
break;
case 'o':
if (optarg) {
opts->out_log = optarg;
opts->out_log = fopen(optarg, "a");
}
break;
case 'e':
if (optarg) {
opts->err_log = optarg;
opts->err_log = fopen(optarg, "a");
}
break;
case 'l':
Expand Down
9 changes: 1 addition & 8 deletions test/csky.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,8 @@ int main(int argc, char *argv[]) {
Options opts;
arguments_parse(argc, argv, &opts);

LoggerOptions logger_options = {
.verbose = opts.verbose,
.log_level = opts.log_level,
.err_log = opts.err_log,
.out_log = opts.out_log
};

Logger logger;
logger_init(&logger, &logger_options);
logger_init(&logger, opts.err_log, opts.out_log, opts.log_level);

// Example 26-character hex string (13 bytes)
const char *hex_str_26 = "7890ABCDEF1234567890ABCDEF";
Expand Down