strcmp(sure, "Y") == 0) {
pid_t pid = fork();
if (pid == 0) {
char *args[\] = {"sudo", "rm", rm_file, NULL};
execvp(args[0\], args);
perror("failed execvp");
exit(1);
}
else {
wait(NULL);
}
} else {
return;
}
}
void systeminfo(void)
{
pid_t pid = fork();
if (pid == 0) {
char *args[\] = {"sh", "-c", "ls && lsblk && ls /", NULL};
execvp(args[0\], args);
perror("failed execvp");
exit(0);
}
else {
wait(NULL);
}
}
void rep(void)
{
while(1) {
char rep_cmd[50\];
printf(" what do you want?\\n"
"<how to see info of system linux>\\n"
"<how to get remove file in this system>\\n"
"<how to get install pkg>\\n"
"c_cpp_helper\\n"
"<how to install wsl in this system \\\\ powershell>: ");
fgets(rep_cmd, sizeof(rep_cmd), stdin);
rep_cmd[strcspn(rep_cmd, "\\n")\] = '\\0';
if (strcmp(rep_cmd, "how to see info of system linux") == 0) {
printf("in your terminal , getting command ls, lsblk, ls /, whoami, in this system, you command the systeminfo\\n");
} else if (strcmp(rep_cmd, "how to get remove file in this system") == 0) {
printf(" in your terminal, getting command rm and your file path
wanted to remove, in this system you command rm and write the path
file\\n");
} else if (strcmp(rep_cmd, "how to get install pkg") == 0) {
printf("sudo and your pkg and your pkg , in this system, just command inst and select pkgmanager, select pkg\\n");
} else if (strcmp(rep_cmd, "how to install wsl in this system \\\\ powershell") == 0) {
printf(" you really use window bruhhh haha, just command wsl
\--install Ubuntu or in this system, just command wslinstubuntu\\n");
} else if (strcmp(rep_cmd, "c_cpp_helper") == 0) {
printf("command the c\\_cpp\\_helper for the c and c++ helper");
} else {
exit(0);
}
}
}
int main(void) {
char user_input[256\];
while(1) {
input_cmd(user_input, sizeof(user_input));
if (strcmp(user_input, "wslinstubuntu") == 0) {
wslinstubuntu();
} else if (strcmp(user_input, "inst") == 0) {
inst();
} else if (strcmp(user_input, "rm") == 0) {
rm();
} else if (strcmp(user_input, "systeminfo") == 0) {
systeminfo();
} else if (strcmp(user_input, "c_cpp_helper") == 0) {
c\\_cpp\\_helper();
} else if (strcmp(user_input, "rep") == 0) {
rep();
} else if (strcmp(user_input, "exit") == 0) {
break;
} else {
printf("not found ***\\n");
}
}
return 0;
}
https://redd.it/1wxejwa
@r_linux
Post #43122
22