summaryrefslogtreecommitdiff
path: root/flags.c
diff options
context:
space:
mode:
Diffstat (limited to 'flags.c')
-rw-r--r--flags.c81
1 files changed, 57 insertions, 24 deletions
diff --git a/flags.c b/flags.c
index d6b579d..bc0f22e 100644
--- a/flags.c
+++ b/flags.c
@@ -45,18 +45,22 @@ void cleanPackages(int os)
{
switch(os)
{
- case pacman:
- system("pacman -Rns \"$(pacman -Qtdq)\" || pacman -Scc");
- break;
-
case apt:
system("apt autoremove --purge || apt clean");
break;
+ case dnf:
+ system("dnf clean all && dnf autoremove");
+ break;
+
case emerge:
system("emerge -caq");
break;
+ case pacman:
+ system("pacman -Rns \"$(pacman -Qtdq)\" || pacman -Scc");
+ break;
+
case xbps:
system("xbps-remove -ROo");
}
@@ -81,15 +85,15 @@ void installPackages(int os, char *packages)
char* command = (char *) calloc(strlen(packages) + 80, sizeof(char));
switch(os)
{
- case pacman:
- strcpy(command, "pacman -S ");
+ case apt:
+ strcpy(command, "apt install ");
strcat(command, packages);
system(command);
free(command);
break;
- case apt:
- strcpy(command, "apt install ");
+ case dnf:
+ strcpy(command, "dnf install ");
strcat(command, packages);
system(command);
free(command);
@@ -102,6 +106,13 @@ void installPackages(int os, char *packages)
free(command);
break;
+ case pacman:
+ strcpy(command, "pacman -S ");
+ strcat(command, packages);
+ system(command);
+ free(command);
+ break;
+
case xbps:
strcpy(command, "xbps-install -S ");
strcat(command, packages);
@@ -119,18 +130,22 @@ void queryPackages(int os)
{
switch(os)
{
- case pacman:
- system("pacman -Qs");
- break;
-
case apt:
system("apt list --installed");
break;
+ case dnf:
+ system("dnf list --installed");
+ break;
+
case emerge:
system("cd /var/db/pkg/ && ls -d */* | sed 's:\\/$::'");
break;
+ case pacman:
+ system("pacman -Qs");
+ break;
+
case xbps:
system("xbps-query -l");
}
@@ -143,15 +158,15 @@ void removePackages(int os, char *packages)
char* command = (char *) calloc(strlen(packages) + 80, sizeof(char));
switch(os)
{
- case pacman:
- strcpy(command, "pacman -Rnsc ");
+ case apt:
+ strcpy(command, "apt autoremove --purge ");
strcat(command, packages);
system(command);
free(command);
break;
- case apt:
- strcpy(command, "apt autoremove --purge ");
+ case dnf:
+ strcpy(command, "dnf remove ");
strcat(command, packages);
system(command);
free(command);
@@ -164,6 +179,13 @@ void removePackages(int os, char *packages)
free(command);
break;
+ case pacman:
+ strcpy(command, "pacman -Rnsc ");
+ strcat(command, packages);
+ system(command);
+ free(command);
+ break;
+
case xbps:
strcpy(command, "xbps-remove -ROo ");
strcat(command, packages);
@@ -184,15 +206,15 @@ void searchPackages(int os, char *packages)
char* command = (char *) calloc(strlen(packages) + 80, sizeof(char));
switch(os)
{
- case pacman:
- strcpy(command, "pacman -Ss ");
+ case apt:
+ strcpy(command, "apt search ");
strcat(command, packages);
system(command);
free(command);
break;
- case apt:
- strcpy(command, "apt search ");
+ case dnf:
+ strcpy(command, "dnf search ");
strcat(command, packages);
system(command);
free(command);
@@ -205,6 +227,13 @@ void searchPackages(int os, char *packages)
free(command);
break;
+ case pacman:
+ strcpy(command, "pacman -Ss ");
+ strcat(command, packages);
+ system(command);
+ free(command);
+ break;
+
case xbps:
strcpy(command, "xbps-query -Rs ");
strcat(command, packages);
@@ -222,18 +251,22 @@ void updatePackages(int os)
{
switch(os)
{
- case pacman:
- system("pacman -Syyuu");
- break;
-
case apt:
system("apt update && apt upgrade -y");
break;
+ case dnf:
+ system("dnf update");
+ break;
+
case emerge:
system("emerge-webrsync && emerge -uaqDU --keep-going --with-bdeps=y --newuse @world");
break;
+ case pacman:
+ system("pacman -Syyuu");
+ break;
+
case xbps:
system("xbps-install -Su");
}