author | cu |
Sun, 15 Oct 2017 21:23:16 +0100 | |
changeset 550 | 58c3536c5a08 |
parent 472 | d1da4bd4d7e9 |
permissions | -rw-r--r-- |
472
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1 |
void welcome() { printf("Welcome!\n"); exit(0); } |
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2 |
void goodbye() { printf("Wrong identity, exiting!\n"); exit(1); } |
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
3 |
|
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
4 |
int main(){ |
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
char name[8]; |
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
6 |
char pw[8]; |
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
7 |
|
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
8 |
printf("login: "); |
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
9 |
get_line(name); |
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
10 |
printf("password: "); |
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
11 |
get_line(pw); |
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
12 |
|
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
13 |
if(match(name, pw) == 0) |
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
14 |
welcome(); |
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
15 |
else |
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
16 |
goodbye(); |
d1da4bd4d7e9
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
17 |
} |