Forgot the year of the Linux. It's the year of Pebble! I had a blast on last Rebble hackathon creating watchface named pRebble inspired by Pebble original UI design which I found amazing in how it manifested through work of designers within limitations and constrains of this platform. I can't wait to explore it even more on second hachathon. Looking forward to see Pebble rising from the ashes \(^-^ )
1. `sfd` is now closed. This cost me an extra line of code tho so I had to improvise.
2. `j` was not initially -1 as even empty input contains one "\n" character. But it could go pass value of 0 underflowing the buffer when buffer contained only white space characters (like in case of single "\n"). This was corrected.
3. `h_addr_list[i]` about this one. I'm quite sure I took it from example in one of man pages. Anyway, I replaced it with `memcpy`.
I also tried to use valgrind. This is OFC my first step but I will continue my studies on detecting memory leaks in future projects.
Yes, that was my reasoning. Also there is non-written rule in this project that forbids me from going wider than 80 columns. With that I initially had indentation set to 2 spaces but later I realized that code is indented at most 2 times and it's better to make space for goto labels on the left.
Besides GNU/Linux I compiled on MacOS. I made no effort to test on BSD systems or Windows. I included only few std libs so I wonder - what exactly makes it not compatible with OpenBSD?
This is such a great feedback. Thank you a lot. OFC I will try to correct my mistakes.
Not to make any excuses, just for the context. I'm a beginner in C programming and I wrote only few small programs. My tooling is basically non existent. I will try to improve tho.
There's a page on the net somewhere, which was on HN front-page a while ago too, that listed all the useful warning flags for gcc, with an explanation.
I'd look for it, as a C programmer. On phone now, so sadly don't have it handy.