The Main PuTTY Configuration Screen On Windows |
To be portable as much as possible PuTTY is written in pure ANSI C (C89/ C90). It is impressive on how many different compilers the sources obviously compile. The code itself is well structured and not too cryptic (beside some functions which I personally might have distributed into smaller ones).
Since we're on ANSI C there is no standard library support for wildcard matching (required for sftp). Hence, the PuTTY team went for an own implementation (see wildcard.c). I seriously hope that I've never have to implement something like this - praise to good library support ;-)
To auto generate the makefiles required for the different target environments PuTTY is utilizing a Perl program called mkfile.pl. This is a handcrafted solution of the PuTTY team, Cmake and automake would be popular open source tools for the same kind of task.
The PuTTY authors (it's actually mainly Simon Tatham) keep a clear separation between platform depended and independed code. I found the implementation very well done. There will by a separate blog post about the implementation of the different communication protocols the PuTTY suite is supporting (ssh, telnet, raw...).
Although I'm a big fan of the Test Driven Development approach, it's calming to see it is still possible to go without ;-) However, I did find some traces of where test data is generated. Also, cmdgen.c, a command line version of the SSH public/ private key generator PuTTYgen, contains some functionality to run external tests. That is taking the binary produced and call it with different arguments while testing for the result.
Also, the code comments are very well written.
The PuTTY Sources Contain Many Helpful Comments And Explainations |
Conclusion: for gaining an inside in the work of a seasoned C programmer, the PuTTY source are more than worth spending some time and coffee.
Keine Kommentare:
Kommentar veröffentlichen