mirror of
https://github.com/CPunch/Laika.git
synced 2024-11-21 12:40:04 +00:00
Shell: CTRL+A now kills the shell
This commit is contained in:
parent
7d9ed4ab87
commit
9a6562f440
@ -254,7 +254,7 @@ void shellC_connectToCNC(tShell_client *client, char *ip, char *port) {
|
||||
}
|
||||
|
||||
bool shellC_poll(tShell_client *client, int timeout) {
|
||||
struct sLaika_pollEvent *evnts, *evnt;
|
||||
struct sLaika_pollEvent *evnts;
|
||||
int numEvents, i;
|
||||
|
||||
/* run any scheduled tasks, this could be moved but it works fine here for now */
|
||||
@ -268,8 +268,7 @@ bool shellC_poll(tShell_client *client, int timeout) {
|
||||
return false;
|
||||
|
||||
for (i = 0; i < numEvents; i++) {
|
||||
evnt = &evnts[i];
|
||||
laikaP_handleEvent(evnt);
|
||||
laikaP_handleEvent(&evnts[i]);
|
||||
}
|
||||
|
||||
/* flush any events after (eg. made by a packet handler) */
|
||||
|
@ -77,6 +77,7 @@ void openShellCMD(tShell_client *client, int args, char *argc[]) {
|
||||
peer = shellS_getPeer(client, id);
|
||||
|
||||
PRINTINFO("Opening shell on peer %04d...\n");
|
||||
PRINTINFO("Use CTRL+A to kill the shell\n");
|
||||
|
||||
/* open shell on peer */
|
||||
shellT_getTermSize(&cols, &rows);
|
||||
@ -93,7 +94,11 @@ void openShellCMD(tShell_client *client, int args, char *argc[]) {
|
||||
if (sz <= 0) /* sanity check */
|
||||
break;
|
||||
|
||||
shellC_sendDataShell(client, buf, sz);
|
||||
/* ctrl + a; kill shell */
|
||||
if (buf[0] == '\01')
|
||||
shellC_closeShell(client);
|
||||
else
|
||||
shellC_sendDataShell(client, buf, sz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,5 +49,5 @@ void shellP_printInfo(tShell_peer *peer) {
|
||||
char buf[128]; /* i don't expect bin2hex to write outside this, but it's only user-info and doesn't break anything (ie doesn't write outside the buffer) */
|
||||
|
||||
sodium_bin2hex(buf, sizeof(buf), peer->pub, crypto_kx_PUBLICKEYBYTES);
|
||||
shellT_printf("\t%s@%s\n\tTYPE: %s\n\tOS: %s\n\tPUBKEY: %s\n\tINET: %s\n", peer->hostname, peer->ipv4, shellP_typeStr(peer), shellP_osTypeStr(peer), buf, peer->inet);
|
||||
shellT_printf("\t%s-%s\n\tOS: %s\n\tINET: %s\n\tPUBKEY: %s\n", peer->ipv4, peer->hostname, shellP_osTypeStr(peer), peer->inet, buf);
|
||||
}
|
Loading…
Reference in New Issue
Block a user