Skip to content

Commit

Permalink
feat: repl portion
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyTubongbanua committed Aug 3, 2023
1 parent 8366a91 commit f07c9dc
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/main.c → test/repl.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ int main()

// initialize buffer to use throughout program

size_t recvlen = 10000;
size_t recvlen = 32768;
unsigned char *recv = malloc(sizeof(unsigned char) * recvlen);
size_t *olen = malloc(sizeof(size_t));

Expand Down Expand Up @@ -137,6 +137,22 @@ int main()

printf("\"%.*s\"\n", (int)*olen, recv);


size_t commandlen = 32768;
unsigned char *command = malloc(sizeof(unsigned char) * commandlen);
memset(command, 0, commandlen);
while(1)
{
fgets(command, commandlen, stdin);
if(strcmp(command, "exit") == 0)
{
break;
}
atclient_connection_send(&secondary_connection, recv, recvlen, olen, command, strlen(command));
memset(command, 0, commandlen);
printf("\nrecv: \"%.*s\"\n\n", recvlen, recv);
}

goto exit;

exit: {
Expand Down

0 comments on commit f07c9dc

Please sign in to comment.