automated code cleanup
This commit is contained in:
parent
61f693f89b
commit
7a78055d06
@ -3,8 +3,10 @@
|
||||
|
||||
#include "lfinput.h"
|
||||
|
||||
#define GRID_SZ 1000
|
||||
|
||||
void advent2015day06(void) {
|
||||
char *input = get_input("input/2015/06");
|
||||
printf("Solution for Day 06 of 2015 is not completed yet\n");
|
||||
|
||||
char *input = get_lines("input/2015/06");
|
||||
free(input);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ static void solution(long p2) {
|
||||
}
|
||||
const char *errstr;
|
||||
long n = 0;
|
||||
n = (long)strtonum(sp[1], LONG_MIN, LONG_MAX, &errstr);
|
||||
n = (long) strtonum(sp[1], LONG_MIN, LONG_MAX, &errstr);
|
||||
if (errstr) {
|
||||
printf("Failed to convert %s to long\n", sp[i]);
|
||||
exit(1);
|
||||
|
34
src/main.c
34
src/main.c
@ -3,7 +3,9 @@
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#include <bsd/stdlib.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "advent2015.h"
|
||||
@ -14,7 +16,7 @@
|
||||
#include "advent2020.h"
|
||||
#include "advent2021.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int main(int argc, char **argv) {
|
||||
if (argc != 3) {
|
||||
printf("Usage: advent $YEAR $DAY\nExample: advent 15 1 will run Solution Day 01 of 2015\n\n");
|
||||
return 1;
|
||||
@ -36,14 +38,28 @@ int main(int argc, char** argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch(year) {
|
||||
case 15: solutions2015[day-1](); break;
|
||||
case 16: solutions2016[day-1](); break;
|
||||
case 17: solutions2017[day-1](); break;
|
||||
case 18: solutions2018[day-1](); break;
|
||||
case 19: solutions2019[day-1](); break;
|
||||
case 20: solutions2020[day-1](); break;
|
||||
case 21: solutions2021[day-1](); break;
|
||||
switch (year) {
|
||||
case 15:
|
||||
solutions2015[day - 1]();
|
||||
break;
|
||||
case 16:
|
||||
solutions2016[day - 1]();
|
||||
break;
|
||||
case 17:
|
||||
solutions2017[day - 1]();
|
||||
break;
|
||||
case 18:
|
||||
solutions2018[day - 1]();
|
||||
break;
|
||||
case 19:
|
||||
solutions2019[day - 1]();
|
||||
break;
|
||||
case 20:
|
||||
solutions2020[day - 1]();
|
||||
break;
|
||||
case 21:
|
||||
solutions2021[day - 1]();
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user