commit a423d52d96bacd87d40190f22f784ff0f347d299 Author: talksik Date: Sun Aug 3 16:03:42 2025 -0700 define arguments for todos diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e586fa3 --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +CC = gcc +CFLAGS = -Wall -g -Iinclude +TARGET = main +SRC = main.c +LIBS = -lcurl + +$(TARGET): $(SRC) + $(CC) $(CFLAGS) -o $(TARGET) $(SRC) $(LIBS) + +clean: + rm -f *.o $(TARGET) diff --git a/main.c b/main.c new file mode 100644 index 0000000..04aeddb --- /dev/null +++ b/main.c @@ -0,0 +1,31 @@ +#include + +struct data_t {}; + +void print_help() { + printf("Here is the help manual: \n" + "-c | create a todo\n" + "-l | list all todos\n" + "-d | delete a particular todo\n"); +} +int main(int argc, char *argv[]) { + printf("Hello world \n"); + + printf("Received %d arguments\n", argc); + + if (argc < 1) { + print_help(); + } + + for (int i = 0; i < argc; i++) { + printf("Argument: %s\n", argv[i]); + } + + int read = 0; + char **moving_ptr = argv; + while (read < argc) { // 0 < 2, 0 < 1 + printf("Argument (ptr loop method): %s\n", *moving_ptr); + moving_ptr = moving_ptr + 1; + read++; + } +}