diff options
author | Stef Walter <stef@memberwebs.com> | 2004-08-27 23:08:18 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2004-08-27 23:08:18 +0000 |
commit | dd53442133709293c04621af9af0f6d9e9aab003 (patch) | |
tree | cd1455be75dacbdc19334daf28cbbb5625a10b75 /common/stringx.c | |
parent | 3d9db3a155a3a0812a6252f37e04b22f89b68ae5 (diff) |
- Changed to buffered IO
Diffstat (limited to 'common/stringx.c')
-rw-r--r-- | common/stringx.c | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/common/stringx.c b/common/stringx.c index b994f7f..8b6a816 100644 --- a/common/stringx.c +++ b/common/stringx.c @@ -126,64 +126,6 @@ void message(clamsmtp_context_t* ctx, int level, const char* msg, ...) va_end(ap); } -#define MAX_LOG_LINE 79 - -void log_fd_data(clamsmtp_context_t* ctx, const char* data, int* fd, int read) -{ - #define offsetof(s, m) ((size_t)&(((s*)0)->m)) - #define ismember(o, m) (((char*)(m)) < (((char*)(o)) + sizeof(*(o)))) - #define ptrdiff(o, t) - - char prefix[16]; - - ASSERT(ctx); - ASSERT(ismember(ctx, fd)); - - switch((char*)fd - (char*)ctx) - { - case offsetof(clamsmtp_context_t, client): - strcpy(prefix, "CLIENT "); - break; - case offsetof(clamsmtp_context_t, server): - strcpy(prefix, "SERVER "); - break; - case offsetof(clamsmtp_context_t, clam): - strcpy(prefix, "CLAM "); - break; - default: - strcpy(prefix, "???? "); - break; - } - - strcat(prefix, read ? "< " : "> "); - log_data(ctx, data, prefix); -} - - -void log_data(clamsmtp_context_t* ctx, const char* data, const char* prefix) -{ - char buf[MAX_LOG_LINE + 1]; - int pos, len; - - for(;;) - { - data += strspn(data, "\r\n"); - - if(!*data) - break; - - pos = strcspn(data, "\r\n"); - - len = pos < MAX_LOG_LINE ? pos : MAX_LOG_LINE; - memcpy(buf, data, len); - buf[len] = 0; - - messagex(ctx, LOG_DEBUG, "%s%s", prefix, buf); - - data += pos; - } -} - /* ---------------------------------------------------------------------------------- * Parsing */ |