Video: C Programming on System 6 - User Authentication and Telnet Negotiation
I review some recent commits covering user authentication and telnet negotiation, then write some ANSI output code and a broken function for returning a number's ordinal suffix.
Video notes:
- sha2.c
- strlcpy
- Telnet Protocol Specification
- xorshift32
-
Of course after reviewing my video, I realized the
ordinal
function I wrote was wrong for values over 20. The new code is:char * ordinal(unsigned short n) { static char ordbuf[8]; switch (n % 100) { case 11: case 12: case 13: sprintf(ordbuf, "%dth", n); break; default: switch (n % 10) { case 1: sprintf(ordbuf, "%dst", n); break; case 2: sprintf(ordbuf, "%dnd", n); break; case 3: sprintf(ordbuf, "%drd", n); break; default: sprintf(ordbuf, "%dth", n); } } return ordbuf; }
Please contact me with any feedback or questions, view past videos in this series, and subscribe to my RSS feed to be notified about future videos and other posts.
Join me and others on
Libera Chat
in the
#cyberpals
channel if you are interested in following along with this series and have
questions or would like to help others.