Index: tools/h5dump/h5dump.c
===================================================================
--- tools/h5dump/h5dump.c	(revision 18506)
+++ tools/h5dump/h5dump.c	(working copy)
@@ -23,8 +23,9 @@
 #include "h5trav.h"
 
 
-/* module-scoped variables */
+/* module-scoped variables 
 const char  *progname = "h5dump";
+*/
 
 /* Macros for displaying objects */
 #define begin_obj(obj,name,begin)                               \
@@ -68,7 +69,7 @@
     } *tables;
 } h5dump_table_list_t;
 
-int                 d_status = EXIT_SUCCESS;
+/*int                 d_status = EXIT_SUCCESS;*/
 static int          unamedtype = 0;     /* shared datatype with no name */
 static h5dump_table_list_t table_list = {0, 0, NULL};
 static table_t      *group_table = NULL, *dset_table = NULL, *type_table = NULL;
@@ -819,7 +820,7 @@
     for(u = 0; u < table_list.nused; u++) {
         /* Release object id */
         if(H5Idec_ref(table_list.tables[u].oid) < 0)
-            d_status = EXIT_FAILURE;
+            h5tools_setstatus( EXIT_FAILURE);
 
         /* Free each table */
         free_table(table_list.tables[u].group_table);
@@ -881,8 +882,8 @@
             else
                 printf("\"%s\"", obj->objname);
         } else {
-            error_msg(progname, "unknown committed type.\n");
-            d_status = EXIT_FAILURE;
+            error_msg(h5tools_getprogname(), "unknown committed type.\n");
+            h5tools_setstatus( EXIT_FAILURE);
         }
     } else {
         switch(H5Tget_class(type)) {
@@ -1121,7 +1122,7 @@
 
                 /* Type doesn't match any of above. */
                 printf("unknown_one_character_type;\n ");
-                d_status = EXIT_FAILURE;
+                h5tools_setstatus( EXIT_FAILURE);
 
     done:
                 H5Tclose(str_type);
@@ -1151,7 +1152,7 @@
                     printf("H5T_STD_B64LE");
                 } else {
                     printf("undefined bitfield");
-                    d_status = EXIT_FAILURE;
+                    h5tools_setstatus( EXIT_FAILURE);
                 }
                 break;
 
@@ -1258,7 +1259,7 @@
 
             default:
                 printf("unknown datatype");
-                d_status = EXIT_FAILURE;
+                h5tools_setstatus( EXIT_FAILURE);
                 break;
         }
     } /* end else */
@@ -1401,11 +1402,11 @@
 
     if((attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT)) < 0) {
         indentation(indent + COL);
-        error_msg(progname, "unable to open attribute \"%s\"\n", attr_name);
+        error_msg(h5tools_getprogname(), "unable to open attribute \"%s\"\n", attr_name);
         indentation(indent);
         end_obj(dump_header_format->attributeend,
                 dump_header_format->attributeblockend);
-        d_status = EXIT_FAILURE;
+        h5tools_setstatus( EXIT_FAILURE);
         ret = FAIL;
     } else {
         hid_t type, space;
@@ -1477,9 +1478,9 @@
     /* Open the object with the attribute */
     if((oid = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) {
         indentation(COL);
-        error_msg(progname, "unable to open object \"%s\"\n", obj_name);
+        error_msg(h5tools_getprogname(), "unable to open object \"%s\"\n", obj_name);
         end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend);
-        d_status = EXIT_FAILURE;
+        h5tools_setstatus( EXIT_FAILURE);
         return FAIL;
     } /* end if */
 
@@ -1504,14 +1505,14 @@
         dump_header_format->attributeblockend);
     } else {
         indentation(COL);
-        error_msg(progname, "unable to open attribute \"%s\"\n", obj_name);
+        error_msg(h5tools_getprogname(), "unable to open attribute \"%s\"\n", obj_name);
         end_obj(dump_header_format->attributeend, dump_header_format->attributeblockend);
-        d_status = EXIT_FAILURE;
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
     /* Close object */
     if(H5Oclose(oid) < 0) {
-        d_status = EXIT_FAILURE;
+        h5tools_setstatus( EXIT_FAILURE);
         return FAIL;
     } /* end if */
 
@@ -1559,8 +1560,8 @@
 
         /* Stat the object */
         if(H5Oget_info_by_name(group, name, &oinfo, H5P_DEFAULT) < 0) {
-            error_msg(progname, "unable to get object information for \"%s\"\n", name);
-            d_status = EXIT_FAILURE;
+            error_msg(h5tools_getprogname(), "unable to get object information for \"%s\"\n", name);
+            h5tools_setstatus( EXIT_FAILURE);
             ret = FAIL;
             goto done;
         } /* end if */
@@ -1570,8 +1571,8 @@
         case H5O_TYPE_GROUP:
             if((obj = H5Gopen2(group, name, H5P_DEFAULT)) < 0)
             {
-                error_msg(progname, "unable to dump group \"%s\"\n", name);
-                d_status = EXIT_FAILURE;
+                error_msg(h5tools_getprogname(), "unable to dump group \"%s\"\n", name);
+                h5tools_setstatus( EXIT_FAILURE);
                 ret = FAIL;
             }
             else
@@ -1609,13 +1610,13 @@
                             begin_obj(dump_header_format->datasetbegin, name,
                                       dump_header_format->datasetblockbegin);
                             indentation(indent + COL);
-                            error_msg(progname,
+                            error_msg(h5tools_getprogname(),
                                       "internal error (file %s:line %d)\n",
                                       __FILE__, __LINE__);
                             indentation(indent);
                             end_obj(dump_header_format->datasetend,
                                     dump_header_format->datasetblockend);
-                            d_status = EXIT_FAILURE;
+                            h5tools_setstatus( EXIT_FAILURE);
                             ret = FAIL;
                             H5Dclose(obj);
                             goto done;
@@ -1678,16 +1679,16 @@
                     dump_function_table->dump_dataset_function(obj, name, NULL);
                     H5Dclose(obj);
                 } else {
-                    error_msg(progname, "unable to dump dataset \"%s\"\n", name);
-                    d_status = EXIT_FAILURE;
+                    error_msg(h5tools_getprogname(), "unable to dump dataset \"%s\"\n", name);
+                    h5tools_setstatus( EXIT_FAILURE);
                     ret = FAIL;
                 }
                 break;
 
             case H5O_TYPE_NAMED_DATATYPE:
                 if((obj = H5Topen2(group, name, H5P_DEFAULT)) < 0) {
-                    error_msg(progname, "unable to dump datatype \"%s\"\n", name);
-                    d_status = EXIT_FAILURE;
+                    error_msg(h5tools_getprogname(), "unable to dump datatype \"%s\"\n", name);
+                    h5tools_setstatus( EXIT_FAILURE);
                     ret = FAIL;
                 } else {
                     dump_function_table->dump_named_datatype_function(obj, name);
@@ -1696,8 +1697,8 @@
                 break;
 
             default:
-                error_msg(progname, "unknown object \"%s\"\n", name);
-                d_status = EXIT_FAILURE;
+                error_msg(h5tools_getprogname(), "unknown object \"%s\"\n", name);
+                h5tools_setstatus( EXIT_FAILURE);
                 ret = FAIL;
         }
     } /* end if */
@@ -1717,8 +1718,8 @@
                 }
 
                 if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
-                    error_msg(progname, "unable to get link value\n");
-                    d_status = EXIT_FAILURE;
+                    error_msg(h5tools_getprogname(), "unable to get link value\n");
+                    h5tools_setstatus( EXIT_FAILURE);
                     ret = FAIL;
                 } else {
                     /* print the value of a soft link */
@@ -1808,8 +1809,8 @@
                     begin_obj(dump_header_format->extlinkbegin, name, dump_header_format->extlinkblockbegin);
 
                 if(H5Lget_val(group, name, targbuf, linfo->u.val_size, H5P_DEFAULT) < 0) {
-                    error_msg(progname, "unable to get external link value\n");
-                    d_status = EXIT_FAILURE;
+                    error_msg(h5tools_getprogname(), "unable to get external link value\n");
+                    h5tools_setstatus( EXIT_FAILURE);
                     ret = FAIL;
                 } /* end if */
                 else {
@@ -1817,8 +1818,8 @@
                     const char *targname;
 
                     if(H5Lunpack_elink_val(targbuf, linfo->u.val_size, NULL, &filename, &targname) < 0) {
-                        error_msg(progname, "unable to unpack external link value\n");
-                        d_status = EXIT_FAILURE;
+                        error_msg(h5tools_getprogname(), "unable to unpack external link value\n");
+                        h5tools_setstatus( EXIT_FAILURE);
                         ret = FAIL;
                     } /* end if */
                     else {
@@ -1950,20 +1951,20 @@
 
     if ((tcpl_id = H5Tget_create_plist(tid)) < 0)
     {
-        error_msg(progname, "error in getting creation property list ID\n");
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "error in getting creation property list ID\n");
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
     /* query the creation properties for attributes */
     if (H5Pget_attr_creation_order(tcpl_id, &attr_crt_order_flags) < 0)
     {
-        error_msg(progname, "error in getting creation properties\n");
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "error in getting creation properties\n");
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
     if(H5Pclose(tcpl_id) < 0) {
-        error_msg(progname, "error in closing creation property list ID\n");
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "error in closing creation property list ID\n");
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
 
@@ -1982,9 +1983,9 @@
         found_obj = search_obj(type_table, oinfo.addr);
 
         if (found_obj == NULL) {
-            error_msg(progname, "internal error (file %s:line %d)\n",
+            error_msg(h5tools_getprogname(), "internal error (file %s:line %d)\n",
                 __FILE__, __LINE__);
-            d_status = EXIT_FAILURE;
+            h5tools_setstatus( EXIT_FAILURE);
             goto done;
         }
         else if (found_obj->displayed) {
@@ -2007,14 +2008,14 @@
 
     if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
         if(H5Aiterate2(tid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
-            error_msg(progname, "error getting attribute information\n");
-            d_status = EXIT_FAILURE;
+            error_msg(h5tools_getprogname(), "error getting attribute information\n");
+            h5tools_setstatus( EXIT_FAILURE);
         } /* end if */
     } /* end if */
     else {
         if(H5Aiterate2(tid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
-            error_msg(progname, "error getting attribute information\n");
-            d_status = EXIT_FAILURE;
+            error_msg(h5tools_getprogname(), "error getting attribute information\n");
+            h5tools_setstatus( EXIT_FAILURE);
         } /* end if */
     } /* end else */
 
@@ -2056,27 +2057,27 @@
 
     if ((gcpl_id = H5Gget_create_plist(gid)) < 0)
     {
-        error_msg(progname, "error in getting group creation property list ID\n");
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "error in getting group creation property list ID\n");
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
     /* query the group creation properties for attributes */
     if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0)
     {
-        error_msg(progname, "error in getting group creation properties\n");
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "error in getting group creation properties\n");
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
     /* query the group creation properties */
     if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0)
     {
-        error_msg(progname, "error in getting group creation properties\n");
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "error in getting group creation properties\n");
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
     if(H5Pclose(gcpl_id) < 0) {
-        error_msg(progname, "error in closing group creation property list ID\n");
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "error in closing group creation property list ID\n");
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
 
@@ -2118,9 +2119,9 @@
 
         if (found_obj == NULL) {
             indentation(indent);
-            error_msg(progname, "internal error (file %s:line %d)\n",
+            error_msg(h5tools_getprogname(), "internal error (file %s:line %d)\n",
                 __FILE__, __LINE__);
-            d_status = EXIT_FAILURE;
+            h5tools_setstatus( EXIT_FAILURE);
         }
         else if (found_obj->displayed) {
             indentation(indent);
@@ -2133,14 +2134,14 @@
 
             if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
                 if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
-                    error_msg(progname, "error getting attribute information\n");
-                    d_status = EXIT_FAILURE;
+                    error_msg(h5tools_getprogname(), "error getting attribute information\n");
+                    h5tools_setstatus( EXIT_FAILURE);
                 } /* end if */
             } /* end if */
             else {
                 if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
-                    error_msg(progname, "error getting attribute information\n");
-                    d_status = EXIT_FAILURE;
+                    error_msg(h5tools_getprogname(), "error getting attribute information\n");
+                    h5tools_setstatus( EXIT_FAILURE);
                 } /* end if */
             } /* end else */
 
@@ -2164,14 +2165,14 @@
 
         if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
             if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
-                error_msg(progname, "error getting attribute information\n");
-                d_status = EXIT_FAILURE;
+                error_msg(h5tools_getprogname(), "error getting attribute information\n");
+                h5tools_setstatus( EXIT_FAILURE);
             } /* end if */
         } /* end if */
         else {
             if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
-                error_msg(progname, "error getting attribute information\n");
-                d_status = EXIT_FAILURE;
+                error_msg(h5tools_getprogname(), "error getting attribute information\n");
+                h5tools_setstatus( EXIT_FAILURE);
             } /* end if */
         } /* end else */
 
@@ -2218,15 +2219,15 @@
 
     if ((dcpl_id = H5Dget_create_plist(did)) < 0)
     {
-        error_msg(progname, "error in getting creation property list ID\n");
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "error in getting creation property list ID\n");
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
     /* query the creation properties for attributes */
     if (H5Pget_attr_creation_order(dcpl_id, &attr_crt_order_flags) < 0)
     {
-        error_msg(progname, "error in getting creation properties\n");
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "error in getting creation properties\n");
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
     indentation(indent);
@@ -2280,14 +2281,14 @@
 
         if( (sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
             if(H5Aiterate2(did, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
-                error_msg(progname, "error getting attribute information\n");
-                d_status = EXIT_FAILURE;
+                error_msg(h5tools_getprogname(), "error getting attribute information\n");
+                h5tools_setstatus( EXIT_FAILURE);
             } /* end if */
         } /* end if */
         else {
             if(H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_attr_cb, NULL) < 0) {
-                error_msg(progname, "error getting attribute information\n");
-                d_status = EXIT_FAILURE;
+                error_msg(h5tools_getprogname(), "error getting attribute information\n");
+                h5tools_setstatus( EXIT_FAILURE);
             } /* end if */
         } /* end else */
 
@@ -2598,8 +2599,8 @@
 
     if (status == FAIL) {
         indentation(indent + COL);
-        error_msg(progname, "unable to print data\n");
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "unable to print data\n");
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
     indentation(indent);
@@ -3554,10 +3555,10 @@
             begin_obj(dump_header_format->datasetbegin, real_name,
                 dump_header_format->datasetblockbegin);
             indentation(COL);
-            error_msg(progname, "unable to open dataset \"%s\"\n", real_name);
+            error_msg(h5tools_getprogname(), "unable to open dataset \"%s\"\n", real_name);
             end_obj(dump_header_format->datasetend,
                 dump_header_format->datasetblockend);
-            d_status = EXIT_FAILURE;
+            h5tools_setstatus( EXIT_FAILURE);
         }
         return;
     } /* end if */
@@ -3624,8 +3625,8 @@
 
                 if ( sset->stride[i] < sset->block[i] )
                 {
-                    error_msg(progname, "wrong subset selection; blocks overlap\n");
-                    d_status = EXIT_FAILURE;
+                    error_msg(h5tools_getprogname(), "wrong subset selection; blocks overlap\n");
+                    h5tools_setstatus( EXIT_FAILURE);
                     return;
 
                 }
@@ -3659,13 +3660,13 @@
             }
         }
         else
-            d_status = EXIT_FAILURE;
+            h5tools_setstatus( EXIT_FAILURE);
     }
     else
         dump_dataset(dsetid, real_name, sset);
 
     if(H5Dclose(dsetid) < 0)
-        d_status = EXIT_FAILURE;
+        h5tools_setstatus( EXIT_FAILURE);
 }
 
 /*-------------------------------------------------------------------------
@@ -3701,9 +3702,9 @@
         {
             begin_obj(dump_header_format->groupbegin, real_name, dump_header_format->groupblockbegin);
             indentation(COL);
-            error_msg(progname, "unable to open group \"%s\"\n", real_name);
+            error_msg(h5tools_getprogname(), "unable to open group \"%s\"\n", real_name);
             end_obj(dump_header_format->groupend, dump_header_format->groupblockend);
-            d_status = EXIT_FAILURE;
+            h5tools_setstatus( EXIT_FAILURE);
         }
     }
     else
@@ -3721,7 +3722,7 @@
         dump_group(gid, real_name);
 
         if(H5Gclose(gid) < 0)
-            d_status = EXIT_FAILURE;
+            h5tools_setstatus( EXIT_FAILURE);
     } /* end else */
 } /* end handle_groups() */
 
@@ -3745,11 +3746,11 @@
     H5L_info_t linfo;
 
     if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) {
-        error_msg(progname, "unable to get link info from \"%s\"\n", links);
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "unable to get link info from \"%s\"\n", links);
+        h5tools_setstatus( EXIT_FAILURE);
     } else if(linfo.type == H5L_TYPE_HARD) {
-        error_msg(progname, "\"%s\" is a hard link\n", links);
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "\"%s\" is a hard link\n", links);
+        h5tools_setstatus( EXIT_FAILURE);
     } else {
         char *buf = HDmalloc(linfo.u.val_size);
 
@@ -3761,9 +3762,9 @@
                 if(H5Lget_val(fid, links, buf, linfo.u.val_size, H5P_DEFAULT) >= 0)
                     printf("LINKTARGET \"%s\"\n", buf);
                 else {
-                    error_msg(progname, "h5dump error: unable to get link value for \"%s\"\n",
+                    error_msg(h5tools_getprogname(), "h5dump error: unable to get link value for \"%s\"\n",
                               links);
-                    d_status = EXIT_FAILURE;
+                    h5tools_setstatus( EXIT_FAILURE);
                 }
                 end_obj(dump_header_format->softlinkend,
                         dump_header_format->softlinkblockend);
@@ -3787,12 +3788,12 @@
                         indentation(COL);
                         printf("TARGETPATH \"%s\"\n", elink_path);
                     } else {
-                        error_msg(progname, "h5dump error: unable to unpack external link value for \"%s\"\n", links);
-                        d_status = EXIT_FAILURE;
+                        error_msg(h5tools_getprogname(), "h5dump error: unable to unpack external link value for \"%s\"\n", links);
+                        h5tools_setstatus( EXIT_FAILURE);
                     }
                 } else {
-                    error_msg(progname, "h5dump error: unable to get external link value for \"%s\"\n", links);
-                    d_status = EXIT_FAILURE;
+                    error_msg(h5tools_getprogname(), "h5dump error: unable to get external link value for \"%s\"\n", links);
+                    h5tools_setstatus( EXIT_FAILURE);
                 }
                 end_obj(dump_header_format->extlinkend,
                         dump_header_format->extlinkblockend);
@@ -3868,10 +3869,10 @@
                 begin_obj(dump_header_format->datatypebegin, real_name,
                     dump_header_format->datatypeblockbegin);
                 indentation(COL);
-                error_msg(progname, "unable to open datatype \"%s\"\n", real_name);
+                error_msg(h5tools_getprogname(), "unable to open datatype \"%s\"\n", real_name);
                 end_obj(dump_header_format->datatypeend,
                     dump_header_format->datatypeblockend);
-                d_status = EXIT_FAILURE;
+                h5tools_setstatus( EXIT_FAILURE);
             }
         }
         else
@@ -3888,7 +3889,7 @@
         dump_named_datatype(type_id, real_name);
 
         if(H5Tclose(type_id) < 0)
-            d_status = EXIT_FAILURE;
+            h5tools_setstatus( EXIT_FAILURE);
     }
 }
 
@@ -3920,7 +3921,7 @@
 
      /* no arguments */
     if (argc == 1) {
-        usage(progname);
+        usage(h5tools_getprogname());
         leave(EXIT_FAILURE);
     }
 
@@ -3970,7 +3971,7 @@
             display_char = TRUE;
             break;
         case 'V':
-            print_version(progname);
+            print_version(h5tools_getprogname());
             leave(EXIT_SUCCESS);
             break;
         case 'w':
@@ -4046,13 +4047,13 @@
         case 'o':
             if ( bin_output ) {
                 if (set_output_file(opt_arg, 1) < 0) {
-                    usage(progname);
+                    usage(h5tools_getprogname());
                     leave(EXIT_FAILURE);
                 }
             }
             else {
                 if (set_output_file(opt_arg, 0) < 0) {
-                    usage(progname);
+                    usage(h5tools_getprogname());
                     leave(EXIT_FAILURE);
                 }
             }
@@ -4066,7 +4067,7 @@
             if ( opt_arg != NULL) {
                 if ( ( bin_form = set_binary_form(opt_arg)) < 0) {
                     /* failed to set binary form */
-                    usage(progname);
+                    usage(h5tools_getprogname());
                     leave(EXIT_FAILURE);
                 }
             }
@@ -4074,7 +4075,7 @@
             if (outfname!=NULL) {
                 if (set_output_file(outfname, 1) < 0)  {
                     /* failed to set output file */
-                    usage(progname);
+                    usage(h5tools_getprogname());
                     leave(EXIT_FAILURE);
                 }
 
@@ -4085,7 +4086,7 @@
         case 'q':
             if ( ( sort_by = set_sort_by(opt_arg)) < 0) {
                 /* failed to set "sort by" form */
-                usage(progname);
+                usage(h5tools_getprogname());
                 leave(EXIT_FAILURE);
             }
             break;
@@ -4093,7 +4094,7 @@
         case 'z':
             if ( ( sort_order = set_sort_order(opt_arg)) < 0) {
                 /* failed to set "sort order" form */
-                usage(progname);
+                usage(h5tools_getprogname());
                 leave(EXIT_FAILURE);
             }
             break;
@@ -4131,7 +4132,7 @@
             /* specify XML namespace (default="hdf5:"), or none */
             /* To Do: check format of this value?  */
         if (!useschema) {
-                usage(progname);
+                usage(h5tools_getprogname());
                 leave(EXIT_FAILURE);
         }
         if (strcmp(opt_arg,":") == 0) {
@@ -4150,7 +4151,7 @@
             struct subset_t *s;
 
             if (!last_was_dset) {
-                error_msg(progname,
+                error_msg(h5tools_getprogname(),
                           "option `-%c' can only be used after --dataset option\n",
                           opt);
                 leave(EXIT_FAILURE);
@@ -4198,11 +4199,11 @@
         /** end subsetting parameters **/
 
         case 'h':
-            usage(progname);
+            usage(h5tools_getprogname());
             leave(EXIT_SUCCESS);
         case '?':
         default:
-            usage(progname);
+            usage(h5tools_getprogname());
             leave(EXIT_FAILURE);
         }
     }
@@ -4210,8 +4211,8 @@
 parse_end:
     /* check for file name to be processed */
     if (argc <= opt_ind) {
-        error_msg(progname, "missing file name\n");
-        usage(progname);
+        error_msg(h5tools_getprogname(), "missing file name\n");
+        usage(h5tools_getprogname());
         leave(EXIT_FAILURE);
     }
     return hand;
@@ -4291,6 +4292,9 @@
  *        September 2007
  *        list objects in requested order (creation order or alphabetically)
  *
+ *        Werner Benger
+ *        March 2010
+ *        Call h5tools functions from shared library instead of static linking.
  *-------------------------------------------------------------------------
  */
 int
@@ -4305,6 +4309,8 @@
     int                 i;
     unsigned            u;
 
+    h5tools_setprogname("h5dump");
+    h5tools_setstatus(EXIT_SUCCESS);
     dump_header_format = &standardformat;
     dump_function_table = &ddl_function_table;
 
@@ -4318,43 +4324,43 @@
 
     if ( bin_output && outfname == NULL )
     {
-        error_msg(progname, "binary output requires a file name, use -o <filename>\n");
+        error_msg(h5tools_getprogname(), "binary output requires a file name, use -o <filename>\n");
         leave(EXIT_FAILURE);
     }
 
     /* Check for conflicting options */
     if (doxml) {
         if (!display_all) {
-            error_msg(progname, "option \"%s\" not available for XML\n",
+            error_msg(h5tools_getprogname(), "option \"%s\" not available for XML\n",
                     "to display selected objects");
             leave(EXIT_FAILURE);
         } else if (display_bb) {
-            error_msg(progname, "option \"%s\" not available for XML\n",
+            error_msg(h5tools_getprogname(), "option \"%s\" not available for XML\n",
                     "--boot-block");
             leave(EXIT_FAILURE);
         } else if (display_oid == 1) {
-            error_msg(progname, "option \"%s\" not available for XML\n",
+            error_msg(h5tools_getprogname(), "option \"%s\" not available for XML\n",
                     "--object-ids");
             leave(EXIT_FAILURE);
         } else if (display_char == TRUE) {
-            error_msg(progname, "option \"%s\" not available for XML\n",
+            error_msg(h5tools_getprogname(), "option \"%s\" not available for XML\n",
                     "--string");
             leave(EXIT_FAILURE);
         } else if (usingdasho) {
-            error_msg(progname, "option \"%s\" not available for XML\n",
+            error_msg(h5tools_getprogname(), "option \"%s\" not available for XML\n",
                     "--output");
             leave(EXIT_FAILURE);
         }
     } else {
         if (xml_dtd_uri) {
-            warn_msg(progname, "option \"%s\" only applies with XML: %s\n",
+            warn_msg(h5tools_getprogname(), "option \"%s\" only applies with XML: %s\n",
                      "--xml-dtd", xml_dtd_uri);
         }
     }
 
     if (argc <= opt_ind) {
-        error_msg(progname, "missing file name\n");
-        usage(progname);
+        error_msg(h5tools_getprogname(), "missing file name\n");
+        usage(h5tools_getprogname());
         leave(EXIT_FAILURE);
     }
     fname = HDstrdup(argv[opt_ind]);
@@ -4362,7 +4368,7 @@
     fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, driver, NULL, 0);
 
     if (fid < 0) {
-        error_msg(progname, "unable to open file \"%s\"\n", fname);
+        error_msg(h5tools_getprogname(), "unable to open file \"%s\"\n", fname);
         leave(EXIT_FAILURE);
     }
 
@@ -4388,7 +4394,7 @@
             }
         } else {
             if (useschema && strcmp(xmlnsprefix,"")) {
-                error_msg(progname, "Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n");
+                error_msg(h5tools_getprogname(), "Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n");
                 leave(EXIT_FAILURE);
             }
         }
@@ -4397,15 +4403,15 @@
 
     /* Get object info for root group */
     if(H5Oget_info_by_name(fid, "/", &oi, H5P_DEFAULT) < 0) {
-        error_msg(progname, "internal error (file %s:line %d)\n", __FILE__, __LINE__);
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "internal error (file %s:line %d)\n", __FILE__, __LINE__);
+        h5tools_setstatus(EXIT_FAILURE);
         goto done;
     }
 
     /* Initialize object tables */
     if(table_list_add(fid, oi.fileno) < 0) {
-        error_msg(progname, "internal error (file %s:line %d)\n", __FILE__, __LINE__);
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "internal error (file %s:line %d)\n", __FILE__, __LINE__);
+        h5tools_setstatus( EXIT_FAILURE);
         goto done;
     }
     group_table = table_list.tables[0].group_table;
@@ -4467,8 +4473,8 @@
     {
         if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
         {
-            error_msg(progname, "unable to open root group\n");
-            d_status = EXIT_FAILURE;
+            error_msg(h5tools_getprogname(), "unable to open root group\n");
+            h5tools_setstatus( EXIT_FAILURE );
         }
         else
         {
@@ -4479,8 +4485,8 @@
 
         if(H5Gclose(gid) < 0)
         {
-            error_msg(progname, "unable to close root group\n");
-            d_status = EXIT_FAILURE;
+            error_msg(h5tools_getprogname(), "unable to close root group\n");
+            h5tools_setstatus( EXIT_FAILURE );
         }
 
 
@@ -4489,8 +4495,8 @@
     {
         /* Note: this option is not supported for XML */
         if(doxml) {
-            error_msg(progname, "internal error (file %s:line %d)\n", __FILE__, __LINE__);
-            d_status = EXIT_FAILURE;
+            error_msg(h5tools_getprogname(), "internal error (file %s:line %d)\n", __FILE__, __LINE__);
+            h5tools_setstatus( EXIT_FAILURE);
             goto done;
         } /* end if */
 
@@ -4510,7 +4516,7 @@
     table_list_free();
 
     if (H5Fclose(fid) < 0)
-        d_status = EXIT_FAILURE;
+        h5tools_setstatus( EXIT_FAILURE);
 
     free_handler(hand, argc);
 
@@ -4521,7 +4527,7 @@
 
     H5Eset_auto2(H5E_DEFAULT, func, edata);
 
-    leave(d_status);
+    leave(h5tools_getstatus());
 }
 
 /*-------------------------------------------------------------------------
@@ -4934,7 +4940,7 @@
             free(dtxid);
         } else {
             printf("<!-- h5dump error: unknown committed type. -->\n");
-            d_status = EXIT_FAILURE;
+            h5tools_setstatus( EXIT_FAILURE);
         }
     } else {
 
@@ -5238,7 +5244,7 @@
 
             default:
                 printf("<!-- unknown datatype -->");
-                d_status = EXIT_FAILURE;
+                h5tools_setstatus( EXIT_FAILURE);
                 break;
         }
     } /* end else */
@@ -5620,7 +5626,7 @@
         printf("<!-- h5dump error: unable to open attribute. -->\n");
         indentation(indent);
         printf("</%sAttribute>\n", xmlnsprefix );
-        d_status = EXIT_FAILURE;
+        h5tools_setstatus( EXIT_FAILURE);
         return FAIL;
     }
 }
@@ -5695,9 +5701,9 @@
 
             if (found_obj == NULL) {
                 indentation(indent);
-                    error_msg(progname, "internal error (file %s:line %d)\n",
+                    error_msg(h5tools_getprogname(), "internal error (file %s:line %d)\n",
                               __FILE__, __LINE__);
-                d_status = EXIT_FAILURE;
+                h5tools_setstatus( EXIT_FAILURE);
                 goto done;
             } else if(found_obj->displayed) {
                 /* We have already printed this named datatype, print it as a
@@ -5776,27 +5782,27 @@
 
     if ((gcpl_id = H5Gget_create_plist(gid)) < 0)
     {
-        error_msg(progname, "error in getting group creation property list ID\n");
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "error in getting group creation property list ID\n");
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
     /* query the group creation properties for attributes */
     if (H5Pget_attr_creation_order(gcpl_id, &attr_crt_order_flags) < 0)
     {
-        error_msg(progname, "error in getting group creation properties\n");
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "error in getting group creation properties\n");
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
     /* query the group creation properties */
     if(H5Pget_link_creation_order(gcpl_id, &crt_order_flags) < 0)
     {
-        error_msg(progname, "error in getting group creation properties\n");
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "error in getting group creation properties\n");
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
     if(H5Pclose(gcpl_id) < 0) {
-        error_msg(progname, "error in closing group creation property list ID\n");
-        d_status = EXIT_FAILURE;
+        error_msg(h5tools_getprogname(), "error in closing group creation property list ID\n");
+        h5tools_setstatus( EXIT_FAILURE);
     }
 
     if(HDstrcmp(name, "/") == 0) {
@@ -5828,9 +5834,9 @@
 
         if (found_obj == NULL) {
             indentation(indent);
-                error_msg(progname, "internal error (file %s:line %d)\n",
+                error_msg(h5tools_getprogname(), "internal error (file %s:line %d)\n",
                           __FILE__, __LINE__);
-            d_status = EXIT_FAILURE;
+            h5tools_setstatus( EXIT_FAILURE);
         } else {
             char *t_name = xml_escape_the_name(name);
             char *grpxid = malloc(100);
@@ -5895,14 +5901,14 @@
 
                 if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
                     if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
-                        error_msg(progname, "error getting attribute information\n");
-                        d_status = EXIT_FAILURE;
+                        error_msg(h5tools_getprogname(), "error getting attribute information\n");
+                        h5tools_setstatus( EXIT_FAILURE);
                     } /* end if */
                 } /* end if */
                 else {
                     if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
-                        error_msg(progname, "error getting attribute information\n");
-                        d_status = EXIT_FAILURE;
+                        error_msg(h5tools_getprogname(), "error getting attribute information\n");
+                        h5tools_setstatus( EXIT_FAILURE);
                     } /* end if */
                 } /* end else */
 
@@ -5967,14 +5973,14 @@
 
         if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
             if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
-                error_msg(progname, "error getting attribute information\n");
-                d_status = EXIT_FAILURE;
+                error_msg(h5tools_getprogname(), "error getting attribute information\n");
+                h5tools_setstatus( EXIT_FAILURE);
             } /* end if */
         } /* end if */
         else {
             if(H5Aiterate2(gid, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
-                error_msg(progname, "error getting attribute information\n");
-                d_status = EXIT_FAILURE;
+                error_msg(h5tools_getprogname(), "error getting attribute information\n");
+                h5tools_setstatus( EXIT_FAILURE);
             } /* end if */
         } /* end else */
 
@@ -6633,14 +6639,14 @@
 
     if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
         if(H5Aiterate2(did, sort_by, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
-            error_msg(progname, "error getting attribute information\n");
-            d_status = EXIT_FAILURE;
+            error_msg(h5tools_getprogname(), "error getting attribute information\n");
+            h5tools_setstatus( EXIT_FAILURE);
         } /* end if */
     } /* end if */
     else {
         if(H5Aiterate2(did, H5_INDEX_NAME, sort_order, NULL, dump_function_table->dump_attribute_function, NULL) < 0) {
-            error_msg(progname, "error getting attribute information\n");
-            d_status = EXIT_FAILURE;
+            error_msg(h5tools_getprogname(), "error getting attribute information\n");
+            h5tools_setstatus( EXIT_FAILURE);
         } /* end if */
     } /* end else */
 
@@ -7073,7 +7079,7 @@
                 handle_datatypes(group, linkname, NULL, 0, objname);
                 break;
             default:
-                d_status = EXIT_FAILURE;
+                h5tools_setstatus( EXIT_FAILURE);
         }
 
         indent -= 2*COL;
@@ -7088,7 +7094,7 @@
     } /* end if */
 
     if (H5Idec_ref(oid) < 0)
-        d_status = EXIT_FAILURE;
+        h5tools_setstatus( EXIT_FAILURE);
 
 
     return SUCCEED;
Index: tools/h5repack/h5repack.c
===================================================================
--- tools/h5repack/h5repack.c	(revision 18506)
+++ tools/h5repack/h5repack.c	(working copy)
@@ -23,7 +23,7 @@
 #include "h5tools_utils.h"
 
 
-extern char  *progname;
+/*extern char  *progname;*/
 
 
 /*-------------------------------------------------------------------------
@@ -157,7 +157,7 @@
 
         if(options->n_filter_g > H5_REPACK_MAX_NFILTERS)
         {
-            error_msg(progname, "maximum number of filters exceeded for <%s>\n", str);
+            error_msg(h5tools_getprogname(), "maximum number of filters exceeded for <%s>\n", str);
             free(obj_list);
             return -1;
         }
@@ -195,7 +195,7 @@
     init_packobject(&pack);
 
     if (options->all_layout==1){
-        error_msg(progname, "invalid layout input: 'all' option \
+        error_msg(h5tools_getprogname(), "invalid layout input: 'all' option \
                             is present with other objects <%s>\n",str);
         return -1;
     }
@@ -614,7 +614,7 @@
                 break;
             case H5D_LAYOUT_ERROR:
             case H5D_NLAYOUTS:
-                error_msg(progname, "invalid layout\n");
+                error_msg(h5tools_getprogname(), "invalid layout\n");
                 return -1;
             default:
                 strcpy(slayout,"invalid layout\n");
@@ -655,7 +655,7 @@
 
     if (options->all_layout==1 && has_ck)
     {
-        error_msg(progname, "invalid chunking input: 'all' option\
+        error_msg(h5tools_getprogname(), "invalid chunking input: 'all' option\
                             is present with other objects\n");
         return -1;
     }
@@ -717,7 +717,7 @@
 
     if (options->all_filter==1 && has_cp)
     {
-        error_msg(progname, "invalid compression input: 'all' option\
+        error_msg(h5tools_getprogname(), "invalid compression input: 'all' option\
                             is present with other objects\n");
         return -1;
     }
@@ -729,24 +729,24 @@
 
     if (options->grp_compact < 0)
     {
-        error_msg(progname, "invalid maximum number of links to store as header messages\n");
+        error_msg(h5tools_getprogname(), "invalid maximum number of links to store as header messages\n");
         return -1;
     }
     if (options->grp_indexed < 0)
     {
-        error_msg(progname, "invalid minimum number of links to store in the indexed format\n");
+        error_msg(h5tools_getprogname(), "invalid minimum number of links to store in the indexed format\n");
         return -1;
     }
     if (options->grp_indexed > options->grp_compact)
     {
-        error_msg(progname, "minimum indexed size is greater than the maximum compact size\n");
+        error_msg(h5tools_getprogname(), "minimum indexed size is greater than the maximum compact size\n");
         return -1;
     }
     for (i=0; i<8; i++)
     {
         if (options->msg_size[i]<0)
         {
-            error_msg(progname, "invalid shared message size\n");
+            error_msg(h5tools_getprogname(), "invalid shared message size\n");
             return -1;
         }
     }
@@ -768,7 +768,7 @@
 
     if ( options->ublock_filename == NULL && options->ublock_size != 0 )
     {
-        error_msg(progname, "file name missing for user block\n",
+        error_msg(h5tools_getprogname(), "file name missing for user block\n",
             options->ublock_filename);
         return -1;
     }
@@ -781,7 +781,7 @@
 
     if ( options->alignment == 0 && options->threshold != 0 )
     {
-        error_msg(progname, "alignment for H5Pset_alignment missing\n");
+        error_msg(h5tools_getprogname(), "alignment for H5Pset_alignment missing\n");
         return -1;
     }
 
@@ -853,7 +853,7 @@
         /* the input object names are present in the file and are valid */
         if(h5trav_getindext(name, travt) < 0)
         {
-            error_msg(progname, "%s Could not find <%s> in file <%s>. Exiting...\n",
+            error_msg(h5tools_getprogname(), "%s Could not find <%s> in file <%s>. Exiting...\n",
                 (options->verbose?"\n":""),name,fname);
             goto out;
         }
@@ -975,7 +975,7 @@
     else if (filtn==H5Z_FILTER_SCALEOFFSET)
         return "SOFF";
     else {
-        error_msg(progname, "input error in filter type\n");
+        error_msg(h5tools_getprogname(), "input error in filter type\n");
         exit(EXIT_FAILURE);
     }
 }
Index: tools/h5repack/h5repack_main.c
===================================================================
--- tools/h5repack/h5repack_main.c	(revision 18506)
+++ tools/h5repack/h5repack_main.c	(working copy)
@@ -17,6 +17,7 @@
 #include <string.h>
 #include <ctype.h>
 
+#include "h5tools.h"
 #include "h5tools_utils.h"
 #include "h5repack.h"
 
@@ -27,8 +28,9 @@
 
 
 /* module-scoped variables */
-const char  *progname = "h5repack";
-int         d_status = EXIT_SUCCESS;
+/*const char  *progname = "h5repack";*/
+/*int         d_status = EXIT_SUCCESS;*/
+
 static int  has_i_o = 0;
 const char  *infile  = NULL;
 const char  *outfile = NULL;
@@ -105,6 +107,8 @@
     pack_opt_t    options;            /*the global options */
     int           ret=-1;
 
+	h5tools_setprogname("h5repack");
+	h5tools_setstatus(EXIT_SUCCESS);
     /* initialize options  */
     h5repack_init (&options,0);
 
@@ -121,8 +125,8 @@
 
             if ( strcmp( infile, outfile ) == 0 )
             {
-                error_msg(progname, "file names cannot be the same\n");
-                usage(progname);
+                error_msg(h5tools_getprogname(), "file names cannot be the same\n");
+                usage(h5tools_getprogname());
                 exit(EXIT_FAILURE);
 
             }
@@ -130,8 +134,8 @@
 
         else
         {
-            error_msg(progname, "file names missing\n");
-            usage(progname);
+            error_msg(h5tools_getprogname(), "file names missing\n");
+            usage(h5tools_getprogname());
             exit(EXIT_FAILURE);
         }
     }
@@ -304,10 +308,10 @@
 
 
         case 'h':
-            usage(progname);
+            usage(h5tools_getprogname());
             exit(EXIT_SUCCESS);
         case 'V':
-            print_version(progname);
+            print_version(h5tools_getprogname());
             exit(EXIT_SUCCESS);
         case 'v':
             options->verbose = 1;
@@ -317,7 +321,7 @@
             /* parse the -f filter option */
             if (h5repack_addfilter( opt_arg, options)<0)
             {
-                error_msg(progname, "in parsing filter\n");
+                error_msg(h5tools_getprogname(), "in parsing filter\n");
                 exit(EXIT_FAILURE);
             }
             break;
@@ -326,7 +330,7 @@
             /* parse the -l layout option */
             if (h5repack_addlayout( opt_arg, options)<0)
             {
-                error_msg(progname, "in parsing layout\n");
+                error_msg(h5tools_getprogname(), "in parsing layout\n");
                 exit(EXIT_FAILURE);
             }
             break;
@@ -337,7 +341,7 @@
             options->min_comp = atoi( opt_arg );
             if ((int)options->min_comp<=0)
             {
-                error_msg(progname, "invalid minimum compress size <%s>\n", opt_arg );
+                error_msg(h5tools_getprogname(), "invalid minimum compress size <%s>\n", opt_arg );
                 exit(EXIT_FAILURE);
             }
             break;
@@ -430,7 +434,7 @@
             options->alignment = atol( opt_arg );
             if ( options->alignment < 1 )
             {
-                error_msg(progname, "invalid alignment size\n", opt_arg );
+                error_msg(h5tools_getprogname(), "invalid alignment size\n", opt_arg );
                 exit(EXIT_FAILURE);
             }
             break;
@@ -445,8 +449,8 @@
         /* check for file names to be processed */
         if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL)
         {
-            error_msg(progname, "missing file names\n");
-            usage(progname);
+            error_msg(h5tools_getprogname(), "missing file names\n");
+            usage(h5tools_getprogname());
             exit(EXIT_FAILURE);
         }
     }
@@ -489,7 +493,7 @@
 
 
     if ((fp = fopen(data_file, "r")) == (FILE *)NULL) {
-        error_msg(progname, "cannot open options file %s\n", filename);
+        error_msg(h5tools_getprogname(), "cannot open options file %s\n", filename);
         exit(EXIT_FAILURE);
     }
 
@@ -526,7 +530,7 @@
             comp_info[i-1]='\0'; /*cut the last " */
 
             if (h5repack_addfilter(comp_info,options)==-1){
-                error_msg(progname, "could not add compression option\n");
+                error_msg(h5tools_getprogname(), "could not add compression option\n");
                 exit(EXIT_FAILURE);
             }
         }
@@ -556,7 +560,7 @@
             comp_info[i-1]='\0'; /*cut the last " */
 
             if (h5repack_addlayout(comp_info,options)==-1){
-                error_msg(progname, "could not add chunck option\n");
+                error_msg(h5tools_getprogname(), "could not add chunck option\n");
                 exit(EXIT_FAILURE);
             }
         }
@@ -565,7 +569,7 @@
         *-------------------------------------------------------------------------
         */
         else {
-            error_msg(progname, "bad file format for %s", filename);
+            error_msg(h5tools_getprogname(), "bad file format for %s", filename);
             exit(EXIT_FAILURE);
         }
     }
Index: tools/h5repack/h5repack_verify.c
===================================================================
--- tools/h5repack/h5repack_verify.c	(revision 18506)
+++ tools/h5repack/h5repack_verify.c	(working copy)
@@ -15,9 +15,10 @@
 
 #include "h5repack.h"
 #include "h5test.h"
+#include "h5tools.h"
 #include "h5tools_utils.h"
 
-extern char  *progname;
+/*extern char  *progname;*/
 static int verify_layout(hid_t pid, pack_info_t *obj);
 static int verify_filters(hid_t pid, hid_t tid, int nfilters, filter_info_t *filter);
 
@@ -313,12 +314,12 @@
         /* Open the files */
         if ((fid1=H5Fopen(fname1,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
         {
-            error_msg(progname, "<%s>: %s\n", fname1, H5FOPENERROR );
+            error_msg(h5tools_getprogname(), "<%s>: %s\n", fname1, H5FOPENERROR );
             return -1;
         }
         if ((fid2=H5Fopen(fname2,H5F_ACC_RDONLY,H5P_DEFAULT)) < 0 )
         {
-            error_msg(progname, "<%s>: %s\n", fname2, H5FOPENERROR );
+            error_msg(h5tools_getprogname(), "<%s>: %s\n", fname2, H5FOPENERROR );
             H5Fclose(fid1);
             return -1;
         }
@@ -367,7 +368,7 @@
 
             if ( crt_order_flag1 != crt_order_flag2 )
             {
-                error_msg(progname, "property lists for <%s> are different\n",trav->objs[i].name);
+                error_msg(h5tools_getprogname(), "property lists for <%s> are different\n",trav->objs[i].name);
                 goto error;
             }
 
@@ -395,7 +396,7 @@
 
             if(ret == 0)
             {
-                error_msg(progname, "property lists for <%s> are different\n",trav->objs[i].name);
+                error_msg(h5tools_getprogname(), "property lists for <%s> are different\n",trav->objs[i].name);
                 goto error;
             }
 
Index: tools/h5repack/h5repack_copy.c
===================================================================
--- tools/h5repack/h5repack_copy.c	(revision 18506)
+++ tools/h5repack/h5repack_copy.c	(working copy)
@@ -30,7 +30,7 @@
 * globals
 *-------------------------------------------------------------------------
 */
-extern char  *progname;
+/*extern char  *progname;*/
 
 /*-------------------------------------------------------------------------
 * macros
@@ -90,7 +90,7 @@
     */
     if((fidin = h5tools_fopen(fnamein, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0)
     {
-        error_msg(progname, "<%s>: %s\n", fnamein, H5FOPENERROR );
+        error_msg(h5tools_getprogname(), "<%s>: %s\n", fnamein, H5FOPENERROR );
         goto out;
     }
 
@@ -100,19 +100,19 @@
 
         if((fcpl_in = H5Fget_create_plist(fidin)) < 0)
         {
-            error_msg(progname, "failed to retrieve file creation property list\n");
+            error_msg(h5tools_getprogname(), "failed to retrieve file creation property list\n");
             goto out;
         }
 
         if(H5Pget_userblock(fcpl_in, &ub_size) < 0)
         {
-            error_msg(progname, "failed to retrieve userblock size\n");
+            error_msg(h5tools_getprogname(), "failed to retrieve userblock size\n");
             goto out;
         }
 
         if(H5Pclose(fcpl_in) < 0)
         {
-            error_msg(progname, "failed to close property list\n");
+            error_msg(h5tools_getprogname(), "failed to close property list\n");
             goto out;
         }
     }
@@ -123,7 +123,7 @@
         /* Create file creation property list */
         if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
         {
-            error_msg(progname, "fail to create a file creation property list\n");
+            error_msg(h5tools_getprogname(), "fail to create a file creation property list\n");
             goto out;
         }
 
@@ -131,7 +131,7 @@
         {
             if(H5Pset_userblock(fcpl, ub_size) < 0)
             {
-                error_msg(progname, "failed to set non-default userblock size\n");
+                error_msg(h5tools_getprogname(), "failed to set non-default userblock size\n");
                 goto out;
             }
         }
@@ -144,7 +144,7 @@
             /* (So that it is created in "dense storage" form) */
             if(H5Pset_link_phase_change(fcpl, (unsigned)options->grp_compact, (unsigned)options->grp_indexed) < 0)
             {
-                error_msg(progname, "fail to adjust group creation parameters for root group\n");
+                error_msg(h5tools_getprogname(), "fail to adjust group creation parameters for root group\n");
                 goto out;
             }
 
@@ -186,7 +186,7 @@
             {
                 if(H5Pset_shared_mesg_nindexes(fcpl, nindex) < 0)
                 {
-                    error_msg(progname, "fail to set the number of shared object header message indexes\n");
+                    error_msg(h5tools_getprogname(), "fail to set the number of shared object header message indexes\n");
                     goto out;
                 }
 
@@ -194,7 +194,7 @@
                 for(i = 0; i < (nindex - 1); i++)
                 {
                     if(H5Pset_shared_mesg_index(fcpl, i, mesg_type_flags[i], min_mesg_sizes[i]) < 0) {
-                        error_msg(progname, "fail to configure the specified shared object header message index\n");
+                        error_msg(h5tools_getprogname(), "fail to configure the specified shared object header message index\n");
                         goto out;
                     } /* end if */
                 } /* end for */
@@ -203,13 +203,13 @@
             /* Create file access property list */
             if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
             {
-                error_msg(progname, "Could not create file access property list\n");
+                error_msg(h5tools_getprogname(), "Could not create file access property list\n");
                 goto out;
             } /* end if */
 
             if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
             {
-                error_msg(progname, "Could not set property for using latest version of the format\n");
+                error_msg(h5tools_getprogname(), "Could not set property for using latest version of the format\n");
                 goto out;
             } /* end if */
         } /* end if */
@@ -236,7 +236,7 @@
             /* set user block size */
             if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
             {
-                error_msg(progname, "failed to set userblock size\n");
+                error_msg(h5tools_getprogname(), "failed to set userblock size\n");
                 goto out;
             }
 
@@ -248,14 +248,14 @@
             /* create a file creation property list */
             if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
             {
-                error_msg(progname, "fail to create a file creation property list\n");
+                error_msg(h5tools_getprogname(), "fail to create a file creation property list\n");
                 goto out;
             }
 
             /* set user block size */
             if(H5Pset_userblock(fcpl, options->ublock_size) < 0)
             {
-                error_msg(progname, "failed to set userblock size\n");
+                error_msg(h5tools_getprogname(), "failed to set userblock size\n");
                 goto out;
             }
 
@@ -280,7 +280,7 @@
 
             if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0)
             {
-                error_msg(progname, "failed to set alignment\n");
+                error_msg(h5tools_getprogname(), "failed to set alignment\n");
                 goto out;
             }
 
@@ -292,13 +292,13 @@
             /* create a file access property list */
             if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
             {
-                error_msg(progname, "Could not create file access property list\n");
+                error_msg(h5tools_getprogname(), "Could not create file access property list\n");
                 goto out;
             }
 
             if (H5Pset_alignment(fapl, options->threshold, options->alignment) < 0)
             {
-                error_msg(progname, "failed to set alignment\n");
+                error_msg(h5tools_getprogname(), "failed to set alignment\n");
                 goto out;
             }
 
@@ -319,7 +319,7 @@
 
     if((fidout = H5Fcreate(fnameout,H5F_ACC_TRUNC, fcpl, fapl)) < 0)
     {
-        error_msg(progname, "<%s>: Could not create file\n", fnameout );
+        error_msg(h5tools_getprogname(), "<%s>: Could not create file\n", fnameout );
         goto out;
     }
 
@@ -332,7 +332,7 @@
     {
         if ( copy_user_block( options->ublock_filename, fnameout, options->ublock_size) < 0 )
         {
-            error_msg(progname, "Could not copy user block. Exiting...\n");
+            error_msg(h5tools_getprogname(), "Could not copy user block. Exiting...\n");
             goto out;
 
         }
@@ -356,7 +356,7 @@
     */
     if(do_copy_objects(fidin, fidout, travt, options) < 0)
     {
-        error_msg(progname, "<%s>: Could not copy data to: %s\n", fnamein, fnameout);
+        error_msg(h5tools_getprogname(), "<%s>: Could not copy data to: %s\n", fnamein, fnameout);
         goto out;
     } /* end if */
 
@@ -398,7 +398,7 @@
     {
         if ( copy_user_block(fnamein, fnameout, ub_size) < 0 )
         {
-            error_msg(progname, "Could not copy user block. Exiting...\n");
+            error_msg(h5tools_getprogname(), "Could not copy user block. Exiting...\n");
             goto out;
 
         }
@@ -1362,19 +1362,19 @@
     /* get user block size */
     if(( fcpl = H5Fget_create_plist(fid)) < 0)
     {
-        error_msg(progname, "failed to retrieve file creation property list\n");
+        error_msg(h5tools_getprogname(), "failed to retrieve file creation property list\n");
         goto done;
     }
 
     if(H5Pget_userblock(fcpl, &ub_size) < 0)
     {
-        error_msg(progname, "failed to retrieve userblock size\n");
+        error_msg(h5tools_getprogname(), "failed to retrieve userblock size\n");
         goto done;
     }
 
     if(H5Pclose(fcpl) < 0)
     {
-        error_msg(progname, "failed to close property list\n");
+        error_msg(h5tools_getprogname(), "failed to close property list\n");
         goto done;
     }
 
Index: tools/h5repack/h5repack_opttable.c
===================================================================
--- tools/h5repack/h5repack_opttable.c	(revision 18506)
+++ tools/h5repack/h5repack_opttable.c	(working copy)
@@ -16,9 +16,10 @@
 #include <stdlib.h>
 #include <string.h>
 #include "h5repack.h"
+#include "h5tools.h"
 #include "h5tools_utils.h"
 
-extern char  *progname;
+/*extern char  *progname;*/
 
 /*-------------------------------------------------------------------------
  * Function: init_packobject
@@ -67,7 +68,7 @@
     }
     else
     {
-    error_msg(progname, "cannot insert the filter in this object.\
+    error_msg(h5tools_getprogname(), "cannot insert the filter in this object.\
         Maximum capacity exceeded\n");
     }
 }
@@ -126,7 +127,7 @@
     table->size += n_objs;
     table->objs = (pack_info_t*)realloc(table->objs, table->size * sizeof(pack_info_t));
     if (table->objs==NULL) {
-        error_msg(progname, "not enough memory for options table\n");
+        error_msg(h5tools_getprogname(), "not enough memory for options table\n");
         return -1;
     }
     for (i = table->nelems; i < table->size; i++)
@@ -153,7 +154,7 @@
 
     if(NULL == (table = (pack_opttbl_t *)malloc(sizeof(pack_opttbl_t))))
     {
-        error_msg(progname, "not enough memory for options table\n");
+        error_msg(h5tools_getprogname(), "not enough memory for options table\n");
         return -1;
     }
 
@@ -161,7 +162,7 @@
     table->nelems = 0;
     if(NULL == (table->objs = (pack_info_t*)malloc(table->size * sizeof(pack_info_t))))
     {
-        error_msg(progname, "not enough memory for options table\n");
+        error_msg(h5tools_getprogname(), "not enough memory for options table\n");
         free(table);
         return -1;
     }
@@ -232,7 +233,7 @@
                     /* already chunk info inserted for this one; exit */
                     if (table->objs[i].chunk.rank>0)
                     {
-                        error_msg(progname, "chunk information already inserted for <%s>\n",obj_list[j].obj);
+                        error_msg(h5tools_getprogname(), "chunk information already inserted for <%s>\n",obj_list[j].obj);
                         exit(EXIT_FAILURE);
                     }
                     /* insert the layout info */
Index: tools/h5repack/h5repack_parse.c
===================================================================
--- tools/h5repack/h5repack_parse.c	(revision 18506)
+++ tools/h5repack/h5repack_parse.c	(working copy)
@@ -19,9 +19,10 @@
 #include <ctype.h>
 
 #include "h5repack.h"
+#include "h5tools.h"
 #include "h5tools_utils.h"
 
-extern char  *progname;
+/*extern char  *progname;*/
 
 /*-------------------------------------------------------------------------
  * Function: parse_filter
@@ -98,7 +99,7 @@
     obj_list = (obj_list_t*) malloc(n*sizeof(obj_list_t));
     if (obj_list==NULL)
     {
-        error_msg(progname, "could not allocate object list\n");
+        error_msg(h5tools_getprogname(), "could not allocate object list\n");
         return NULL;
     }
     *n_objs=n;
@@ -121,7 +122,7 @@
     if (end_obj+1==(int)len)
     {
         if (obj_list) free(obj_list);
-        error_msg(progname, "input Error: Invalid compression type in <%s>\n",str);
+        error_msg(h5tools_getprogname(), "input Error: Invalid compression type in <%s>\n",str);
         exit(EXIT_FAILURE);
     }
 
@@ -159,7 +160,7 @@
                         c = str[u];
                         if (!isdigit(c) && l==-1){
                             if (obj_list) free(obj_list);
-                            error_msg(progname, "compression parameter not digit in <%s>\n",str);
+                            error_msg(h5tools_getprogname(), "compression parameter not digit in <%s>\n",str);
                             exit(EXIT_FAILURE);
                         }
                         if (l==-1)
@@ -179,7 +180,7 @@
                                     filt->cd_values[j++]=H5_SZIP_EC_OPTION_MASK;
                                 else
                                 {
-                                    error_msg(progname, "szip mask must be 'NN' or 'EC' \n");
+                                    error_msg(h5tools_getprogname(), "szip mask must be 'NN' or 'EC' \n");
                                     exit(EXIT_FAILURE);
                                 }
 
@@ -219,7 +220,7 @@
                         c = str[u];
                         if (!isdigit(c) && l==-1){
                             if (obj_list) free(obj_list);
-                            error_msg(progname, "compression parameter is not a digit in <%s>\n",str);
+                            error_msg(h5tools_getprogname(), "compression parameter is not a digit in <%s>\n",str);
                             exit(EXIT_FAILURE);
                         }
                         if (l==-1)
@@ -239,7 +240,7 @@
                                     filt->cd_values[j++]=H5Z_SO_FLOAT_DSCALE;
                                 else
                                 {
-                                    error_msg(progname, "scale type must be 'IN' or 'DS' \n");
+                                    error_msg(h5tools_getprogname(), "scale type must be 'IN' or 'DS' \n");
                                     exit(EXIT_FAILURE);
                                 }
 
@@ -263,7 +264,7 @@
                         c = str[u];
                         if (!isdigit(c)){
                             if (obj_list) free(obj_list);
-                            error_msg(progname, "compression parameter is not a digit in <%s>\n",str);
+                            error_msg(h5tools_getprogname(), "compression parameter is not a digit in <%s>\n",str);
                             exit(EXIT_FAILURE);
                         }
                         stype[m]=c;
@@ -309,7 +310,7 @@
        if (no_param)
        { /*no more parameters, GZIP must have parameter */
            if (obj_list) free(obj_list);
-           error_msg(progname, "missing compression parameter in <%s>\n",str);
+           error_msg(h5tools_getprogname(), "missing compression parameter in <%s>\n",str);
            exit(EXIT_FAILURE);
        }
    }
@@ -325,7 +326,7 @@
        if (no_param)
        { /*no more parameters, SZIP must have parameter */
            if (obj_list) free(obj_list);
-           error_msg(progname, "missing compression parameter in <%s>\n",str);
+           error_msg(h5tools_getprogname(), "missing compression parameter in <%s>\n",str);
            exit(EXIT_FAILURE);
        }
    }
@@ -341,7 +342,7 @@
        if (m>0)
        { /*shuffle does not have parameter */
            if (obj_list) free(obj_list);
-           error_msg(progname, "extra parameter in SHUF <%s>\n",str);
+           error_msg(h5tools_getprogname(), "extra parameter in SHUF <%s>\n",str);
            exit(EXIT_FAILURE);
        }
    }
@@ -356,7 +357,7 @@
        if (m>0)
        { /*shuffle does not have parameter */
            if (obj_list) free(obj_list);
-           error_msg(progname, "extra parameter in FLET <%s>\n",str);
+           error_msg(h5tools_getprogname(), "extra parameter in FLET <%s>\n",str);
            exit(EXIT_FAILURE);
        }
    }
@@ -371,7 +372,7 @@
        if (m>0)
        { /*nbit does not have parameter */
            if (obj_list) free(obj_list);
-           error_msg(progname, "extra parameter in NBIT <%s>\n",str);
+           error_msg(h5tools_getprogname(), "extra parameter in NBIT <%s>\n",str);
            exit(EXIT_FAILURE);
        }
    }
@@ -386,13 +387,13 @@
        if (no_param)
        { /*no more parameters, SOFF must have parameter */
            if (obj_list) free(obj_list);
-           error_msg(progname, "missing compression parameter in <%s>\n",str);
+           error_msg(h5tools_getprogname(), "missing compression parameter in <%s>\n",str);
            exit(EXIT_FAILURE);
        }
    }
    else {
        if (obj_list) free(obj_list);
-       error_msg(progname, "invalid filter type in <%s>\n",str);
+       error_msg(h5tools_getprogname(), "invalid filter type in <%s>\n",str);
        exit(EXIT_FAILURE);
    }
   }
@@ -415,7 +416,7 @@
        if (filt->cd_values[0]>9 )
        {
            if (obj_list) free(obj_list);
-           error_msg(progname, "invalid compression parameter in <%s>\n",str);
+           error_msg(h5tools_getprogname(), "invalid compression parameter in <%s>\n",str);
            exit(EXIT_FAILURE);
        }
        break;
@@ -430,19 +431,19 @@
        if ((pixels_per_block%2)==1)
        {
            if (obj_list) free(obj_list);
-           error_msg(progname, "pixels_per_block is not even in <%s>\n",str);
+           error_msg(h5tools_getprogname(), "pixels_per_block is not even in <%s>\n",str);
            exit(EXIT_FAILURE);
        }
        if (pixels_per_block>H5_SZIP_MAX_PIXELS_PER_BLOCK)
        {
            if (obj_list) free(obj_list);
-           error_msg(progname, "pixels_per_block is too large in <%s>\n",str);
+           error_msg(h5tools_getprogname(), "pixels_per_block is too large in <%s>\n",str);
            exit(EXIT_FAILURE);
        }
        if ( (strcmp(smask,"NN")!=0) && (strcmp(smask,"EC")!=0) )
        {
            if (obj_list) free(obj_list);
-           error_msg(progname, "szip mask must be 'NN' or 'EC' \n");
+           error_msg(h5tools_getprogname(), "szip mask must be 'NN' or 'EC' \n");
            exit(EXIT_FAILURE);
        }
        break;
@@ -519,7 +520,7 @@
     obj_list = (obj_list_t*) malloc(n*sizeof(obj_list_t));
     if (obj_list==NULL)
     {
-        error_msg(progname, "could not allocate object list\n");
+        error_msg(h5tools_getprogname(), "could not allocate object list\n");
         return NULL;
     }
     *n_objs=n;
@@ -543,7 +544,7 @@
     if (end_obj+1==(int)len)
     {
         if (obj_list) free(obj_list);
-        error_msg(progname, "in parse layout, no characters after : in <%s>\n",str);
+        error_msg(h5tools_getprogname(), "in parse layout, no characters after : in <%s>\n",str);
         exit(EXIT_FAILURE);
     }
 
@@ -560,7 +561,7 @@
             else if (strcmp(slayout,"CHUNK")==0)
                 pack->layout=H5D_CHUNKED;
             else {
-                error_msg(progname, "in parse layout, not a valid layout in <%s>\n",str);
+                error_msg(h5tools_getprogname(), "in parse layout, not a valid layout in <%s>\n",str);
                 exit(EXIT_FAILURE);
             }
         }
@@ -584,7 +585,7 @@
         if (j>(int)len)
         {
             if (obj_list) free(obj_list);
-            error_msg(progname, "in parse layout,  <%s> Chunk dimensions missing\n",str);
+            error_msg(h5tools_getprogname(), "in parse layout,  <%s> Chunk dimensions missing\n",str);
             exit(EXIT_FAILURE);
         }
 
@@ -598,7 +599,7 @@
                 && c!='N' && c!='O' && c!='N' && c!='E'
                 ){
                 if (obj_list) free(obj_list);
-                error_msg(progname, "in parse layout, <%s> Not a valid character in <%s>\n",
+                error_msg(h5tools_getprogname(), "in parse layout, <%s> Not a valid character in <%s>\n",
                     sdim,str);
                 exit(EXIT_FAILURE);
             }
@@ -611,7 +612,7 @@
                     pack->chunk.chunk_lengths[c_index]=atoi(sdim);
                     if (pack->chunk.chunk_lengths[c_index]==0) {
                         if (obj_list) free(obj_list);
-                        error_msg(progname, "in parse layout, <%s> conversion to number in <%s>\n",
+                        error_msg(h5tools_getprogname(), "in parse layout, <%s> conversion to number in <%s>\n",
                             sdim,str);
                         exit(EXIT_FAILURE);
                     }
@@ -629,7 +630,7 @@
                         pack->chunk.chunk_lengths[c_index]=atoi(sdim);
                         if (pack->chunk.chunk_lengths[c_index]==0){
                             if (obj_list) free(obj_list);
-                            error_msg(progname, "in parse layout, <%s> conversion to number in <%s>\n",
+                            error_msg(h5tools_getprogname(), "in parse layout, <%s> conversion to number in <%s>\n",
                                 sdim,str);
                             exit(EXIT_FAILURE);
                         }
Index: tools/h5repack/h5repacktst.c
===================================================================
--- tools/h5repack/h5repacktst.c	(revision 18506)
+++ tools/h5repack/h5repacktst.c	(working copy)
@@ -89,10 +89,11 @@
 #define H5REPACK_EXTFILE "h5repack_ext.bin"
 
 
+/*
 const char *progname = "h5repacktst";
 int d_status = EXIT_SUCCESS;
+*/
 
-
 #define DIM1    40
 #define DIM2    20
 #define CDIM1   DIM1/2
@@ -166,6 +167,9 @@
     int szip_can_encode = 0;
 #endif
 
+	h5tools_setprogname("h5repacktst");
+	h5tools_setstatus(EXIT_SUCCESS);
+
     /* initialize */
     memset(&diff_options, 0, sizeof (diff_opt_t));
     memset(&pack_options, 0, sizeof (pack_opt_t));
Index: tools/h5jam/h5jam.c
===================================================================
--- tools/h5jam/h5jam.c	(revision 18506)
+++ tools/h5jam/h5jam.c	(working copy)
@@ -22,6 +22,7 @@
 
 #include "hdf5.h"
 #include "H5private.h"
+#include "h5tools.h"
 #include "h5tools_utils.h"
 
 #define TRUE 1
@@ -32,8 +33,11 @@
 hsize_t copy_some_to_file (int, int, hsize_t, hsize_t, ssize_t);
 void parse_command_line (int, const char *[]);
 
+/*
 const char *progname = "h5jam";
 int d_status = EXIT_SUCCESS;
+*/
+
 int do_clobber = FALSE;
 char *output_file = NULL;
 char *input_file = NULL;
@@ -131,14 +135,14 @@
 	  do_clobber = TRUE;
 	  break;
 	case 'h':
-	  usage (progname);
+	  usage (h5tools_getprogname());
 	  exit (EXIT_SUCCESS);
     case 'V':
-	  print_version (progname);
+	  print_version (h5tools_getprogname());
 	  exit (EXIT_SUCCESS);
 	case '?':
 	default:
-	  usage (progname);
+	  usage (h5tools_getprogname());
 	  exit (EXIT_FAILURE);
 	}
     }
@@ -184,21 +188,23 @@
   H5Eget_auto2(H5E_DEFAULT, &func, &edata);
   H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
 
+  h5tools_setprogname("h5jam");
+  h5tools_setstatus(EXIT_SUCCESS);
   parse_command_line (argc, argv);
 
   if (ub_file == NULL)
     {
       /* no user block */
-      error_msg (progname, "no user block file name\n");
-      usage (progname);
+      error_msg (h5tools_getprogname(), "no user block file name\n");
+      usage (h5tools_getprogname());
       exit (EXIT_FAILURE);
     }
 
   if (input_file == NULL)
     {
       /* no user block */
-      error_msg (progname, "no HDF5 file\n");
-      usage (progname);
+      error_msg (h5tools_getprogname(), "no HDF5 file\n");
+      usage (h5tools_getprogname());
       exit (EXIT_FAILURE);
     }
 
@@ -206,7 +212,7 @@
 
   if (testval <= 0)
     {
-      error_msg (progname, "Input HDF5 file is not HDF \"%s\"\n", input_file);
+      error_msg (h5tools_getprogname(), "Input HDF5 file is not HDF \"%s\"\n", input_file);
       exit (EXIT_FAILURE);
     }
 
@@ -214,14 +220,14 @@
 
   if (ifile < 0)
     {
-      error_msg (progname, "Can't open input HDF5 file \"%s\"\n", input_file);
+      error_msg (h5tools_getprogname(), "Can't open input HDF5 file \"%s\"\n", input_file);
       exit (EXIT_FAILURE);
     }
 
   plist = H5Fget_create_plist (ifile);
   if (plist < 0)
     {
-      error_msg (progname, "Can't get file creation plist for file \"%s\"\n",
+      error_msg (h5tools_getprogname(), "Can't get file creation plist for file \"%s\"\n",
 		 input_file);
       exit (EXIT_FAILURE);
     }
@@ -229,7 +235,7 @@
   status = H5Pget_userblock (plist, &usize);
   if (status < 0)
     {
-      error_msg (progname, "Can't get user block for file \"%s\"\n",
+      error_msg (h5tools_getprogname(), "Can't get user block for file \"%s\"\n",
 		 input_file);
       exit (EXIT_FAILURE);
     }
@@ -241,7 +247,7 @@
 
   if (ufid < 0)
     {
-      error_msg (progname, "unable to open user block file \"%s\"\n",
+      error_msg (h5tools_getprogname(), "unable to open user block file \"%s\"\n",
 		 ub_file);
       exit (EXIT_FAILURE);
     }
@@ -250,7 +256,7 @@
 
   if (res < 0)
     {
-      error_msg (progname, "Can't stat file \"%s\"\n", ub_file);
+      error_msg (h5tools_getprogname(), "Can't stat file \"%s\"\n", ub_file);
       exit (EXIT_FAILURE);
     }
 
@@ -260,7 +266,7 @@
 
   if (h5fid < 0)
     {
-      error_msg (progname, "unable to open HDF5 file for read \"%s\"\n",
+      error_msg (h5tools_getprogname(), "unable to open HDF5 file for read \"%s\"\n",
 		 input_file);
       exit (EXIT_FAILURE);
     }
@@ -269,7 +275,7 @@
 
   if (res < 0)
     {
-      error_msg (progname, "Can't stat file \"%s\"\n", input_file);
+      error_msg (h5tools_getprogname(), "Can't stat file \"%s\"\n", input_file);
       exit (EXIT_FAILURE);
     }
 
@@ -281,7 +287,7 @@
 
       if (ofid < 0)
 	{
-	  error_msg (progname, "unable to open output file \"%s\"\n",
+	  error_msg (h5tools_getprogname(), "unable to open output file \"%s\"\n",
 		     output_file);
 	  exit (EXIT_FAILURE);
 	}
@@ -292,7 +298,7 @@
 
       if (ofid < 0)
 	{
-	  error_msg (progname, "unable to create output file \"%s\"\n",
+	  error_msg (h5tools_getprogname(), "unable to create output file \"%s\"\n",
 		     output_file);
 	  exit (EXIT_FAILURE);
 	}
@@ -346,7 +352,7 @@
   HDclose (h5fid);
   HDclose (ofid);
 
-  return d_status;
+  return h5tools_getstatus();
 }
 
 /*-------------------------------------------------------------------------
@@ -395,7 +401,7 @@
   if (startin > startout)
     {
       /* this case is prohibited */
-      error_msg (progname, "copy_some_to_file: panic: startin > startout?\n");
+      error_msg (h5tools_getprogname(), "copy_some_to_file: panic: startin > startout?\n");
       exit (EXIT_FAILURE);
     }
 
@@ -405,7 +411,7 @@
 
       if (res < 0)
 	{
-	  error_msg (progname, "Can't stat file \n");
+	  error_msg (h5tools_getprogname(), "Can't stat file \n");
 	  exit (EXIT_FAILURE);
 	}
 
Index: tools/h5jam/h5unjam.c
===================================================================
--- tools/h5jam/h5unjam.c	(revision 18506)
+++ tools/h5jam/h5unjam.c	(working copy)
@@ -24,6 +24,7 @@
 
 #include "hdf5.h"
 #include "H5private.h"
+#include "h5tools.h"
 #include "h5tools_utils.h"
 
 #define TRUE 1
@@ -34,8 +35,11 @@
 hsize_t compute_pad( hsize_t );
 herr_t copy_to_file( int , int , ssize_t, ssize_t );
 
+/* moved into tools lib calls (WB)
 const char  *progname = "h5unjam";
 int          d_status = EXIT_SUCCESS;
+*/
+
 int do_delete = FALSE;
 char *output_file = NULL;
 char *input_file = NULL;
@@ -125,14 +129,14 @@
 	  do_delete = TRUE;
 	  break;
     case 'h':
-        usage(progname);
+        usage(h5tools_getprogname() );
         exit(EXIT_SUCCESS);
     case 'V':
-        print_version (progname);
+        print_version (h5tools_getprogname() );
         exit (EXIT_SUCCESS);
     case '?':
     default:
-        usage(progname);
+        usage(h5tools_getprogname() );
         exit(EXIT_FAILURE);
         }
     }
@@ -140,8 +144,8 @@
     /* check for file name to be processed */
 /*
     if (argc <= opt_ind+2) {
-        error_msg(progname, "missing file name\n");
-        usage(progname);
+        error_msg(h5tools_getprogname() , "missing file name\n");
+        usage(h5tools_getprogname() );
         exit(EXIT_FAILURE);
     }
 */
@@ -182,37 +186,39 @@
     H5Eget_auto2(H5E_DEFAULT, &func, &edata);
     H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
 
+    h5tools_setprogname("h5unjam");
+    h5tools_setstatus(EXIT_SUCCESS);
     parse_command_line(argc, argv);
 
     testval = H5Fis_hdf5(input_file);
 
     if (testval <= 0) {
-        error_msg(progname, "Input HDF5 file is not HDF \"%s\"\n", input_file);
+        error_msg(h5tools_getprogname() , "Input HDF5 file is not HDF \"%s\"\n", input_file);
         exit(EXIT_FAILURE);
     }
 
     ifile = H5Fopen(input_file, H5F_ACC_RDONLY , H5P_DEFAULT);
 
     if (ifile < 0) {
-        error_msg(progname, "Can't open input HDF5 file \"%s\"\n", input_file);
+        error_msg(h5tools_getprogname() , "Can't open input HDF5 file \"%s\"\n", input_file);
         exit(EXIT_FAILURE);
     }
 
     plist = H5Fget_create_plist(ifile);
     if (plist < 0) {
-        error_msg(progname, "Can't get file creation plist for file \"%s\"\n", input_file);
+        error_msg(h5tools_getprogname() , "Can't get file creation plist for file \"%s\"\n", input_file);
         exit(EXIT_FAILURE);
     }
 
     status =  H5Pget_userblock(plist, & usize  );
     if (status < 0) {
-        error_msg(progname, "Can't get user block for file \"%s\"\n", input_file);
+        error_msg(h5tools_getprogname() , "Can't get user block for file \"%s\"\n", input_file);
         exit(EXIT_FAILURE);
     }
 
     if (usize == 0) {
 	/* no user block to remove: message? */
-        error_msg(progname, "\"%s\" has no user block: no change to file\n", input_file);
+        error_msg(h5tools_getprogname() , "\"%s\" has no user block: no change to file\n", input_file);
         exit(EXIT_SUCCESS);
 
     }
@@ -220,7 +226,7 @@
     res = stat(input_file, &sbuf);
 
     if (res < 0) {
-        error_msg(progname, "Can't stat file \"%s\"\n", input_file);
+        error_msg(h5tools_getprogname() , "Can't stat file \"%s\"\n", input_file);
         exit(EXIT_FAILURE);
     }
 
@@ -229,12 +235,12 @@
     ifid = HDopen(input_file,O_RDONLY,0);
 
     if (ifid < 0) {
-        error_msg(progname, "unable to open input HDF5 file \"%s\"\n", input_file);
+        error_msg(h5tools_getprogname() , "unable to open input HDF5 file \"%s\"\n", input_file);
         exit(EXIT_FAILURE);
     }
 
     if (do_delete && (ub_file != NULL)) {
-            error_msg(progname, "??\"%s\"\n", ub_file);
+            error_msg(h5tools_getprogname() , "??\"%s\"\n", ub_file);
             exit(EXIT_FAILURE);
     }
 
@@ -245,7 +251,7 @@
         ufid = HDopen(ub_file,O_WRONLY|O_CREAT|O_TRUNC, 0644 );
 
         if (ufid < 0) {
-            error_msg(progname, "unable to open user block file for output\"%s\"\n", ub_file);
+            error_msg(h5tools_getprogname() , "unable to open user block file for output\"%s\"\n", ub_file);
             exit(EXIT_FAILURE);
         }
     }
@@ -254,14 +260,14 @@
         h5fid = HDopen(input_file,O_WRONLY, 0);
 
         if (h5fid < 0) {
-            error_msg(progname, "unable to open output HDF5 file \"%s\"\n", input_file);
+            error_msg(h5tools_getprogname() , "unable to open output HDF5 file \"%s\"\n", input_file);
             exit(EXIT_FAILURE);
         }
     } else {
         h5fid = HDopen(output_file,O_WRONLY|O_CREAT|O_TRUNC, 0644 );
 
         if (h5fid < 0) {
-            error_msg(progname, "unable to open output HDF5 file \"%s\"\n", output_file);
+            error_msg(h5tools_getprogname() , "unable to open output HDF5 file \"%s\"\n", output_file);
             exit(EXIT_FAILURE);
         }
     }
@@ -270,7 +276,7 @@
     /* copy from 0 to 'usize - 1' into ufid */
     if (!do_delete) {
 	if(copy_to_file(ifid, ufid, 0, (ssize_t) usize) < 0) {
-            error_msg(progname, "unable to copy user block to output file \"%s\"\n", ub_file);
+            error_msg(h5tools_getprogname() , "unable to copy user block to output file \"%s\"\n", ub_file);
             exit(EXIT_FAILURE);
         }
     }
@@ -279,7 +285,7 @@
      * starting at end of user block if present
      */
     if(copy_to_file(ifid, h5fid, (ssize_t) usize, (ssize_t)(fsize - (ssize_t)usize)) < 0) {
-        error_msg(progname, "unable to copy hdf5 data to output file \"%s\"\n", output_file);
+        error_msg(h5tools_getprogname() , "unable to copy hdf5 data to output file \"%s\"\n", output_file);
         exit(EXIT_FAILURE);
     }
 
@@ -288,7 +294,7 @@
     HDclose(h5fid);
     HDclose(ifid);
 
-    return d_status;
+    return h5tools_getstatus();
 }
 
 /*
Index: tools/h5diff/h5diffgentest.c
===================================================================
--- tools/h5diff/h5diffgentest.c	(revision 18506)
+++ tools/h5diff/h5diffgentest.c	(working copy)
@@ -1420,7 +1420,6 @@
     /*-----------------------------------------------------------------------
     * External Links
     *------------------------------------------------------------------------*/
-    /*--------------
     /* source file */
     status = H5Lcreate_external(fname2, "/target_group/x_dset", fid1, "ext_link_dset1", H5P_DEFAULT, H5P_DEFAULT);
     if (status < 0)
Index: tools/h5diff/h5diff_common.c
===================================================================
--- tools/h5diff/h5diff_common.c	(revision 18506)
+++ tools/h5diff/h5diff_common.c	(working copy)
@@ -25,7 +25,9 @@
 
 
 /* module-scoped variables */
+/* disabled. WB
 const char  *progname = "h5diff";
+*/
 
 /*
  * Command-line options: The user can specify short or long-named
@@ -69,6 +71,8 @@
 
     int opt;
 
+    h5tools_setprogname("h5diff");
+
     /* process the command-line */
     memset(options, 0, sizeof (diff_opt_t));
 
@@ -90,7 +94,7 @@
             usage();
             h5diff_exit(EXIT_SUCCESS);
         case 'V':
-            print_version(progname);
+            print_version(h5tools_getprogname() );
             h5diff_exit(EXIT_SUCCESS);
         case 'v':
             options->m_verbose = 1;
@@ -174,7 +178,7 @@
     /* check for file names to be processed */
     if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL)
     {
-        error_msg(progname, "missing file names\n");
+        error_msg(h5tools_getprogname() , "missing file names\n");
         usage();
         h5diff_exit(EXIT_FAILURE);
     }
Index: tools/lib/h5tools_ref.h
===================================================================
--- tools/lib/h5tools_ref.h	(revision 18506)
+++ tools/lib/h5tools_ref.h	(working copy)
@@ -18,6 +18,8 @@
 
 #include "hdf5.h"
 
+#include "hdf5toolsDllApi.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
Index: tools/lib/h5tools.h
===================================================================
--- tools/lib/h5tools.h	(revision 18506)
+++ tools/lib/h5tools.h	(working copy)
@@ -23,8 +23,16 @@
 #define H5TOOLS_H__
 
 #include "hdf5.h"
+#include "hdf5toolsDllApi.h"
 #include "h5tools_error.h"
 
+
+extern hdf5tools_API const char*h5tools_getprogname(void);
+extern hdf5tools_API int h5tools_getstatus(void);
+
+extern hdf5tools_API void h5tools_setprogname(const char*progname);
+extern hdf5tools_API void h5tools_setstatus(int d_status);
+
 #define ESCAPE_HTML             1
 #define OPT(X,S)                ((X) ? (X) : (S))
 #define OPTIONAL_LINE_BREAK     "\001"  /* Special strings embedded in the output */
@@ -532,26 +540,26 @@
 #define H5_TOOLS_DATATYPE        "DATATYPE"
 
 /* Definitions of useful routines */
-extern void     h5tools_init(void);
-extern void     h5tools_close(void);
-extern hid_t    h5tools_fopen(const char *fname, unsigned flags, hid_t fapl,
-                    const char *driver, char *drivername, size_t drivername_len);
-extern int      h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset,
-                                  hid_t p_typ, struct subset_t *sset, int indentlevel);
-extern int      h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id,
-                                 hid_t type, hid_t space, void *mem, int indentlevel);
-extern hid_t    h5tools_get_native_type(hid_t type);
-extern hid_t    h5tools_get_little_endian_type(hid_t type);
-extern hid_t    h5tools_get_big_endian_type(hid_t type);
+extern hdf5tools_API void     h5tools_init(void);
+extern hdf5tools_API void     h5tools_close(void);
+extern hdf5tools_API hid_t    h5tools_fopen(const char *fname, unsigned flags, hid_t fapl,
+                    			    const char *driver, char *drivername, size_t drivername_len);
+extern hdf5tools_API int      h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, hid_t dset,
+                                  		hid_t p_typ, struct subset_t *sset, int indentlevel);
+extern hdf5tools_API int      h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, hid_t obj_id,
+                                 		hid_t type, hid_t space, void *mem, int indentlevel);
+extern hdf5tools_API hid_t    h5tools_get_native_type(hid_t type);
+extern hdf5tools_API hid_t    h5tools_get_little_endian_type(hid_t type);
+extern hdf5tools_API hid_t    h5tools_get_big_endian_type(hid_t type);
 
 
-extern void     h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container,
-                         h5tools_context_t *ctx/*in,out*/, unsigned flags,
-                         hsize_t nelmts, hid_t type, void *_mem);
+extern hdf5tools_API void     h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container,
+                         				h5tools_context_t *ctx/*in,out*/, unsigned flags,
+                         				hsize_t nelmts, hid_t type, void *_mem);
 
-extern int      h5tools_canreadf(const char* name,
-                                 hid_t dcpl_id);
-extern int      h5tools_can_encode(H5Z_filter_t filtn);
+extern hdf5tools_API int      h5tools_canreadf(const char* name,
+                    		               hid_t dcpl_id);
+extern hdf5tools_API int      h5tools_can_encode(H5Z_filter_t filtn);
 
 void            init_acc_pos(h5tools_context_t *ctx, hsize_t *dims);
 /*
Index: tools/lib/hdf5toolsDllApi.h
===================================================================
--- tools/lib/hdf5toolsDllApi.h	(revision 0)
+++ tools/lib/hdf5toolsDllApi.h	(revision 0)
@@ -0,0 +1,14 @@
+#ifndef	__hdf5toolsDllApi_H__
+#define	__hdf5toolsDllApi_H__ "Generated by make system" 
+
+#ifdef	__WINDOWS
+# ifdef	hdf5tools_EXPORTS
+#  define hdf5tools_API __declspec(dllexport)
+# else
+#  define hdf5tools_API __declspec(dllimport)
+# endif
+#else
+# define hdf5tools_API
+#endif
+
+#endif /* __DllApi_H__ */
Index: tools/lib/h5tools_ref.c
===================================================================
--- tools/lib/h5tools_ref.c	(revision 18506)
+++ tools/lib/h5tools_ref.c	(working copy)
@@ -45,9 +45,30 @@
 static H5SL_t *ref_path_table = NULL;   /* the "table" (implemented with a skip list) */
 static hid_t thefile = (-1);
 
-extern char  *progname;
-extern int   d_status;
+static const char  *my_progname = "(undefined)";
+static int   d_status = 0;
 
+void h5tools_setprogname(const char *Progname)
+{
+	my_progname = Progname;
+}
+
+void h5tools_setstatus(int D_status)
+{
+	d_status = D_status;
+}
+
+const char*h5tools_getprogname()
+{
+	return my_progname;
+}
+
+int h5tools_getstatus()
+{
+	return d_status;
+}
+
+
 static int ref_path_table_put(const char *, haddr_t objno);
 
 /*-------------------------------------------------------------------------
@@ -122,7 +143,7 @@
 
     /* Iterate over objects in this file */
     if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL) < 0) {
-        error_msg(progname, "unable to construct reference path table\n");
+	    error_msg(h5tools_getprogname(), "unable to construct reference path table\n");
         d_status = EXIT_FAILURE;
     } /* end if */
 
Index: tools/h5copy/h5copy.c
===================================================================
--- tools/h5copy/h5copy.c	(revision 18506)
+++ tools/h5copy/h5copy.c	(working copy)
@@ -19,9 +19,11 @@
 #include <string.h>
 #include <stdlib.h>
 
-const char *progname="h5copy";
+/*const char *progname="h5copy";
 int   d_status;
+*/
 
+
 /* command-line options: short and long-named parameters */
 static const char *s_opts = "d:f:hi:o:ps:vV";
 static struct long_options l_opts[] = {
@@ -176,7 +178,7 @@
  }
  else
  {
-  error_msg(progname, "Error in input flag\n");
+  error_msg( h5tools_getprogname(), "Error in input flag\n");
   return -1;
  }
 
@@ -214,6 +216,9 @@
  char         str_flag[20];
  int          opt;
 
+ h5tools_setprogname("h5copy");
+ h5tools_setstatus(0);
+
  /* initialize h5tools lib */
  h5tools_init();
 
@@ -264,7 +269,7 @@
    break;
 
   case 'V':
-   print_version(progname);
+   print_version(h5tools_getprogname() );
    leave(EXIT_SUCCESS);
    break;
 
@@ -284,28 +289,28 @@
 
  if (fname_src==NULL)
  {
-  error_msg(progname, "Input file name missing\n");
+  error_msg(h5tools_getprogname(), "Input file name missing\n");
   usage();
   leave(EXIT_FAILURE);
  }
 
  if (fname_dst==NULL)
  {
-  error_msg(progname, "Output file name missing\n");
+  error_msg(h5tools_getprogname(), "Output file name missing\n");
   usage();
   leave(EXIT_FAILURE);
  }
 
  if (oname_src==NULL)
  {
-  error_msg(progname, "Source object name missing\n");
+  error_msg(h5tools_getprogname(), "Source object name missing\n");
   usage();
   leave(EXIT_FAILURE);
  }
 
  if (oname_dst==NULL)
  {
-  error_msg(progname, "Destination object name missing\n");
+  error_msg(h5tools_getprogname(), "Destination object name missing\n");
   usage();
   leave(EXIT_FAILURE);
  }
@@ -322,7 +327,7 @@
  *-------------------------------------------------------------------------*/
  if (fid_src==-1)
  {
-  error_msg(progname, "Could not open input file <%s>...Exiting\n", fname_src);
+  error_msg(h5tools_getprogname(), "Could not open input file <%s>...Exiting\n", fname_src);
   if (fname_src)
    free(fname_src);
   leave(EXIT_FAILURE);
@@ -345,7 +350,7 @@
  *-------------------------------------------------------------------------*/
  if (fid_dst==-1)
  {
-  error_msg(progname, "Could not open output file <%s>...Exiting\n", fname_dst);
+  error_msg(h5tools_getprogname(), "Could not open output file <%s>...Exiting\n", fname_dst);
   if (fname_src)
    free(fname_src);
   if (fname_dst)
@@ -386,7 +391,7 @@
 
     /* Create link creation property list */
     if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
-        error_msg(progname, "Could not create link creation property list\n");
+        error_msg(h5tools_getprogname(), "Could not create link creation property list\n");
         goto error;
     } /* end if */
 
@@ -394,13 +399,13 @@
     if(parents) {
         /* Set the intermediate group creation property */
         if(H5Pset_create_intermediate_group(lcpl_id, 1) < 0) {
-            error_msg(progname, "Could not set property for creating parent groups\n");
+            error_msg(h5tools_getprogname(), "Could not set property for creating parent groups\n");
             goto error;
         } /* end if */
 
         /* Display some output if requested */
         if(verbose)
-            printf("%s: Creating parent groups\n", progname);
+            printf("%s: Creating parent groups\n", h5tools_getprogname());
     } /* end if */
 
 /*-------------------------------------------------------------------------
Index: tools/h5stat/h5stat.c
===================================================================
--- tools/h5stat/h5stat.c	(revision 18506)
+++ tools/h5stat/h5stat.c	(working copy)
@@ -97,8 +97,9 @@
 } iter_t;
 
 
-const char *progname = "h5stat";
-int               d_status = EXIT_SUCCESS;
+/*const char *progname = "h5stat";*/
+/*int               d_status = EXIT_SUCCESS;*/
+
 static int        display_all = TRUE;
 static int        display_file = FALSE;
 static int        display_file_metadata = FALSE;
@@ -723,11 +724,11 @@
     while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
         switch ((char)opt) {
             case 'h':
-                usage(progname);
+                usage(h5tools_getprogname());
                 leave(EXIT_SUCCESS);
 
             case 'V':
-                print_version(progname);
+                print_version(h5tools_getprogname());
                 leave(EXIT_SUCCESS);
                 break;
 
@@ -781,15 +782,15 @@
                 break;
 
             default:
-                usage(progname);
+                usage(h5tools_getprogname());
                 leave(EXIT_FAILURE);
         } /* end switch */
     } /* end while */
 
     /* check for file name to be processed */
     if (argc <= opt_ind) {
-        error_msg(progname, "missing file name\n");
-        usage(progname);
+        error_msg(h5tools_getprogname(), "missing file name\n");
+        usage(h5tools_getprogname());
         leave(EXIT_FAILURE);
     } /* end if */
 
@@ -1323,6 +1324,9 @@
     struct handler_t   *hand;
     H5F_info_t      	finfo;
 
+	h5tools_setprogname("h5stat");
+	h5tools_setstatus(EXIT_SUCCESS);
+
     /* Disable error reporting */
     H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
 
@@ -1330,7 +1334,7 @@
     h5tools_init();
     hand = parse_command_line (argc, argv);
     if(!hand) {
-        error_msg(progname, "unable to parse command line arguments \n");
+        error_msg(h5tools_getprogname(), "unable to parse command line arguments \n");
         leave(EXIT_FAILURE);
     } /* end if */
 
@@ -1340,7 +1344,7 @@
 
     fid = H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT);
     if(fid < 0) {
-        error_msg(progname, "unable to open file \"%s\"\n", fname);
+        error_msg(h5tools_getprogname(), "unable to open file \"%s\"\n", fname);
         leave(EXIT_FAILURE);
     } /* end if */
 
@@ -1349,7 +1353,7 @@
 
     /* Get storge info for SOHM's btree/list/heap and superblock extension */
     if(H5Fget_info(fid, &finfo) < 0)
-	warn_msg(progname, "Unable to retrieve SOHM info\n");
+	warn_msg(h5tools_getprogname(), "Unable to retrieve SOHM info\n");
     else {
 	iter.super_ext_size = finfo.super_ext_size;
 	iter.SM_hdr_storage_size = finfo.sohm.hdr_size;
@@ -1358,10 +1362,10 @@
     } /* end else */
 
     if((fcpl = H5Fget_create_plist(fid)) < 0)
-        warn_msg(progname, "Unable to retrieve file creation property\n");
+        warn_msg(h5tools_getprogname(), "Unable to retrieve file creation property\n");
 
     if(H5Pget_userblock(fcpl, &iter.ublk_size) < 0)
-        warn_msg(progname, "Unable to retrieve userblock size\n");
+        warn_msg(h5tools_getprogname(), "Unable to retrieve userblock size\n");
 
     /* Walk the objects or all file */
     if(display_object) {
@@ -1370,7 +1374,7 @@
         u = 0;
         while(hand[u].obj) {
             if (h5trav_visit(fid, hand[u].obj, TRUE, TRUE, obj_stats, lnk_stats, &iter) < 0)
-		warn_msg(progname, "Unable to traverse object \"%s\"\n", hand[u].obj);
+		warn_msg(h5tools_getprogname(), "Unable to traverse object \"%s\"\n", hand[u].obj);
 	    else
 		print_statistics(hand[u].obj, &iter);
             u++;
@@ -1378,7 +1382,7 @@
     } /* end if */
     else {
         if (h5trav_visit(fid, "/", TRUE, TRUE, obj_stats, lnk_stats, &iter) < 0)
-	    warn_msg(progname, "Unable to traverse objects/links in file \"%s\"\n", fname);
+	    warn_msg(h5tools_getprogname(), "Unable to traverse objects/links in file \"%s\"\n", fname);
 	else
 	    print_statistics("/", &iter);
     } /* end else */
@@ -1386,7 +1390,7 @@
     if (hand) free(hand);
 
     if(H5Fclose(fid) < 0) {
-        error_msg(progname, "unable to close file \"%s\"\n", fname);
+        error_msg(h5tools_getprogname(), "unable to close file \"%s\"\n", fname);
         leave(EXIT_FAILURE);
     }
 
Index: tools/h5ls/h5ls.c
===================================================================
--- tools/h5ls/h5ls.c	(revision 18506)
+++ tools/h5ls/h5ls.c	(working copy)
@@ -29,6 +29,8 @@
 #include "h5tools_utils.h"
 #include "h5trav.h"
 
+#include "h5tools_ref.h"
+
 #define NAME_BUF_SIZE   2048
 
 /* Struct to keep track of external link targets visited */
@@ -88,8 +90,6 @@
 static void display_type(hid_t type, int ind);
 static herr_t visit_obj(hid_t file, const char *oname, iter_t *iter);
 
-const char *progname="h5ls";
-int   d_status;
 
 
 /*-------------------------------------------------------------------------
@@ -135,7 +135,7 @@
       within the file then the contents of the root group are displayed).\n\
       The file name may include a printf(3C) integer format such as\n\
       \"%%05d\" to open a file family.\n",
-     progname);
+	    h5tools_getprogname() );
 }
 
 
@@ -2179,8 +2179,10 @@
     int  argno;
     static char root_name[] = "/";
     char        drivername[50];
-    const char *preferred_driver = NULL;
+    const char *preferred_driver = NULL; 
 
+	    h5tools_setprogname("h5ls");
+
     /* Initialize h5tools lib */
     h5tools_init();
 
@@ -2248,7 +2250,7 @@
         } else if(!HDstrcmp(argv[argno], "--verbose")) {
             verbose_g++;
         } else if(!HDstrcmp(argv[argno], "--version")) {
-            print_version(progname);
+		print_version(h5tools_getprogname() );
             leave(EXIT_SUCCESS);
         } else if(!HDstrcmp(argv[argno], "--hexdump")) {
             hexdump_g = TRUE;
@@ -2324,7 +2326,7 @@
                         break;
 
                     case 'V': /* --version */
-                        print_version(progname);
+			    print_version(h5tools_getprogname() );
                         leave(EXIT_SUCCESS);
 
                     case 'x': /* --hexdump */
@@ -2479,5 +2481,6 @@
     } /* end while */
 
     leave(EXIT_SUCCESS);
+    return 0;
 } /* end main() */
 
