aboutsummaryrefslogtreecommitdiff
path: root/7.1
diff options
context:
space:
mode:
Diffstat (limited to '7.1')
-rw-r--r--7.1/Makefile8
-rw-r--r--7.1/main.c17
2 files changed, 25 insertions, 0 deletions
diff --git a/7.1/Makefile b/7.1/Makefile
new file mode 100644
index 0000000..ae5b7bd
--- /dev/null
+++ b/7.1/Makefile
@@ -0,0 +1,8 @@
+lower upper :
+ gcc -o lower main.c
+ cp lower upper
+
+.PHONY : clean
+clean:
+ rm lower upper
+
diff --git a/7.1/main.c b/7.1/main.c
new file mode 100644
index 0000000..f210c39
--- /dev/null
+++ b/7.1/main.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+int main(int argc, char *argv[])
+{
+ char c;
+
+ if (!strcmp(argv[0], "lower"))
+ while ((c = getchar()) != EOF)
+ putchar(tolower(c));
+ else
+ while ((c = getchar()) != EOF)
+ putchar(toupper(c));
+
+ return 0;
+}