Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,7 @@ Mkfile.old
dkms.conf

build
vcpkg_installed
vcpkg_installed

# nix
.direnv
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 0xViena

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
description = "A very basic flake";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};

outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [
gnumake42
libgcc
clang-tools
readline
];
};
};
}

6 changes: 6 additions & 0 deletions include/helpers/prompt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef PROMPT_H
#define PROMPT_H

char *build_prompt(void);

#endif
21 changes: 21 additions & 0 deletions src/helpers/prompt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

char *build_prompt(void) {
char *cwd = getcwd(NULL, 0);
if (!cwd)
return NULL;

size_t len = strlen(cwd) + 4;
char *prompt = malloc(len);
if (!prompt) {
free(cwd);
return NULL;
}

snprintf(prompt, len, "%s $ ", cwd);
free(cwd);
return prompt;
}
6 changes: 5 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "../include/builtins/shell_builtin.h"
#include "../include/helpers/free_pipeline.h"
#include "../include/helpers/hashmap.h"
#include "../include/helpers/prompt.h"
#include "../include/init_auto_completion.h"
#include "../include/load_history.h"
#include "../include/parser/parser.h"
Expand Down Expand Up @@ -29,7 +30,10 @@ int main() {

while (1) {

char *line = readline("$ ");
char *prompt = build_prompt();
char *line = readline(prompt);
free(prompt);

if (!line)
break;

Expand Down
5 changes: 4 additions & 1 deletion src/run/pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ int run_pipeline(pipeline_t *pl) {

for (size_t i = 0; i < pl->count; i++) {
if (i < pl->count - 1)
pipe(pfds);
if (-1 == pipe(pfds)) {
perror("pipe");
return -1;
}

pc cmd = pl->commands[i];
pid_t pid = fork();
Expand Down