This commit is contained in:
parent
5d4eccff4a
commit
a9198e4331
@ -8,5 +8,4 @@ steps:
|
||||
commands:
|
||||
- xbps-install -Sy gcc make
|
||||
- make
|
||||
- cd 01
|
||||
- ./day1
|
||||
- ./run_all.sh
|
||||
|
@ -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);
|
9
run_all.sh
Executable file
9
run_all.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAYS="day1"
|
||||
|
||||
for x in $DAYS; do
|
||||
echo "running" $x
|
||||
./$x
|
||||
echo "complete"
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user