1 |
#include <mailutils/errno.h> |
/* GNU mailutils - a suite of utilities for electronic mail |
2 |
#include <mailutils/url.h> |
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. |
3 |
|
|
4 |
|
This program is free software; you can redistribute it and/or modify |
5 |
|
it under the terms of the GNU General Public License as published by |
6 |
|
the Free Software Foundation; either version 2, or (at your option) |
7 |
|
any later version. |
8 |
|
|
9 |
|
This program 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 |
12 |
|
GNU General Public License for more details. |
13 |
|
|
14 |
|
You should have received a copy of the GNU General Public License |
15 |
|
along with this program; if not, write to the Free Software |
16 |
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ |
17 |
|
|
18 |
#include <stdio.h> |
#include <stdio.h> |
19 |
#include <string.h> |
#include <string.h> |
20 |
|
#include <mailutils/errno.h> |
21 |
|
#include <mailutils/url.h> |
22 |
|
|
23 |
int |
int |
24 |
main () |
main () |
34 |
int rc; |
int rc; |
35 |
|
|
36 |
str[strlen (str) - 1] = '\0'; /* chop newline */ |
str[strlen (str) - 1] = '\0'; /* chop newline */ |
37 |
if(strspn(str, " \t") == strlen(str)) |
if (strspn (str, " \t") == strlen (str)) |
38 |
continue; /* skip empty lines */ |
continue; /* skip empty lines */ |
39 |
if ((rc = url_create(&u, str)) != 0) |
if ((rc = url_create (&u, str)) != 0) |
40 |
{ |
{ |
41 |
fprintf(stderr, "url_create %s ERROR: [%d] %s", |
fprintf (stderr, "url_create %s ERROR: [%d] %s", |
42 |
str, rc, mu_errstring(rc)); |
str, rc, mu_errstring (rc)); |
43 |
exit (1); |
exit (1); |
44 |
} |
} |
45 |
if ((rc = url_parse (u)) != 0) |
if ((rc = url_parse (u)) != 0) |
46 |
{ |
{ |
47 |
printf ("%s --> FAILED: [%d] %s\n", |
printf ("%s => FAILED: [%d] %s\n", |
48 |
str, rc, mu_errstring(rc)); |
str, rc, mu_errstring (rc)); |
49 |
continue; |
continue; |
50 |
} |
} |
51 |
printf ("%s --> SUCCESS\n", str); |
printf ("%s => SUCCESS\n", str); |
52 |
|
|
53 |
url_get_scheme (u, buffer, len, NULL); |
url_get_scheme (u, buffer, len, NULL); |
54 |
printf (" scheme <%s>\n", buffer); |
printf (" scheme <%s>\n", buffer); |
79 |
} |
} |
80 |
return 0; |
return 0; |
81 |
} |
} |
|
|
|