-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69f1b00
commit 7e32bce
Showing
17 changed files
with
507 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,4 +85,5 @@ Temporary Items | |
|
||
|
||
|
||
.vscode/ | ||
build/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
|
||
make clean && CC=clang-16 make debug && ./build/chat_node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ip=127.0.0.1 | ||
port=51966 | ||
username=Person |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "chat_node.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// dbg.h | ||
// | ||
// Based on Zed's awesome debug macros | ||
// Modified by Wolf-Dieter Otte | ||
// | ||
|
||
#pragma once | ||
|
||
#include <stdio.h> | ||
#include <errno.h> | ||
#include <string.h> | ||
|
||
#ifndef NDEBUG | ||
// debug() - maskable debug message, expanded only if symbol DEBUG is defined | ||
#define debug(M, ...) fprintf(stderr, "\n[DEBUG] %s:%d: " M, __FILE__, __LINE__, ##__VA_ARGS__) | ||
#else | ||
#define debug(M, ...) | ||
#endif | ||
|
||
// helper macro, not to be used on its own | ||
#define clean_errno() (errno == 0 ? "None" : strerror(errno)) | ||
|
||
// logging macros - unlike debug() above, cannot be masked | ||
#define log_err(M, ...) fprintf(stderr, "\n[ERROR] (%s:%d: errno: %s) " M "\n", __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__) | ||
#define log_warn(M, ...) fprintf(stderr, "\n[WARN] (%s:%d: errno: %s) " M "\n", __FILE__, __LINE__, clean_errno(), ##__VA_ARGS__) | ||
#define log_info(M, ...) fprintf(stderr, "\n[INFO] (%s:%d) " M "\n", __FILE__, __LINE__, ##__VA_ARGS__) | ||
|
||
// probe() checks an assertion A. if it fails, logs an error and goes to label 'error' | ||
#define probe(A, M, ...) if(!(A)) { log_err(M, ##__VA_ARGS__); errno=0; goto error; } | ||
// sentinel() put into a part of a program that should not be accessed by program flow. if still accessed, logs error and goes to 'error' | ||
#define sentinel(M, ...) { log_err(M, ##__VA_ARGS__); errno=0; goto error; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "message.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.