Added AmogOwOS support

This commit is contained in:
TheDarkBug 2021-09-10 00:51:37 +02:00
parent d61bd391bd
commit 3ecf05e4a1
4 changed files with 89 additions and 67 deletions

View file

@ -10,7 +10,7 @@ Nyalpine, Nyarch Linuwu, ArcOwO, Nyartix Linuwu, Debinyan, endevaOwO, Fedowa, Ge
### Partial support (Either no ASCII art, or no image is provided)
KDE NeOwOn, nixOwOs; Plus FweeBSD, OwOpenBSD and macOwOS; Plus WinyandOwOws.
AmogOwOS, KDE NeOwOn, nixOwOs; Plus FweeBSD, OwOpenBSD and macOwOS; Plus WinyandOwOws.
## Building and installation

9
res/ascii/amogos.txt Normal file
View file

@ -0,0 +1,9 @@
{BACKGROUND_RED} {NORMAL}
{BACKGROUND_WHITE} {BACKGROUND_RED} {NORMAL} {BACKGROUND_RED} {NORMAL}
{BACKGROUND_WHITE} {BACKGROUND_RED} {NORMAL} {BACKGROUND_RED} {NORMAL}
{BACKGROUND_WHITE} {BACKGROUND_RED} {NORMAL}
{BACKGROUND_WHITE} {BACKGROUND_RED} {NORMAL}
{BACKGROUND_WHITE} {BACKGROUND_RED} {NORMAL}
{BACKGROUND_RED} {NORMAL} {BACKGROUND_RED} {NORMAL}
{BACKGROUND_RED} {NORMAL} {BACKGROUND_RED} {NORMAL}

View file

@ -82,6 +82,7 @@ Unknown (tux logo) \fBunknown\fR
.TP
.SH IMAGE OR ASCII ONLY
.EX
AmogOwOs \fBamogos\fR
KDE NeOwOn \fBneon\fR
nixOwOs \fBnixos\fR
FweeBSD \fBfreebsd\fR

View file

@ -171,7 +171,8 @@ int main(int argc, char *argv[])
uwu_kernel();
uwu_name();
for (int i = 0; gpu_model[i][0]; i++) {
for (int i = 0; gpu_model[i][0]; i++)
{
uwu_hw(gpu_model[i]);
}
uwu_hw(cpu_model);
@ -417,7 +418,8 @@ void get_info()
FILE *cpuinfo = popen("sysctl -a | egrep -i 'hw.model'", "r");
#endif
FILE *host_model_info = fopen("/sys/devices/virtual/dmi/id/board_name", "r");
if (!host_model_info) host_model_info = fopen("/sys/devices/virtual/dmi/id/product_name", "r");
if (!host_model_info)
host_model_info = fopen("/sys/devices/virtual/dmi/id/product_name", "r");
#ifdef __FREEBSD__
host_model_info = popen("sysctl -a hw.hv_vendor", "r");
while (fgets(line, sizeof(line), host_model_info))
@ -667,7 +669,7 @@ void list(char *arg)
" %sArch linux %sbased:\n"
" %sarch, arcolinux, %sartix, endeavouros %smanjaro, manjaro-arm\n\n"
" %sDebian/%sUbuntu %sbased:\n"
" %sdebian, %slinuxmint, neon %spop, %sraspbian %subuntu\n\n"
" %samogos, debian, %slinuxmint, neon %spop, %sraspbian %subuntu\n\n"
" %sBSD %sbased:\n"
" %sfreebsd, %sopenbsd, %sm%sa%sc%so%ss\n\n"
" %sOther/spare distributions:\n"
@ -684,10 +686,12 @@ void list(char *arg)
replace("Hello World!", "World", "everyone")
This returns "Hello everyone!".
*/
void replace(char *original, char *search, char *replacer) {
void replace(char *original, char *search, char *replacer)
{
char buffer[1024];
char *ch;
if(!(ch = strstr(original, search))) return;
if (!(ch = strstr(original, search)))
return;
strncpy(buffer, original, ch - original);
buffer[ch - original] = 0;
@ -698,10 +702,12 @@ void replace(char *original, char *search, char *replacer) {
return replace(original, search, replacer);
}
void replace_ignorecase(char *original, char *search, char *replacer) {
void replace_ignorecase(char *original, char *search, char *replacer)
{
char buffer[1024];
char *ch;
if(!(ch = strcasestr(original, search))) return;
if (!(ch = strcasestr(original, search)))
return;
strncpy(buffer, original, ch - original);
buffer[ch - original] = 0;
@ -721,16 +727,22 @@ void print_ascii()
sprintf(ascii_file, "./res/ascii/%s.txt", version_name);
file = fopen(ascii_file, "r");
// Now tries to get file from normal directory
if(!file) {
if(strcmp(version_name, "android") == 0) {
if (!file)
{
if (strcmp(version_name, "android") == 0)
{
sprintf(ascii_file, "/data/data/com.termux/files/usr/lib/uwufetch/ascii/%s.txt", version_name);
} else {
}
else
{
sprintf(ascii_file, "/usr/lib/uwufetch/ascii/%s.txt", version_name);
}
file = fopen(ascii_file, "r");
if(!file) {
if (!file)
{
// Prevent infinite loops
if(strcmp(version_name, "unknown") == 0) {
if (strcmp(version_name, "unknown") == 0)
{
printf("No\nunknown\nascii\nfile\n\n\n\n");
return;
}
@ -739,7 +751,8 @@ void print_ascii()
}
}
char line[256];
while(fgets(line, 256, file)) {
while (fgets(line, 256, file))
{
replace(line, "{NORMAL}", NORMAL);
replace(line, "{BOLD}", BOLD);
replace(line, "{BLACK}", BLACK);
@ -752,8 +765,10 @@ void print_ascii()
replace(line, "{WHITE}", WHITE);
replace(line, "{PINK}", PINK);
replace(line, "{LPINK}", LPINK);
// For manjaro
// For manjaro and amogos
replace(line, "{BACKGROUND_GREEN}", "\e[0;42m");
replace(line, "{BACKGROUND_RED}", "\e[0;41m");
replace(line, "{BACKGROUND_WHITE}", "\e[0;47m");
printf("%s", line);
}
// Always set color to NORMAL, so there's no need to do this in every ascii file.
@ -1009,11 +1024,6 @@ void print_ascii()
WHITE, YELLOW, WHITE, YELLOW, WHITE, YELLOW, WHITE, YELLOW);*/
}
void print_unknown_ascii() {
printf("\n\n\n\n\nidk man\n");
return;
}
void print_image()
{ // prints logo (as an image) of the given system. distributions listed alphabetically.
char command[256];
@ -1078,6 +1088,7 @@ void uwu_kernel()
KERNEL_TO_UWU(splitted[i], "Linux", "Linuwu");
else KERNEL_TO_UWU(splitted[i], "linux", "linuwu");
else KERNEL_TO_UWU(splitted[i], "alpine", "Nyalpine");
else KERNEL_TO_UWU(splitted[i], "amogos", "AmogOwOS");
else KERNEL_TO_UWU(splitted[i], "arch", "Nyarch Linuwu");
else KERNEL_TO_UWU(splitted[i], "artix", "Nyartix Linuwu");
else KERNEL_TO_UWU(splitted[i], "debian", "Debinyan");
@ -1153,6 +1164,7 @@ void uwu_name()
// linux
STRING_TO_UWU("alpine", "Nyalpine");
else STRING_TO_UWU("amogos", "AmogOwOS");
else STRING_TO_UWU("arch", "Nyarch Linuwu");
else STRING_TO_UWU("arcolinux", "ArcOwO Linuwu");
else STRING_TO_UWU("artix", "Nyartix Linuwu");