- 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
21 lines
364 B
C
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;
|
|
}
|