2023-12-07

How pipex almost made me go crazy

So in Pipex we recreate the piping of commands in a shell using c. The project brings in a lot of new concepts like processes, pipes and forkes. I started really well and I got my error handling working really quickly. On that moment I told myself I would also make the bonus and I started to work on other parts of the project. Getting the right input and the here_doc checker were really quickly done but then I first encountered pipes and forks. I have to say this was a big challenge for me and I was super confused on how everything worked. Then I started to watch some videos of it and it started to make a bit more sense but still I was making progress really slow.

After some time I got a working version of the project. Even the bonus worked but not everything was nice. Single quotes would let the program crash and I couldn't valgrind because I was not forking my last command. Also I found the code base to look really bad and most stuff were just numbers and I didn't have any macros anywhere. So my solution to that? Rewrite the whole project again and that was a really bad decision. It took me 2 full weeks of non stop work to get everything right again and how I wanted. Okay the code base looked a lot more clean and the addidtion of macros was a big improvement. Everything was also more performant and worked but still it took me a lot of effort.

Now for the future, in minishell I will again make pipes and I'm now still looking at how I should plan it perfectly so that I don't make the same mistakes. I have good hope for the future and that while doing minishell it will go beter. So this was my small blogpost about why pipex almost made me give up. Okay no to be honest I learned a lot and my general code got cleaner and I think more about how I write stuff so that is something very nice to have now. I hope you guys enjoyed my quick blogpost and I will see you guys next time!

C programming
19