1 /*! \file
2
3 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
5 2015, 2016, 2017, 2018
6 University Corporation for Atmospheric Research/Unidata.
7
8 See \ref copyright file for more info.
9
10 */
11 #include "config.h"
12 #include <stdlib.h>
13 #include <stdio.h>
14 #include <string.h>
15 #include "netcdf.h"
16 #include "nctestserver.h"
17
18 #define FURL "%s"
19 static char url[4096];
20
21 #ifdef DEBUG
22 static void
CHECK(int e,const char * msg)23 CHECK(int e, const char* msg)
24 {
25 if(e == NC_NOERR) return;
26 if(msg == NULL) msg = "Error";
27 printf("%s: %s\n", msg, nc_strerror(e));
28 exit(1);
29 }
30 #endif
31
32 static void
XFAIL(int e,const char * msg)33 XFAIL(int e, const char* msg)
34 {
35 if(e == NC_NOERR) return;
36 if(msg == NULL) msg = "XFAIL";
37 printf("%s: %s\n", msg, nc_strerror(e));
38 }
39
40 int
main()41 main()
42 {
43 int ncid,retval;
44 char* serverlist = NULL;
45 char* svcurl = NULL;
46 const char* servlet = "dts";
47
48 #ifdef REMOTETESTSERVERS
49 serverlist = strdup(REMOTETESTSERVERS);
50 #endif
51
52 if(serverlist == NULL || strlen(serverlist) == 0) {
53 fprintf(stderr,"WARNING: Cannot determine a server list");
54 exit(0);
55 }
56 svcurl = nc_findtestserver(servlet,serverlist);
57 if(svcurl == NULL) {
58 fprintf(stderr,"WARNING: Server not found: %s\n",servlet);
59 exit(1);
60 }
61
62 snprintf(url,sizeof(url),FURL,svcurl);
63
64 printf("Testing: Misc. Tests url=|%s|\n",url);
65 retval = nc_open(url, 0, &ncid);
66 XFAIL(retval,"*** XFail : No trailing slash in url");
67 retval = nc_close(ncid);
68 /* cleanup */
69 free(serverlist);
70 free(svcurl);
71 return 0;
72 }
73