Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <stdlib.h> | ||
|
||
#define BUFFSIZE 30 | ||
|
||
int getPassword(char* buffer){ | ||
/* Get the Password */ | ||
printf("Enter Password> "); | ||
fgets(buffer, BUFFSIZE, stdin); | ||
//Remove the Newlines | ||
buffer[strcspn(buffer, "\r\n")] = 0; | ||
printf("\nYou put %s\n", buffer); | ||
} | ||
|
||
void showSuperWin(char* command){ | ||
printf("Super Win\n"); | ||
system(command); | ||
} | ||
|
||
void showWin(void){ | ||
printf("Congratulations you win\n"); | ||
} | ||
|
||
void showLose(void){ | ||
printf("Lose\n"); | ||
} | ||
|
||
void main(void){ | ||
char buffer[BUFFSIZE]; | ||
char *expected = "Swordfish"; | ||
|
||
getPassword(buffer); | ||
|
||
if (strcmp(buffer, expected) == 0){ | ||
__asm__("nop\n\t" | ||
"nop\n\t" | ||
"nop\n\t" | ||
"nop\n\t" | ||
"nop\n\t" | ||
"nop\n\t" | ||
"nop\n\t" | ||
"nop\n\t" | ||
"nop\n\t" | ||
"nop\n\t" | ||
"nop\n\t" | ||
"nop\n\t" | ||
"nop\n\t" | ||
"nop\n\t" | ||
"nop\n\t" | ||
"nop\n\t" | ||
"nop"); | ||
showWin(); | ||
} | ||
else{ | ||
showLose(); | ||
} | ||
} |