concierge/challenge/challenge.c

27 lines
504 B
C
Raw Normal View History

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