shell test
This commit is contained in:
parent
c220e33b66
commit
57975e19be
2 changed files with 15 additions and 1 deletions
|
@ -10,6 +10,19 @@ static int emac_id = -1;
|
|||
|
||||
static Client cli;
|
||||
|
||||
static int iamsrv = 0;
|
||||
|
||||
|
||||
#include <metalsvm/stdio.h>
|
||||
|
||||
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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue