Commit 801152df 801152df4886327e5eba960cdd0d0dd84c8487a6 by Wojciech Polak

Cosmetics

1 parent a315776c
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
3 3
4 GNU Mailutils is free software; you can redistribute it and/or modify 4 GNU Mailutils is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
17 17
18 #include <stdio.h> 18 #include <stdio.h>
19 #include <errno.h>
20 #include <string.h> 19 #include <string.h>
20 #include <errno.h>
21 21
22 #include <mailutils/address.h> 22 #include <mailutils/address.h>
23 #include <mailutils/errno.h> 23 #include <mailutils/errno.h>
...@@ -35,9 +35,7 @@ parse (const char *str) ...@@ -35,9 +35,7 @@ parse (const char *str)
35 address_t address = NULL; 35 address_t address = NULL;
36 36
37 mu_set_user_email_domain ("localhost"); 37 mu_set_user_email_domain ("localhost");
38
39 status = address_create (&address, str); 38 status = address_create (&address, str);
40
41 address_get_count (address, &pcount); 39 address_get_count (address, &pcount);
42 40
43 if (status) 41 if (status)
...@@ -56,40 +54,33 @@ parse (const char *str) ...@@ -56,40 +54,33 @@ parse (const char *str)
56 int isgroup; 54 int isgroup;
57 55
58 address_is_group (address, no, &isgroup); 56 address_is_group (address, no, &isgroup);
59
60 printf ("%lu ", (unsigned long) no); 57 printf ("%lu ", (unsigned long) no);
61 58
62 if (isgroup) 59 if (isgroup)
63 { 60 {
64 address_get_personal (address, no, buf, sizeof (buf), &got); 61 address_get_personal (address, no, buf, sizeof (buf), &got);
65
66 printf ("group <%s>\n", buf); 62 printf ("group <%s>\n", buf);
67 } 63 }
68 else 64 else
69 { 65 {
70 address_get_email (address, no, buf, sizeof (buf), 0); 66 address_get_email (address, no, buf, sizeof (buf), 0);
71
72 printf ("email <%s>\n", buf); 67 printf ("email <%s>\n", buf);
73 } 68 }
74 69
75 address_get_personal (address, no, buf, sizeof (buf), &got); 70 address_get_personal (address, no, buf, sizeof (buf), &got);
76
77 if (got && !isgroup) 71 if (got && !isgroup)
78 printf (" personal <%s>\n", buf); 72 printf (" personal <%s>\n", buf);
79 73
80 address_get_comments (address, no, buf, sizeof (buf), &got); 74 address_get_comments (address, no, buf, sizeof (buf), &got);
81
82 if (got) 75 if (got)
83 printf (" comments <%s>\n", buf); 76 printf (" comments <%s>\n", buf);
84 77
85 address_get_local_part (address, no, buf, sizeof (buf), &got); 78 address_get_local_part (address, no, buf, sizeof (buf), &got);
86
87 if (got) 79 if (got)
88 { 80 {
89 printf (" local-part <%s>", buf); 81 printf (" local-part <%s>", buf);
90 82
91 address_get_domain (address, no, buf, sizeof (buf), &got); 83 address_get_domain (address, no, buf, sizeof (buf), &got);
92
93 if (got) 84 if (got)
94 printf (" domain <%s>", buf); 85 printf (" domain <%s>", buf);
95 86
...@@ -97,14 +88,12 @@ parse (const char *str) ...@@ -97,14 +88,12 @@ parse (const char *str)
97 } 88 }
98 89
99 address_get_route (address, no, buf, sizeof (buf), &got); 90 address_get_route (address, no, buf, sizeof (buf), &got);
100
101 if (got) 91 if (got)
102 printf (" route <%s>\n", buf); 92 printf (" route <%s>\n", buf);
103 } 93 }
104 address_destroy (&address); 94 address_destroy (&address);
105 95
106 printf ("\n"); 96 printf ("\n");
107
108 return 0; 97 return 0;
109 } 98 }
110 99
...@@ -128,19 +117,14 @@ main (int argc, const char *argv[]) ...@@ -128,19 +117,14 @@ main (int argc, const char *argv[])
128 argc = 1; 117 argc = 1;
129 118
130 if (!argv[argc]) 119 if (!argv[argc])
131 { 120 return parseinput ();
132 return parseinput (); 121
133 }
134 for (; argv[argc]; argc++) 122 for (; argv[argc]; argc++)
135 { 123 {
136 if (strcmp (argv[argc], "-") == 0) 124 if (strcmp (argv[argc], "-") == 0)
137 { 125 parseinput ();
138 parseinput ();
139 }
140 else 126 else
141 { 127 parse (argv[argc]);
142 parse (argv[argc]);
143 }
144 } 128 }
145 129
146 return 0; 130 return 0;
......