Compare commits

..

No commits in common. "353b77271d7e5daa6eebb45aa8e05c45acfea096" and "94cd12ac8250ef478b1c50ed3161a144c466e95c" have entirely different histories.

3 changed files with 3 additions and 67 deletions

1
lcthw/.gitignore vendored
View File

@ -3,4 +3,3 @@ ex3
ex7
ex8
ex9
ex10

View File

@ -1,7 +1,6 @@
CFLAGS ?= -Wall -g
GDBRUN = gdb --batch --ex run --ex bt --ex q --args
BUILD_TARGETS = ex1 ex3 ex7 ex8 ex9 ex10
TEST_TARGETS = ex1 ex3 ex7 ex8 ex9
BUILD_TARGETS = ex1 ex3 ex7 ex8 ex9
.PHONY: all
all: build test
@ -15,10 +14,10 @@ build: $(BUILD_TARGETS)
.PHONY: gtest
gtest:
@$(foreach bt,$(TEST_TARGETS),$(GDBRUN) ./$(bt) &&) \
@$(foreach bt,$(BUILD_TARGETS),$(GDBRUN) ./$(bt) &&) \
echo ' gYAY'
.PHONY: test
test:
@$(foreach bt,$(TEST_TARGETS),./$(bt) &&) \
@$(foreach bt,$(BUILD_TARGETS),./$(bt) &&) \
echo ' YAY'

View File

@ -1,62 +0,0 @@
#include <stdio.h>
int main(int argc, char *argv[])
{
if (argc < 2) {
printf("ERROR: You need at least one argument.\n");
// this is how you abort a program
return 1;
}
int i = 0;
int arg = 1;
for (arg = 1; arg < argc; arg++) {
for (i = 0; argv[arg][i] != '\0'; i++) {
printf("(%d) ", arg);
char letter = argv[arg][i];
// lowercase letters
if (letter >= 'A' && letter <= 'Z') {
letter += ('a' - 'A');
}
switch (letter) {
case 'a':
printf("%d: 'a'\n", i);
break;
case 'e':
printf("%d: 'e'\n", i);
break;
case 'i':
printf("%d: 'i'\n", i);
break;
case 'o':
printf("%d: 'o'\n", i);
break;
case 'u':
printf("%d: 'u'\n", i);
break;
case 'y':
// why i > 2? is this a bug?
if (i > 2) {
// it's only sometimes Y
printf("%d: 'y'\n", i);
} else {
printf("%d: %c is not a vowel\n", i, letter);
}
break;
default:
printf("%d: %c is not a vowel\n", i, letter);
}
}
}
return 0;
}