From 57975e19be0589e22086e271dfda68b946800977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Benedikt=20Kr=C3=BCger?= Date: Tue, 12 Jul 2011 15:15:55 +0200 Subject: [PATCH] shell test --- kernel/shell.c | 14 ++++++++++++++ kernel/shell.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/kernel/shell.c b/kernel/shell.c index e2d44330..48ef0c95 100644 --- a/kernel/shell.c +++ b/kernel/shell.c @@ -10,6 +10,19 @@ static int emac_id = -1; static Client cli; +static int iamsrv = 0; + + +#include + +void shelldebugprintf(char* x,...) +{ + if (iamsrv) + srv_sendBuffer(&srv,emac_id,x,strlen(x)); + else + cli_sendBuffer(&cli,x,srlen(x)); +} + void shell_on_connect(ServerEventArgs* e) { if (srv.ConnectionsAddr[e->ClientID].sin_addr.s_addr > 0xC0A80031 || srv.ConnectionsAddr[e->ClientID].sin_addr.s_addr < 0xC0A80001) @@ -35,6 +48,7 @@ void shell_init(int srv_or_cli) { if (!srv_or_cli) { + iamsrv = 1; kprintf("server init"); server_init(&srv,5555,49); srv._OnConnect = shell_on_connect; diff --git a/kernel/shell.h b/kernel/shell.h index 0e3607f5..553211d7 100644 --- a/kernel/shell.h +++ b/kernel/shell.h @@ -1,7 +1,7 @@ #ifndef SHELL_H #define SHELL_H -#define SHELLDEBUGPRINTF(x,...) cli_sendBuffer(x,##__VA_ARGS__); +void shelldebugprintf(char* x,...); void shell_init(int srv_or_cli);