From ec8c94dc43db11c79ef58b212cacfadec09bb59c Mon Sep 17 00:00:00 2001 From: Jack Jamison Date: Fri, 17 Oct 2025 18:21:51 -0400 Subject: lines argument --- args.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 args.c (limited to 'args.c') diff --git a/args.c b/args.c new file mode 100644 index 0000000..5fe2f89 --- /dev/null +++ b/args.c @@ -0,0 +1,26 @@ +#include +#include +#include +#include + +#include "args.h" + +void parse_args(client_state* state, int argc, char* argv[]) { + static struct option long_opts[] = { + {"lines", required_argument, 0, 'l'}, + {0, 0, 0, 0} + }; + + int opt; + int long_index = 0; + while ((opt = getopt_long(argc, argv, "l:", long_opts, &long_index)) != -1) { + switch (opt) { + case 'l': + state->lines = atoi(optarg); + break; + default: + fprintf(stderr, "Usage: NOT WHAT YOU TYPED\n"); + break; + } + } +} -- cgit v1.2.3