|
version 1.13.4.1, 2014/04/29 01:21:44
|
version 1.16, 2019/02/04 21:22:31
|
|
Line 12 terms:
|
Line 12 terms:
|
| All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
| Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
| |
|
| Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 | Copyright 2004 - 2019 |
| by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
| |
|
| Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
|
Line 978 cliInit(int fin, int fout, const char *prompt)
|
Line 978 cliInit(int fin, int fout, const char *prompt)
|
| linebuffer_t *cli_buffer; |
linebuffer_t *cli_buffer; |
| bindkey_t *keys; |
bindkey_t *keys; |
| register int i; |
register int i; |
| |
char szPrompt[STRSIZ] = {[0 ... STRSIZ - 1] = 0}; |
| |
|
| /* init buffer */ |
/* init buffer */ |
| cli_buffer = e_malloc(sizeof(linebuffer_t)); |
cli_buffer = e_malloc(sizeof(linebuffer_t)); |
|
Line 994 cliInit(int fin, int fout, const char *prompt)
|
Line 995 cliInit(int fin, int fout, const char *prompt)
|
| SLIST_INIT(&cli_buffer->line_cmds); |
SLIST_INIT(&cli_buffer->line_cmds); |
| |
|
| if (prompt) { |
if (prompt) { |
| cli_buffer->line_prompt = e_strdup(prompt); | strlcpy(cli_buffer->line_porigin, prompt, sizeof cli_buffer->line_porigin); |
| | snprintf(szPrompt, sizeof szPrompt, "%s{%d}> ", cli_buffer->line_porigin, cli_buffer->line_level); |
| | cli_buffer->line_prompt = e_strdup(szPrompt); |
| if (!cli_buffer->line_prompt) { |
if (!cli_buffer->line_prompt) { |
| LOGERR; |
LOGERR; |
| e_free(cli_buffer); |
e_free(cli_buffer); |
|
Line 1355 cliNetLoop(linebuffer_t * __restrict cli_buffer, const
|
Line 1358 cliNetLoop(linebuffer_t * __restrict cli_buffer, const
|
| int sock, int timeout) |
int sock, int timeout) |
| { |
{ |
| u_char buf[BUFSIZ]; |
u_char buf[BUFSIZ]; |
| int pid, stat, pty, r, s, alen, flg, attrlen = 0, ret = 0; | int pid, stat, pty, s, alen, flg, attrlen = 0, ret = 0; |
| fd_set fds; |
fd_set fds; |
| struct timeval tv = { DEFAULT_SOCK_TIMEOUT, 0 }; |
struct timeval tv = { DEFAULT_SOCK_TIMEOUT, 0 }; |
| struct telnetAttrs *a, Attr[10]; |
struct telnetAttrs *a, Attr[10]; |
|
Line 1400 cliNetLoop(linebuffer_t * __restrict cli_buffer, const
|
Line 1403 cliNetLoop(linebuffer_t * __restrict cli_buffer, const
|
| break; |
break; |
| } |
} |
| |
|
| r = FD_ISSET(sock, &fds) ? sock : pty; |
|
| s = FD_ISSET(sock, &fds) ? pty : sock; |
s = FD_ISSET(sock, &fds) ? pty : sock; |
| |
|
| if (FD_ISSET(sock, &fds)) { |
if (FD_ISSET(sock, &fds)) { |