1 #include "config.h"
2 #include <stdlib.h>
3 #include <stdio.h>
4 #include <string.h>
5 #include "netcdf.h"
6 #include "nctestserver.h"
7 
8 #define FURL "%s"
9 static char url[4096];
10 
11 #ifdef DEBUG
12 static void
CHECK(int e,const char * msg)13 CHECK(int e, const char* msg)
14 {
15     if(e == NC_NOERR) return;
16     if(msg == NULL) msg = "Error";
17     printf("%s: %s\n", msg, nc_strerror(e));
18     exit(1);
19 }
20 #endif
21 
22 static void
XFAIL(int e,const char * msg)23 XFAIL(int e, const char* msg)
24 {
25     if(e == NC_NOERR) return;
26     if(msg == NULL) msg = "XFAIL";
27     printf("%s: %s\n", msg, nc_strerror(e));
28 }
29 
30 int
main()31 main()
32 {
33     int ncid,retval;
34     char* serverlist = NULL;
35     char* svcurl = NULL;
36     const char* servlet = "dts";
37 
38 #ifdef REMOTETESTSERVERS
39     serverlist = strdup(REMOTETESTSERVERS);
40 #endif
41 
42     if(serverlist == NULL || strlen(serverlist) == 0) {
43 	fprintf(stderr,"Cannot determine a server list");
44 	exit(1);
45     }
46     svcurl = nc_findtestserver(servlet,0,serverlist);
47     if(svcurl == NULL) {
48 	fprintf(stderr,"not found: %s\n",servlet);
49 	exit(1);
50     }
51 
52     snprintf(url,sizeof(url),FURL,svcurl);
53 
54     printf("Testing: Misc. Tests url=|%s|\n",url);
55     retval = nc_open(url, 0, &ncid);
56     XFAIL(retval,"*** XFail : No trailing slash in url");
57     retval = nc_close(ncid);
58     /* cleanup */
59     free(serverlist);
60     free(svcurl);
61     return 0;
62 }
63