summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-06-12Remove unecessary includes.mrb0nk500
This is because I now have these includes in `network.h`.
2021-06-12Start work on the networking code.mrb0nk500
2021-06-12Start work on the git related code.mrb0nk500
2021-06-12Expanded all instances of `did_fail`, andmrb0nk500
`did_fail_reason`. I also replaced all instances of `log` in the expanded `did_fail_reason` instances with `log_reason`.
2021-06-12Removed `did_fail`, and `did_fail_reason`, and addedmrb0nk500
`log_reason`. I didn't realize just how unreadable the codebase became, with those two macros.
2021-06-12Replaced all log messages with the macros frommrb0nk500
`macros.h`. This was done not only to make it smaller, and easier to read, but also to make it easier for debugging.
2021-06-12Created `macros.h`.mrb0nk500
This header contains any macros that're widely used throughout the codebase.
2021-06-11Replace call to `malloc()` with call to `calloc()` inmrb0nk500
the config parser. Because `calloc()` zeros out the allocated space, we can remove the previous call to `memset()`.
2021-06-11Replace `!` with `== 0` for all calls tomrb0nk500
`strcasecmp()`. This was done to make it more readable.
2021-06-11Remove unneeded call to `memset()` in `make_str()`.mrb0nk500
2021-06-11Change `port` from an int to a string, and move themrb0nk500
valid port check into the config parser.
2021-06-11Added a test config file.mrb0nk500
2021-06-11Added failure reasons to all the failure log messagesmrb0nk500
in `init_socket()`.
2021-06-10Changed `fd` to a `const int`, and added a failedmrb0nk500
socket creation reason in `init_socket()`.
2021-06-10Fixed a typo in `init_socket()`.mrb0nk500
Accidentally used `sprintf()`, instead of `snprintf()`.
2021-06-10Finished `init_socket()`.mrb0nk500
2021-06-10Added the include for `netdb.h`.mrb0nk500
2021-06-10Fixed a bug in `parse_config()` that was caused by notmrb0nk500
zeroing `cfg`.
2021-06-10Added the `cleanup()`, and `cleanup_config()`mrb0nk500
functions.
2021-06-10Added the `make_str()` function.mrb0nk500
This function automatically allocates a string that's the same size of the supplied string, and copies it to this newly allocated string, which is then returned. Since this uses `malloc()`, it must be `free()`'d after it's been used.
2021-06-09Fixed segfault in `read_file()` that occured whenevermrb0nk500
the file couldn't be opened. Forgot about that call to `fclose()`.
2021-06-09Added the socket, and network includes.mrb0nk500
Forgot to add them. oof
2021-06-09Started work on adding the socket initialization code.mrb0nk500
2021-06-09Moved the main loop into a separate function.mrb0nk500
2021-06-09Move the main loop code into an if statement.mrb0nk500
This was done to make it easier to understand what's going on.
2021-06-08Fixed a typo in `init_config()`.mrb0nk500
2021-06-08Include `config.h` in `pullreqd.c`.mrb0nk500
I forgot to add it. oof
2021-06-08Added the config file initialization code.mrb0nk500
2021-06-08Added the `init_config()` function.mrb0nk500
This function reads the config file supplied by `config_file`, and initialize the `config *` supplied by `cfg` accordingly. `init_config()` returns true if the config file was successfully read, otherwise, it returns false.
2021-06-08Added the `done` flag.mrb0nk500
This flag, when true, exits the main loop, and thus exits the program.
2021-06-08Treat `TYPE_BOOL` the same as `TYPE_INT`.mrb0nk500
The reason for keeping `TYPE_BOOL` is for readability.
2021-06-08Remove the `b` member from the `config_val` union.mrb0nk500
We can use the `i` member instead.
2021-06-08Removed unnecessary comment in `config_opts`.mrb0nk500
2021-06-07Fixed a bug with offsets being handled improperly inmrb0nk500
`set_config_opt()`.
2021-06-07Fixed a segfault in `parse_config()`.mrb0nk500
2021-06-07Fixed a segfault bug in `get_line()`.mrb0nk500
2021-06-07Fixed a typo, and replaced a `NULL` in the offset ofmrb0nk500
the null entry with -1 in `config_opts`.
2021-06-07Removed the casts to `long` in `parse_option_value()`.mrb0nk500
They weren't needed.
2021-06-07Fixed a bug in one of the checks in `read_file()`.mrb0nk500
2021-06-07Added the `set_config_opt()` function.mrb0nk500
This function takes the offset of a given member of a config option in a `config` struct, and sets the member to the value supplied by `val`, with the type of value being determined by `type`.
2021-06-07Added the `config` struct.mrb0nk500
This data structure holds all of the variables set by the config file options.
2021-06-07Replace `func` in config_opt with `offset`.mrb0nk500
`offset` is the offset of the member of the config option in the `config` struct. This was done in order to allow for setting any member of the config struct with just a single function.
2021-06-06Moved `TYPE_NONE` to the start of `config_type`, andmrb0nk500
added `TYPE_COUNT` at the end of `config_type`. This is to allow for any iterators that need to count upto the total number of types to just to count up to `TYPE_COUNT`.
2021-06-06Added the config option value parser.mrb0nk500
This function, called `parse_option_value()`, parses the supplied `value` string, and based on the value type supplied by `opt`, sets a given member of `val` for that value type.
2021-06-06Added a loop for finding a valid config option.mrb0nk500
I also added a call to a function that parses the value of the config option.
2021-06-06Added a NULL entry to the end of `config_opts`.mrb0nk500
2021-06-06Added a new union called `config_val`.mrb0nk500
This is so that I don't have to cast the variable as a `void *`, and make it easier to read. I also added `TYPE_NONE` to the `config_type` enum for denoting that the config option doesn't take a value.
2021-06-05Fixed a bug, and typo in the `strtok_r()` call in themrb0nk500
config parser loop.
2021-06-05Replace `find_line()` with `get_line()`.mrb0nk500
The loop body was also changed accordingly. This was done to make the config parser easier to read.
2021-06-05Move the config option stuff into `config.h`.mrb0nk500