/* Example typop.c: gcc -o typop typop.c -fstack-protector -fPIE -pie */ #include #include #include #include void getFeedback() { char buf[10] = {0}; puts("Do you like ctf?"); read(STDIN_FILENO, buf, 30); printf("You said: %s\n", buf); if (buf[0] == 'y') { printf("That\'s great! "); } else { printf("Aww :( "); } puts("Can you provide some extra feedback?"); read(STDIN_FILENO, buf, 90); } void win(char c1, char c2, char c3) { FILE *f; int res; char buf[48] = {0}; char filename[10] = {c1, c2, c3, 'g', '.', 't', 'x', 't', '\0'}; f = fopen(filename, "r"); if (f == NULL) { puts("Error opening flag file."); exit(1); } fgets(buf, 32, f); puts(buf); } int main(void) { int res; while (true) { res = puts("Do you want to complete a survey?"); if (res == 0) { return 0; } res = getchar(); if (res != 'y') break; getchar(); getFeedback(); } return 0; }