Commit 54759f99 54759f999958197531dad3afa7572b969af85b4e by Sergey Poznyakoff

Removed url.c

1 parent 0e49de77
...@@ -25,6 +25,6 @@ lib_LTLIBRARIES = libmu_mh.la ...@@ -25,6 +25,6 @@ lib_LTLIBRARIES = libmu_mh.la
25 25
26 libmu_mh_la_SOURCES = \ 26 libmu_mh_la_SOURCES = \
27 folder.c\ 27 folder.c\
28 mbox.c\ 28 mbox.c
29 url.c 29
30 30
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
17
18 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21
22 #ifdef ENABLE_MH
23
24 #include <errno.h>
25 #include <stdlib.h>
26 #include <string.h>
27
28 #include <url0.h>
29 #include <registrar0.h>
30
31 static void
32 url_mh_destroy (url_t url ARG_UNUSED)
33 {
34 }
35
36 /*
37 MH url
38 mh:path
39 */
40 int
41 _url_mh_init (url_t url)
42 {
43 const char *name = url_to_string (url);
44 size_t len = strlen (name);
45
46 /* reject the obvious */
47 if (name == NULL || strncmp (MU_MH_SCHEME, name, MU_MH_SCHEME_LEN) != 0
48 || len < (MU_MH_SCHEME_LEN + 1) /* (scheme)+1(path)*/)
49 return EINVAL;
50
51 /* do I need to decode url encoding '% hex hex' ? */
52
53 /* TYPE */
54 url->_destroy = url_mh_destroy;
55
56 /* SCHEME */
57 url->scheme = strdup (MU_MH_SCHEME);
58 if (url->scheme == NULL)
59 {
60 url_mh_destroy (url);
61 return ENOMEM;
62 }
63
64 /* PATH */
65 name += MU_MH_SCHEME_LEN; /* pass the scheme */
66 url->path = strdup (name);
67 if (url->path == NULL)
68 {
69 url_mh_destroy (url);
70 return ENOMEM;
71 }
72
73 return 0;
74 }
75
76 #endif