r/cprogramming 1d ago

Myshell

https://github.com/tracebyte8/myshell-linux-mini-shell

Basic project to learn more about Linux system calls and C programming. I accept any criticism.

4 Upvotes

4 comments sorted by

3

u/codeOfError 1d ago

Hey, I tried your shell project. Neat project!

A few issues I noticed while testing:

1: Pressing Enter on an empty line causes a segmentation fault

2: mkdir creates the directory, but it prints mkdir failed: File exists.

3: ls > file.txt doesn't seem to work.

Let me know if I'm doing anything wrong.

0

u/cdtrmnbaell 1d ago

Hi! You got it. I've fixed those issues, so you can check again now. Please let me know if there's anything else that needs to be corrected. Thank you for your attention!

2

u/flyingron 1d ago

I find the include file that does nothing other than include include files a bit grody and blows encapsulation out of the water. Only put as much in any single include file (and c file for that matter) necessary to compile it.

Similarly, the

read(); while(cond) { do_something(); read(); } is also problematic.

1

u/v_maria 16h ago

The functions from buildin, why did you give them a ptr as arg rather than named ones? Also since it doesnt check boundaries it will happily consume garbage data