Skip to content

Instantly share code, notes, and snippets.

@ghoshaakash
Last active November 11, 2023 21:21
Show Gist options
  • Save ghoshaakash/45f9273e5c282e174a1b7bd9a8d7947c to your computer and use it in GitHub Desktop.
Save ghoshaakash/45f9273e5c282e174a1b7bd9a8d7947c to your computer and use it in GitHub Desktop.
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <time.h>
void success()
{
char *strings[] = {
"*pets your head*",
"*gives you scritches*",
"you're such a smart cookie~",
"that's a good boy~",
"MOMMY thinks MOMMY's little boy earned a big hug~",
"good boy~\nMOMMY's so proud of you~",
"aww, what a good boy~\nMOMMY knew you could do it~",
"you did it~!",
"MOMMY loves you~",
"*gives you a sticker*"
};
int l=10;
srand(time(NULL));
printf(strings[rand()%l]);
printf("\n");
}
void fail()
{
char *strings[] = {
"MOMMY believes in you~",
"do you think you're going to get a reward from MOMMY like that~?",
"aww, you'll get it next time~",
"do you need MOMMY's help~?",
"MOMMY still loves you no matter what~",
"oh no did MOMMY's little boy make a big mess~?",
"MOMMY knows her little boy can do better~",
"MOMMY still loves you~",
"just a little further, sweetie~"
};
int l=9;
srand(time(NULL));
printf(strings[rand()%l]);
printf("\n");
}
int getTimeDifference(const char *file_path) {
struct stat file_info;
if (stat(file_path, &file_info) == 0) {
time_t access_time = file_info.st_atime;
time_t current_time = time(NULL);
double time_diff = difftime(current_time, access_time);
// Convert the time difference to seconds
int seconds_diff = (int)time_diff;
return seconds_diff;
}
return -1; // Error
}
int main(int argc, char* argv[])
{
int s=0;
printf("\n\n");
printf("Mommy feels you are calling mommy from: ");
system("cd");
if (argc==1)
{
printf("\nDarling, it would be absolutely wonderful if you could attach the source code, wouldn't it? MOMMY believes in you\n");
return 0;
}
else if (argc==2)
{
printf("\nDear, since you haven't chosen a name for your output file, MOMMY will lovingly name it 'output.exe' for you, sweetie~\n");
char comp[]="gcc ";
strcat(comp,argv[1]);
strcat(comp," -o output.exe -lm");
system(comp);
printf("\n");
s =getTimeDifference("output.exe");
}
else if (argc==3)
{
printf("\nOh, well done, darling! It appears you've provided all the necessary arguments. How impressive of you! MOMMY is proud of you~\n");
char comp[]="gcc ";
strcat(comp,argv[1]);
strcat(comp," -o ");
strcat(comp,argv[2]);
strcat(comp," -lm");
system(comp);
printf("\n");
s =getTimeDifference(argv[2]);
}
else
{
printf("\n");
printf("My dear, it seems you've showered me with too many arguments. I can only handle so much~");
printf("\n");
return 0;
}
if (s<2 & s!=-1)
{
success();
}
else
{
fail();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment