2014-06-10 12:46:18 +02:00
|
|
|
#include <string.h>
|
2014-06-07 18:21:13 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2014-06-07 18:40:16 +02:00
|
|
|
int main() {
|
2014-06-10 13:01:34 +02:00
|
|
|
int ret;
|
2014-06-10 12:39:36 +02:00
|
|
|
size_t nbytes = 0;
|
2014-06-10 13:03:34 +02:00
|
|
|
char *input_str = NULL;
|
2014-06-07 18:21:13 +02:00
|
|
|
char *password = "23door42\n";
|
|
|
|
|
|
|
|
puts("Please enter Password: ");
|
2014-06-10 13:03:34 +02:00
|
|
|
ret = getline(&input_str, &nbytes, stdin);
|
2014-06-07 18:21:13 +02:00
|
|
|
|
2014-06-10 13:01:34 +02:00
|
|
|
if (ret == -1) {
|
2014-06-07 18:21:13 +02:00
|
|
|
puts("Error");
|
2014-06-10 13:03:34 +02:00
|
|
|
} else if (strcmp(input_str, password) == 0) {
|
2014-06-10 13:01:34 +02:00
|
|
|
puts("Success");
|
|
|
|
ret = 0;
|
2014-06-07 18:21:13 +02:00
|
|
|
} else {
|
2014-06-10 13:01:34 +02:00
|
|
|
puts("How about no?!");
|
|
|
|
ret = -1;
|
2014-06-07 18:21:13 +02:00
|
|
|
}
|
|
|
|
|
2014-06-10 13:03:34 +02:00
|
|
|
free(input_str);
|
2014-06-10 13:01:34 +02:00
|
|
|
return ret;
|
2014-06-07 18:21:13 +02:00
|
|
|
}
|