To get deadline support on command-line programs that don't, one can use rlwrap. Ex: rlwrap openssl s_client -connect IMAP.google.com:993 rlwrap telnet google.com 443
I guessed that rlwrap used an LD_PRELOAD trick but a cursory glance at the source shows that it's much more complex. Can anyone explain? This might be worthy of its own HN post.