diff --git a/README.md b/README.md index 1a3567c..32741b3 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ Please complete this checklist (turn [ ] into [X]) before you submit: - [x] I completed java/compile.sh - [x] I completed java/run.sh - [x] I completed java/disassemble.sh -- [ ] I solved the C part: - - [ ] I implemented the C code - - [ ] I completed c/compile.sh - - [ ] I completed c/run.sh - - [ ] I completed c/disassemble.sh +- [x] I solved the C part: + - [x] I implemented the C code + - [x] I completed c/compile.sh + - [x] I completed c/run.sh + - [x] I completed c/disassemble.sh - [ ] I wrote the source code myself and did not look at the source code of my classmates - [ ] I ran test/test.sh and verified that it produces the expected output - [ ] I verified that the disassembled instructions appear (not just the function names) diff --git a/c/compile.sh b/c/compile.sh index f7d403e..bd22197 100755 --- a/c/compile.sh +++ b/c/compile.sh @@ -1,3 +1,3 @@ #!/bin/sh -# TODO Command to compile main.c with gcc +gcc -o main ./main.c \ No newline at end of file diff --git a/c/disassemble.sh b/c/disassemble.sh index 8998b77..a06d786 100755 --- a/c/disassemble.sh +++ b/c/disassemble.sh @@ -1,3 +1,3 @@ #!/bin/sh -# TODO Command to disassemble the compiled C program with otool +otool -xv ./main \ No newline at end of file diff --git a/c/main b/c/main new file mode 100755 index 0000000..a83213b Binary files /dev/null and b/c/main differ diff --git a/c/main.c b/c/main.c index 1abe391..e9cf8ab 100644 --- a/c/main.c +++ b/c/main.c @@ -1 +1,6 @@ -// TODO Write C code +#include +#include + +int main() { + puts(getenv("USER")); +} \ No newline at end of file diff --git a/c/run.sh b/c/run.sh index f65e9dd..a56af46 100755 --- a/c/run.sh +++ b/c/run.sh @@ -1,3 +1,3 @@ #!/bin/sh -# TODO Command to run the compiled C program +./main \ No newline at end of file