-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
99 lines (87 loc) · 2.9 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#include "convert.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
// Greetings
const char *morning_greeting_text = "|| ღ Ohayo, %s~\n";
const char *greeting_text = "|| ღ Kon ni chi va, %s!\n";
const char *evening_greeting = "|| (๑> . <) Kon ba n va, %s\n";
const char *night_greeting_text = "|| (⌒ω⌒)ノ Oya sumi nasa i, %s >•<\n";
// Time formats
const char *time_text = "|| ☆ Time is |%02d:%02d| nya~\n|| Today is %s %d, %s ヽ(*・ω・)ノ☆\n||\n";
// Additional texts
const char *good_luck = "|| Have a goowd day, senpai~\n";
const char *good_code = "|| Good cowding, senpai (^ω~)\n";
const char *love_ya_sempai = "|| (o^ ^o) L..l..love you ♡\n";
const char *kitty =
" /ᐢ⑅ᐢ\\ ♡ ₊˚ \n"
"꒰ ˶• ༝ •˶꒱ ♡‧₊˚ ♡\n"
"./づ~ :¨·.·¨: ₊˚ \n"
" `·..·‘ ₊˚ ♡\n";
int main(int argc, const char *argv[]) {
const char *USERNAME = getlogin();
time_t nani = time(NULL);
struct tm *local_time = localtime(&nani);
srand(time(NULL));
int choice = 1 + rand() % 4;
const char *letter;
if (choice == 1) { letter = good_luck; }
if (choice == 2) { letter = good_code; }
if (choice == 3) { letter = love_ya_sempai; }
if (choice == 4) { letter = kitty; }
system("clear");
if (local_time->tm_hour < 11 && local_time->tm_hour >= 6) {
printf(morning_greeting_text, USERNAME);
printf(
time_text,
local_time->tm_hour,
local_time->tm_min,
getYearMonth(local_time->tm_mon),
local_time->tm_mday,
getWeekDay(local_time->tm_wday)
);
printf("%s", letter);
return 0;
}
if (local_time->tm_hour >= 11 && local_time->tm_hour < 18) {
printf(greeting_text, USERNAME);
printf(
time_text,
local_time->tm_hour,
local_time->tm_min,
getYearMonth(local_time->tm_mon),
local_time->tm_mday,
getWeekDay(local_time->tm_wday)
);
printf("%s", letter);
return 0;
}
if (local_time->tm_hour > 17 && local_time->tm_hour <= 22) {
printf(evening_greeting, USERNAME);
printf(
time_text,
local_time->tm_hour,
local_time->tm_min,
getYearMonth(local_time->tm_mon),
local_time->tm_mday,
getWeekDay(local_time->tm_wday)
);
printf("%s", letter);
return 0;
}
if (local_time->tm_hour > 22 || local_time->tm_hour < 6) {
printf(night_greeting_text, USERNAME);
printf(
time_text,
local_time->tm_hour,
local_time->tm_min,
getYearMonth(local_time->tm_mon),
local_time->tm_mday,
getWeekDay(local_time->tm_wday)
);
printf("%s", letter);
return 0;
}
return 0;
}