Added Manjaro

This commit is contained in:
Јован Ђокић-Шумарац 2021-05-21 10:14:02 +02:00
parent cb7e5c4caa
commit b762f5b74a
3 changed files with 43 additions and 7 deletions

BIN
fetchy

Binary file not shown.

View file

@ -33,17 +33,34 @@ int main(int argc, char *argv[]){
char sys, char sys,
*os_name = NULL, *os_name = NULL,
*cpu_name = NULL, *cpu_name = NULL,
*gpu = NULL, *gpu = NULL,
*os = malloc(BUF_SIZE), *os = malloc(BUF_SIZE),
*cache_path = malloc(BUF_SIZE * 2); *cache_path = malloc(BUF_SIZE * 2);
cache_info(cache_path, &cpu_name, &gpu); cache_info(cache_path, &cpu_name, &gpu);
os = get_sys(&sys, os_name); os = get_sys(&sys, os_name);
if ( argv[1] != NULL ){ if ( argv[1] != NULL ){
sys = *(argv[1] + 1) ;
} switch ( *(argv[1] + 1) ){
case 'a':
case 'x':
case 'r':
case 'u':
case 'd':
case 'm':
sys = *(argv[1] + 1) ;
break;
default:
printf("\n\nArgument not supported\n\n");
exit(EXIT_FAILURE);
}
}
//This one is in logos.h //This one is in logos.h
@ -188,8 +205,9 @@ static char *get_sys(char *sys, char *os_name){
fclose(sysName); fclose(sysName);
truncate_spaces_leading(name); truncate_spaces_leading(name);
if ( !strcmp( name, "Arch") ) *sys = 'a';
if ( !strcmp( name, "Artix") ) *sys = 'x'; if ( !strcmp( name, "Artix") ) *sys = 'x';
if ( !strcmp( name, "Arch") ) *sys = 'a';
if ( !strcmp( name, "Manjaro") ) *sys = 'm';
if ( !strcmp( name, "ArcoLinux") ) *sys = 'r'; if ( !strcmp( name, "ArcoLinux") ) *sys = 'r';
if ( !strcmp( name, "Debian")) *sys = 'd'; if ( !strcmp( name, "Debian")) *sys = 'd';
@ -323,9 +341,10 @@ static char *get_packages(char *package_count, char sys){
switch (sys){ switch (sys){
case 'r': case 'r':
case 'x': case 'x':
case 'a': case 'a':
case 'm':
pkg_count = count_files(opendir("/var/lib/pacman/local")); pkg_count = count_files(opendir("/var/lib/pacman/local"));
break; break;

17
logos.h
View file

@ -94,6 +94,23 @@ void concatenate_and_print(char sys, char *os, char *cpu_name, char *gpu){
case 'm':
printf("\n");
printf("\x1b[1m ||||||||| |||| %s\n", os);
printf("\x1b[1m ||||||||| |||| %s\n", get_kernel(kern_name));
printf("\x1b[1m |||| |||| %s\n", get_uptime(uptime));
printf("\x1b[1m |||| |||| |||| %s\n", get_packages(package_count, sys));
printf("\x1b[1m |||| |||| |||| %s\n", cpu_name);
printf("\x1b[1m |||| |||| |||| %s\n", gpu);
printf("\x1b[1m |||| |||| |||| %s\n", get_RAM(ram_info));
printf("\n\n");
break;
default: default:
printf("\n\n ERROR : Unsupported system\n\n"); printf("\n\n ERROR : Unsupported system\n\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);