Revision 5ddf869b
Added by Hamish Coleman over 16 years ago
- ID 5ddf869b3c60cbe309b6a4b25cefeee96bba7f1d
Makefile | ||
---|---|---|
CFLAGS:=-Wall
|
||
CC:=gcc
|
||
|
||
LIBCLI:=libcli/libcli.o
|
||
|
||
wconsd.c: debug.h scm.h
|
||
win-scm.c: scm.h
|
||
|
||
wconsd.exe: wconsd.o win-scm.o
|
||
wconsd.exe: wconsd.o win-scm.o $(LIBCLI)
|
||
$(CC) -o $@ $^ -lws2_32
|
||
|
||
portenum.exe: portenum.c
|
wconsd.c | ||
---|---|---|
|
||
#include "scm.h"
|
||
|
||
#include "libcli/libcli.h"
|
||
|
||
#define VERSION "0.2.6"
|
||
|
||
/* Size of buffers for send and receive */
|
||
... | ... | |
};
|
||
struct connection connection[MAXCONNECTIONS];
|
||
|
||
struct cli_def *cli;
|
||
|
||
int wconsd_init(int argc, char **argv);
|
||
int wconsd_main(int param1);
|
||
... | ... | |
return 0;
|
||
}
|
||
|
||
int libcli_test(struct cli_def *cli, char *command, char *argv[], int argc) {
|
||
int i;
|
||
cli_print(cli, "called %s with \"%s\"", __FUNCTION__, command);
|
||
cli_print(cli, "%d arguments:", argc);
|
||
for (i = 0; i < argc; i++)
|
||
cli_print(cli, " %s", argv[i]);
|
||
|
||
return CLI_OK;
|
||
}
|
||
|
||
|
||
/* Initialise wconsd: open a listening socket and the COM port, and
|
||
* create lots of event objects. */
|
||
int wconsd_init(int argc, char **argv) {
|
||
... | ... | |
return 12;
|
||
}
|
||
|
||
if (!(cli = cli_init())) {
|
||
dprintf(1,"wconsd: wconsd_init: failed run cli_init\n");
|
||
return 13;
|
||
}
|
||
cli_set_banner(cli, "wconsd serial to telnet");
|
||
cli_set_hostname(cli, (char *)hostname);
|
||
cli_set_idle_timeout(cli, 60);
|
||
cli_register_command(cli, NULL, "test", libcli_test, PRIVILEGE_UNPRIVILEGED,
|
||
MODE_EXEC, NULL);
|
||
#if 0
|
||
cli_set_auth_callback(cli, check_auth);
|
||
cli_set_enable_callback(cli, check_enable);
|
||
#endif
|
||
|
||
|
||
|
||
return 0;
|
||
}
|
||
|
||
... | ... | |
netprintf(&connection[i],"Serial Connection Closed by Connection ID %i\r\n",conn->id);
|
||
close_serial_connection(&connection[i]);
|
||
netprintf(conn,"Connection ID %i serial port closed\r\n",connid);
|
||
} else if (!strcmp(command, "menu")) {
|
||
cli_loop(cli,conn->net);
|
||
} else {
|
||
/* other, unknown commands */
|
||
netprintf(conn,"\r\nInvalid Command: '%s'\r\n\r\n",line);
|
Also available in: Unified diff
Add libcli to the mix