Gentoo Archives: gentoo-commits

From: Michael Palimaka <kensington@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-misc/abook/files/
Date: Sat, 02 Sep 2017 15:15:41
Message-Id: 1504365329.b99131d4b4f58921e7db75f145a53e0a17b3c57b.kensington@gentoo
1 commit: b99131d4b4f58921e7db75f145a53e0a17b3c57b
2 Author: Michael Mair-Keimberger (asterix) <m.mairkeimberger <AT> gmail <DOT> com>
3 AuthorDate: Wed Aug 16 09:04:23 2017 +0000
4 Commit: Michael Palimaka <kensington <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 2 15:15:29 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b99131d4
7
8 app-misc/abook: remove unused patches
9
10 .../abook/files/abook-0.6.0_pre2-vcard-fix.patch | 10 -
11 .../files/abook-0.6.0_pre2-vcard-import.patch | 325 ---------------------
12 2 files changed, 335 deletions(-)
13
14 diff --git a/app-misc/abook/files/abook-0.6.0_pre2-vcard-fix.patch b/app-misc/abook/files/abook-0.6.0_pre2-vcard-fix.patch
15 deleted file mode 100644
16 index 8045909463a..00000000000
17 --- a/app-misc/abook/files/abook-0.6.0_pre2-vcard-fix.patch
18 +++ /dev/null
19 @@ -1,10 +0,0 @@
20 ---- abook-0.6.0pre2/abook.c.orig 2010-10-03 14:54:23.827767178 -0700
21 -+++ abook-0.6.0pre2/abook.c 2010-10-03 14:54:55.738042419 -0700
22 -@@ -708,6 +708,7 @@
23 - check_abook_directory();
24 - init_opts();
25 - load_opts(rcfile);
26 -+ init_standard_fields();
27 - atexit(free_opts);
28 -
29 - /*
30
31 diff --git a/app-misc/abook/files/abook-0.6.0_pre2-vcard-import.patch b/app-misc/abook/files/abook-0.6.0_pre2-vcard-import.patch
32 deleted file mode 100644
33 index 316f1229fd9..00000000000
34 --- a/app-misc/abook/files/abook-0.6.0_pre2-vcard-import.patch
35 +++ /dev/null
36 @@ -1,325 +0,0 @@
37 -diff -ru a/filter.c b/filter.c
38 ---- a/filter.c 2006-09-06 07:26:10.000000000 +0200
39 -+++ b/filter.c 2008-05-18 20:55:12.000000000 +0200
40 -@@ -44,6 +44,7 @@
41 - static int csv_parse_file(FILE *in);
42 - static int allcsv_parse_file(FILE *in);
43 - static int palmcsv_parse_file(FILE *in);
44 -+static int vcard_parse_file(FILE *in);
45 -
46 - /*
47 - * export filter prototypes
48 -@@ -75,6 +76,7 @@
49 - { "csv", N_("comma separated values"), csv_parse_file },
50 - { "allcsv", N_("comma separated values (all fields)"), allcsv_parse_file },
51 - { "palmcsv", N_("Palm comma separated values"), palmcsv_parse_file },
52 -+ { "vcard", N_("vCard file"), vcard_parse_file },
53 - { "\0", NULL, NULL }
54 - };
55 -
56 -@@ -1331,6 +1333,262 @@
57 - */
58 -
59 - /*
60 -+ * vCard import filter
61 -+ */
62 -+
63 -+static char *vcard_fields[] = {
64 -+ "FN", /* NAME */
65 -+ "EMAIL", /* EMAIL */
66 -+ "ADR", /* ADDRESS */
67 -+ "ADR", /* ADDRESS2 - not used */
68 -+ "ADR", /* CITY */
69 -+ "ADR", /* STATE */
70 -+ "ADR", /* ZIP */
71 -+ "ADR", /* COUNTRY */
72 -+ "TEL", /* PHONE */
73 -+ "TEL", /* WORKPHONE */
74 -+ "TEL", /* FAX */
75 -+ "TEL", /* MOBILEPHONE */
76 -+ "NICKNAME", /* NICK */
77 -+ "URL", /* URL */
78 -+ "NOTE", /* NOTES */
79 -+ NULL /* not implemented: ANNIVERSARY, ITEM_FIELDS */
80 -+};
81 -+
82 -+/*
83 -+ * mappings between vCard ADR field and abook's ADDRESS
84 -+ * see rfc2426 section 3.2.1
85 -+ */
86 -+static int vcard_address_fields[] = {
87 -+ -1, /* vCard(post office box) - not used */
88 -+ -1, /* vCard(the extended address) - not used */
89 -+ 2, /* vCard(the street address) - ADDRESS */
90 -+ 4, /* vCard(the locality) - CITY */
91 -+ 5, /* vCard(the region) - STATE */
92 -+ 6, /* vCard(the postal code) - ZIP */
93 -+ 7 /* vCard(the country name) - COUNTRY */
94 -+};
95 -+
96 -+enum {
97 -+ VCARD_KEY = 0,
98 -+ VCARD_KEY_ATTRIBUTE,
99 -+ VCARD_VALUE,
100 -+};
101 -+
102 -+static char *
103 -+vcard_get_line_element(char *line, int element)
104 -+{
105 -+ int i;
106 -+ char *line_copy = 0;
107 -+ char *result = 0;
108 -+ char *key = 0;
109 -+ char *key_attr = 0;
110 -+ char *value = 0;
111 -+
112 -+ line_copy = xstrdup(line);
113 -+
114 -+ /* make newline characters if exist end of string */
115 -+ for(i=0; line_copy[i]; i++) {
116 -+ if(line_copy[i] == '\r' || line_copy[i] == '\n') {
117 -+ line_copy[i] = '\0';
118 -+ break;
119 -+ }
120 -+ }
121 -+
122 -+ /* separate key from value */
123 -+ for(i=0; line_copy[i]; i++) {
124 -+ if(line_copy[i] == ':') {
125 -+ line_copy[i] = '\0';
126 -+ key = line_copy;
127 -+ value = &line_copy[i+1];
128 -+ break;
129 -+ }
130 -+ }
131 -+
132 -+ /* separate key from key attributes */
133 -+ if (key) {
134 -+ for(i=0; key[i]; i++) {
135 -+ if(key[i] == ';') {
136 -+ key[i] = '\0';
137 -+ key_attr = &key[i+1];
138 -+ break;
139 -+ }
140 -+ }
141 -+ }
142 -+
143 -+ switch(element) {
144 -+ case VCARD_KEY:
145 -+ if(key)
146 -+ result = xstrdup(key);
147 -+ break;
148 -+ case VCARD_KEY_ATTRIBUTE:
149 -+ if(key_attr)
150 -+ result = xstrdup(key_attr);
151 -+ break;
152 -+ case VCARD_VALUE:
153 -+ if(value)
154 -+ result = xstrdup(value);
155 -+ break;
156 -+ }
157 -+
158 -+ xfree(line_copy);
159 -+ return result;
160 -+}
161 -+
162 -+static void
163 -+vcard_parse_email(list_item item, char *line)
164 -+{
165 -+ char *email;
166 -+
167 -+ email = vcard_get_line_element(line, VCARD_VALUE);
168 -+
169 -+ if(item[1]) {
170 -+ item[1] = strconcat(item[1], ",", email, 0);
171 -+ xfree(email);
172 -+ }
173 -+ else {
174 -+ item[1] = email;
175 -+ }
176 -+}
177 -+
178 -+static void
179 -+vcard_parse_address(list_item item, char *line)
180 -+{
181 -+ int i;
182 -+ int k;
183 -+ char *value;
184 -+ char *address_field;
185 -+
186 -+ value = vcard_get_line_element(line, VCARD_VALUE);
187 -+ if(!value)
188 -+ return;
189 -+
190 -+ address_field = value;
191 -+ for(i=k=0; value[i]; i++) {
192 -+ if(value[i] == ';') {
193 -+ value[i] = '\0';
194 -+ if(vcard_address_fields[k] >= 0) {
195 -+ item[vcard_address_fields[k]] = xstrdup(address_field);
196 -+ }
197 -+ address_field = &value[i+1];
198 -+ k++;
199 -+ if((k+1)==(sizeof(vcard_address_fields)/sizeof(*vcard_address_fields)))
200 -+ break;
201 -+ }
202 -+ }
203 -+ item[vcard_address_fields[k]] = xstrdup(address_field);
204 -+ xfree(value);
205 -+}
206 -+
207 -+static void
208 -+vcard_parse_phone(list_item item, char *line)
209 -+{
210 -+ int index = 8;
211 -+ char *type = vcard_get_line_element(line, VCARD_KEY_ATTRIBUTE);
212 -+ char *value = vcard_get_line_element(line, VCARD_VALUE);
213 -+
214 -+ /* set the standard number */
215 -+ if (!type) {
216 -+ item[index] = value;
217 -+ }
218 -+
219 -+ /*
220 -+ * see rfc2426 section 3.3.1
221 -+ */
222 -+ else if (strstr(type, "TYPE=") == type){
223 -+ if (strcasestr(type, "home")) {
224 -+ item[index] = xstrdup(value);
225 -+ }
226 -+ if (strcasestr(type, "work")) {
227 -+ item[index+1] = xstrdup(value);
228 -+ }
229 -+ if (strcasestr(type, "fax")) {
230 -+ item[index+2] = xstrdup(value);
231 -+ }
232 -+ if (strcasestr(type, "cell")) {
233 -+ item[index+3] = xstrdup(value);
234 -+ }
235 -+
236 -+ xfree(type);
237 -+ xfree(value);
238 -+ }
239 -+}
240 -+
241 -+static void
242 -+vcard_parse_line(list_item item, char *line)
243 -+{
244 -+ int i;
245 -+ char *key;
246 -+
247 -+ for(i=0; vcard_fields[i]; i++) {
248 -+ key = vcard_fields[i];
249 -+
250 -+ if(!strncmp(key, line, strlen(key))) {
251 -+ if(i == 1) {
252 -+ vcard_parse_email(item, line);
253 -+ }
254 -+ else if(i == 2) {
255 -+ vcard_parse_address(item, line);
256 -+ }
257 -+ else if(i == 8) {
258 -+ vcard_parse_phone(item, line);
259 -+ }
260 -+ else {
261 -+ item[i] = vcard_get_line_element(line, VCARD_VALUE);
262 -+ }
263 -+ break;
264 -+ }
265 -+ }
266 -+}
267 -+
268 -+static void
269 -+vcard_parse_item(FILE *in)
270 -+{
271 -+ char *line = NULL;
272 -+ list_item item = item_create();
273 -+
274 -+ while(!feof(in)) {
275 -+ line = getaline(in);
276 -+
277 -+ if(line && !strncmp("END:VCARD", line, 9)) {
278 -+ xfree(line);
279 -+ break;
280 -+ }
281 -+ else if(line) {
282 -+ vcard_parse_line(item, line);
283 -+ xfree(line);
284 -+ }
285 -+ }
286 -+
287 -+ add_item2database(item);
288 -+ item_free(&item);
289 -+}
290 -+
291 -+static int
292 -+vcard_parse_file(FILE *in)
293 -+{
294 -+ char *line = NULL;
295 -+
296 -+ while(!feof(in)) {
297 -+ line = getaline(in);
298 -+
299 -+ if(line && !strncmp("BEGIN:VCARD", line, 11)) {
300 -+ xfree(line);
301 -+ vcard_parse_item(in);
302 -+ }
303 -+ else if(line) {
304 -+ xfree(line);
305 -+ }
306 -+ }
307 -+
308 -+ return 0;
309 -+}
310 -+
311 -+/*
312 -+ * end of vCard import filter
313 -+ */
314 -+
315 -+/*
316 - * csv addressbook export filters
317 - */
318 -
319 -diff -ru a/misc.c b/misc.c
320 ---- a/misc.c 2006-09-04 21:24:18.000000000 +0200
321 -+++ b/misc.c 2008-05-18 18:00:33.000000000 +0200
322 -@@ -77,6 +77,27 @@
323 - return 1;
324 - }
325 -
326 -+char *
327 -+strcasestr(char *haystack, char *needle)
328 -+{
329 -+ int i;
330 -+ int k;
331 -+
332 -+ assert(haystack != NULL);
333 -+ assert(needle != NULL);
334 -+
335 -+ for(i=0; i<strlen(haystack)-strlen(needle)+1; i++) {
336 -+ for(k=0; k<strlen(needle); k++, i++) {
337 -+ if (tolower(haystack[i]) != tolower(needle[k]))
338 -+ break;
339 -+ else if ((k+1) == strlen(needle))
340 -+ return &haystack[i];
341 -+ }
342 -+ }
343 -+
344 -+ return NULL;
345 -+}
346 -+
347 -
348 - #ifdef HAVE_CONFIG_H
349 - # include "config.h"
350 -diff -ru a/misc.h b/misc.h
351 ---- a/misc.h 2006-09-04 21:24:18.000000000 +0200
352 -+++ b/misc.h 2008-05-18 17:55:59.000000000 +0200
353 -@@ -18,6 +18,8 @@
354 -
355 - int is_number(char *s);
356 -
357 -+char *strcasestr(char *haystack, char *needle);
358 -+
359 - char *strdup_printf(const char *format, ... );
360 - char *strconcat(const char *str, ...);
361 -