Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_tlsv12/sys/src/cmd/upas/fs/tester.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
#include <ctype.h>
4
#include <String.h>
5
#include "message.h"
6
 
7
Message *root;
8
 
9
void
10
prindent(int i)
11
{
12
	for(; i > 0; i--)
13
		print(" ");
14
}
15
 
16
void
17
prstring(int indent, char *tag, String *s)
18
{
19
	if(s == nil)
20
		return;
21
	prindent(indent+1);
22
	print("%s %s\n", tag, s_to_c(s));
23
}
24
 
25
void
26
info(int indent, int mno, Message *m)
27
{
28
	int i;
29
	Message *nm;
30
 
31
	prindent(indent);
32
	print("%d%c %d ", mno, m->allocated?'*':' ', m->end - m->start);
33
	if(m->unixfrom != nil)
34
		print("uf %s ", s_to_c(m->unixfrom));
35
	if(m->unixdate != nil)
36
		print("ud %s ", s_to_c(m->unixdate));
37
	print("\n");
38
	prstring(indent, "from:", m->from822);
39
	prstring(indent, "sender:", m->sender822);
40
	prstring(indent, "to:", m->to822);
41
	prstring(indent, "cc:", m->cc822);
42
	prstring(indent, "reply-to:", m->replyto822);
43
	prstring(indent, "subject:", m->subject822);
44
	prstring(indent, "date:", m->date822);
45
	prstring(indent, "filename:", m->filename);
46
	prstring(indent, "type:", m->type);
47
	prstring(indent, "charset:", m->charset);
48
 
49
	i = 1;
50
	for(nm = m->part; nm != nil; nm = nm->next){
51
		info(indent+1, i++, nm);
52
	}
53
}
54
 
55
 
56
void
57
main(int argc, char **argv)
58
{
59
	char *err;
60
	char *mboxfile;
61
 
62
	ARGBEGIN{
63
	}ARGEND;
64
 
65
	if(argc > 0)
66
		mboxfile = argv[0];
67
	else
68
		mboxfile = "./mbox";
69
 
70
	root = newmessage(nil);
71
 
72
	err = readmbox(mboxfile, &root->part);
73
	if(err != nil){
74
		fprint(2, "boom: %s\n", err);
75
		exits(0);
76
	}
77
 
78
	info(0, 1, root);
79
 
80
	exits(0);
81
}