File: headercheck.c

package info (click to toggle)
cone 0.89-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 25,628 kB
  • ctags: 14,171
  • sloc: ansic: 85,400; cpp: 82,903; sh: 11,713; makefile: 1,732; perl: 832; yacc: 291; sed: 16
file content (48 lines) | stat: -rw-r--r-- 704 bytes parent folder | download | duplicates (18)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "rfc2045_config.h"
#include <stdio.h>
#include <stdlib.h>
#include "rfc2045.h"

void rfc2045_error(const char *s)
{
	printf("%s\n", s);
	exit(0);
}

int main(int argc, char **argv)
{
	struct rfc2045src *src;
	struct rfc2045 *rfcp;
	struct rfc2045headerinfo *hi;
	char *h, *v;

	if (argc < 3)
		return (0);

	rfcp=rfc2045_fromfd(0);

	if (!rfcp)
		return (0);

	if (argv[2][0])
		rfcp=rfc2045_find(rfcp, argv[2]);

	src=rfc2045src_init_fd(0);

	if (!src)
		return (0);

	hi=rfc2045header_start(src, rfcp);

	if (!hi)
		return (0);

	while (rfc2045header_get(hi, &h, &v, atoi(argv[1])) == 0)
	{
		if (h == NULL)
			break;
		printf("Header: %s\n", h);
		printf("Value: %s\n", v);
	}
	return (0);
}