Browse Source

Initial commit

master
T. Meissner 5 years ago
commit
3c0d6a08cc
4 changed files with 54 additions and 0 deletions
  1. +10
    -0
      chapter_02/Makefile
  2. +7
    -0
      chapter_02/hello_world.c
  3. +10
    -0
      chapter_04/Makefile
  4. +27
    -0
      chapter_04/prompt.c

+ 10
- 0
chapter_02/Makefile View File

@ -0,0 +1,10 @@
all: hello_world
%: %.c
cc -std=c11 -Wall $@.c -o $@
.PHONY: clean
clean:
rm -rf hello_world

+ 7
- 0
chapter_02/hello_world.c View File

@ -0,0 +1,7 @@
#include <stdio.h>
int main(int argc, char** argv) {
puts("Hello, world!");
return 0;
}

+ 10
- 0
chapter_04/Makefile View File

@ -0,0 +1,10 @@
all: prompt
%: %.c
cc -std=c11 -Wall $@.c -o $@
.PHONY: clean
clean:
rm -rf prompt

+ 27
- 0
chapter_04/prompt.c View File

@ -0,0 +1,27 @@
#include <stdio.h>
/* Declare a buffer for user input of size 2048 */
static char input[2048];
int main(int argc, char const *argv[])
{
/* Print version and exit information */
puts("Lispy version 0.0.0.0.1");
puts("Press Ctrl+c to exit\n");
/* In a never ending loop */
while (1) {
/* Output our prompt */
fputs("lispy> ", stdout);
/* Read a line of user input of max size 2014 */
fgets(input, 2048, stdin);
/* Echo input back to user */
printf("No you're a %s", input);
}
return 0;
}

Loading…
Cancel
Save