aboutsummaryrefslogtreecommitdiff
path: root/args.c
diff options
context:
space:
mode:
authorJack Jamison <jackqjamison@gmail.com>2025-10-17 18:21:51 -0400
committerJack Jamison <jackqjamison@gmail.com>2025-10-17 18:21:51 -0400
commitec8c94dc43db11c79ef58b212cacfadec09bb59c (patch)
treedac513e9acb40b2d6f606031bb4d9299e2e8c423 /args.c
parent7abba4bd6aea943870bfd571866e36a6167c80a2 (diff)
lines argument
Diffstat (limited to 'args.c')
-rw-r--r--args.c26
1 files changed, 26 insertions, 0 deletions
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 <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <getopt.h>
+
+#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;
+ }
+ }
+}