Commit 567a68fd 567a68fd897da7ad69bc05b5ca1b62c371d52761 by Alain Magloire

doc fixes.

1 parent 750120a9
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
25 a long AC_CHECK_LIB, break it in two. 25 a long AC_CHECK_LIB, break it in two.
26 Check for strsignal() 26 Check for strsignal()
27 27
28 * doc/auth.texi: Bug fixes in texinfo.
29 * doc/Makefile.am: Commented the ex-address.texi generation.
30 * doc/ex-address.texi: New file.
31
28 2001-05-21 Alain Magloire 32 2001-05-21 Alain Magloire
29 33
30 * configure.in, imap4d/signal.c, pop3d/signal.c: 34 * configure.in, imap4d/signal.c, pop3d/signal.c:
......
1 info_TEXINFOS = \ 1 info_TEXINFOS = mailutils.texi
2 mailutils.texi
3 2
4 EXTRA_DIST = \ 3 EXTRA_DIST = \
5 rfc1734.txt \ 4 rfc1734.txt \
...@@ -13,6 +12,7 @@ EXTRA_DIST = \ ...@@ -13,6 +12,7 @@ EXTRA_DIST = \
13 auth.texi \ 12 auth.texi \
14 body.texi \ 13 body.texi \
15 encoding.texi \ 14 encoding.texi \
15 ex-address.texi \
16 headers.texi \ 16 headers.texi \
17 locker.texi \ 17 locker.texi \
18 mailbox.texi \ 18 mailbox.texi \
...@@ -23,6 +23,11 @@ EXTRA_DIST = \ ...@@ -23,6 +23,11 @@ EXTRA_DIST = \
23 url.texi \ 23 url.texi \
24 version.texi 24 version.texi
25 25
26 ex-address.texi: ${top_srdir}/examples/addr.c 26 ## Sam, the examples dir is not part of the distribution so this will not work
27 sed -es/{/@{/g -e s/}/@}/g < $< > $@ 27 ## but we should probably have a "addrmsg" program and reenable this.
28 ## Alain.
29 #ex-address.texi: ${top_srcdir}/examples/addr.c
30 # sed -es/{/@{/g -e s/}/@}/g < $< > $@
28 31
32 #mailutils.info: mailutils.texi version.texi ex-address.texi
33 #mailutils.dvi: mailutils.texi version.texi ex-address.texi
......
1 There are many ways to authenticate to a server, to be flexible the 1 There are many ways to authenticate to a server, to be flexible the
2 authentication process is provided by two objects @code{auth_t} and 2 authentication process is provided by two objects @code{auth_t} and
3 @{ticket_t}. The @{auth_t} can implement different protocol like 3 @code{ticket_t}. The @code{auth_t} can implement different protocol like
4 APOP, MD5-AUTH, One Time Passwd etc .. By default if a mailbox 4 APOP, MD5-AUTH, One Time Passwd etc .. By default if a mailbox
5 does not understand or know how to authenticate it falls back to 5 does not understand or know how to authenticate it falls back to
6 user/passwd authentication. The @{ticket_t} is away to 6 user/passwd authentication. The @code{ticket_t} is away to
7 Mailboxes and Mailers provide a way to authenticate when the URL does not 7 Mailboxes and Mailers provide a way to authenticate when the URL does not
8 contain enough information. The default action is to call function 8 contain enough information. The default action is to call function
9 @code{auth_authenticate} who will get the @emph{user} and @emph{passwd} 9 @code{auth_authenticate} who will get the @emph{user} and @emph{passwd}
......
1 #include <stdio.h>
2 #include <errno.h>
3 #include <mailutils/address.h>
4
5 #define EPARSE ENOENT
6
7 static const char* err_name(int e)
8 @{
9 struct @{
10 int e;
11 const char* s;
12 @} map[] = @{
13 #define E(e) @{ e, #e @},
14 E(ENOENT)
15 E(EINVAL)
16 E(ENOMEM)
17 #undef E
18 @{ 0, NULL @}
19 @};
20 static char s[sizeof(int) * 8 + 3];
21 int i;
22
23 for(i = 0; map[i].s; i++) @{
24 if(map[i].e == e)
25 return map[i].s;
26 @}
27 sprintf(s, "[%d]", e);
28
29 return s;
30 @}
31
32 static int parse(const char* str)
33 @{
34 size_t no = 0;
35 size_t pcount = 0;
36 int status;
37
38 char buf[BUFSIZ];
39
40 address_t address = NULL;
41
42 status = address_create(&address, str);
43
44 address_get_count(address, &pcount);
45
46 if(status) @{
47 printf("%s=> error %s\n\n", str, err_name(status));
48 return 0;
49 @} else @{
50 printf("%s=> pcount %d\n", str, pcount);
51 @}
52
53 for(no = 1; no <= pcount; no++) @{
54 size_t got = 0;
55 int isgroup;
56
57 address_is_group(address, no, &isgroup);
58
59 printf("%d ", no);
60
61 if(isgroup) @{
62 address_get_personal(address, no, buf, sizeof(buf), &got);
63
64 printf("group <%s>\n", buf);
65 @} else @{
66 address_get_email(address, no, buf, sizeof(buf), 0);
67
68 printf("email <%s>\n", buf);
69 @}
70
71 address_get_personal(address, no, buf, sizeof(buf), &got);
72
73 if(got && !isgroup) printf(" personal <%s>\n", buf);
74
75 address_get_comments(address, no, buf, sizeof(buf), &got);
76
77 if(got) printf(" comments <%s>\n", buf);
78
79 address_get_local_part(address, no, buf, sizeof(buf), &got);
80
81 if(got) @{
82 printf(" local-part <%s>", buf);
83
84 address_get_domain(address, no, buf, sizeof(buf), &got);
85
86 if(got) printf(" domain <%s>", buf);
87
88 printf("\n");
89 @}
90
91 address_get_route(address, no, buf, sizeof(buf), &got);
92
93 if(got) printf(" route <%s>\n", buf);
94 @}
95 address_destroy(&address);
96
97 printf("\n");
98
99 return 0;
100 @}
101
102 static int parseinput(void)
103 @{
104 char buf[BUFSIZ];
105
106 while(fgets(buf, sizeof(buf), stdin) != 0) @{
107 buf[strlen(buf) - 1] = 0;
108 parse(buf);
109 @}
110
111 return 0;
112 @}
113
114 int main(int argc, const char *argv[])
115 @{
116 argc = 1;
117
118 if(!argv[argc]) @{
119 return parseinput();
120 @}
121 for(; argv[argc]; argc++) @{
122 if(strcmp(argv[argc], "-") == 0) @{
123 parseinput();
124 @} else @{
125 parse(argv[argc]);
126 @}
127 @}
128
129 return 0;
130 @}