Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / servers / exchange / lib / urltest.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
3 /* Copyright (C) 2002-2004 Novell, Inc.
4  *
5  * This  program is free  software; you  can redistribute  it and/or
6  * modify it under the terms of version 2  of the GNU General Public
7  * License as published by the Free Software Foundation.
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 GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19
20 /*
21  * This program takes account URL as input and dups E2KUri structure
22  * values
23  */
24
25 #ifdef HAVE_CONFIG_H
26 #include <config.h>
27 #endif
28
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <time.h>
32
33 #include "e2k-uri.h"
34 #include "test-utils.h"
35
36 const char *test_program_name = "urltest";
37
38 static void
39 dump_uri (E2kUri *euri) {
40         const char *temp;
41
42         printf ("URI contents \n");
43         printf ("==================== \n");
44
45         if (euri->protocol)
46                 printf("Protocol : %s \n", euri->protocol);
47         else 
48                 printf ("Protocol : NULL \n");  
49         if (euri->user)
50                 printf("User : %s \n", euri->user);
51         else 
52                 printf ("User : NULL \n");      
53         if (euri->domain)
54                 printf("Domain : %s \n", euri->domain);
55         else 
56                 printf ("Domain : NULL \n");    
57         if (euri->authmech)
58                 printf("Authmech : %s \n", euri->authmech);
59         else 
60                 printf ("Authmech : NULL \n");  
61         if (euri->passwd)
62                 printf("Password : %s \n", euri->passwd);
63         else 
64                 printf ("Password : NULL \n");  
65         if (euri->host)
66                 printf("Host : %s \n", euri->host);
67         else 
68                 printf ("Host : NULL \n");      
69         if (euri->port)
70                 printf("Port : %d \n", euri->port);
71         else 
72                 printf ("Port : NULL \n");      
73         if (euri->path)
74                 printf("Path : %s \n", euri->path);
75         else 
76                 printf ("Path : NULL \n");      
77         if (euri->params) {
78                 printf("\nParams : \n");
79                 temp = e2k_uri_get_param (euri, "ad_server"); 
80                 if (temp) printf ("\tAd server = %s\n", temp);
81                 else printf ("\tAd server = NULL \n");
82
83                 temp = e2k_uri_get_param (euri, "ad_limit"); 
84                 if (temp) printf ("\tAd Limit = %s\n", temp);
85                 else printf ("\tAd Limit = NULL\n");
86
87                 temp = e2k_uri_get_param (euri, "passwd_exp_warn_period"); 
88                 if (temp) printf ("\tPasswd expiry warn period = %s\n", temp);
89                 else printf ("\tPasswd expiry warn period = NULL \n");
90
91                 temp = e2k_uri_get_param (euri, "offline_sync"); 
92                 if (temp) printf ("\tOffline Sync = %s\n", temp);
93                 else printf ("\tOffline Sync = NULL \n");
94
95                 temp = e2k_uri_get_param (euri, "owa_path"); 
96                 if (temp) printf ("\tOwa path = %s\n", temp);
97                 else printf ("\tOwa path = NULL \n");
98
99                 temp = e2k_uri_get_param (euri, "pf_server"); 
100                 if (temp) printf ("\tPf server = %s\n", temp);
101                 else printf ("\tPf server = NULL \n");
102
103                 temp = e2k_uri_get_param (euri, "use_ssl"); 
104                 if (temp) printf ("\tSSL = %s\n", temp);
105                 else printf ("\tSSL = NULL\n");
106
107                 temp = e2k_uri_get_param (euri, "mailbox"); 
108                 if (temp) printf ("\tMailbox = %s\n", temp);
109                 else printf ("\tMailbox = NULL \n");
110
111                 temp = e2k_uri_get_param (euri, "filter"); 
112                 if (temp) printf ("\tFilter = %s\n", temp);
113                 else printf ("\tFilter = NULL \n");
114
115                 temp = e2k_uri_get_param (euri, "filter_junk"); 
116                 if (temp) printf ("\tFilter junk = %s\n", temp);
117                 else printf ("\tFilter junk = NULL \n");
118
119                 temp = e2k_uri_get_param (euri, "filter_junk_inbox"); 
120                 if (temp) printf ("\tFilter junk inbox = %s\n", temp);
121                 else printf ("\tFilter junk inbox = NULL \n");
122
123                 temp = e2k_uri_get_param (euri, "owa_protocol"); 
124                 if (temp) printf ("\tOwa protocol = %s\n", temp);
125                 else printf ("\tOwa protocol = NULL \n");
126
127                 temp = e2k_uri_get_param (euri, "owa_url"); 
128                 if (temp) printf ("\tOwa url = %s\n", temp);
129                 else printf ("\tOwa url = NULL \n");
130         }
131         else 
132                 printf ("Params : NULL \n");    
133         if (euri->query)
134                 printf("Query : %s \n", euri->query);
135         else 
136                 printf ("Query : NULL \n");     
137         if (euri->fragment)
138                 printf("Fragment : %s \n", euri->fragment);
139         else 
140                 printf ("Fragment : NULL \n");  
141 }
142
143 void
144 test_main (int argc, char **argv)
145 {
146         const char *url;
147         E2kUri *euri;
148
149         if (argc != 2) {
150                 fprintf (stderr, "Usage: %s url \n", argv[0]);
151                 exit (1);
152         }
153
154         url = argv[1];
155         euri = e2k_uri_new (url);
156         dump_uri (euri);
157         test_quit ();
158 }