diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a73d557b..54a727f70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,7 +148,6 @@ ENDIF() IF(CMAKE_COMPILER_IS_GNUCC OR APPLE) OPTION(ENABLE_COVERAGE_TESTS "Enable compiler flags needed to perform coverage tests." OFF) OPTION(ENABLE_CONVERSION_WARNINGS "Enable warnings for implicit conversion from 64 to 32-bit datatypes." ON) - OPTION(ENABLE_USED_VAR_PAR_WARNINGS "Enable warnings for unused parameters and variables. Creates very noisy output." OFF) OPTION(ENABLE_LARGE_FILE_TESTS "Enable large file tests." OFF) # Debugging flags @@ -171,11 +170,6 @@ IF(CMAKE_COMPILER_IS_GNUCC OR APPLE) SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O2") - # Unused var and parameter warnings create a lot of noise. - IF(NOT ENABLE_UNUSED_VAR_PAR_WARNINGS) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-variable -Wno-unused-parameter") - ENDIF() - # Warnings for 64-to-32 bit conversions. IF(ENABLE_CONVERSION_WARNINGS) CHECK_C_COMPILER_FLAG(-Wconversion CC_HAS_WCONVERSION) @@ -907,6 +901,7 @@ IF(ENABLE_PNETCDF) SET(HAVE_LIBPNETCDF ON) # pnetcdf => parallel SET(STATUS_PARALLEL "ON") + SET(USE_PARALLEL ON) ENDIF() # Enable Parallel Tests. diff --git a/cf b/cf index 831645f08..f28adb206 100644 --- a/cf +++ b/cf @@ -23,6 +23,7 @@ CFLAGS="" stddir="/usr/local" PREFIX=/usr/local + if test "x${cmds}" = x ; then cmds="" else @@ -102,11 +103,6 @@ fi CXXFLAGS="$CPPFLAGS $CXXFLAGS" -if test -z "$NB" ; then -${MAKE} maintainer-clean >/dev/null 2>&1 -if autoreconf -i --force ; then ok=1; else exit ; fi -fi - FLAGS="--prefix ${PREFIX}" #FLAGS="$FLAGS --disable-f77 --disable-f90" #FLAGS="$FLAGS --disable-cxx" @@ -181,6 +177,11 @@ export CXXFLAGS DISTCHECK_CONFIGURE_FLAGS="$FLAGS" export DISTCHECK_CONFIGURE_FLAGS +if test -z "$NB" ; then +${MAKE} maintainer-clean >/dev/null 2>&1 +if autoreconf -i --force ; then ok=1; else exit ; fi +fi + if test -f Makefile ; then ${MAKE} distclean >/dev/null 2>&1 ; fi sh $X ./configure ${FLAGS} for c in $cmds; do diff --git a/oc2/Make0 b/oc2/Make0 index 0d82a1d2f..bee37b81b 100755 --- a/oc2/Make0 +++ b/oc2/Make0 @@ -1,6 +1,6 @@ THISDIR=../oc2 #OCDIR=/home/dmh/svn/oc2.0 -OCDIR=f:/svn/oc2.0 +OCDIR=f:/git/oc # Make consistent with Makefile.am SRC=oc.c \ @@ -64,3 +64,8 @@ diffoc:: fi; \ fi; \ done + +backoc:: + for f in ${FILES} ; do \ + cp -f ./$$f ${OCDIR}/$$f ; \ + done diff --git a/oc2/daptab.c b/oc2/daptab.c index 1014c728d..da689cd11 100644 --- a/oc2/daptab.c +++ b/oc2/daptab.c @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.0. */ +/* A Bison parser, made by GNU Bison 3.0.2. */ /* Bison implementation for Yacc-like parsers in C @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0" +#define YYBISON_VERSION "3.0.2" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -77,11 +77,11 @@ int dapdebug = 0; #line 79 "dap.tab.c" /* yacc.c:339 */ -# ifndef YY_NULL +# ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr +# define YY_NULLPTR nullptr # else -# define YY_NULL 0 +# define YY_NULLPTR 0 # endif # endif @@ -210,11 +210,30 @@ typedef short int yytype_int16; # endif #endif -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if (! defined __GNUC__ || __GNUC__ < 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) -# define __attribute__(Spec) /* empty */ +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) # endif #endif @@ -464,7 +483,7 @@ static const char *const yytname[] = "array_decl", "datasetname", "var_name", "attributebody", "attr_list", "attribute", "bytes", "int16", "uint16", "int32", "uint32", "float32", "float64", "strs", "urls", "url", "str_or_id", "alias", "errorbody", - "errorcode", "errormsg", "errorptype", "errorprog", "name", YY_NULL + "errorcode", "errormsg", "errorptype", "errorprog", "name", YY_NULLPTR }; #endif @@ -989,11 +1008,11 @@ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + const char *yyformat = YY_NULLPTR; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per @@ -1050,7 +1069,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; @@ -1389,611 +1408,611 @@ yyreduce: case 6: #line 58 "dap.y" /* yacc.c:1646 */ {dap_unrecognizedresponse(parsestate); YYABORT;} -#line 1393 "dap.tab.c" /* yacc.c:1646 */ +#line 1412 "dap.tab.c" /* yacc.c:1646 */ break; case 7: #line 63 "dap.y" /* yacc.c:1646 */ {dap_tagparse(parsestate,SCAN_DATASET);} -#line 1399 "dap.tab.c" /* yacc.c:1646 */ +#line 1418 "dap.tab.c" /* yacc.c:1646 */ break; case 8: #line 67 "dap.y" /* yacc.c:1646 */ {dap_tagparse(parsestate,SCAN_ATTR);} -#line 1405 "dap.tab.c" /* yacc.c:1646 */ +#line 1424 "dap.tab.c" /* yacc.c:1646 */ break; case 9: #line 71 "dap.y" /* yacc.c:1646 */ {dap_tagparse(parsestate,SCAN_ERROR);} -#line 1411 "dap.tab.c" /* yacc.c:1646 */ +#line 1430 "dap.tab.c" /* yacc.c:1646 */ break; case 10: #line 76 "dap.y" /* yacc.c:1646 */ {dap_datasetbody(parsestate,(yyvsp[-1]),(yyvsp[-3]));} -#line 1417 "dap.tab.c" /* yacc.c:1646 */ +#line 1436 "dap.tab.c" /* yacc.c:1646 */ break; case 11: #line 81 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_declarations(parsestate,null,null);} -#line 1423 "dap.tab.c" /* yacc.c:1646 */ +#line 1442 "dap.tab.c" /* yacc.c:1646 */ break; case 12: #line 82 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_declarations(parsestate,(yyvsp[-1]),(yyvsp[0]));} -#line 1429 "dap.tab.c" /* yacc.c:1646 */ +#line 1448 "dap.tab.c" /* yacc.c:1646 */ break; case 13: #line 89 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_makebase(parsestate,(yyvsp[-2]),(yyvsp[-3]),(yyvsp[-1]));} -#line 1435 "dap.tab.c" /* yacc.c:1646 */ +#line 1454 "dap.tab.c" /* yacc.c:1646 */ break; case 14: #line 91 "dap.y" /* yacc.c:1646 */ {if(((yyval)=dap_makestructure(parsestate,(yyvsp[-2]),(yyvsp[-1]),(yyvsp[-4])))==null) {YYABORT;}} -#line 1441 "dap.tab.c" /* yacc.c:1646 */ +#line 1460 "dap.tab.c" /* yacc.c:1646 */ break; case 15: #line 93 "dap.y" /* yacc.c:1646 */ {if(((yyval)=dap_makesequence(parsestate,(yyvsp[-1]),(yyvsp[-3])))==null) {YYABORT;}} -#line 1447 "dap.tab.c" /* yacc.c:1646 */ +#line 1466 "dap.tab.c" /* yacc.c:1646 */ break; case 16: #line 96 "dap.y" /* yacc.c:1646 */ {if(((yyval)=dap_makegrid(parsestate,(yyvsp[-1]),(yyvsp[-6]),(yyvsp[-3])))==null) {YYABORT;}} -#line 1453 "dap.tab.c" /* yacc.c:1646 */ +#line 1472 "dap.tab.c" /* yacc.c:1646 */ break; case 17: #line 98 "dap.y" /* yacc.c:1646 */ {dapsemanticerror(parsestate,OC_EBADTYPE,"Unrecognized type"); YYABORT;} -#line 1459 "dap.tab.c" /* yacc.c:1646 */ +#line 1478 "dap.tab.c" /* yacc.c:1646 */ break; case 18: #line 103 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_BYTE;} -#line 1465 "dap.tab.c" /* yacc.c:1646 */ +#line 1484 "dap.tab.c" /* yacc.c:1646 */ break; case 19: #line 104 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_INT16;} -#line 1471 "dap.tab.c" /* yacc.c:1646 */ +#line 1490 "dap.tab.c" /* yacc.c:1646 */ break; case 20: #line 105 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_UINT16;} -#line 1477 "dap.tab.c" /* yacc.c:1646 */ +#line 1496 "dap.tab.c" /* yacc.c:1646 */ break; case 21: #line 106 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_INT32;} -#line 1483 "dap.tab.c" /* yacc.c:1646 */ +#line 1502 "dap.tab.c" /* yacc.c:1646 */ break; case 22: #line 107 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_UINT32;} -#line 1489 "dap.tab.c" /* yacc.c:1646 */ +#line 1508 "dap.tab.c" /* yacc.c:1646 */ break; case 23: #line 108 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_FLOAT32;} -#line 1495 "dap.tab.c" /* yacc.c:1646 */ +#line 1514 "dap.tab.c" /* yacc.c:1646 */ break; case 24: #line 109 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_FLOAT64;} -#line 1501 "dap.tab.c" /* yacc.c:1646 */ +#line 1520 "dap.tab.c" /* yacc.c:1646 */ break; case 25: #line 110 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_URL;} -#line 1507 "dap.tab.c" /* yacc.c:1646 */ +#line 1526 "dap.tab.c" /* yacc.c:1646 */ break; case 26: #line 111 "dap.y" /* yacc.c:1646 */ {(yyval)=(Object)SCAN_STRING;} -#line 1513 "dap.tab.c" /* yacc.c:1646 */ +#line 1532 "dap.tab.c" /* yacc.c:1646 */ break; case 27: #line 115 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_arraydecls(parsestate,null,null);} -#line 1519 "dap.tab.c" /* yacc.c:1646 */ +#line 1538 "dap.tab.c" /* yacc.c:1646 */ break; case 28: #line 116 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_arraydecls(parsestate,(yyvsp[-1]),(yyvsp[0]));} -#line 1525 "dap.tab.c" /* yacc.c:1646 */ +#line 1544 "dap.tab.c" /* yacc.c:1646 */ break; case 29: #line 120 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_arraydecl(parsestate,null,(yyvsp[-1]));} -#line 1531 "dap.tab.c" /* yacc.c:1646 */ +#line 1550 "dap.tab.c" /* yacc.c:1646 */ break; case 30: #line 121 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_arraydecl(parsestate,null,(yyvsp[-1]));} -#line 1537 "dap.tab.c" /* yacc.c:1646 */ +#line 1556 "dap.tab.c" /* yacc.c:1646 */ break; case 31: #line 122 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_arraydecl(parsestate,(yyvsp[-3]),(yyvsp[-1]));} -#line 1543 "dap.tab.c" /* yacc.c:1646 */ +#line 1562 "dap.tab.c" /* yacc.c:1646 */ break; case 32: #line 124 "dap.y" /* yacc.c:1646 */ {dapsemanticerror(parsestate,OC_EDIMSIZE,"Illegal dimension declaration"); YYABORT;} -#line 1549 "dap.tab.c" /* yacc.c:1646 */ +#line 1568 "dap.tab.c" /* yacc.c:1646 */ break; case 33: #line 128 "dap.y" /* yacc.c:1646 */ {(yyval)=(yyvsp[0]);} -#line 1555 "dap.tab.c" /* yacc.c:1646 */ +#line 1574 "dap.tab.c" /* yacc.c:1646 */ break; case 34: #line 130 "dap.y" /* yacc.c:1646 */ {dapsemanticerror(parsestate,OC_EDDS,"Illegal dataset declaration"); YYABORT;} -#line 1561 "dap.tab.c" /* yacc.c:1646 */ +#line 1580 "dap.tab.c" /* yacc.c:1646 */ break; case 35: #line 133 "dap.y" /* yacc.c:1646 */ {(yyval)=(yyvsp[0]);} -#line 1567 "dap.tab.c" /* yacc.c:1646 */ +#line 1586 "dap.tab.c" /* yacc.c:1646 */ break; case 36: #line 136 "dap.y" /* yacc.c:1646 */ {dap_attributebody(parsestate,(yyvsp[-1]));} -#line 1573 "dap.tab.c" /* yacc.c:1646 */ +#line 1592 "dap.tab.c" /* yacc.c:1646 */ break; case 37: #line 138 "dap.y" /* yacc.c:1646 */ {dapsemanticerror(parsestate,OC_EDAS,"Illegal DAS body"); YYABORT;} -#line 1579 "dap.tab.c" /* yacc.c:1646 */ +#line 1598 "dap.tab.c" /* yacc.c:1646 */ break; case 38: #line 142 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrlist(parsestate,null,null);} -#line 1585 "dap.tab.c" /* yacc.c:1646 */ +#line 1604 "dap.tab.c" /* yacc.c:1646 */ break; case 39: #line 143 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrlist(parsestate,(yyvsp[-1]),(yyvsp[0]));} -#line 1591 "dap.tab.c" /* yacc.c:1646 */ +#line 1610 "dap.tab.c" /* yacc.c:1646 */ break; case 40: #line 147 "dap.y" /* yacc.c:1646 */ {(yyval)=null;} -#line 1597 "dap.tab.c" /* yacc.c:1646 */ +#line 1616 "dap.tab.c" /* yacc.c:1646 */ break; case 41: #line 149 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_BYTE);} -#line 1603 "dap.tab.c" /* yacc.c:1646 */ +#line 1622 "dap.tab.c" /* yacc.c:1646 */ break; case 42: #line 151 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_INT16);} -#line 1609 "dap.tab.c" /* yacc.c:1646 */ +#line 1628 "dap.tab.c" /* yacc.c:1646 */ break; case 43: #line 153 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_UINT16);} -#line 1615 "dap.tab.c" /* yacc.c:1646 */ +#line 1634 "dap.tab.c" /* yacc.c:1646 */ break; case 44: #line 155 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_INT32);} -#line 1621 "dap.tab.c" /* yacc.c:1646 */ +#line 1640 "dap.tab.c" /* yacc.c:1646 */ break; case 45: #line 157 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_UINT32);} -#line 1627 "dap.tab.c" /* yacc.c:1646 */ +#line 1646 "dap.tab.c" /* yacc.c:1646 */ break; case 46: #line 159 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_FLOAT32);} -#line 1633 "dap.tab.c" /* yacc.c:1646 */ +#line 1652 "dap.tab.c" /* yacc.c:1646 */ break; case 47: #line 161 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_FLOAT64);} -#line 1639 "dap.tab.c" /* yacc.c:1646 */ +#line 1658 "dap.tab.c" /* yacc.c:1646 */ break; case 48: #line 163 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_STRING);} -#line 1645 "dap.tab.c" /* yacc.c:1646 */ +#line 1664 "dap.tab.c" /* yacc.c:1646 */ break; case 49: #line 165 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attribute(parsestate,(yyvsp[-2]),(yyvsp[-1]),(Object)SCAN_URL);} -#line 1651 "dap.tab.c" /* yacc.c:1646 */ +#line 1670 "dap.tab.c" /* yacc.c:1646 */ break; case 50: #line 166 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrset(parsestate,(yyvsp[-3]),(yyvsp[-1]));} -#line 1657 "dap.tab.c" /* yacc.c:1646 */ +#line 1676 "dap.tab.c" /* yacc.c:1646 */ break; case 51: #line 168 "dap.y" /* yacc.c:1646 */ {dapsemanticerror(parsestate,OC_EDAS,"Illegal attribute"); YYABORT;} -#line 1663 "dap.tab.c" /* yacc.c:1646 */ +#line 1682 "dap.tab.c" /* yacc.c:1646 */ break; case 52: #line 172 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_BYTE);} -#line 1669 "dap.tab.c" /* yacc.c:1646 */ +#line 1688 "dap.tab.c" /* yacc.c:1646 */ break; case 53: #line 174 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_BYTE);} -#line 1675 "dap.tab.c" /* yacc.c:1646 */ +#line 1694 "dap.tab.c" /* yacc.c:1646 */ break; case 54: #line 177 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_INT16);} -#line 1681 "dap.tab.c" /* yacc.c:1646 */ +#line 1700 "dap.tab.c" /* yacc.c:1646 */ break; case 55: #line 179 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_INT16);} -#line 1687 "dap.tab.c" /* yacc.c:1646 */ +#line 1706 "dap.tab.c" /* yacc.c:1646 */ break; case 56: #line 182 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_UINT16);} -#line 1693 "dap.tab.c" /* yacc.c:1646 */ +#line 1712 "dap.tab.c" /* yacc.c:1646 */ break; case 57: #line 184 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_UINT16);} -#line 1699 "dap.tab.c" /* yacc.c:1646 */ +#line 1718 "dap.tab.c" /* yacc.c:1646 */ break; case 58: #line 187 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_INT32);} -#line 1705 "dap.tab.c" /* yacc.c:1646 */ +#line 1724 "dap.tab.c" /* yacc.c:1646 */ break; case 59: #line 189 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_INT32);} -#line 1711 "dap.tab.c" /* yacc.c:1646 */ +#line 1730 "dap.tab.c" /* yacc.c:1646 */ break; case 60: #line 192 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_UINT32);} -#line 1717 "dap.tab.c" /* yacc.c:1646 */ +#line 1736 "dap.tab.c" /* yacc.c:1646 */ break; case 61: #line 193 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_UINT32);} -#line 1723 "dap.tab.c" /* yacc.c:1646 */ +#line 1742 "dap.tab.c" /* yacc.c:1646 */ break; case 62: #line 196 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_FLOAT32);} -#line 1729 "dap.tab.c" /* yacc.c:1646 */ +#line 1748 "dap.tab.c" /* yacc.c:1646 */ break; case 63: #line 197 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_FLOAT32);} -#line 1735 "dap.tab.c" /* yacc.c:1646 */ +#line 1754 "dap.tab.c" /* yacc.c:1646 */ break; case 64: #line 200 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_FLOAT64);} -#line 1741 "dap.tab.c" /* yacc.c:1646 */ +#line 1760 "dap.tab.c" /* yacc.c:1646 */ break; case 65: #line 201 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_FLOAT64);} -#line 1747 "dap.tab.c" /* yacc.c:1646 */ +#line 1766 "dap.tab.c" /* yacc.c:1646 */ break; case 66: #line 204 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_STRING);} -#line 1753 "dap.tab.c" /* yacc.c:1646 */ +#line 1772 "dap.tab.c" /* yacc.c:1646 */ break; case 67: #line 205 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_STRING);} -#line 1759 "dap.tab.c" /* yacc.c:1646 */ +#line 1778 "dap.tab.c" /* yacc.c:1646 */ break; case 68: #line 209 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,null,(yyvsp[0]),(Object)SCAN_URL);} -#line 1765 "dap.tab.c" /* yacc.c:1646 */ +#line 1784 "dap.tab.c" /* yacc.c:1646 */ break; case 69: #line 210 "dap.y" /* yacc.c:1646 */ {(yyval)=dap_attrvalue(parsestate,(yyvsp[-2]),(yyvsp[0]),(Object)SCAN_URL);} -#line 1771 "dap.tab.c" /* yacc.c:1646 */ +#line 1790 "dap.tab.c" /* yacc.c:1646 */ break; case 70: #line 214 "dap.y" /* yacc.c:1646 */ {(yyval)=(yyvsp[0]);} -#line 1777 "dap.tab.c" /* yacc.c:1646 */ +#line 1796 "dap.tab.c" /* yacc.c:1646 */ break; case 71: #line 218 "dap.y" /* yacc.c:1646 */ {(yyval)=(yyvsp[0]);} -#line 1783 "dap.tab.c" /* yacc.c:1646 */ +#line 1802 "dap.tab.c" /* yacc.c:1646 */ break; case 72: #line 219 "dap.y" /* yacc.c:1646 */ {(yyval)=(yyvsp[0]);} -#line 1789 "dap.tab.c" /* yacc.c:1646 */ +#line 1808 "dap.tab.c" /* yacc.c:1646 */ break; case 73: #line 230 "dap.y" /* yacc.c:1646 */ {(yyval)=(yyvsp[-1]); (yyval)=(yyvsp[0]); (yyval)=null;} -#line 1795 "dap.tab.c" /* yacc.c:1646 */ +#line 1814 "dap.tab.c" /* yacc.c:1646 */ break; case 74: #line 235 "dap.y" /* yacc.c:1646 */ {dap_errorbody(parsestate,(yyvsp[-5]),(yyvsp[-4]),(yyvsp[-3]),(yyvsp[-2]));} -#line 1801 "dap.tab.c" /* yacc.c:1646 */ +#line 1820 "dap.tab.c" /* yacc.c:1646 */ break; case 75: #line 238 "dap.y" /* yacc.c:1646 */ {(yyval)=null;} -#line 1807 "dap.tab.c" /* yacc.c:1646 */ +#line 1826 "dap.tab.c" /* yacc.c:1646 */ break; case 76: #line 238 "dap.y" /* yacc.c:1646 */ {(yyval)=(yyvsp[-1]);} -#line 1813 "dap.tab.c" /* yacc.c:1646 */ +#line 1832 "dap.tab.c" /* yacc.c:1646 */ break; case 77: #line 239 "dap.y" /* yacc.c:1646 */ {(yyval)=null;} -#line 1819 "dap.tab.c" /* yacc.c:1646 */ +#line 1838 "dap.tab.c" /* yacc.c:1646 */ break; case 78: #line 239 "dap.y" /* yacc.c:1646 */ {(yyval)=(yyvsp[-1]);} -#line 1825 "dap.tab.c" /* yacc.c:1646 */ +#line 1844 "dap.tab.c" /* yacc.c:1646 */ break; case 79: #line 240 "dap.y" /* yacc.c:1646 */ {(yyval)=null;} -#line 1831 "dap.tab.c" /* yacc.c:1646 */ +#line 1850 "dap.tab.c" /* yacc.c:1646 */ break; case 80: #line 240 "dap.y" /* yacc.c:1646 */ {(yyval)=(yyvsp[-1]);} -#line 1837 "dap.tab.c" /* yacc.c:1646 */ +#line 1856 "dap.tab.c" /* yacc.c:1646 */ break; case 81: #line 241 "dap.y" /* yacc.c:1646 */ {(yyval)=null;} -#line 1843 "dap.tab.c" /* yacc.c:1646 */ +#line 1862 "dap.tab.c" /* yacc.c:1646 */ break; case 82: #line 241 "dap.y" /* yacc.c:1646 */ {(yyval)=(yyvsp[-1]);} -#line 1849 "dap.tab.c" /* yacc.c:1646 */ +#line 1868 "dap.tab.c" /* yacc.c:1646 */ break; case 83: #line 247 "dap.y" /* yacc.c:1646 */ {(yyval)=dapdecode(parsestate->lexstate,(yyvsp[0]));} -#line 1855 "dap.tab.c" /* yacc.c:1646 */ +#line 1874 "dap.tab.c" /* yacc.c:1646 */ break; case 84: #line 248 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("alias");} -#line 1861 "dap.tab.c" /* yacc.c:1646 */ +#line 1880 "dap.tab.c" /* yacc.c:1646 */ break; case 85: #line 249 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("array");} -#line 1867 "dap.tab.c" /* yacc.c:1646 */ +#line 1886 "dap.tab.c" /* yacc.c:1646 */ break; case 86: #line 250 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("attributes");} -#line 1873 "dap.tab.c" /* yacc.c:1646 */ +#line 1892 "dap.tab.c" /* yacc.c:1646 */ break; case 87: #line 251 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("byte");} -#line 1879 "dap.tab.c" /* yacc.c:1646 */ +#line 1898 "dap.tab.c" /* yacc.c:1646 */ break; case 88: #line 252 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("dataset");} -#line 1885 "dap.tab.c" /* yacc.c:1646 */ +#line 1904 "dap.tab.c" /* yacc.c:1646 */ break; case 89: #line 253 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("data");} -#line 1891 "dap.tab.c" /* yacc.c:1646 */ +#line 1910 "dap.tab.c" /* yacc.c:1646 */ break; case 90: #line 254 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("error");} -#line 1897 "dap.tab.c" /* yacc.c:1646 */ +#line 1916 "dap.tab.c" /* yacc.c:1646 */ break; case 91: #line 255 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("float32");} -#line 1903 "dap.tab.c" /* yacc.c:1646 */ +#line 1922 "dap.tab.c" /* yacc.c:1646 */ break; case 92: #line 256 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("float64");} -#line 1909 "dap.tab.c" /* yacc.c:1646 */ +#line 1928 "dap.tab.c" /* yacc.c:1646 */ break; case 93: #line 257 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("grid");} -#line 1915 "dap.tab.c" /* yacc.c:1646 */ +#line 1934 "dap.tab.c" /* yacc.c:1646 */ break; case 94: #line 258 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("int16");} -#line 1921 "dap.tab.c" /* yacc.c:1646 */ +#line 1940 "dap.tab.c" /* yacc.c:1646 */ break; case 95: #line 259 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("int32");} -#line 1927 "dap.tab.c" /* yacc.c:1646 */ +#line 1946 "dap.tab.c" /* yacc.c:1646 */ break; case 96: #line 260 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("maps");} -#line 1933 "dap.tab.c" /* yacc.c:1646 */ +#line 1952 "dap.tab.c" /* yacc.c:1646 */ break; case 97: #line 261 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("sequence");} -#line 1939 "dap.tab.c" /* yacc.c:1646 */ +#line 1958 "dap.tab.c" /* yacc.c:1646 */ break; case 98: #line 262 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("string");} -#line 1945 "dap.tab.c" /* yacc.c:1646 */ +#line 1964 "dap.tab.c" /* yacc.c:1646 */ break; case 99: #line 263 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("structure");} -#line 1951 "dap.tab.c" /* yacc.c:1646 */ +#line 1970 "dap.tab.c" /* yacc.c:1646 */ break; case 100: #line 264 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("uint16");} -#line 1957 "dap.tab.c" /* yacc.c:1646 */ +#line 1976 "dap.tab.c" /* yacc.c:1646 */ break; case 101: #line 265 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("uint32");} -#line 1963 "dap.tab.c" /* yacc.c:1646 */ +#line 1982 "dap.tab.c" /* yacc.c:1646 */ break; case 102: #line 266 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("url");} -#line 1969 "dap.tab.c" /* yacc.c:1646 */ +#line 1988 "dap.tab.c" /* yacc.c:1646 */ break; case 103: #line 267 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("code");} -#line 1975 "dap.tab.c" /* yacc.c:1646 */ +#line 1994 "dap.tab.c" /* yacc.c:1646 */ break; case 104: #line 268 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("message");} -#line 1981 "dap.tab.c" /* yacc.c:1646 */ +#line 2000 "dap.tab.c" /* yacc.c:1646 */ break; case 105: #line 269 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("program");} -#line 1987 "dap.tab.c" /* yacc.c:1646 */ +#line 2006 "dap.tab.c" /* yacc.c:1646 */ break; case 106: #line 270 "dap.y" /* yacc.c:1646 */ {(yyval)=strdup("program_type");} -#line 1993 "dap.tab.c" /* yacc.c:1646 */ +#line 2012 "dap.tab.c" /* yacc.c:1646 */ break; -#line 1997 "dap.tab.c" /* yacc.c:1646 */ +#line 2016 "dap.tab.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires diff --git a/oc2/daptab.h b/oc2/daptab.h index d015b33e4..97d65186d 100644 --- a/oc2/daptab.h +++ b/oc2/daptab.h @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.0. */ +/* A Bison parser, made by GNU Bison 3.0.2. */ /* Bison interface for Yacc-like parsers in C diff --git a/oc2/occurlfunctions.c b/oc2/occurlfunctions.c index 4a6e0f97e..38d198da0 100644 --- a/oc2/occurlfunctions.c +++ b/oc2/occurlfunctions.c @@ -52,7 +52,7 @@ oc_curl_protocols(struct OCGLOBALSTATE* state) /* Set various general curl flags */ -int +CURLcode ocset_curl_flags(OCstate* state) { CURLcode cstat = CURLE_OK; diff --git a/oc2/ochttp.c b/oc2/ochttp.c index be7f91c48..1f7d25c20 100644 --- a/oc2/ochttp.c +++ b/oc2/ochttp.c @@ -97,6 +97,7 @@ ocfetchurl(CURL* curl, const char* url, OCbytes* buf, long* filetime, CURLcode cstat = CURLE_OK; size_t len; long httpcode = 0; + /* Set the URL */ cstat = curl_easy_setopt(curl, CURLOPT_URL, (void*)url); if (cstat != CURLE_OK) @@ -113,7 +114,6 @@ ocfetchurl(CURL* curl, const char* url, OCbytes* buf, long* filetime, if (cstat != CURLE_OK) goto fail; #else - char tbuf[1024]; snprintf(tbuf,1023,"%s:%s",creds->username,creds->password); cstat = curl_easy_setopt(curl, CURLOPT_USERPWD, tbuf); if (cstat != CURLE_OK) @@ -121,6 +121,7 @@ ocfetchurl(CURL* curl, const char* url, OCbytes* buf, long* filetime, #endif } #endif + /* send all data to this function */ cstat = curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback); if (cstat != CURLE_OK) @@ -330,10 +331,6 @@ ocping(const char* url) stat = occurlopen(&curl); if(stat != OC_NOERR) return stat; - /* use a very short timeout: 10 seconds */ - cstat = curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)10); - if (cstat != CURLE_OK) - goto done; /* Use redirects */ cstat = curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 10L); if (cstat != CURLE_OK) @@ -342,6 +339,11 @@ ocping(const char* url) if (cstat != CURLE_OK) goto done; + /* use a very short timeout: 10 seconds */ + cstat = curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)10); + if (cstat != CURLE_OK) + goto done; + /* fail on HTTP 400 code errors */ cstat = curl_easy_setopt(curl, CURLOPT_FAILONERROR, (long)1); if (cstat != CURLE_OK) diff --git a/oc2/ochttp.h b/oc2/ochttp.h index 5c75de8a1..af74dd465 100644 --- a/oc2/ochttp.h +++ b/oc2/ochttp.h @@ -4,6 +4,9 @@ #ifndef HTTP_H #define HTTP_H 1 +extern int curlopen(CURL** curlp); +extern void curlclose(CURL*); + extern OCerror ocfetchurl(CURL*, const char*, OCbytes*, long*, struct OCcredentials*); extern OCerror ocfetchurl_file(CURL*, const char*, FILE*, off_t*, long*); diff --git a/oc2/ocinternal.c b/oc2/ocinternal.c index c23cd6cf5..00a8d30dc 100644 --- a/oc2/ocinternal.c +++ b/oc2/ocinternal.c @@ -388,12 +388,11 @@ createtempfile(OCstate* state, OCtree* tree) fail: if(name != NULL) { - oclog(OCLOGERR,"oc_open: attempt to create tmp file failed: %s",name); - free(name); + oclog(OCLOGERR,"oc_open: attempt to create tmp file failed: %s",name); + free(name); } else { - oclog(OCLOGERR,"oc_open: attempt to create tmp file failed: NULL"); + oclog(OCLOGERR,"oc_open: attempt to create tmp file failed: NULL"); } - return stat; } diff --git a/oc2/ocinternal.h b/oc2/ocinternal.h index e51e73694..36a1a6dc2 100644 --- a/oc2/ocinternal.h +++ b/oc2/ocinternal.h @@ -206,7 +206,6 @@ extern void occlose(OCstate* state); extern OCerror ocfetch(OCstate*, const char*, OCdxd, OCflags, OCnode**); extern int oc_network_order; extern int oc_invert_xdr_double; - extern OCerror ocinternalinitialize(void); extern OCerror ocupdatelastmodifieddata(OCstate* state); diff --git a/oc2/oclist.c b/oc2/oclist.c index 80112ea36..821c5588d 100644 --- a/oc2/oclist.c +++ b/oc2/oclist.c @@ -147,9 +147,11 @@ void** oclistdup(OClist* l) { void** result = (void**)malloc(sizeof(void*)*(l->length+1)); - if(result != NULL && l != NULL && oclistlength(l) != 0) - memcpy((void*)result,(void*)l->content,sizeof(void*)*l->length); - result[l->length] = (void*)0; + if(result != NULL) { + if(l != NULL && oclistlength(l) != 0) + memcpy((void*)result,(void*)l->content,sizeof(void*)*l->length); + result[l->length] = (void*)0; + } return result; } diff --git a/oc2/ocrc.c b/oc2/ocrc.c index 2fbc9c241..e2b499859 100644 --- a/oc2/ocrc.c +++ b/oc2/ocrc.c @@ -81,8 +81,8 @@ ocextract_credentials(const char *url, char **name, char **pw, char **result_url url_len = strlen(url) - up_len; *result_url = malloc(sizeof(char) * (url_len + 1)); - if(*result_url == NULL) - return OC_ENOMEM; + if (*result_url == NULL) + return OC_ENOMEM; strncpy(*result_url, url, (size_t)(pos - url)); strncpy(*result_url + (pos - url), end + 1, url_len - (pos - url)); @@ -120,7 +120,6 @@ rcreadline(FILE* f, char* more, int morelen) return 1; } - /* Trim TRIMCHARS from both ends of text; */ static void rctrim(char* text) @@ -173,7 +172,7 @@ parseproxy(OCstate* state, char* v) *port_sep = '\0'; host_len = strlen(host_pos); state->proxy.host = malloc(sizeof(char) * host_len + 1); - if(state->proxy.host == NULL) + if (state->proxy.host == NULL) return OC_ENOMEM; strncpy(state->proxy.host, host_pos, host_len); @@ -183,7 +182,7 @@ parseproxy(OCstate* state, char* v) } else { size_t host_len = strlen(host_pos); state->proxy.host = malloc(sizeof(char) * host_len + 1); - if(state->proxy.host == NULL) + if (state->proxy.host == NULL) return OC_ENOMEM; strncpy(state->proxy.host, host_pos, host_len); @@ -196,13 +195,13 @@ parseproxy(OCstate* state, char* v) state->proxy.port = atoi(v); s_len = strlen(v); state->proxy.user = malloc(sizeof(char) * s_len + 1); - if(state->proxy.user == NULL) + if (state->proxy.user == NULL) return OC_ENOMEM; strncpy(state->proxy.user, v, s_len); state->proxy.user[s_len] = '\0'; p_len = strlen(v); state->proxy.password = malloc(sizeof(char) * p_len + 1); - if(state->proxy.password == NULL) + if (state->proxy.password == NULL) return OC_ENOMEM; strncpy(state->proxy.password, v, p_len); state->proxy.password[p_len] = '\0'; @@ -295,7 +294,7 @@ ocdodsrc_read(char* basename, char* path) in_file = fopen(path, "r"); /* Open the file to read it */ if (in_file == NULL) { oclog(OCLOGERR, "Could not open configuration file: %s",basename); - return 0; + return OC_EPERM; } for(;;) { diff --git a/oc2/ocread.c b/oc2/ocread.c index 9e748050e..6d49958a6 100644 --- a/oc2/ocread.c +++ b/oc2/ocread.c @@ -39,6 +39,7 @@ readDDS(OCstate* state, OCtree* tree) long lastmodified = -1; ocurisetconstraints(state->uri,tree->constraint); + ocset_user_password(state); #ifdef OCDEBUG fprintf(stderr,"readDDS:\n"); diff --git a/oc2/ocuri.c b/oc2/ocuri.c index 4b8adfe9e..24d8290b2 100644 --- a/oc2/ocuri.c +++ b/oc2/ocuri.c @@ -4,11 +4,13 @@ * $Header$ *********************************************************************/ +#include "config.h" #include #include #include #include +#include "oc.h" #include "ocuri.h" #define OCURIDEBUG @@ -35,9 +37,24 @@ static int failpoint = 0; #define NILLEN(s) ((s)==NULL?0:strlen(s)) #endif +#ifdef HAVE_STRDUP #ifndef nulldup #define nulldup(s) ((s)==NULL?NULL:strdup(s)) #endif +#endif + +#ifndef HAVE_STRDUP +static char* nulldup(char* s) +{ + char* dup = NULL; + if(s != NULL) { + dup = (char*)malloc(strlen(s)+1); + if(dup != NULL) + strcpy(dup,s); + } + return dup; +} +#endif #define terminate(p) {*(p) = EOFCHAR;}