Update of the TuxExec
Source (open):
this is the TuxExec v0.02 source , just the simple c_cpp_helper update
\#include <stdio.h>
\#include <unistd.h>
\#include <sys/types.h>
\#include <sys/wait.h>
\#include <stdlib.h>
\#include <string.h>
void input_cmd(char *buf, size_t size)
{
printf("TuxExec: ");
if (fgets(buf, size, stdin) != NULL) {
buf[strcspn(buf, "\\n")\] = '\\0';
}
}
void wslinstubuntu(void)
{
system("wsl --install -d Ubuntu");
printf("window fuckass using wsl btw =)) ");
}
void inst(void)
{
char pkgmn[256\];
printf("Linux pkgmn = ? (pacman ,apt , dnf): ");
fgets(pkgmn, sizeof(pkgmn), stdin);
pkgmn[strcspn(pkgmn, "\\n")\] = '\\0';
if (strcmp(pkgmn, "apt") == 0) {
while(1) {
char apt[512\];
printf("pkg install: ");
fgets(apt, sizeof(apt), stdin);
apt[strcspn(apt, "\\n")\] = '\\0';
pid_t pid = fork();
if (pid < 0) {
perror("pid failed");
}
else if (pid == 0) {
char *args[\] = {"sudo", "apt", "install", apt, NULL};
execvp(args[0\], args);
perror("failed execvp");
exit(1);
}
else {
wait(NULL);
}
}
}
else if (strcmp(pkgmn, "dnf") == 0) {
while(1) {
char dnf[512\];
printf("pkg install: ");
fgets(dnf, sizeof(dnf), stdin);
dnf[strcspn(dnf, "\\n")\] = '\\0';
pid_t pid = fork();
if (pid < 0) {
perror("failed pid");
}
else if (pid == 0) {
char *args[\] = {"sudo", "dnf", "install", dnf, NULL};
execvp(args[0\], args);
perror("failed execvp");
exit(1);
}
else {
wait(NULL);
}
}
}
else if (strcmp(pkgmn, "pacman") == 0) {
char pacman[512\];
printf("pkg install: ");
fgets(pacman, sizeof(pacman), stdin);
pacman[strcspn(pacman, "\\n")\] = '\\0';
pid_t pid = fork();
if (pid < 0) {
perror(" failed pid");
}
else if (pid == 0) {
char *args[\] = {"sudo", "pacman", "-S", pacman, NULL};
execvp(args[0\], args);
perror("failed execvp");
exit(1);
}
else {
wait(NULL);
}
}
}
void c_cpp_helper(void)
{
int choice;
do {
system("clear");
printf("C vs C++ QUICK HELPER & COMPARISON\\n\\n");
printf("1.Learn about if-else in C vs C++\\n");
printf("2.Compare I/O (printf/scanf vs cin/cout)\\n");
printf("3.C99 stdbool.h vs C++ Native Bool\\n");
printf("4.Memory Management (malloc/free vs new/delete)\\n");
printf("5.Back / Exit\\n\\n");
printf("Enter your choice: ");
if (scanf("%d", &choice) != 1) {
while (getchar() != '\\n');
continue;
}
system("clear");
switch (choice) {
case 1:
printf("IF-ELSE IN C VS C++\\n\\n");
printf("In C:\\n");
printf(" Uses integer values to evaluate conditions.\\n");
printf(" 0 means FALSE, any NON-ZERO value means TRUE.\\n");
printf(" Example: if (1) { /* Always runs */ }\\n\\n");
printf("In C++:\\n");
printf(" Has native 'bool' type with 'true' and 'false'.\\n");
printf(" Conditions like if (expr) still implicitly convert numbers to bool.\\n");
break;
case 2:
printf("PRINTF/SCANF (C) VS CIN/COUT (C++)\\n\\n");
printf("C (printf / scanf):\\n");
printf(" Pure functions inside <stdio.h>.\\n");
printf(" Requires explicit format specifiers: %%d, %%s, %%f, %%p.\\n");
printf(" Minimal memory footprint, perfect for lightweight CLI tools.\\n\\n");
printf("C++ (cin / cout):\\n");
printf(" Stream objects inside <iostream>.\\n");
printf(" Automatically detects data types via operator overloading (<<, >>).\\n");
printf(" Convenient, but increases binary size.\\n");
break;
case 3:
printf("BOOLEAN TYPES\\n\\n");
printf("In C:\\n");
printf(" C89/C90 has no native bool type.\\n");
printf(" Since C99, you must include <stdbool.h> to use 'bool', 'true', 'false'.\\n\\n");
printf("In C++:\\n");
printf(" 'bool', 'true', and 'false' are built-in keywords.\\n");
break;
case 4:
printf("MEMORY MANAGEMENT\\n\\n");
printf("In C:\\n");
printf(" Uses malloc(), calloc(), realloc() for Heap allocation.\\n");
printf(" Manual memory cleanup required using free() to prevent leaks.\\n\\n");
printf("In C++:\\n");
printf(" Uses 'new' and 'delete' (or 'delete[\]').\\n");
printf(" Supports RAII and Smart Pointers (unique_ptr, shared_ptr) for safety.\\n");
break;
case 0:
printf("Exiting
Post #43119
12