Re: [dev] [sic] tok and ctok functions

From: anonymous <>
Date: Thu, 15 Apr 2010 17:53:43 +0400

Patch attached. What I have changed:

 * Replaced `tok` and `ctok` functions with `skip` and (already
   existing, but a little different) `eat`

 * Changed parsing of separators (<SPACE> from RFC) in server
 responses. Now tabs are not skipped. Also no more than one space is
 skipped. RFC says there can be more than one space but I have seen
 no server that will add extra separator characters. It is not hard
 to parse but simplicity > correctness.

 * Removed always true `if(msg[1])` check

 * Added output of command parameters:
- pout(usr, ">< %s: %s", cmd, txt);
+ pout(usr, ">< %s (%s): %s", cmd, msg, txt);
   Now it is possible to use such commands as "LIST"

 * Added function `trim` for removing trailing whitespace.
   It is now used on `msg` variable before outputting it so instead of 04/15/10 17:45 >< NOTICE (AUTH ): *** Looking up your hostname...
   you get 04/15/10 17:45 >< NOTICE (AUTH): *** Looking up your hostname...
   It is not a problem when you output it with "%-12s" format like
   first argument of pout, but it is easy to see the problem when you
   output it in parenthesis.

Code is one line less now.

Received on Thu Apr 15 2010 - 13:53:43 UTC

This archive was generated by hypermail 2.2.0 : Thu Apr 15 2010 - 14:00:02 UTC