Commit d52743d3 d52743d3f4fddafd69cb92757b3e01553f8a8c3e by Alain Magloire

New example from Sam Roberts.

1 parent bc3a57b1
...@@ -2,11 +2,11 @@ CFLAGS = -Wall -pedantic -g ...@@ -2,11 +2,11 @@ CFLAGS = -Wall -pedantic -g
2 INCLUDES = -I../libmailbox 2 INCLUDES = -I../libmailbox
3 LIBS = ../libmailbox/.libs/libmailbox.al 3 LIBS = ../libmailbox/.libs/libmailbox.al
4 4
5 from: from.c $(LIBS)
6 gcc $(CFLAGS) $(INCLUDES) -o from from.c $(LIBS)
7
8 showmail: showmail.c $(LIBS) 5 showmail: showmail.c $(LIBS)
9 gcc $(CFLAGS) $(INCLUDES) -o showmail showmail.c $(LIBS) 6 $(CC) $(CFLAGS) $(INCLUDES) -o showmail showmail.c $(LIBS)
7
8 addr: addr.c $(LIBS)
9 $(CC) $(CFLAGS) $(INCLUDES) -o addr addr.c $(LIBS)
10 10
11 clean: 11 clean:
12 rm -f from showmail 12 rm -f addr showmail
......
1 #include <stdio.h> 1 #include <stdio.h>
2 #include <mailutils/address.h> 2 #include <mailutils/address.h>
3 3
4 static int use_zero = 1;
5
6 static int parse(const char* str) 4 static int parse(const char* str)
7 { 5 {
8 size_t no = 0; 6 size_t no = 0;
...@@ -12,9 +10,6 @@ static int parse(const char* str) ...@@ -12,9 +10,6 @@ static int parse(const char* str)
12 10
13 address_t address = NULL; 11 address_t address = NULL;
14 12
15 if(use_zero)
16 address_create0(&address, str);
17 else
18 address_create(&address, str); 13 address_create(&address, str);
19 14
20 address_get_count(address, &pcount); 15 address_get_count(address, &pcount);
...@@ -72,14 +67,6 @@ int main(int argc, const char *argv[]) ...@@ -72,14 +67,6 @@ int main(int argc, const char *argv[])
72 { 67 {
73 argc = 1; 68 argc = 1;
74 69
75 if(argv[argc] && strcmp(argv[argc], "-1") == 0) {
76 use_zero = 0;
77 argc++;
78 }
79 if(argv[argc] && strcmp(argv[argc], "-0") == 0) {
80 use_zero = 1;
81 argc++;
82 }
83 if(!argv[argc]) { 70 if(!argv[argc]) {
84 return parseinput(); 71 return parseinput();
85 } 72 }
......