Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
0f4b13ec
...
0f4b13ec737f886f893521e605b664aff89f287b
authored
2000-04-28 02:44:00 +0000
by
Alain Magloire
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
url_file.c
new file.
1 parent
193c1ef7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
0 deletions
mailbox/url_file.c
mailbox/url_file.c
0 → 100644
View file @
0f4b13e
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <url0.h>
#include <registrar0.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
static
void
url_file_destroy
(
url_t
*
purl
);
static
int
url_file_init
(
url_t
*
purl
,
const
char
*
name
);
struct
url_registrar
_url_file_registrar
=
{
"file:"
,
url_file_init
,
url_file_destroy
};
static
void
url_file_destroy
(
url_t
*
purl
)
{
if
(
purl
&&
*
purl
)
{
url_t
url
=
*
purl
;
free
(
url
->
scheme
);
free
(
url
->
path
);
free
(
url
);
*
purl
=
NULL
;
}
}
/*
UNIX box
*/
static
int
url_file_init
(
url_t
*
purl
,
const
char
*
name
)
{
url_t
url
;
struct
url_registrar
*
ureg
=
&
_url_mbox_registrar
;
/* reject the obvious */
if
(
name
==
NULL
||
*
name
==
'\0'
)
return
EINVAL
;
/* FIXME: do I need to decode url encoding '% hex hex' ? */
url
=
calloc
(
1
,
sizeof
(
*
url
));
if
(
url
==
NULL
)
return
ENOMEM
;
/* TYPE */
url
->
_init
=
ureg
->
_init
;
url
->
_destroy
=
ureg
->
_destroy
;
/* SCHEME */
url
->
scheme
=
strdup
(
ureg
->
scheme
);
if
(
url
->
scheme
==
NULL
)
{
ureg
->
_destroy
(
&
url
);
return
ENOMEM
;
}
/* PATH */
url
->
path
=
strdup
(
name
);
if
(
url
->
path
==
NULL
)
{
ureg
->
_destroy
(
&
url
);
return
ENOMEM
;
}
*
purl
=
url
;
return
0
;
}
Please
register
or
sign in
to post a comment