reorg
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
blackbeard420 2021-12-04 22:06:35 -05:00
parent 5d4eccff4a
commit a9198e4331
Signed by: blackbeard420
GPG Key ID: 88C719E09CDDA4A5
6 changed files with 16 additions and 6 deletions

View File

@ -8,5 +8,4 @@ steps:
commands:
- xbps-install -Sy gcc make
- make
- cd 01
- ./day1
- ./run_all.sh

View File

@ -1,6 +1,8 @@
#include <stdlib.h>
#include <stdio.h>
#define INPUT "inputs/input-day1"
void
first()
{
@ -8,7 +10,7 @@ first()
int total = 0;
static char buffer[1024];
FILE *f = fopen("input", "r");
FILE *f = fopen(INPUT, "r");
while(fgets(buffer, 1024, f)) {
int val = atoi(buffer);
@ -28,7 +30,7 @@ count_lines()
{
int total = 0;
static char buf[256];
FILE *f = fopen("input", "r");
FILE *f = fopen(INPUT, "r");
while(fgets(buf, 256, f))
total++;
fclose(f);
@ -42,7 +44,7 @@ load_all(int count)
int idx = 0;
static char buf[256];
FILE *f = fopen("input", "r");
FILE *f = fopen(INPUT, "r");
while(fgets(buf, 256, f)) {
i[idx] = atoi(buf);

View File

@ -1,4 +1,4 @@
DAYS = 01/day1
DAYS = day1
all: $(DAYS)

9
run_all.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
DAYS="day1"
for x in $DAYS; do
echo "running" $x
./$x
echo "complete"
done