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-07 18:21:13 +02:00
|
|
|
int bytes_read;
|
2014-06-10 12:39:36 +02:00
|
|
|
size_t nbytes = 0;
|
|
|
|
char *my_string = NULL;
|
2014-06-07 18:21:13 +02:00
|
|
|
char *password = "23door42\n";
|
|
|
|
|
|
|
|
puts("Please enter Password: ");
|
|
|
|
|
2014-06-10 12:39:36 +02:00
|
|
|
bytes_read = getline(&my_string, &nbytes, stdin);
|
2014-06-07 18:21:13 +02:00
|
|
|
|
|
|
|
if(bytes_read == -1) {
|
|
|
|
puts("Error");
|
2014-06-10 12:39:36 +02:00
|
|
|
free(my_string);
|
2014-06-07 18:21:13 +02:00
|
|
|
return -1;
|
|
|
|
} else {
|
2014-06-10 12:39:36 +02:00
|
|
|
if (strcmp(my_string, password) == 0) {
|
2014-06-07 18:21:13 +02:00
|
|
|
puts("Success");
|
2014-06-10 12:39:36 +02:00
|
|
|
free(my_string);
|
2014-06-07 18:21:13 +02:00
|
|
|
return 0;
|
|
|
|
} else {
|
|
|
|
puts("How about no?!");
|
2014-06-10 12:39:36 +02:00
|
|
|
free(my_string);
|
2014-06-07 18:21:13 +02:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|