Compare commits
No commits in common. "d4b5c737e5573ae136a600697d0077fd0235289d" and "ea9cb1f84676ffdfb951a64bd3374d824a04128c" have entirely different histories.
d4b5c737e5
...
ea9cb1f846
@ -1,3 +0,0 @@
|
|||||||
carrot
|
|
||||||
angelfood
|
|
||||||
yellow
|
|
@ -1,5 +0,0 @@
|
|||||||
garble
|
|
||||||
geckle
|
|
||||||
gimple
|
|
||||||
gorble
|
|
||||||
gunkle
|
|
1
lcthw/.gitignore
vendored
1
lcthw/.gitignore
vendored
@ -6,4 +6,3 @@ ex9
|
|||||||
ex10
|
ex10
|
||||||
ex11
|
ex11
|
||||||
ex12
|
ex12
|
||||||
ex13
|
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
CFLAGS ?= -Wall -g
|
CFLAGS ?= -Wall -g
|
||||||
GDBRUN = gdb --batch --ex run --ex bt --ex q --args
|
GDBRUN = gdb --batch --ex run --ex bt --ex q --args
|
||||||
BUILD_TARGETS = $(foreach ex,$(wildcard ex*.c),$(subst .c,,$(ex)))
|
BUILD_TARGETS = ex1 ex3 ex7 ex8 ex9 ex10 ex11 ex12
|
||||||
|
TEST_TARGETS = ex1 ex3 ex7 ex8 ex9 ex11 ex12
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: build test
|
all: build test
|
||||||
|
|
||||||
.PHONY: echo
|
|
||||||
echo:
|
|
||||||
@echo BUILD_TARGETS=$(BUILD_TARGETS)
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f $(BUILD_TARGETS)
|
rm -f $(BUILD_TARGETS)
|
||||||
@ -18,18 +15,16 @@ build: $(BUILD_TARGETS)
|
|||||||
|
|
||||||
.PHONY: gtest
|
.PHONY: gtest
|
||||||
gtest:
|
gtest:
|
||||||
@$(foreach bt, $(BUILD_TARGETS), make .gtest.$(bt) &&) \
|
@$(foreach bt, $(TEST_TARGETS), make .gtest.$(bt) &&) \
|
||||||
printf '\ngYAY\n'
|
printf '\ngYAY\n'
|
||||||
|
|
||||||
.gtest.%:
|
.gtest.%:
|
||||||
@test_argv=$$(cat .$*.argv 2>/dev/null || echo) && \
|
|
||||||
printf '\n==> %s\n' "$*" && $(GDBRUN) ./$*
|
printf '\n==> %s\n' "$*" && $(GDBRUN) ./$*
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
@$(foreach bt, $(BUILD_TARGETS), make .test.$(bt) &&) \
|
@$(foreach bt, $(TEST_TARGETS), make .test.$(bt) &&) \
|
||||||
printf '\nYAY\n'
|
printf '\nYAY\n'
|
||||||
|
|
||||||
.test.%:
|
.test.%:
|
||||||
@test_argv=$$(cat .$*.argv 2>/dev/null || echo) && \
|
printf '\n==> %s\n' "$*" && ./$*
|
||||||
printf '\n==> %s\n' "$*" && ./$* $$test_argv
|
|
||||||
|
26
lcthw/ex13.c
26
lcthw/ex13.c
@ -1,26 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
// go through each string in argv
|
|
||||||
// why am I skipping argv[0]?
|
|
||||||
for (i = 1; i < argc; i++) {
|
|
||||||
printf("arg %d: %s\n", i, argv[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// let's make our own array of strings
|
|
||||||
char *states[] = {
|
|
||||||
"California",
|
|
||||||
"Oregon",
|
|
||||||
"Washington",
|
|
||||||
"Texas",
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
for (i = 0; states[i] != NULL; i++) {
|
|
||||||
printf("state %d: %s\n", i, states[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user