Skip to content

Commit d577158

Browse files
committed
Merge branch 'master' of github.com:seckcoder/csapp
2 parents b15227a + fff1adf commit d577158

14 files changed

+504
-359
lines changed

assembly/Makefile

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
all:main
1+
all:main main.s
22

3+
main.s:main.c
4+
gcc -m32 -g -S main.c
35
main: main.c
4-
gcc -g main.c -o main
6+
gcc -m32 -g main.c -o main
7+
8+
clean:
9+
rm main.s main

assembly/main

-3.15 KB
Binary file not shown.

assembly/main.c

+6-33
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,16 @@
11
#include <stdio.h>
22

3-
int bar1(int x) {
4-
return x;
5-
}
63

7-
int bar2(int x, int y) {
8-
return x + y;
4+
void Gets(char *s) {
95
}
106

11-
12-
int bar3(int x, int y, int z) {
13-
return x + y + z;
14-
}
15-
16-
int bar4(int x, int y, int z, int w) {
17-
return x + y + z + w;
18-
}
19-
20-
void foo() {
21-
int x = 3;
22-
bar1(x);
23-
int y = 4;
24-
bar2(x,y);
25-
int z = 5;
26-
bar3(x,y,z);
27-
int w = 6;
28-
bar4(x,y,z,w);
29-
}
30-
31-
32-
void input() {
33-
char s[] = "1 a 1";
34-
int x,y;
35-
char c;
36-
int v = sscanf(s, "%d %c %d", &x,&c,&y);
37-
printf("%d: %d %c %d\n", v, x,c,y);
7+
int getbuf() {
8+
char buf[32];
9+
Gets(buf);
10+
return 1;
3811
}
3912

4013
int main() {
41-
input();
14+
getbuf();
4215
return 0;
4316
}

0 commit comments

Comments
 (0)