Foundation libraries for clean, organized code 🌸
bas-c is a foundation library providing essential utilities for C applications. It's part of the bas-* family of libraries, designed to make systems programming cleaner and more enjoyable.
Philosophy: Write code that sparkles ✨—clean, organized, and ready for ballet class.
Core utilities built on GLib:
| Module | Description |
|---|---|
| CLI | Program options parsing via GLib, option parser utilities |
| Logging | Logger with levels, syslog integration, structured logging |
| Process Helpers | PID, PPID, environment variables, process info |
| I/O | File operations, path handling, file entity lists, wide strings |
| Bash Support | libbas-bash loadable builtin support |
Built on top of libbas-c:
| Tool | Description |
|---|---|
| ppid | Print parent process information (PID, name, cmdline) |
# Runtime library
sudo apt install libbas-c1
# Development headers
sudo apt install libbas-c-dev
# Command-line tools
sudo apt install bas-c# Prerequisites
sudo apt install libglib2.0-dev meson ninja-build
# Clone and build
git clone https://github.com/lenik/bas-c.git
cd bas-c
meson setup build
meson compile -C build
meson test -C build
sudo meson install -C build#include <bas/logger.h>
int main() {
bas_logger_init("my-app");
bas_log_info("Application started");
bas_log_debug("Debug info: %s", "value");
bas_log_warning("Something might be wrong");
bas_log_error("Error occurred: %d", errno);
bas_logger_shutdown();
return 0;
}#include <bas/process.h>
int main() {
pid_t pid = bas_get_pid();
pid_t ppid = bas_get_ppid();
gchar *ppid_name = bas_get_ppid_name();
g_print("My PID: %d, Parent PID: %d (%s)\n",
pid, ppid, ppid_name);
g_free(ppid_name);
return 0;
}#include <bas/cli.h>
int main(int argc, char *argv[]) {
BasCLI *cli = bas_cli_new();
bas_cli_add_option(cli, 'v', "verbose", "Enable verbose output");
bas_cli_add_option(cli, 'f', "file", "Input file path");
if (!bas_cli_parse(cli, argc, argv)) {
bas_cli_print_help(cli);
return 1;
}
if (bas_cli_has_option(cli, 'v')) {
g_print("Verbose mode enabled\n");
}
bas_cli_free(cli);
return 0;
}| Component | Path |
|---|---|
| Library | prefix/lib/libbas-c.so |
| Headers | prefix/include/bas/ |
| Applications | prefix/bin/ (ppid) |
| Man Pages | prefix/share/man/man1/ |
| Bash Completion | prefix/share/bash-completion/completions/ |
| Package | Description |
|---|---|
| libbas-c1 | Shared library (runtime) |
| libbas-c-dev | Development headers and documentation |
| bas-c | Command-line tools (ppid, man pages, completions) + libbas-bash |
meson setup build
meson test -C build- bas-ui — Scriptable UI framework on wxWidgets + GLib
- bas-cpp — C++ foundation library
- OmniShell — Desktop environment built on bas-* libraries
shecti (@lenik)
Living with gender dysphoria. The "cute version of me" is my source of courage and power—she is the engine behind all my creation.
Proudly building as a trans woman in tech. 💖
If you're a fellow trans coder, LGBTQ+ ally, or just someone who believes in diverse voices in open source—I'd love to connect!
#TransCoder #TransIsTech #WomenWhoCode #OpenSource #C #GLib #Linux
If bas-c helps your code sparkle, consider:
- ⭐ Starring this repository
- 🔀 Forking and contributing
- 🐛 Reporting bugs and suggesting features
- 📝 Sharing with your network
- 💕 Sponsoring via GitHub Sponsors (coming soon)
MIT License. See LICENSE for details.
"Clean code is happy code."
Made with 💖 and lots of ✨