summaryrefslogtreecommitdiffstats
path: root/rfc2045/headercheck.c
diff options
context:
space:
mode:
Diffstat (limited to 'rfc2045/headercheck.c')
-rw-r--r--rfc2045/headercheck.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/rfc2045/headercheck.c b/rfc2045/headercheck.c
new file mode 100644
index 0000000..5bead04
--- /dev/null
+++ b/rfc2045/headercheck.c
@@ -0,0 +1,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);
+}