Now, two of those are header (.h) files, because in C the programmer typically splits units of code into headers (aka declarations), and body (aka implementation), unlike say, Pascal, where headers and implementations typically share the same file.
That is, there are really just two pieces of functionality here.
One is the file getting (uget.h, uget.c), and the other is the SSL interface to OpenSSL (ssl.h, ssl.c):
#ifdef ENABLE_SSL
#include <openssl/x509v3.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
[etc.]
Now those files (and the OpenSSL dependency) are only required only because the modern web predominantly uses the encrypted SSL protocol (i.e., https) -- compare to the earlier web which predominantly used unencrypted http, where all of that extra code is basically unnecessary (but of course, you lose encryption -- that's the trade-off).
As a commercial, production-ready tool, the author is quite right that you should probably use 'wget' or 'curl' instead, but as a teaching tool (or tool to be included on a minimal educational operating system), one where simplicity, understandability and minimal lines of code are virtuous, I believe that 'uget' is quite good, heck, I'd go as far as to say 'quite excellent' at achieving the smallest codebase and the greatest understandability for the purpose!
While other HN readers may disagree with me (and are free to do so!), I have to commend the author for a great minimal utility, and job well done!
The author bills this C source code as a "Really stupid get-file-over-http program/function".
I wholeheartedly disagree!
I claim, much to the contrary, that it is very, very intelligent!
See in terms of simplicity, in terms of understandability, in terms of the codebase, there are only 4 C source files here: https://github.com/troglobit/uget/tree/master/src .
Now, two of those are header (.h) files, because in C the programmer typically splits units of code into headers (aka declarations), and body (aka implementation), unlike say, Pascal, where headers and implementations typically share the same file.
That is, there are really just two pieces of functionality here.
One is the file getting (uget.h, uget.c), and the other is the SSL interface to OpenSSL (ssl.h, ssl.c):
#ifdef ENABLE_SSL
#include <openssl/x509v3.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
[etc.]
Now those files (and the OpenSSL dependency) are only required only because the modern web predominantly uses the encrypted SSL protocol (i.e., https) -- compare to the earlier web which predominantly used unencrypted http, where all of that extra code is basically unnecessary (but of course, you lose encryption -- that's the trade-off).
As a commercial, production-ready tool, the author is quite right that you should probably use 'wget' or 'curl' instead, but as a teaching tool (or tool to be included on a minimal educational operating system), one where simplicity, understandability and minimal lines of code are virtuous, I believe that 'uget' is quite good, heck, I'd go as far as to say 'quite excellent' at achieving the smallest codebase and the greatest understandability for the purpose!
While other HN readers may disagree with me (and are free to do so!), I have to commend the author for a great minimal utility, and job well done!
Well done, uget author, well done!
(Related: https://suckless.org/ https://en.wikipedia.org/wiki/Suckless.org)