From a6a7d6ce079cabdaf2fa502b2e2cf15e5428ac6f Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Wed, 3 Jul 2024 15:52:39 +0200 Subject: format files --- src/hfield.c | 94 +++++++++++++++++++++++++++++------------------------------- 1 file changed, 45 insertions(+), 49 deletions(-) (limited to 'src/hfield.c') diff --git a/src/hfield.c b/src/hfield.c index 2376e1f..3043327 100644 --- a/src/hfield.c +++ b/src/hfield.c @@ -1,39 +1,38 @@ #include "hfield.h" static char *(hname[]) = { - "unknown-header" -, "sender" -, "from" -, "reply-to" -, "to" -, "cc" -, "bcc" -, "date" -, "message-id" -, "subject" -, "resent-sender" -, "resent-from" -, "resent-reply-to" -, "resent-to" -, "resent-cc" -, "resent-bcc" -, "resent-date" -, "resent-message-id" -, "return-receipt-to" -, "errors-to" -, "apparently-to" -, "received" -, "return-path" -, "delivered-to" -, "content-length" -, "content-type" -, "content-transfer-encoding" -, "notice-requested-upon-delivery-to" -, "mail-followup-to" -, 0 -}; + "unknown-header", + "sender", + "from", + "reply-to", + "to", + "cc", + "bcc", + "date", + "message-id", + "subject", + "resent-sender", + "resent-from", + "resent-reply-to", + "resent-to", + "resent-cc", + "resent-bcc", + "resent-date", + "resent-message-id", + "return-receipt-to", + "errors-to", + "apparently-to", + "received", + "return-path", + "delivered-to", + "content-length", + "content-type", + "content-transfer-encoding", + "notice-requested-upon-delivery-to", + "mail-followup-to", + 0}; -static int hmatch( char *s,int len,char *t) +static int hmatch(char *s, int len, char *t) { int i; char ch; @@ -54,19 +53,18 @@ static int hmatch( char *s,int len,char *t) } } -int hfield_known(char *s,int len) +int hfield_known(char *s, int len) { int i; char *t; for (i = 1; (t = hname[i]); ++i) - if (hmatch(s,len,t)) - return i; - - return 0; + if (hmatch(s, len, t)) return i; + + return 0; } -int hfield_valid(char *s,int len) +int hfield_valid(char *s, int len) { int i; int j; @@ -76,11 +74,10 @@ int hfield_valid(char *s,int len) if (s[j] == ':') break; if (j >= len) return 0; - + while (j) { ch = s[j - 1]; - if ((ch != ' ') && (ch != '\t')) - break; + if ((ch != ' ') && (ch != '\t')) break; --j; } if (!j) return 0; @@ -89,11 +86,11 @@ int hfield_valid(char *s,int len) ch = s[i]; if (ch <= 32) return 0; if (ch >= 127) return 0; - } + } return 1; } -unsigned int hfield_skipname(char *s,int len) +unsigned int hfield_skipname(char *s, int len) { int i; char ch; @@ -102,12 +99,11 @@ unsigned int hfield_skipname(char *s,int len) if (s[i] == ':') break; if (i < len) ++i; - while (i < len) { - ch = s[i]; - if ((ch != '\t') && (ch != '\n') && (ch != '\r') && (ch != ' ')) - break; - ++i; - } + while (i < len) { + ch = s[i]; + if ((ch != '\t') && (ch != '\n') && (ch != '\r') && (ch != ' ')) break; + ++i; + } return i; } -- cgit v1.2.3