| 14 |
* * |
* * |
| 15 |
***************************************************************************/ |
***************************************************************************/ |
| 16 |
|
|
| 17 |
|
#include "common.h" |
| 18 |
#include "io.h" |
#include "io.h" |
| 19 |
#include "log.h" |
#include "log.h" |
|
#include "common.h" |
|
| 20 |
#include <errno.h> |
#include <errno.h> |
| 21 |
#include <stdio.h> |
#include <fcntl.h> |
| 22 |
#include <stdarg.h> |
#include <stdarg.h> |
| 23 |
|
#include <stdio.h> |
| 24 |
#include <string.h> |
#include <string.h> |
| 25 |
#include <time.h> |
#include <time.h> |
|
#include <fcntl.h> |
|
| 26 |
#include <unistd.h> |
#include <unistd.h> |
|
#include <sys/select.h> |
|
|
#include <sys/ioctl.h> |
|
| 27 |
#include <sys/epoll.h> |
#include <sys/epoll.h> |
| 28 |
|
#include <sys/ioctl.h> |
| 29 |
|
#include <sys/select.h> |
| 30 |
|
#include <libssh/callbacks.h> |
| 31 |
#include <libssh/libssh.h> |
#include <libssh/libssh.h> |
| 32 |
#include <libssh/server.h> |
#include <libssh/server.h> |
|
#include <libssh/callbacks.h> |
|
| 33 |
|
|
| 34 |
static char stdout_buf[BUFSIZ]; |
static char stdout_buf[BUFSIZ]; |
| 35 |
static int stdout_buf_len = 0; |
static int stdout_buf_len = 0; |
| 176 |
} |
} |
| 177 |
else |
else |
| 178 |
{ |
{ |
| 179 |
|
#ifdef _DEBUG |
| 180 |
log_error("write(STDOUT) error (%d)\n", errno); |
log_error("write(STDOUT) error (%d)\n", errno); |
| 181 |
|
#endif |
| 182 |
retry = 0; |
retry = 0; |
| 183 |
break; |
break; |
| 184 |
} |
} |
| 335 |
} |
} |
| 336 |
else |
else |
| 337 |
{ |
{ |
| 338 |
|
#ifdef _DEBUG |
| 339 |
log_error("read(STDIN) error (%d)\n", errno); |
log_error("read(STDIN) error (%d)\n", errno); |
| 340 |
|
#endif |
| 341 |
loop = 0; |
loop = 0; |
| 342 |
break; |
break; |
| 343 |
} |
} |
| 357 |
} |
} |
| 358 |
|
|
| 359 |
// For debug |
// For debug |
| 360 |
// for (int j = pos; j < len; j++) |
#ifdef _DEBUG |
| 361 |
// { |
for (int j = pos; j < len; j++) |
| 362 |
// log_common("Debug: <--[%u]\n", (buf[j] + 256) % 256); |
{ |
| 363 |
// } |
log_common("Debug: <--[%u]\n", (buf[j] + 256) % 256); |
| 364 |
|
} |
| 365 |
|
#endif |
| 366 |
} |
} |
| 367 |
|
|
| 368 |
fcntl(STDIN_FILENO, F_SETFL, flags); |
fcntl(STDIN_FILENO, F_SETFL, flags); |
| 817 |
} |
} |
| 818 |
|
|
| 819 |
// for debug |
// for debug |
| 820 |
// if (out != KEY_TIMEOUT && out != KEY_NULL) |
#ifdef _DEBUG |
| 821 |
// { |
if (out != KEY_TIMEOUT && out != KEY_NULL) |
| 822 |
// log_common("Debug: -->[0x %x]\n", out); |
{ |
| 823 |
// } |
log_common("Debug: -->[0x %x]\n", out); |
| 824 |
|
} |
| 825 |
|
#endif |
| 826 |
|
|
| 827 |
return out; |
return out; |
| 828 |
} |
} |