net-tools/src/cli/handlers/handle_size.c
lohhiiccc f6af6473db test(cli/handlers): add unit tests for CLI handlers
- Add unit tests for handlers
- Update sources.mk to remove test_parse.c from test sources
- Fix in handle_size to set packet_size instead of count
2026-03-03 11:26:58 +01:00

21 lines
364 B
C

#include "cli.h"
#include "ft_ping.h"
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
int
cli_handle_size(const char *arg, t_ping_config *config)
{
uint64_t size;
if (0 != cli_parse_uint64(arg, &size) || size > (65535 - 8))
{
dprintf(STDERR_FILENO, "Invalide size\n");
return CLI_ERROR;
}
config->packet_size = size;
return CLI_SUCCESS;
}