diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-12-08 16:31:24 +0100 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-12-08 17:00:23 +0100 |
| commit | 4da7a3e44d2bbd7b21ae05c7b6604748e7227227 (patch) | |
| tree | cbb81eed24dd2bed75998e4f8ffb803dd479a6df /src/net | |
| parent | de3532bd6b685c66015202a48d53e1b8fa4900f5 (diff) | |
| download | jancity-4da7a3e44d2bbd7b21ae05c7b6604748e7227227.tar.gz | |
wip2
Diffstat (limited to 'src/net')
| -rw-r--r-- | src/net/ps1/src/net.c | 5 | ||||
| -rw-r--r-- | src/net/win9x/src/serial.c | 17 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/net/ps1/src/net.c b/src/net/ps1/src/net.c index af964cf..185d990 100644 --- a/src/net/ps1/src/net.c +++ b/src/net/ps1/src/net.c @@ -7,6 +7,7 @@ #include <stdbool.h> #include <stddef.h> #include <stdio.h> +#include <stdint.h> static struct net_host { @@ -82,7 +83,7 @@ static int on_write(const void *const buf, size_t n, void *const arg) EnterCriticalSection(); - for (const char *b = buf; n; n--, b++) + for (const uint8_t *b = buf; n; n--, b++) { struct net_host_fifo *const f = &h->out; size_t new = f->pending + 1; @@ -115,7 +116,7 @@ static int on_read(void *const buf, const size_t n, void *const arg) EnterCriticalSection(); - for (char *b = buf; rem; rem--, b++) + for (uint8_t *b = buf; rem; rem--, b++) { if (f->read == f->pending) goto end; diff --git a/src/net/win9x/src/serial.c b/src/net/win9x/src/serial.c index c1cffb6..57d7261 100644 --- a/src/net/win9x/src/serial.c +++ b/src/net/win9x/src/serial.c @@ -1,6 +1,7 @@ #include <net.h> #include <net_private.h> #include <windows.h> +#include <ctype.h> #include <errno.h> #include <stddef.h> #include <stdio.h> @@ -244,6 +245,22 @@ static int on_write(const void *const buf, const size_t n, void *const arg) __func__, GetLastError()); goto failure; } + + printf("%s: outgoing packet, buf: %p, n: %u: [", __func__, buf, (unsigned)n); + + for (size_t i = 0; i < n; i++) + { + const char b = ((const char *)buf)[i]; + printf("%02hhx", b); + + if (isprint((unsigned char)b)) + printf(" (%c)", b); + + if (i + 1 < n) + printf(", "); + } + + printf("]\n"); } return get_result(h, r); |
