Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <time.h>
- #include <unistd.h>
- #include <sys/types.h>
- #include <stdlib.h>
- #include <string.h>
- #include <signal.h>
- #include <sys/wait.h>
- #define SECONDS 10
- void sigHandler(int sigNum);
- void main(int argc, char** argv)
- {
- signal(SIGALRM, sigHandler);
- alarm(SECONDS);
- /*รงa marche pas !!!!!
- const char* myStr = "Hello vorld.\n";
- int output;
- asm("mov $39, %eax");
- asm("mov %1, %ebx" : "=r" (output) : "r" (&myStr));
- asm("mov $0x0, %ecx");
- asm("int $0x80");
- //*/
- char* buffer = malloc(255);
- printf("Entrez le mot de passe:\n");
- scanf("%s", buffer);
- if(strcmp(buffer, "testlol") == 0)
- {
- printf("Bravo :o\n");
- }
- }
- void sigHandler(int sigNum)
- {
- if(sigNum == SIGALRM)
- {
- static int amnt = 3;
- amnt--;
- if(amnt > 0)
- {
- printf("10s ecoulees. Il vous reste %d essai%s.\n", amnt, amnt!=1?"s":"");
- alarm(SECONDS);
- }
- else
- {
- perror("Temps total ecoule. Fermeture du programme.\n");
- exit(0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement