From fc776ca9e6684d641528b50bbcf18bfc142b6975 Mon Sep 17 00:00:00 2001 From: Claudio Maggioni Date: Fri, 22 Sep 2023 20:44:41 +0200 Subject: [PATCH] Done C part --- README.md | 10 +++++----- c/compile.sh | 2 +- c/disassemble.sh | 2 +- c/main | Bin 0 -> 33056 bytes c/main.c | 7 ++++++- c/run.sh | 2 +- 6 files changed, 14 insertions(+), 9 deletions(-) create mode 100755 c/main 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 0000000000000000000000000000000000000000..a83213b89f0e551931c7896c7d2a85c5de1d272a GIT binary patch literal 33056 zcmeI*yH6BB9Ki8e9*P2b(Zpz!d1mrbGv z__$S?HOrJ-vbGkk)O;XCcD$%p9!A=a`AalT`nskT6ZuoFu(n#O&s4XYvg5t<<8}Be zk~rzm=EvLR8?2qJ)|Shax$U^|dEff+^qDkioKE@<(#hI-<#D-EvgOKyB{`9u-#b5^ zz9UTyoYQ?;G#4*N2D3;%6tg~B#LpO{4gUK3+GV_vHQ{F9__?)l0_DjY@?w*k`^U`wB$MX`OlUVP0 zSn_L$bzS_BQrp`lk4R1@y*A0|_H_Mglv!W?aHsi<6z=&nmUK#pvpcZ%d1J4X=RZz;+UmY1wXN>^a-0|| zj!NP70w;Uh)1~h5)jhzn|JmhNem}6rx_7ukdgfej36kx_uBwMz0I4kO6`N(q`wvT3C5x?8ADkDsf=V9v$2?*~NJqu7tDoT4?9P=~B3CS{J9w71P~p zqNjR^q@ +#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