diff options
| author | Franklin Wei <git@fwei.tk> | 2015-12-05 13:20:26 -0500 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2015-12-05 13:20:26 -0500 |
| commit | cdd4bc0b411d6834952434b80313b5ee0b131db0 (patch) | |
| tree | 215ce96e0f2de497bd257f582384aba49d5942bf /src/client.c | |
| parent | 8fca7ee4076aaefe7122be86abda5e9ae6a50ff7 (diff) | |
| download | netcosm-cdd4bc0b411d6834952434b80313b5ee0b131db0.zip netcosm-cdd4bc0b411d6834952434b80313b5ee0b131db0.tar.gz netcosm-cdd4bc0b411d6834952434b80313b5ee0b131db0.tar.bz2 netcosm-cdd4bc0b411d6834952434b80313b5ee0b131db0.tar.xz | |
telnet support
Diffstat (limited to 'src/client.c')
| -rw-r--r-- | src/client.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/client.c b/src/client.c index 5555bd5..18c390c 100644 --- a/src/client.c +++ b/src/client.c @@ -13,6 +13,11 @@ void __attribute__((format(printf,1,2))) out(const char *fmt, ...) write(client_fd, buf, sizeof(buf)); } +void out_raw(const unsigned char *buf, size_t len) +{ + write(client_fd, buf, len); +} + #define BUFSZ 128 char *client_read(void) @@ -32,6 +37,8 @@ tryagain: printf("Read '%s'\n", buf); if(buf[0] & 0x80) { + telnet_handle_command((unsigned char*)buf); + free(buf); goto tryagain; } @@ -54,6 +61,8 @@ void client_main(int fd, struct sockaddr_in *addr, int total) { client_fd = fd; + telnet_init(); + char *ip = inet_ntoa(addr->sin_addr); printf("New client %s\n", ip); printf("Total clients: %d\n", total); |