@@ -106,15 +106,17 @@ int pkgman() { // this is just a function that returns the total of installed pa
106
106
fscanf (file [6 ], "%d" , & rpm );
107
107
fscanf (file [7 ], "%d" , & xbps );
108
108
for (int i = 0 ; i < 8 ; i ++ ) fclose (file [i ]);
109
-
110
- if (apt > 0 ) { total += apt ; strcat (pkgman_name , "(apt)" ); }
111
- if (dnf > 0 ) { total += dnf ; strcat (pkgman_name , "(dnf)" ); }
112
- if (emerge > 0 ) { total += emerge ; strcat (pkgman_name , "(emerge)" ); }
113
- if (flatpak > 0 ) { total += flatpak ; strcat (pkgman_name , "(flatpak)" ); }
114
- if (nix > 0 ) { total += nix ; strcat (pkgman_name , "(nix)" ); }
115
- if (pacman > 0 ) { total += pacman ; strcat (pkgman_name , "(pacman)" ); }
116
- if (rpm > 0 ) { total += rpm ; strcat (pkgman_name , "(rpm)" ); }
117
- if (xbps > 0 ) { total += xbps ; strcat (pkgman_name , "(xbps)" ); }
109
+
110
+ #define ADD_PACKAGES (package_count , pkgman_to_add ) if (package_count > 0) { total += package_count; strcat(pkgman_name, pkgman_to_add); }
111
+ ADD_PACKAGES (apt , "(apt)" )
112
+ ADD_PACKAGES (dnf , "(dnf)" )
113
+ ADD_PACKAGES (emerge , "(emerge)" )
114
+ ADD_PACKAGES (flatpak ,"(flatpak)" )
115
+ ADD_PACKAGES (nix , "(nix)" )
116
+ ADD_PACKAGES (pacman , "(pacman)" )
117
+ ADD_PACKAGES (rpm , "(rpm)" )
118
+ ADD_PACKAGES (xbps , "(xbps)" )
119
+ #undef ADD_PACKAGES
118
120
119
121
return total ;
120
122
}
@@ -371,4 +373,4 @@ void uwu_name() { // changes distro name to uwufied(?) name
371
373
// BSD
372
374
else if (strcmp (version_name , "freebsd" ) == 0 ) sprintf (version_name , "%s" , "FweeBSD" );
373
375
else if (strcmp (version_name , "openbsd" ) == 0 ) sprintf (version_name , "%s" , "OwOpenBSD" );
374
- }
376
+ }
0 commit comments