challenge.c 504 Bytes
Newer Older
1
#include <string.h>
2
3
4
#include <stdio.h>
#include <stdlib.h>

gnomus's avatar
gnomus committed
5
int main() {
6
    int ret;
anthraxx's avatar
anthraxx committed
7
    size_t nbytes = 0;
8
    char *input_str = NULL;
9
10
11
    char *password = "23door42\n";

    puts("Please enter Password: ");
12
    ret = getline(&input_str, &nbytes, stdin);
13

14
    if (ret == -1) {
15
        puts("Error");
16
    } else if (strcmp(input_str, password) == 0) {
17
18
        puts("Success");
        ret = 0;
19
    } else {
20
21
        puts("How about no?!");
        ret = -1;
22
23
    }

24
    free(input_str);
25
    return ret;
26
}