MCPcopy Create free account
hub / github.com/git/git / is_rfc2822_header

Function is_rfc2822_header

mailinfo.c:870–896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

868}
869
870static int is_rfc2822_header(const struct strbuf *line)
871{
872 /*
873 * The section that defines the loosest possible
874 * field name is "3.6.8 Optional fields".
875 *
876 * optional-field = field-name ":" unstructured CRLF
877 * field-name = 1*ftext
878 * ftext = %d33-57 / %59-126
879 */
880 int ch;
881 char *cp = line->buf;
882
883 /* Count mbox From headers as headers */
884 if (starts_with(cp, "From ") || starts_with(cp, ">From "))
885 return 1;
886
887 while ((ch = *cp++)) {
888 if (ch == ':')
889 return 1;
890 if ((33 <= ch && ch <= 57) ||
891 (59 <= ch && ch <= 126))
892 continue;
893 break;
894 }
895 return 0;
896}
897
898static int read_one_header_line(struct strbuf *line, FILE *in)
899{

Callers 1

read_one_header_lineFunction · 0.70

Calls 1

starts_withFunction · 0.85

Tested by

no test coverage detected