Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cruft eradication
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 29 Jun 2004 04:06:31 +0000 (04:06 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 29 Jun 2004 04:06:31 +0000 (04:06 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@142 48e7efb5-ca39-0410-a469-dd3cf9ba447f

50 files changed:
src/nws_portability/.cvsignore [deleted file]
src/nws_portability/Copyright [deleted file]
src/nws_portability/Forecast/Makefile [deleted file]
src/nws_portability/Forecast/exp_smooth.c [deleted file]
src/nws_portability/Forecast/fbuff.c [deleted file]
src/nws_portability/Forecast/forc.c [deleted file]
src/nws_portability/Forecast/forecast_api.c [deleted file]
src/nws_portability/Forecast/forecasters.c [deleted file]
src/nws_portability/Forecast/last_value.c [deleted file]
src/nws_portability/Forecast/median.c [deleted file]
src/nws_portability/Forecast/mse_forc.c [deleted file]
src/nws_portability/Forecast/predictor.c [deleted file]
src/nws_portability/Forecast/run_mean.c [deleted file]
src/nws_portability/Include/.cvsignore [deleted file]
src/nws_portability/Include/Makefile [deleted file]
src/nws_portability/Include/config_portability.h.in [deleted file]
src/nws_portability/Include/diagnostic.h [deleted file]
src/nws_portability/Include/dnsutil.h [deleted file]
src/nws_portability/Include/exp_smooth.h [deleted file]
src/nws_portability/Include/fbuff.h [deleted file]
src/nws_portability/Include/forc.h [deleted file]
src/nws_portability/Include/forecast_api.h [deleted file]
src/nws_portability/Include/forecasters.h [deleted file]
src/nws_portability/Include/formatutil.h [deleted file]
src/nws_portability/Include/last_value.h [deleted file]
src/nws_portability/Include/median.h [deleted file]
src/nws_portability/Include/messages.h [deleted file]
src/nws_portability/Include/mse_forc.h [deleted file]
src/nws_portability/Include/osutil.h [deleted file]
src/nws_portability/Include/predictor.h [deleted file]
src/nws_portability/Include/protocol.h [deleted file]
src/nws_portability/Include/run_mean.h [deleted file]
src/nws_portability/Include/strutil.h [deleted file]
src/nws_portability/Include/timeouts.h [deleted file]
src/nws_portability/Makedefs.in [deleted file]
src/nws_portability/Makefile [deleted file]
src/nws_portability/README [deleted file]
src/nws_portability/config.guess [deleted file]
src/nws_portability/config.sub [deleted file]
src/nws_portability/configure [deleted file]
src/nws_portability/configure.in [deleted file]
src/nws_portability/diagnostic.c [deleted file]
src/nws_portability/dnsutil.c [deleted file]
src/nws_portability/formatutil.c [deleted file]
src/nws_portability/install-sh [deleted file]
src/nws_portability/messages.c [deleted file]
src/nws_portability/osutil.c [deleted file]
src/nws_portability/protocol.c [deleted file]
src/nws_portability/strutil.c [deleted file]
src/nws_portability/timeouts.c [deleted file]

diff --git a/src/nws_portability/.cvsignore b/src/nws_portability/.cvsignore
deleted file mode 100644 (file)
index dc4ea0b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Makedefs build-* config.log config.status
diff --git a/src/nws_portability/Copyright b/src/nws_portability/Copyright
deleted file mode 100644 (file)
index ba08528..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright (c) 2002, The Regents of the University of California
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-Redistributions of source code must retain the above copyright notice, this
-list of conditions and the following disclaimer.
-
-Redistributions in binary form must reproduce the above copyright notice,
-this list of conditions and the following disclaimer in the documentation
-and/or other materials provided with the distribution.
-Neither the names of the University of California, nor the names of its
-contributors may be used to endorse or promote products derived from this
-software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/src/nws_portability/Forecast/Makefile b/src/nws_portability/Forecast/Makefile
deleted file mode 100644 (file)
index a69fbae..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Makefile for Forecaster
-
-# include common variables
-include ../Makedefs
-
-# these are the targets
-LIBRARY = $(buildlibdir)/libNwsForecast.a
-
-# objects we are creating here
-OBJS   =       $(buildobjdir)/exp_smooth.o \
-               $(buildobjdir)/fbuff.o \
-               $(buildobjdir)/forc.o \
-               $(buildobjdir)/forecast_api.o \
-               $(buildobjdir)/last_value.o \
-               $(buildobjdir)/median.o \
-               $(buildobjdir)/mse_forc.o \
-               $(buildobjdir)/run_mean.o
-
-.PHONY: all clean dist
-
-all: $(LIBRARY) 
-
-clean:
-       @$(RM) -f $(OBJS) 
-
-dist:
-       @$(INSTALL) -d $(DIST_ROOT)/Forecast
-       @$(CP) Makefile *.c $(DIST_ROOT)/Forecast
-
-$(LIBRARY): $(OBJS)
-       $(AR) $(ARFLAGS) $@ $(OBJS)
-       $(RANLIB) $@
-
-#pure:
-#      $(MAKE) LD="$(PURIFY) $(LD)"
-
-
-# Compilation rules for C.
-$(buildobjdir)/%.o : %.c ../Include/config_portability.h ../Include/%.h ../Include/forc.h
-       $(CC) $(INCLUDES) $(CFLAGS) -g -c $< -o $@
-
diff --git a/src/nws_portability/Forecast/exp_smooth.c b/src/nws_portability/Forecast/exp_smooth.c
deleted file mode 100644 (file)
index 0615f63..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/* $Id$ */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <strings.h>
-
-#include "fbuff.h"
-#include "exp_smooth.h"
-
-struct exp_smooth_state
-{
-       fbuff series;                   /* the series so far */
-       fbuff time_stamps;              /* the time stamps */
-       double last_pred;
-       double gain;
-};
-
-/*
- * init local state.  can save a copy of the pointer to the
- * series and time stamps, if desired
- */
-char *
-InitExpSmooth(fbuff series, fbuff time_stamps, char *params)
-{
-       struct exp_smooth_state *state;
-       double gain;
-       char *p_str;
-       
-       state = (struct exp_smooth_state *)
-               malloc(sizeof(struct exp_smooth_state));
-       
-       if(state == NULL)
-       {
-               return(NULL);
-       }
-       
-       if(params == NULL)
-       {
-               free(state);
-               return(NULL);
-       }
-       
-       p_str = params;
-       gain = strtod(p_str,&p_str);
-       
-       /*
-        * all functions take a series and time_stamps
-        */
-       state->series = series;
-       state->time_stamps = time_stamps;
-       state->last_pred = 0.0;
-       state->gain = gain;
-       
-       return((char *)state);
-}
-
-void
-FreeExpSmooth(char *state)
-{
-       free(state);
-       return;
-}
-
-void
-UpdateExpSmooth(char *state,
-               double ts,
-               double value)
-{
-       double pred;
-       struct exp_smooth_state *s = (struct exp_smooth_state *)state;
-
-       pred = s->last_pred + s->gain * (value - s->last_pred);
-       
-       /*
-        * if there is only one value, last pred is the first valeu in the
-        * series
-        */
-       if(F_COUNT(s->series) <= 1)
-       {
-               s->last_pred = F_VAL(s->series,F_FIRST(s->series));
-       }
-       else
-       {
-               s->last_pred = pred;
-       }
-
-       return;
-}
-
-int
-ForcExpSmooth(char *state, double *v)
-{
-       struct exp_smooth_state *s = (struct exp_smooth_state *)state;
-       
-       *v = s->last_pred;
-
-       return(1);
-
-}
-
-
diff --git a/src/nws_portability/Forecast/fbuff.c b/src/nws_portability/Forecast/fbuff.c
deleted file mode 100644 (file)
index d5de930..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/* $Id$ */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-
-#include "fbuff.h"
-
-fbuff
-InitFBuff(int size)
-{
-       fbuff lb;
-
-       lb = (fbuff)malloc(FBUFF_SIZE);
-
-       if(lb == NULL)
-       {
-               fprintf(stderr,"InitFBuff: couldn't get space for fbuff\n");
-               fflush(stderr);
-               return(NULL);
-       }
-
-       /*
-        * count from bottom to top
-        *
-        * head is the next available space
-        * tail is the last valid data item
-        */
-       lb->size = size;
-       lb->head = size - 1;
-       lb->tail = 0;
-
-       lb->vals = (double *)malloc(size*sizeof(double));
-       if(lb->vals == NULL)
-       {
-               fprintf(stderr,"InitFBuff: couldn't get space for vals\n");
-               fflush(stderr);
-               free(lb);
-               return(NULL);
-       }
-
-       return(lb);
-
-}
-
-void
-FreeFBuff(fbuff fb)
-{
-       free(fb->vals);
-       free(fb);
-       
-       return;
-}
-
-void
-UpdateFBuff(fbuff fb, double val)
-{
-       F_HEAD(fb) = val;
-       fb->head = MODMINUS(fb->head,1,fb->size);
-       
-       /*
-        * if we have moved the head over the tail, bump the tail around too
-        */
-       if(fb->head == fb->tail)
-       {
-               fb->tail = MODMINUS(fb->tail,1,fb->size);
-       }
-       
-       return;
-}
-
diff --git a/src/nws_portability/Forecast/forc.c b/src/nws_portability/Forecast/forc.c
deleted file mode 100644 (file)
index e59e6ba..0000000
+++ /dev/null
@@ -1,1152 +0,0 @@
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <strings.h>
-
-
-
-/*
- * individual forecaster packages
- */
-#include "forecasters.h"
-
-#include "mse_forc.h"
-#include "forc.h"
-
-#define FORECASTER(name,init,params,freer,update,forecaster)   \
-{                                                              \
-       frb = InitForcB(series,                                 \
-                       time_stamps,                            \
-                       (name),                                 \
-                       (init),                                 \
-                       (params),                               \
-                       (freer),                                \
-                       (update),                               \
-                       (forecaster));                          \
-                                                               \
-       if(frb == NULL)                                         \
-       {                                                       \
-               free(l_forcl);                                  \
-               free(forcs);                                    \
-               free(derived_forcs);                            \
-               FreeFBuff(series);                              \
-               FreeFBuff(time_stamps);                         \
-               return(NULL);                                   \
-       }                                                       \
-                                                               \
-       frb->series = series;                                   \
-       frb->time_stamps = time_stamps;                         \
-       forcs[l_forcl->count] = frb;                            \
-       l_forcl->count = l_forcl->count + 1;                    \
-}
-
-
-#define DERIVED_FORC(name,init,params,freer,update,forecaster)         \
-{                                                              \
-       frb = InitForcB(series,                                 \
-                 time_stamps,                                  \
-                 (name),                                       \
-                 (init),                                       \
-                 (params),                                     \
-                 (freer),                                      \
-                 (update),                                     \
-                 (forecaster));                                \
-                                                               \
-       if(frb == NULL)                                         \
-       {                                                       \
-               free((char *)forcs);                                    \
-               free((char *)derived_forcs);                            \
-               FreeFBuff(series);                              \
-               FreeFBuff(time_stamps);                         \
-               for(i=0; i < l_forcl->count; i++)               \
-               {                                               \
-                       FreeForcB(l_forcl->forcs[i]);           \
-               }                                               \
-               free((char *)l_forcl);                                  \
-               return(NULL);                                   \
-       }                                                       \
-       frb->series = series;                                   \
-       frb->time_stamps = time_stamps;                         \
-       derived_forcs[l_forcl->derived_count] = frb;            \
-       l_forcl->derived_count = l_forcl->derived_count + 1;    \
-}
-
-forcb
-InitForcB(fbuff series,
-         fbuff time_stamps,
-         const char *name,
-         char *(*init)(),
-         const char *params,
-         void (*freer)(),
-         void (*update)(),
-         int (*forecast)())
-{
-       forcb frb;
-       
-       frb = (forcb)malloc(FORCB_SIZE);
-       
-       
-       if(frb == NULL)
-       {
-               return(NULL);
-       }
-       
-       /*
-        * get fbuff space for the cumulative error series -- needed
-        * for windowed MSE and MAE predictions
-        */
-       frb->se_series = InitFBuff(MAX_MSE_WIN);
-
-       if(frb->se_series == NULL)
-       {
-               free(frb);
-               return(NULL);
-       }
-       
-       frb->ae_series = InitFBuff(MAX_MSE_WIN);
-
-       if(frb->se_series == NULL)
-       {
-               FreeFBuff(frb->se_series);
-               free(frb);
-               return(NULL);
-       }
-       /*
-        * could be NULL because of derived forecasters
-        */
-       if(init != NULL)
-       {
-               frb->state = (*init)(series,time_stamps,params);
-               if(frb == NULL)
-               {
-                       FreeFBuff(frb->se_series);
-                       FreeFBuff(frb->ae_series);
-                       free(frb);
-                       fprintf(stderr,"InitForcB: init failed for %s\n",
-                                       name);
-                       fflush(stderr);
-                       return(NULL);
-               }
-       }
-       else
-       {
-               frb->state = NULL;
-       }
-       
-       frb->update = update;
-       frb->forecast = forecast;
-       frb->free = freer;
-       
-
-       frb->se = 0.0;
-       frb->ae = 0.0;
-       frb->count = 0.0;
-       strncpy(frb->name,name,sizeof(frb->name));
-       
-       /*
-        * point forcb at the series and time stamp buffers
-        */
-       frb->series = series;
-       frb->time_stamps = time_stamps;
-
-       frb->best_f = 0.0;
-       frb->best_i = 0;
-       frb->best_err = 0.0;
-
-       
-       return(frb);
-}
-
-void
-FreeForcB(forcb frb)
-{
-       if(frb->state != NULL)
-       {
-               frb->free(frb->state);
-       }
-
-       /*
-        * defensive programming
-        */
-       if(frb->se_series != NULL)
-       {
-               FreeFBuff(frb->se_series);
-       }
-       if(frb->ae_series != NULL)
-       {
-               FreeFBuff(frb->ae_series);
-       }
-       free(frb);
-       
-       return;
-}
-
-void
-FreeForcl(char *i_forcl)
-{
-       int i;
-       forcl l_forcl;
-       
-       l_forcl = (forcl)i_forcl;
-
-       /*
-        * shared by all forcbs
-        */
-       FreeFBuff(l_forcl->forcs[0]->series);
-       FreeFBuff(l_forcl->forcs[0]->time_stamps);
-       
-       for(i=0; i < l_forcl->count; i++)
-       {
-               FreeForcB(l_forcl->forcs[i]);
-       }
-       for(i=0; i < l_forcl->derived_count; i++)
-       {
-               FreeForcB(l_forcl->derived_forcs[i]);
-       }
-
-       /*
-        * the state is the l_forcl itself -- clear it to free works
-        * properly
-        */
-       l_forcl->total_mse->state = NULL;
-       l_forcl->total_mae->state = NULL;
-       FreeForcB(l_forcl->total_mse);
-       FreeForcB(l_forcl->total_mae);
-       
-       free(l_forcl->derived_forcs);
-       free(l_forcl->forcs);
-       free(l_forcl);
-       
-       return;
-}
-       
-/*
- * initializes a single fbuff for the data series and another for the
- * time stamps. 
- * 
- * initializes an array of forcb structs, one per forecaster
- * 
- * points each forcb to the series and time stamps
- */
-char *
-InitForcl(int max_forc_count, int buff_size)
-{
-       forcb frb;
-       forcb *forcs;
-       forcb *derived_forcs;
-       forcl l_forcl;
-       fbuff series;
-       fbuff time_stamps;
-       int i;
-       char derived_params[255];
-       
-       /*
-        * first, get space for series and time stamps
-        */
-       series = InitFBuff(buff_size);
-       if(series == NULL)
-       {
-               fprintf(stderr,"InitForcs: couldn't get fbuff for series\n");
-               fflush(stderr);
-               return(NULL);
-       }
-       
-       time_stamps = InitFBuff(buff_size);
-       if(time_stamps == NULL)
-       {
-               fprintf(stderr,
-                       "InitForcs: couldn't get fbuff for time stamps\n");
-               fflush(stderr);
-               FreeFBuff(series);
-               return(NULL);
-       }
-       
-       /*
-        * now, get forcl list space
-        */
-       l_forcl = (forcl)(malloc(FORCL_SIZE));
-       if(l_forcl == NULL)
-       {
-               fprintf(stderr,"InitForcs: couldn't malloc %d forcl\n",
-                               max_forc_count);
-               fflush(stderr);
-               FreeFBuff(series);
-               FreeFBuff(time_stamps);
-               return(NULL);
-       }
-       
-       memset((char *)l_forcl,0,FORCL_SIZE);
-       l_forcl->derived_count = 0;
-   
-       /*
-        * get space for individual forecasters
-        */
-       forcs = (forcb *)(malloc(max_forc_count*sizeof(forcb)));
-       
-       if(forcs == NULL)
-       {
-               fprintf(stderr,"InitForcl: couldn't malloc %d forcb pointers\n",
-                               max_forc_count);
-               fflush(stderr);
-               free(l_forcl);
-               FreeFBuff(series);
-               FreeFBuff(time_stamps);
-               return(NULL);
-       }
-
-       /*
-        * get space for derived forecasters
-        */
-       derived_forcs = (forcb *)(malloc(max_forc_count*sizeof(forcb)));
-       
-       if(derived_forcs == NULL)
-       {
-               fprintf(stderr,"InitForcl: couldn't malloc %d derived forcb pointers\n",
-                               max_forc_count);
-               fflush(stderr);
-               free(l_forcl);
-               FreeFBuff(series);
-               FreeFBuff(time_stamps);
-               free(forcs);
-               return(NULL);
-       }
-       
-       l_forcl->forcs = forcs;
-       l_forcl->derived_forcs = derived_forcs;
-       
-       /*
-        * include the primary forecasters
-        */
-#include "forecasters.c"
-
-
-       /*
-        * now do derived forecaster types
-        */
-       
-       /*
-        * for min MSE, we set the window size to 0.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               0);
-       DERIVED_FORC("Minimum MSE",
-                    InitWinMSE,
-                    derived_params,
-                    FreeWinMSE,
-                    NULL,
-                    LocalWinMSEForecast);
-
-       /*
-        * for min MAE, we set the window size to 0.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               0);
-
-       DERIVED_FORC("Minimum MAE",
-                    InitWinMAE,
-                    derived_params,
-                    FreeWinMAE,
-                    NULL,
-                    LocalWinMAEForecast);
-
-       /*
-        * for min windowed MSE, we set the window size to 1.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               1);
-       DERIVED_FORC("Minimum Window 1 MSE",
-                    InitWinMSE,
-                    derived_params,
-                    FreeWinMSE,
-                    NULL,
-                    LocalWinMSEForecast);
-       /*
-        * for min windowed MSE, we set the window size to 5.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               5);
-       DERIVED_FORC("Minimum Window 5 MSE",
-                    InitWinMSE,
-                    derived_params,
-                    FreeWinMSE,
-                    NULL,
-                    LocalWinMSEForecast);
-
-       /*
-        * for min windowed MSE, we set the window size to 10.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               10);
-       DERIVED_FORC("Minimum Window 10 MSE",
-                    InitWinMSE,
-                    derived_params,
-                    FreeWinMSE,
-                    NULL,
-                    LocalWinMSEForecast);
-
-       /*
-        * for min windowed MSE, we set the window size to 20.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               20);
-       DERIVED_FORC("Minimum Window 20 MSE",
-                    InitWinMSE,
-                    derived_params,
-                    FreeWinMSE,
-                    NULL,
-                    LocalWinMSEForecast);
-       /*
-        * for min windowed MSE, we set the window size to 30.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               30);
-       DERIVED_FORC("Minimum Window 30 MSE",
-                    InitWinMSE,
-                    derived_params,
-                    FreeWinMSE,
-                    NULL,
-                    LocalWinMSEForecast);
-       /*
-        * for min windowed MSE, we set the window size to 50.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               50);
-       DERIVED_FORC("Minimum Window 50 MSE",
-                    InitWinMSE,
-                    derived_params,
-                    FreeWinMSE,
-                    NULL,
-                    LocalWinMSEForecast);
-       /*
-        * for min windowed MSE, we set the window size to 100.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               100);
-       DERIVED_FORC("Minimum Window 100 MSE",
-                    InitWinMSE,
-                    derived_params,
-                    FreeWinMSE,
-                    NULL,
-                    LocalWinMSEForecast);
-
-       /*
-        * for win min MAE, with window size to 1.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               1);
-
-       DERIVED_FORC("Minimum Window 1 MAE",
-                    InitWinMAE,
-                    derived_params,
-                    FreeWinMAE,
-                    NULL,
-                    LocalWinMAEForecast);
-       /*
-        * for win min MAE, with window size to 5.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               5);
-
-       DERIVED_FORC("Minimum Window 5 MAE",
-                    InitWinMAE,
-                    derived_params,
-                    FreeWinMAE,
-                    NULL,
-                    LocalWinMAEForecast);
-       /*
-        * for win min MAE, with window size to 10.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               10);
-
-       DERIVED_FORC("Minimum Window 10 MAE",
-                    InitWinMAE,
-                    derived_params,
-                    FreeWinMAE,
-                    NULL,
-                    LocalWinMAEForecast);
-       /*
-        * for win min MAE, with window size to 20.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               20);
-
-       DERIVED_FORC("Minimum Window 20 MAE",
-                    InitWinMAE,
-                    derived_params,
-                    FreeWinMAE,
-                    NULL,
-                    LocalWinMAEForecast);
-       /*
-        * for win min MAE, with window size to 30.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               30);
-
-       DERIVED_FORC("Minimum Window 30 MAE",
-                    InitWinMAE,
-                    derived_params,
-                    FreeWinMAE,
-                    NULL,
-                    LocalWinMAEForecast);
-       /*
-        * for win min MAE, with window size to 50.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               50);
-
-       DERIVED_FORC("Minimum Window 50 MAE",
-                    InitWinMAE,
-                    derived_params,
-                    FreeWinMAE,
-                    NULL,
-                    LocalWinMAEForecast);
-       /*
-        * for win min MAE, with window size to 100.  The first
-        * argument is the address of the forc list structure we are building
-        * 
-        * thread safe?  I think not.
-        */
-       sprintf(derived_params,
-               "%p %d",
-               (void *)l_forcl,
-               100);
-
-       DERIVED_FORC("Minimum Window 100 MAE",
-                    InitWinMAE,
-                    derived_params,
-                    FreeWinMAE,
-                    NULL,
-                    LocalWinMAEForecast);
-       /*
-        * end of derived forecaster init
-        */
-       
-       /*
-        * now init a total MSE forcb for the
-        * list
-        */
-       
-       frb = InitForcB(series,
-                       time_stamps,
-                       "Total MSE",
-                       NULL,           /* no init */
-                       NULL,           /* no params */
-                       NULL,           /* no free */
-                       NULL,           /* no update */
-                       TotalMSEForecast);      /* MSE forecast */
-       if(frb == NULL)
-       {
-               free(forcs);
-               free(derived_forcs);
-               FreeFBuff(series);
-               FreeFBuff(time_stamps);
-               for(i=0; i < l_forcl->count; i++)
-               {
-                       FreeForcB(l_forcl->forcs[i]);
-               }
-               for(i=0; i < l_forcl->derived_count; i++)
-               {
-                       FreeForcB(l_forcl->derived_forcs[i]);
-               }
-               free(l_forcl->derived_forcs);
-               free(l_forcl);
-               return(NULL);
-       }
-       frb->series = series;
-       frb->time_stamps = time_stamps;
-       frb->ae = 0.0;
-       frb->se = 0.0;
-       frb->count = 0.0;
-       /*
-        * total forecasters take forcl as state
-        */
-       frb->state = (char *)l_forcl;
-       l_forcl->total_mse = frb;
-
-       /*
-        * now init a total MAE forcb for the
-        * list
-        */
-       
-       frb = InitForcB(series,
-                       time_stamps,
-                       "Total MAE",
-                       NULL,           /* no init */
-                       NULL,           /* no params */
-                       NULL,           /* no free */
-                       NULL,           /* no update */
-                       TotalMAEForecast);      /* MSE forecast */
-       if(frb == NULL)
-       {
-               free(forcs);
-               free(derived_forcs);
-               FreeFBuff(series);
-               FreeFBuff(time_stamps);
-               for(i=0; i < l_forcl->count; i++)
-               {
-                       FreeForcB(l_forcl->forcs[i]);
-               }
-               for(i=0; i < l_forcl->derived_count; i++)
-               {
-                       FreeForcB(l_forcl->derived_forcs[i]);
-               }
-               free(l_forcl->derived_forcs);
-               free(l_forcl);
-               return(NULL);
-       }
-       frb->series = series;
-       frb->time_stamps = time_stamps;
-       frb->ae = 0.0;
-       frb->se = 0.0;
-       frb->count = 0.0;
-       /*
-        * total forecasters take forcl as state
-        */
-       frb->state = (char *)l_forcl;
-       l_forcl->total_mae = frb;
-       
-       
-
-       return((char *)l_forcl);
-       
-}
-
-void
-UpdateForecasts(char *i_forcl, double ts, double value)
-{
-       int i;
-       double err;
-       double forecast;
-       int ferr;
-       forcl l_forcl;
-       int forc_okay;
-       double best_sq_f;
-       double best_f;
-       int best_i;
-       int best_sq_i;
-       double best_sq_err;
-       double best_err;
-       
-       l_forcl = (forcl)i_forcl;
-       
-       forc_okay = 0;
-       
-       /*
-        * get mse forecast for this value and update error
-        */
-       ferr = (l_forcl->total_mse)->forecast((l_forcl->total_mse)->state,
-                             &forecast);
-       if(ferr == 1)
-       {
-               forc_okay = 1;
-               err = forecast - value;
-               if(err < 0.0)
-               {
-                       err = err * -1.0;
-               }
-               l_forcl->total_mse->ae += err;
-               l_forcl->total_mse->se += err*err;
-               l_forcl->total_mse->count += 1.0;
-               
-               /*
-                * write out the cumulative total in the
-                * series buffer so that we may do windowed
-                * mse and mae things
-                */
-               UpdateFBuff(l_forcl->total_mse->se_series,
-                          l_forcl->total_mse->se); 
-               UpdateFBuff(l_forcl->total_mse->ae_series,
-                          l_forcl->total_mse->ae); 
-       }
-       /*
-        * get mae forecast for this value and update error
-        */
-       ferr = (l_forcl->total_mae)->forecast((l_forcl->total_mae)->state,
-                             &forecast);
-       if(ferr == 1)
-       {
-               err = forecast - value;
-               if(err < 0.0)
-               {
-                       err = err * -1.0;
-               }
-               l_forcl->total_mae->ae += err;
-               l_forcl->total_mae->se += err*err;
-               l_forcl->total_mae->count += 1.0;
-               
-               /*
-                * write out the cumulative total in the
-                * series buffer so that we may do windowed
-                * mse and mae things
-                */
-               UpdateFBuff(l_forcl->total_mae->se_series,
-                          l_forcl->total_mae->se); 
-               UpdateFBuff(l_forcl->total_mae->ae_series,
-                          l_forcl->total_mae->ae); 
-       }
-
-       if(forc_okay == 1)
-       {
-               /*
-                * update derived forecast error values
-                */
-               for(i=0; i < l_forcl->derived_count; i++)
-               {
-                       /*
-                        * get forecast for this value and update error
-                        */
-                       ferr = 
-       (l_forcl->derived_forcs[i])->forecast((l_forcl->derived_forcs[i])->state,
-                                             &forecast);
-                       if(ferr == 0)
-                       {
-                               continue;
-                       }
-                       forc_okay = 1;
-                       err = forecast - value;
-                       if(err < 0.0)
-                       {
-                               err = err * -1.0;
-                       }
-                       l_forcl->derived_forcs[i]->ae += err;
-                       l_forcl->derived_forcs[i]->se += err*err;
-                       l_forcl->derived_forcs[i]->count += 1.0;
-                       
-                       /*
-                        * write out the cumulative total in the
-                        * series buffer so that we may do windowed
-                        * mse and mae things
-                        */
-                       UpdateFBuff(l_forcl->derived_forcs[i]->se_series,
-                                  l_forcl->derived_forcs[i]->se); 
-                       UpdateFBuff(l_forcl->derived_forcs[i]->ae_series,
-                                  l_forcl->derived_forcs[i]->ae); 
-               }
-       }
-       /*
-        * first, update the error values
-        */
-       best_sq_err = DBIG_VAL;
-       best_err = DBIG_VAL;
-       best_sq_f = 0.0;
-       best_f = 0.0;
-       best_sq_i = 0;
-       best_i = 0;
-       for(i=0; i < l_forcl->count; i++)
-       {
-               /*
-                * get forecast for this value and update error
-                */
-               ferr = 
-       (l_forcl->forcs[i])->forecast((l_forcl->forcs[i])->state,&forecast);
-               if(ferr == 0)
-               {
-                       continue;
-               }
-               
-               err = forecast - value;
-               if(err < 0.0)
-               {
-                       err = err * -1.0;
-               }
-               l_forcl->forcs[i]->ae += err;
-               l_forcl->forcs[i]->se += err*err;
-               l_forcl->forcs[i]->count += 1.0;
-
-               /*
-                * find the forecast that actually has the min error
-                */
-               if((err*err) < best_sq_err)
-               {
-                       best_sq_err = err*err;
-                       best_sq_i = i;
-                       best_sq_f = forecast;
-               }
-               if(err < best_err)
-               {
-                       best_err = err;
-                       best_i = i;
-                       best_f = forecast;
-               }
-               /*
-                * write out the cumulative total in the
-                * series buffer so that we may do windowed
-                * mse and mae things
-                */
-               UpdateFBuff(l_forcl->forcs[i]->se_series,
-                          l_forcl->forcs[i]->se); 
-               UpdateFBuff(l_forcl->forcs[i]->ae_series,
-                          l_forcl->forcs[i]->ae); 
-       }
-
-       /*
-        * record the forecast that actually won
-        */
-       if(best_sq_err != DBIG_VAL)
-       {
-               l_forcl->total_mse->best_f = best_sq_f;
-               l_forcl->total_mse->best_i = best_sq_i;
-               l_forcl->total_mse->best_err += best_sq_err;
-
-               l_forcl->total_mae->best_f = best_f;
-               l_forcl->total_mae->best_i = best_i;
-               l_forcl->total_mae->best_err += best_err;
-       }
-       
-       /*
-        * now update the series and time_stamps fbuffs.  all forcs point
-        * the same series and time_stamp fbuffs
-        */ 
-       
-       if(l_forcl->count >= 1)
-       {
-               UpdateFBuff(l_forcl->forcs[0]->series, value);
-               UpdateFBuff(l_forcl->forcs[0]->time_stamps, ts);
-       }
-       
-       for(i=0; i < l_forcl->count; i++)
-       {
-               /*
-                * now update forecast state for the individual forecasters
-                * 
-                * note that the forecasters need not record the series and
-                * time_stamp points, hence the ts and value parameters
-                */
-               (l_forcl->forcs[i])->update((l_forcl->forcs[i])->state,
-                                  ts,
-                                  value);
-       }
-       
-       return;
-}
-
-int
-ForcRange(char *i_forcl, double *low, double *high, int *low_i, int *high_i)
-{
-       forcl l_forcl;
-       int i;
-       double min = DBIG_VAL;
-       double max = -1.0 * DBIG_VAL;
-       double f;
-       int err;
-       
-       l_forcl = (forcl)i_forcl;
-       
-       /*
-        * simple forecasters
-        */
-       for(i=0; i < l_forcl->count; i++)
-       {
-               err = l_forcl->forcs[i]->forecast(l_forcl->forcs[i]->state,
-                                                 &f);
-               if(err == 0)
-                       continue;
-               
-               if(f < min)
-               {
-                       min = f;
-                       *low_i = i;
-               }
-               
-               if(f > max)
-               {
-                       max = f;
-                       *high_i = i;
-               }
-       }
-       
-       if((min == DBIG_VAL) || (max == (-1.0*DBIG_VAL)))
-       {
-               return(0);
-       }
-                       
-       *low = min;
-       *high = max;
-       
-       return(1);
-       
-}
-
-void
-PrintForecastSummary(char *i_forcl)
-{
-       forcl l_forcl;
-       int i;
-       
-       l_forcl = (forcl)i_forcl;
-       
-       /*
-        * simple forecasters
-        */
-       for(i=0; i < l_forcl->count; i++)
-       {
-               fprintf(stdout,"MSE: %3.4f\tMAE: %3.4f\t%s\n",
-                       l_forcl->forcs[i]->se/l_forcl->forcs[i]->count,
-                       l_forcl->forcs[i]->ae/l_forcl->forcs[i]->count,
-                       l_forcl->forcs[i]->name);
-       }
-       
-       /*
-        * secondary forecasters
-        */
-       for(i=0; i < l_forcl->derived_count; i++)
-       {
-               fprintf(stdout,"MSE: %3.4f\tMAE: %3.4f\t%s\n",
-               l_forcl->derived_forcs[i]->se/l_forcl->derived_forcs[i]->count,
-               l_forcl->derived_forcs[i]->ae/l_forcl->derived_forcs[i]->count,
-               l_forcl->derived_forcs[i]->name);
-       }
-       
-       /*
-        * totals
-        */
-       fprintf(stdout,"MSE: %3.4f\tMAE: %3.4f\tTotal MSE\n",
-                       l_forcl->total_mse->se / l_forcl->total_mse->count,
-                       l_forcl->total_mse->ae / l_forcl->total_mse->count);
-       fprintf(stdout,"MSE: %3.4f\tMAE: %3.4f\tTotal MAE\n",
-                       l_forcl->total_mae->se / l_forcl->total_mae->count,
-                       l_forcl->total_mae->ae / l_forcl->total_mae->count);
-       fprintf(stdout,"MSE: %3.4f\tMAE: %3.4f\tOptimum\n",
-                       l_forcl->total_mse->best_err/l_forcl->total_mse->count,
-                       l_forcl->total_mae->best_err/l_forcl->total_mse->count);
-
-       return;
-}
-
-void
-PrintLifetimeForecastSummary(char *state)
-{
-       forclife flife;
-       
-       flife = (forclife)state;
-       
-       PrintForecastSummary(flife->forc_list);
-       
-       return;
-}
-
-/*
- * routine put in to support FORECASTAPI_MethodName which doesn't
- * take a state record
- */
-void
-GetForcNames(char *state, char *methodNames[], int max_size, int *out_size)
-{
-       forcl s;
-       int i;
-       
-       s = (forcl)state;
-       
-       for(i=0; i < max_size; i++)
-       {
-               if(i >= s->count)
-                       break;
-               
-               methodNames[i] = s->forcs[i]->name;
-       }
-       
-       *out_size = i;
-       
-       return;
-}
-
-char *
-InitForcLife(int max_forc_count, int buff_size, double lifetime)
-{
-       char *l_forcl;
-       forclife flife;
-       
-       /*
-        * get a forc list for the series
-        */
-       l_forcl = InitForcl(max_forc_count, buff_size);
-       if(l_forcl == NULL)
-       {
-               fprintf(stderr,"InitForcLife: no space for forc list\n");
-               fflush(stderr);
-               return(NULL);
-       }
-       
-       /*
-        * now, get space for the lifetime forecasting structure
-        */
-       flife = (forclife)malloc(FORCLIFE_SIZE);
-       if(flife == NULL)
-       {
-               FreeForcl(l_forcl);
-               fprintf(stderr,"InitForcLife: no space for forclife struct\n");
-               fflush(stderr);
-               return(NULL);
-       }
-       
-       
-       flife->lifetime = lifetime;
-       flife->epoch_end = 0.0;
-       flife->total = 0.0;
-       flife->count = 0.0;
-       flife->forc_list = l_forcl;
-       
-       return((char *)flife);
-}
-
-void
-FreeForcLife(char *state)
-{
-       forclife flife;
-       
-       flife = (forclife)state;
-       
-       FreeForcl(flife->forc_list);
-       free(flife);
-       
-       return;
-}
-
-void
-UpdateForcLife(char *state, double ts, double value)
-{
-       forclife flife;
-       double avg;
-       
-       flife = (forclife)state;
-       
-       /*
-        * if we are initializing
-        */
-       if(flife->epoch_end == 0.0)
-       {
-               flife->epoch_end = ts + flife->lifetime;
-       }
-       
-       if(ts < flife->epoch_end)
-       {
-               flife->total += value;
-               flife->count += 1.0;
-       }
-       else
-       {
-               if(flife->count == 0.0)
-                       flife->count = 1.0;
-
-               avg = flife->total / flife->count;
-               UpdateForecasts((char *)flife->forc_list,
-                                 flife->epoch_end,
-                                 avg);
-               flife->total = 0.0;
-               flife->count = 0.0;
-               flife->epoch_end = ts+flife->lifetime;
-       }
-
-       return;
-}
-
-double
-LifetimeValue(char *state)
-{
-       forclife flife;
-       forcl l_forcl;
-       double value;
-       
-       flife = (forclife)state;
-       l_forcl = (forcl)flife->forc_list;
-       
-       value = 
-          F_VAL(l_forcl->forcs[0]->series,F_FIRST(l_forcl->forcs[0]->series));
-       
-       return(value);
-}
-
-double
-LifetimeTimestamp(char *state)
-{
-       forclife flife;
-       forcl l_forcl;
-       double ts;
-       
-       flife = (forclife)state;
-       l_forcl = (forcl)flife->forc_list;
-       
-       ts = 
-          F_VAL(l_forcl->forcs[0]->time_stamps,
-                          F_FIRST(l_forcl->forcs[0]->time_stamps));
-       
-       return(ts);
-}
diff --git a/src/nws_portability/Forecast/forecast_api.c b/src/nws_portability/Forecast/forecast_api.c
deleted file mode 100644 (file)
index 6cd7d38..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $Id$ */
-
-#include <stdlib.h>        /* free() malloc() */
-#include <string.h>        /* strdup() */
-#include "forc.h"         /* forecaster functions */
-#include "diagnostic.h"    /* FAIL() */
-#include "forecast_api.h"
-
-
-struct FORECASTAPI_ForecastStateStruct {
-  char *Forecaster_state;
-};
-
-
-void
-FORECASTAPI_FreeForecastState(FORECASTAPI_ForecastState **state) {
-  FreeForcl((*state)->Forecaster_state);
-  free(*state);
-  *state = NULL;
-}
-
-const char *
-FORECASTAPI_MethodName(unsigned int methodIndex) {
-
-  int i;
-  static int methodCount = 0;
-  static char *methodNames[MAX_FORC];
-  char *stateForNames;
-
-  if(methodCount == 0) {
-    stateForNames = InitForcl(MAX_FORC, MAX_DATA_ENTRIES);
-    GetForcNames(stateForNames, methodNames, MAX_FORC, &methodCount);
-    /*
-    ** GetForNames() gives us pointers which will be freed by FreeForcl(), so
-    ** we have to strdup() them.
-    */
-    for(i = 0; i < methodCount; i++) {
-      methodNames[i] = strdup(methodNames[i]);
-    }
-    FreeForcl(stateForNames);
-  }
-
-  return((methodIndex < methodCount) ? methodNames[methodIndex] : NULL);
-
-}
-  
-
-FORECASTAPI_ForecastState *
-FORECASTAPI_NewForecastState(void) {
-  FORECASTAPI_ForecastState *returnValue;
-  /*
-   * init the forecaster state
-   */
-  returnValue = 
-    (FORECASTAPI_ForecastState *)malloc(sizeof(FORECASTAPI_ForecastState)); 
-  if(returnValue == NULL)
-    FAIL("NewForecastState: out of memory\n");
-  
-  returnValue->Forecaster_state = InitForcl(MAX_FORC,MAX_DATA_ENTRIES);
-  if(returnValue->Forecaster_state == NULL) {
-    free(returnValue);
-    FAIL("NewForecastState: out of memory\n");
-  }
-  return returnValue;
-}
-
-
-void
-FORECASTAPI_UpdateForecastState(FORECASTAPI_ForecastState *state,
-                                const FORECASTAPI_Measurement *measurements,
-                                size_t howManyMeasurements,
-                                FORECASTAPI_ForecastCollection *forecasts,
-                                size_t howManyForecasts) {
-       int i;
-
-       /* sanity check */
-       if (state == NULL) {
-               return;
-       }
-
-       /* check if we want forecast */
-       if (forecasts == NULL) {
-               howManyForecasts = 0;
-       }
-
-       for(i = howManyMeasurements - 1; i >= 0; i--) {
-               UpdateForecasts(state->Forecaster_state, (double)measurements[i].timeStamp, (double)measurements[i].measurement);
-               if(i < howManyForecasts) {
-                       FORECASTAPI_ComputeForecast(state, &forecasts[i]);
-                       forecasts[i].measurement = measurements[i];
-               }
-       }
-}
-
-int
-FORECASTAPI_ComputeForecast(        FORECASTAPI_ForecastState *state,
-                               FORECASTAPI_ForecastCollection *forecast) {
-
-       /* sanity check */
-       if (state == NULL || forecast == NULL) {
-               return 1;
-       }
-
-       forecast->forecasts[FORECASTAPI_MAE_FORECAST].forecast = MAEForecast(state->Forecaster_state);
-       forecast->forecasts[FORECASTAPI_MAE_FORECAST].error = MAEError(state->Forecaster_state);
-       forecast->forecasts[FORECASTAPI_MAE_FORECAST].methodUsed = MAEMethod(state->Forecaster_state);
-       forecast->forecasts[FORECASTAPI_MSE_FORECAST].forecast = MSEForecast(state->Forecaster_state);
-       forecast->forecasts[FORECASTAPI_MSE_FORECAST].error = MSEError(state->Forecaster_state);
-       forecast->forecasts[FORECASTAPI_MSE_FORECAST].methodUsed = MSEMethod(state->Forecaster_state);
-
-       return 0;
-}
-
diff --git a/src/nws_portability/Forecast/forecasters.c b/src/nws_portability/Forecast/forecasters.c
deleted file mode 100644 (file)
index e981642..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-/* $Id$ */
-
-/*
- * Forecaster Configuration File
- * 
- * FORECASTER(name,init,params,free,update,forecaster)
- *     name -- a print string to be associated with the forecaster
- *     init -- initialization function
- *     params -- string to be passed to init as initial parameters
- *     free -- free routine to be called to release forecaster spec. state
- *     update -- update routine for forecaster
- *     forecaster -- forecaster routine
- *     
- *     To add a forecaster to the system, both a FORECASTER specifier and
- *     an include file need to be specified.  forecasters.h contains include
- *     files for each forecasting package.
- *     
- *     Each forecaster consists of a (char *)init() routine, a (void)free()
- *     routine, a (void)update() routine, and an (int)forecaster()
- *     routine.
- *     
- *     char * Init(fbuff series,
- *                 fbuff time_stamps,
- *                 char *params)
- *                 
- *             series -- a pointer to the actual data series 
- *             time_stamps -- a pointer to the time stamp series
- *             params -- string passed as initial parameters
- *             
- *             returns a local state record that will be passed to
- *                     all subsequent calls
- *                     
- *     void Free(char *state)
- *     
- *             state -- local state to be deallocated when forecaster]
- *                      is shut down
- *                      
- *     void Update(char *state,
- *                 double ts,
- *                 doubel value)
- *                 
- *             state -- local forecaster state
- *             ts -- time stamp for new value to be added
- *             value -- value to be added to the forecaster state
- *             
- *     int Forecaster(char *state,
- *                    double *forecast)
- *                    
- *             state -- local forecaster state
- *             forecast -- out parameter through which forecast is passed
- *             
- *             returns a 1 if forecast can be made and a 0 if the
- *                     foreacster fails for some reason
- *                     
- * a header file for each package shoould include external definitions
- * for each routine
- */
-
-/*
- * last value predictor
- */
-FORECASTER("Last Value", 
-           InitLastValue, 
-           NULL, 
-           FreeLastValue, 
-           UpdateLastValue, 
-           ForcLastValue);
-
-/*
- * running tabulation of the mean
- */
-FORECASTER("Running Mean", 
-           InitRunMean, 
-           NULL, 
-           FreeRunMean, 
-           UpdateRunMean, 
-           ForcRunMean);
-
-/*
- * exp smooth predictor with 0.05 gain
- */
-FORECASTER("5% Exp Smooth",
-          InitExpSmooth,
-          "0.05",
-          FreeExpSmooth,
-          UpdateExpSmooth,
-          ForcExpSmooth);
-
-/*
- * exp smooth predictor with 0.10 gain
- */
-FORECASTER("10% Exp Smooth",
-          InitExpSmooth,
-          "0.10",
-          FreeExpSmooth,
-          UpdateExpSmooth,
-          ForcExpSmooth);
-
-/*
- * exp smooth predictor with 0.15 gain
- */
-FORECASTER("15% Exp Smooth",
-          InitExpSmooth,
-          "0.15",
-          FreeExpSmooth,
-          UpdateExpSmooth,
-          ForcExpSmooth);
-
-/*
- * exp smooth predictor with 0.20 gain
- */
-FORECASTER("20% Exp Smooth",
-          InitExpSmooth,
-          "0.20",
-          FreeExpSmooth,
-          UpdateExpSmooth,
-          ForcExpSmooth);
-
-/*
- * exp smooth predictor with 0.30 gain
- */
-FORECASTER("30% Exp Smooth",
-          InitExpSmooth,
-          "0.30",
-          FreeExpSmooth,
-          UpdateExpSmooth,
-          ForcExpSmooth);
-
-/*
- * exp smooth predictor with 0.40 gain
- */
-FORECASTER("40% Exp Smooth",
-          InitExpSmooth,
-          "0.40",
-          FreeExpSmooth,
-          UpdateExpSmooth,
-          ForcExpSmooth);
-
-/*
- * exp smooth predictor with 0.50 gain
- */
-FORECASTER("50% Exp Smooth",
-          InitExpSmooth,
-          "0.50",
-          FreeExpSmooth,
-          UpdateExpSmooth,
-          ForcExpSmooth);
-
-/*
- * exp smooth predictor with 0.75 gain
- */
-FORECASTER("75% Exp Smooth",
-          InitExpSmooth,
-          "0.75",
-          FreeExpSmooth,
-          UpdateExpSmooth,
-          ForcExpSmooth);
-
-/*
- * median predictor with window = 31
- */
-FORECASTER("Median Window 31",
-          InitMedian,
-          "31.0",
-          FreeMedian,
-          UpdateMedian,
-          ForcMedian);
-
-/*
- * median predictor with window = 5
- */
-FORECASTER("Median Window 5",
-          InitMedian,
-          "5.0",
-          FreeMedian,
-          UpdateMedian,
-          ForcMedian);
-
-/*
- * sliding window with window = 31 -- Trim Median with alpha = 0.0
- */
-FORECASTER("Sliding Median Window 31",
-          InitTrimMedian,
-          "31.0 0.0",
-          FreeTrimMedian,
-          UpdateTrimMedian,
-          ForcTrimMedian);
-
-/*
- * sliding window with window = 5 -- Trim Median with alpha = 0.0
- */
-FORECASTER("Sliding Median Window 5",
-          InitTrimMedian,
-          "5.0 0.0",
-          FreeTrimMedian,
-          UpdateTrimMedian,
-          ForcTrimMedian);
-
-/*
- * trimmed median with window = 31, alpha = 0.30
- */
-FORECASTER("30% Trimmed Median Window 31",
-          InitTrimMedian,
-          "31.0 0.30",
-          FreeTrimMedian,
-          UpdateTrimMedian,
-          ForcTrimMedian);
-
-/*
- * trimmed median with window = 51, alpha = 0.30
- */
-FORECASTER("30% Trimmed Median Window 51",
-          InitTrimMedian,
-          "51.0 0.30",
-          FreeTrimMedian,
-          UpdateTrimMedian,
-          ForcTrimMedian);
-
-/*
- * adaptive median with win=10, min_win=5, max_win=21, and a adjustment
- * value of 1
- */
-FORECASTER("Adaptive Median Window 5-21",
-          InitAdMedian,
-          "10.0 5.0 21.0 1.0",
-          FreeAdMedian,
-          UpdateAdMedian,
-          ForcAdMedian);
-
-/*
- * adaptive median with win=30, min_win=21, max_win=51, and a adjustment
- * value of 5
- */
-FORECASTER("Adaptive Median Window 21-51",
-          InitAdMedian,
-          "30.0 21.0 51.0 5.0",
-          FreeAdMedian,
-          UpdateAdMedian,
-          ForcAdMedian);
diff --git a/src/nws_portability/Forecast/last_value.c b/src/nws_portability/Forecast/last_value.c
deleted file mode 100644 (file)
index 590c114..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/* $Id$ */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <strings.h>
-
-#include "fbuff.h"
-#include "last_value.h"
-
-struct last_value_state
-{
-       fbuff series;                   /* the series so far */
-       fbuff time_stamps;              /* the time stamps */
-       double value;
-};
-
-/*
- * init local state.  can save a copy of the pointer to the
- * series and time stamps, if desired
- */
-char *
-InitLastValue(fbuff series, fbuff time_stamps, char *params)
-{
-       struct last_value_state *state;
-       
-       state = (struct last_value_state *)
-               malloc(sizeof(struct last_value_state));
-       
-       if(state == NULL)
-       {
-               return(NULL);
-       }
-       
-       /*
-        * all functions take a forcb
-        */
-       state->series = series;
-       state->time_stamps = time_stamps;
-       
-       return((char *)state);
-}
-
-void
-FreeLastValue(char *state)
-{
-       free(state);
-       return;
-}
-
-void
-UpdateLastValue(char *state,
-               double ts,
-               double value)
-{
-       /*
-        * no op -- will just grab it from series
-        */
-       return;
-}
-
-int
-ForcLastValue(char *state, double *v)
-{
-       double val;
-       struct last_value_state *s = (struct last_value_state *)state;
-       
-       if(!IS_EMPTY(s->series))
-       {
-               val = F_VAL(s->series,F_FIRST(s->series));
-               *v = val;
-               return(1);
-       }
-       else
-       {
-               *v = 0.0;
-               return(0);
-       }
-}
-
-
diff --git a/src/nws_portability/Forecast/median.c b/src/nws_portability/Forecast/median.c
deleted file mode 100644 (file)
index 88c881b..0000000
+++ /dev/null
@@ -1,978 +0,0 @@
-/* $Id$ */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/times.h>
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-
-
-#include "fbuff.h"
-#include "median.h"
-
-
-/*
- * to do --
- * 
- * init M_ts to BIG_TS
- * 
- * handle the case where data is filling the window
- * 
- * find the biggest window
- */
-
-#define SMALL_TS (-1)
-#define BIG_TS (99999999999999999.99)
-
-
-
-/*
- * state record for median and trimmed median
- */
-struct median_state
-{
-       fbuff series;
-       fbuff time_stamps;
-       double M_array[MAX_MED_SIZE];
-       double M_ts[MAX_MED_SIZE];
-       int artificial_time;
-       int M_count;
-       int M_size;
-       double trim;
-};
-
-/*
- * state record for adjusted median and adjusted mean
- */
-struct ad_median_state
-{
-       fbuff series;
-       fbuff time_stamps;
-       double M_array[MAX_MED_SIZE];
-       double M_ts[MAX_MED_SIZE];
-       int M_count;
-       int artificial_time;
-       int last_win;
-       int win;
-       int min;
-       int max;
-       int offset;
-};
-
-void
-MSort(double *M_value, double *M_ts, double value, double ts, int size)
-{
-       int i;
-       int prev;
-       int curr;
-       int next;
-       int l_index = 0;
-       double temp;
-       double min_ts = BIG_TS;
-       
-       /*
-        * list is sorted from smallest to biggest -- find the
-        * oldest time stamp
-        */
-       for(i=0; i < size; i++)
-       {
-               if(M_ts[i] < min_ts)
-               {
-                       l_index = i;
-                       min_ts = M_ts[i];
-               }
-       }
-       
-       /*
-        * overwrite the slot with the new value and
-        * timestamp
-        */
-       M_value[l_index] = value;
-       M_ts[l_index] = ts;
-       
-       /*
-        * bump the value into the right place in the list
-        */
-
-       prev = l_index - 1;
-       if(prev < 0)
-               prev = 0;
-       curr = l_index;
-       next = l_index + 1;
-       if(next > (size - 1))
-               next = size - 1;
-       /*
-        * while the value is not in the right spot
-        */
-       while(!((M_value[curr] >= M_value[prev]) &&
-               (M_value[curr] <= M_value[next])))
-       {
-               /*
-                * if it is too big, shift up
-                */
-               if(M_value[curr] < M_value[prev])
-               {
-                       temp = M_value[prev];
-                       M_value[prev] = M_value[curr];
-                       M_value[curr] = temp;
-
-                       temp = M_ts[prev];
-                       M_ts[prev] = M_ts[curr];
-                       M_ts[curr] = temp;
-                       
-                       curr = curr - 1;
-               }
-               else /* shift down */
-               {
-                       temp = M_value[next];
-                       M_value[next] = M_value[curr];
-                       M_value[curr] = temp;
-
-                       temp = M_ts[next];
-                       M_ts[next] = M_ts[curr];
-                       M_ts[curr] = temp;
-                       
-                       curr = curr + 1;
-               }
-               
-               prev = curr - 1;
-               if(prev < 0)
-                       prev = 0;
-               
-               next = curr + 1;
-               if(next > (size - 1))
-                       next = size - 1;
-       }
-       
-       /*
-        * new list should be sorted
-        */
-       
-       return;
-}
-
-
-/*
- * these next two routines can do windowed medians for different
- * window sizes.  We put them in for the Adjusted versions but
- * all medians should use them
- */
-double
-FindMedian(double *sorted_list, 
-          double *sorted_ts, 
-          int list_size,
-          double now, 
-          int win_size)
-{
-       int i;
-       int count;
-       int temp;
-       double val;
-       int last_i;
-       
-       last_i = 0;
-       
-       if(win_size == 1)
-       {
-               return(sorted_list[0]);
-       }
-       
-       /*
-        * sweep through sorted list counting only those that are
-        * within a win_size of now.  stop when we have win_size/2
-        */
-       count = 0;
-       for(i=0; i < list_size; i++)
-       {
-               if(sorted_ts[i] > (now - win_size))
-               {
-                       count++;
-                       /*
-                        * need to remember this one for the even case
-                        */
-                       if(count == (win_size / 2))
-                       {
-                               last_i = i;
-                       }
-               }
-
-               if(count == ((win_size / 2) + 1))
-                       break;
-       }
-       
-       /*
-        * i should now be the index of middle element -- almost
-        */
-       temp = win_size / 2;
-       /*
-        * if even
-        */
-       if(win_size == (temp * 2))
-       {
-               val = (sorted_list[last_i] + sorted_list[i]) / 2.0;
-       }
-       else
-       {
-               val = sorted_list[i];
-       }
-       
-       return(val);
-}
-
-double
-FindTrimMedian(double *sorted_list, 
-          double *sorted_ts, 
-          double now, 
-          int win_size,
-          double alpha)
-{
-       int i;
-       double val;
-       int T;
-       double vcount;
-       
-       if(win_size == 1)
-       {
-               return(sorted_list[0]);
-       }
-       
-       /*
-        * sweep through sorted list counting only those that are
-        * within a win_size of now.  stop when we have win_size/2
-        */
-       T = alpha * win_size;
-       val = 0.0;
-       vcount = 0.0;
-       for(i=0; i < win_size ; i++)
-       {
-               if((sorted_ts[i] > (now - win_size + T)) &&
-                  (sorted_ts[i] < (now - T)))
-               {
-                       val += sorted_list[i];
-                       vcount++;
-               }
-       }
-       
-       if(vcount > 0.0)
-       {
-               val = val / vcount;
-       }
-       else
-       {
-               val = 0.0;
-       }
-
-       return(val);
-}
-
-
-char *
-InitMedian(fbuff series, fbuff time_stamps, char *params)
-{
-       struct median_state *state;
-       char *p_str;
-       double M_size;
-       int i;
-       
-       state = (struct median_state *)malloc(sizeof(struct median_state));
-       
-       if(state == NULL)
-       {
-               return(NULL);
-       }
-       
-       memset((void *)state,0,sizeof(struct median_state));
-       
-       state->trim = 0;
-       if(params != NULL)
-       {
-               /*
-                * first parameter is siaze of median window
-                */
-               p_str = params;
-               M_size = (int)strtod(p_str,&p_str);
-               state->M_size = M_size;
-       }
-       else
-       {
-               state->M_size = MAX_MED_SIZE;
-       }
-       
-       /*
-        * init M_ts to all SMALL_TS so that MSort will build sorted
-        * list correctly
-        */
-       for(i=0; i < MAX_MED_SIZE; i++)
-       {
-               state->M_ts[i] = SMALL_TS;
-       }
-       state->artificial_time = 0;
-       state->series = series;
-       state->time_stamps = time_stamps;
-       state->M_count = 0;
-       
-       return((char *)state);
-}
-
-void
-FreeMedian(char *state)
-{
-       free(state);
-       return;
-}
-
-void
-UpdateMedian(char *state,
-            double ts,
-            double value)
-{
-       struct median_state *s = (struct median_state *)state;
-       int curr_size;
-       
-
-       curr_size = F_COUNT(s->series);
-
-       if(curr_size > s->M_size)
-       {
-               s->M_count = curr_size = s->M_size;
-       }
-       else
-       {
-               s->M_count = curr_size;
-       }
-
-       /*
-        * update the sorted list
-        */
-       
-       /*
-        * increment the artificial time stamp
-        */
-       s->artificial_time = s->artificial_time + 1;
-
-       /*
-        * use artificial time stamp instead of real one to
-        * keep things in terms of entries instead of seconds
-        */
-       MSort(s->M_array,s->M_ts,value,s->artificial_time,curr_size);
-       
-       return;
-}
-
-
-int
-ForcMedian(char *state, double *forecast)
-{
-       struct median_state *s = (struct median_state *)state;
-       int l_index;
-       double val;
-       
-       if(s->M_count < 1)
-       {
-               return(0);
-       }
-
-       l_index = s->M_count/2;
-
-       /*
-        * if even
-        */
-       if(s->M_count == (2 * l_index))
-       {
-               val = (s->M_array[l_index-1] + s->M_array[l_index]) / 2.0;
-       }
-       else
-       {
-               val = s->M_array[l_index];
-       }
-       
-       *forecast = val;
-       return(1);
-}
-
-char *InitTrimMedian(fbuff series, fbuff time_stamps, char *params)
-{
-       struct median_state *state;
-       char *p_str;
-       double M_size;
-       double alpha;
-       int i;
-       
-       state = (struct median_state *)malloc(sizeof(struct median_state));
-       
-       if(state == NULL)
-       {
-               return(NULL);
-       }
-
-       memset((void *)state,0,sizeof(struct median_state));
-       
-       state->trim = 0;
-       if(params != NULL)
-       {
-               /*
-                * first parameter is size of median window
-                */
-               p_str = params;
-               M_size = (int)strtod(p_str,&p_str);
-               state->M_size = M_size;
-               
-               /*
-                * second parameter is the alpha trim value
-                */
-               alpha = strtod(p_str, &p_str);
-               state->trim = alpha;
-       }
-       else
-       {
-               state->M_size = MAX_MED_SIZE;
-               state->trim = 0.0;
-       }
-       
-       /*
-        * init M_ts to all SMALL_TS so that MSort will build sorted
-        * list correctly
-        */
-       for(i=0; i < MAX_MED_SIZE; i++)
-       {
-               state->M_ts[i] = SMALL_TS;
-       }
-       state->artificial_time = 0;
-       state->series = series;
-       state->time_stamps = time_stamps;
-       state->M_count = 0;
-       
-       return((char *)state);
-}
-
-void
-FreeTrimMedian(char *state)
-{
-       FreeMedian(state);
-       return;
-}
-
-void
-UpdateTrimMedian(char *state, double ts, double value)
-{
-       UpdateMedian(state,ts,value);
-       return;
-}
-
-
-
-/*
- * page 264 in DSP book
- */
-int
-ForcTrimMedian(char *state, double *forecast)
-{
-       struct median_state *s = (struct median_state *)state;
-       double val;
-       int l_index;
-       int T;
-       
-       if(s->M_count < 1)
-       {
-               return(0);
-       }
-
-
-       T = (int)(s->trim * s->M_count);
-
-       val = 0.0;
-       for(l_index = T; l_index < (s->M_count - T); l_index++)
-       {
-               val += s->M_array[l_index];
-       }
-
-       val = val / (double)(s->M_count - 2*T);
-
-
-       *forecast = val;
-       
-       return(1);
-}
-
-
-
-char *InitAdMedian(fbuff series, fbuff time_stamps, char *params)
-{
-       struct ad_median_state *state;
-       char *p_str;
-       double win;
-       double min_win;
-       double max_win;
-       double offset;
-       int i;
-       
-       state = (struct ad_median_state *)
-               malloc(sizeof(struct ad_median_state));
-       
-       if(state == NULL)
-       {
-               return(NULL);
-       }
-
-       memset((void *)state,0,sizeof(struct median_state));
-       
-       
-       if(params != NULL)
-       {
-               /*
-                * first parameter is initial target size of median window
-                */
-               p_str = params;
-               win = (int)strtod(p_str,&p_str);
-               state->win = win;
-               
-               /*
-                * defaults
-                */
-               min_win = win;
-               max_win = win;
-               offset = 1;
-               
-               /*
-                * second parameter is the min window value
-                */
-               min_win = strtod(p_str, &p_str);
-
-               /*
-                * third parameter is the max window value
-                */
-               max_win = strtod(p_str, &p_str);
-
-               /*
-                * fourth parameter is the offset value to use
-                * when calculating alternative window sizes
-                */
-               offset = strtod(p_str, &p_str);
-               state->offset = (int)offset;
-               
-               /*
-                * sanity checking
-                */
-               if(win == 1)
-                       state->offset = 0;
-               
-               if((win - state->offset) < 0)
-                       state->offset = 1;
-                       
-               if(min_win > (win - state->offset))
-                       min_win = win - state->offset;
-               
-               if(max_win < (win + state->offset))
-                       max_win = win + state->offset;
-
-               state->min = (int)min_win;
-               state->max = (int)max_win;
-       }
-       else
-       {
-               state->min = state->max = state->win = MAX_MED_SIZE;
-               state->offset = 1;
-       }
-       
-       /*
-        * init M_ts to all SMALL_TS so that MSort will build sorted
-        * list correctly
-        */
-       for(i=0; i < MAX_MED_SIZE; i++)
-       {
-               state->M_ts[i] = SMALL_TS;
-       }
-       state->artificial_time = 0;
-       state->series = series;
-       state->time_stamps = time_stamps;
-       state->M_count = 0;
-       state->artificial_time = 1;
-       
-       return((char *)state);
-}
-
-void
-FreeAdMedian(char *state)
-{
-               free(state);
-               return;
-}
-
-void
-UpdateAdMedian(char *state, double ts, double value) 
-{
-       struct ad_median_state *s = (struct ad_median_state *)state;
-       int curr_size;
-       int win;
-       double less_val;
-       double eq_val;
-       double more_val;
-       double less_err;
-       double eq_err;
-       double more_err;
-       int lo_offset;
-       int hi_offset;
-       
-
-       curr_size = F_COUNT(s->series);
-
-       /*
-        * M_size is the current window size, and M_count is the
-        * current amount of data in the median buffer
-        */
-       
-       if(curr_size > s->max)
-       {
-               s->M_count = curr_size = s->max;
-       }
-       else
-       {
-               s->M_count = curr_size;
-       }
-
-       /*
-        * update the sorted list
-        */
-       
-       /*
-        * increment the artificial time stamp
-        */
-       s->artificial_time = s->artificial_time + 1;
-
-       /*
-        * use artificial time stamp instead of real one to
-        * keep things in terms of entries instead of seconds
-        */
-       MSort(s->M_array,s->M_ts,value,s->artificial_time,curr_size);
-       
-       
-       /*
-        * calculate the window based on how much data there is
-        */
-       if(curr_size > s->win)
-       {
-               win = s->win;
-       }
-       else
-       {
-               win = curr_size;
-       }
-       /*
-        * find the median using the current
-        * window size
-        */
-       eq_val = FindMedian(s->M_array,
-                           s->M_ts,
-                           s->M_count,
-                           s->artificial_time,
-                           win);
-       
-       /*
-        * we want to wait until there is enough data before we start
-        * to adapt.  We don't start to adjust s->win until there is
-        * enough data to get out to the max window size
-        */
-       if(curr_size < s->max)
-       {
-               return;
-       }
-       
-       if((win - s->offset) < 0)
-       {
-               lo_offset = win - 1;
-       }
-       else
-       {
-               lo_offset = s->offset;
-       }
-       
-       if((win + s->offset) > s->M_count)
-       {
-               hi_offset = s->M_count - win - 1;
-       }
-       else
-       {
-               hi_offset = s->offset;
-       }
-       
-       /*
-        * find the median for a smaller window -- offset
-        * controls how much smaller or bigger the window should be
-        * that we consider
-        */
-       less_val = FindMedian(s->M_array,
-                             s->M_ts,
-                             s->M_count,
-                             s->artificial_time,
-                             lo_offset);
-
-       /*
-        * find the median for a bigger window -- offset
-        * controls how much smaller or bigger the window should be
-        * that we consider
-        */
-       more_val = FindMedian(s->M_array,
-                             s->M_ts,
-                             s->M_count,
-                             s->artificial_time,
-                             hi_offset);
-       
-       /*
-        * now, calculate the errors
-        */
-       less_err = (value - less_val) * (value - less_val);
-       more_err = (value - more_val) * (value - more_val);
-       eq_err = (value - eq_val) * (value - eq_val);
-       
-       /*
-        * adapt the window according to the direction giving us the
-        * smallest error
-        */
-       if(less_err < eq_err)
-       {
-               if(less_err < more_err)
-               {
-                       win = win - 1;
-               }
-               else if(more_err < eq_err)
-               {
-                       win = win + 1;
-               }
-       }
-       else if(more_err < eq_err)
-       {
-               if(more_err < less_err)
-               {
-                       win = win + 1;
-               }
-               else if(less_err < eq_err)
-               {
-                       win = win - 1;
-               }
-       }
-
-       s->win = win;
-
-       return;
-}      
-       
-
-int
-ForcAdMedian(char *state, double *forecast)
-{
-       struct ad_median_state *s = (struct ad_median_state *)state;
-       double forc;
-       
-       if(s->M_count == 0)
-       {
-               return(0);
-       }
-       
-       if(s->M_count < s->max)
-       {
-               forc = FindMedian(s->M_array,
-                                 s->M_ts,
-                                 s->M_count,
-                                 s->artificial_time,
-                                 s->M_count);
-       }
-       else
-       {
-               forc = FindMedian(s->M_array,
-                                 s->M_ts,
-                                 s->M_count,
-                                 s->artificial_time,
-                                 s->win);
-               
-       }
-       
-       *forecast = forc;
-       
-       return(1);
-}
-
-       
-       
-
-
-       
-
-
-
-#ifdef NOTYET
-
-AdjustedMedian(tp,pred,min,max)
-struct thruput_pred *tp;
-int pred;
-int min;
-int max;
-{
-       double err1;
-       double err2;
-       double err3;
-       double val1;
-       double val2;
-       double val3;
-       int win;
-       struct value_el *data = tp->data;
-       int prev = MODMINUS(tp->head,1,HISTORYSIZE);
-       int head = tp->head;
-       double value = tp->data[head].value;
-       double predictor = PRED(pred,data[prev]);
-       int out_win;
-       double out_val;
-
-       win = MedWIN(pred,data[prev]);
-       if(MODMINUS(head,tp->tail,HISTORYSIZE) < 3)
-       {
-               PRED(pred,data[head]) = value;
-               MedWIN(pred,data[head]) = win;
-               return(0.0);
-       }
-       if(win < 2)
-               win = 2;
-       val1 = Median(tp,win-1);
-       val2 = Median(tp,win+1);
-       val3 = Median(tp,win);
-
-       err1 = (value - val1) * (value - val1);
-       err2 = (value - val2) * (value - val2);
-       err3 = (value - val3) * (value - val3);
-
-       if(err1 < err2)
-       {
-               if(err1 < err3)
-               {
-                       out_win = win - 1;
-                       out_val = val1;
-               }
-               else
-               {
-                       out_win = win;
-                       out_val = val3;
-               }
-       }
-       else if(err2 < err1)
-       {
-               if(err2 < err3)
-               {
-                       out_win = win + 1;
-                       out_val = val2;
-               }
-               else
-               {
-                       out_win = win;
-                       out_val = val3;
-               }
-       }
-       else
-       {
-               out_win = win;
-               out_val = val3;
-       }
-
-       if(out_win < min)
-       {
-               out_win = min;
-               out_val = Median(tp,min);
-       }
-
-       if(out_win > max)
-       {
-               out_win = max;
-               out_val = Median(tp,max);
-       }
-
-       MedWIN(pred,data[head]) = out_win;
-       PRED(pred,data[head]) = out_val;
-}
-
-AdjustedMean(tp,pred,min,max)
-struct thruput_pred *tp;
-int pred;
-int min;
-int max;
-{
-       double err1;
-       double err2;
-       double err3;
-       double val1;
-       double val2;
-       double val3;
-       int win;
-       struct value_el *data = tp->data;
-       int prev = MODMINUS(tp->head,1,HISTORYSIZE);
-       int head = tp->head;
-       double value = tp->data[head].value;
-       double predictor = PRED(pred,data[prev]);
-       int out_win;
-       double out_val;
-
-       win = MeanWIN(pred,data[prev]);
-       if(MODMINUS(head,tp->tail,HISTORYSIZE) < 3)
-       {
-               PRED(pred,data[head]) = value;
-               MeanWIN(pred,data[head]) = WIN_INIT;
-               return(0.0);
-       }
-       if(win < 2)
-               win = 2;
-       val1 = TrimmedMedian(tp,win-1,0.0);
-       val2 = TrimmedMedian(tp,win+1,0.0);
-       val3 = TrimmedMedian(tp,win,0.0);
-
-       err1 = (value - val1) * (value - val1);
-       err2 = (value - val2) * (value - val2);
-       err3 = (value - val3) * (value - val3);
-
-       if(err1 < err2)
-       {
-               if(err1 < err3)
-               {
-                       out_win = win - 1;
-                       out_val = val1;
-               }
-               else
-               {
-                       out_win = win;
-                       out_val = val3;
-               }
-       }
-       else if(err2 < err1)
-       {
-               if(err2 < err3)
-               {
-                       out_win = win + 1;
-                       out_val = val2;
-               }
-               else
-               {
-                       out_win = win;
-                       out_val = val3;
-               }
-       }
-       else
-       {
-               out_win = win;
-               out_val = val3;
-       }
-
-       if(out_win < min)
-       {
-               out_win = min;
-               out_val = TrimmedMedian(tp,min,0.0);
-       }
-
-       if(out_win > max)
-       {
-               out_win = max;
-               out_val = TrimmedMedian(tp,max,0.0);
-       }
-
-       MeanWIN(pred,data[head]) = out_win;
-       PRED(pred,data[head]) = out_val;
-}
-
-#endif
diff --git a/src/nws_portability/Forecast/mse_forc.c b/src/nws_portability/Forecast/mse_forc.c
deleted file mode 100644 (file)
index efefead..0000000
+++ /dev/null
@@ -1,658 +0,0 @@
-#include <unistd.h>
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <strings.h>
-
-
-
-#include "forc.h"
-
-struct mse_state
-{
-       forcl forc_list;
-       int win;
-       int method;
-       int last_index;         /* optimization */
-       double last_forecast;   /* optimization */
-};
-
-
-/*
- * forward refs for derived forecaster types
- */
-int TotalMSEForecast(char *state, double *forecast);
-int LocalMAEForecast(char *state, double *forecast);
-
-int DerivedMethod(char *state);
-
-/*
- * the MSE forecast chooses the best forecast from the derived
- * forecasters, one of which is the total MSE forecast
- */
-double
-MSEForecast(char *i_forcl) 
-{
-       int i;
-       int min_i;
-       double min_se;
-       double sq_err;
-       double forecast;
-       forcl l_forcl;
-       int ferr;
-       fbuff series;
-       
-       l_forcl = (forcl)i_forcl;
-       
-       /*
-        * first, check to see if there is any data -- the forecaster
-        * routines may be called with an empty series
-        */
-       if(F_COUNT(l_forcl->forcs[0]->series) == 0)
-       {
-               forecast = FORE_ERROR_VAL;
-               return(forecast);
-       }
-
-
-
-       min_se = DBIG_VAL;
-       min_i = 0;
-
-       /*
-        * find the forecaster that has the lowest current
-        * mean square error
-        */
-       for(i=0; i < l_forcl->derived_count; i++)
-       {
-               series = l_forcl->derived_forcs[i]->se_series;
-               if(F_COUNT(series) > 0)
-               {
-                       sq_err = 
-                       F_VAL(series,F_FIRST(series)) / F_COUNT(series);
-               }
-               else
-               {
-                       sq_err = DBIG_VAL;
-               }
-
-               if(sq_err < min_se)
-               {
-                       min_i = i;
-                       min_se = sq_err;
-               }
-       }
-
-       /*
-        * report the best
-        */
-       ferr = 
-(l_forcl->derived_forcs[min_i])->forecast((l_forcl->derived_forcs[min_i])->state,
-                                 &forecast);
-       
-       /*
-        * if an error has occurred, print and error and report
-        * FORE_ERROR_VAL
-        */
-       if(ferr == 0)
-       {
-               /*
-                * since we know there is at least one data item,
-                * return the last on error
-                */
-               forecast = F_VAL(l_forcl->forcs[0]->series,
-                               F_FIRST(l_forcl->forcs[0]->series));
-               return(forecast);
-       }
-       
-       /*
-        * update the method that was used
-        */
-       l_forcl->total_mse_method = 
-               DerivedMethod(l_forcl->derived_forcs[min_i]->state);
-
-       return(forecast);
-}
-
-double
-MSEError(char *state)
-{
-       forcl s;
-       double val;
-       
-       s = (forcl)state;
-       
-       if(s->total_mse->count > 0.0)
-       {
-               val = s->total_mse->se / s->total_mse->count;
-       }
-       else
-       {
-               val = 0.0;
-       }
-       
-       return(val);
-}
-
-int
-MSEMethod(char *state)
-{
-       forcl s;
-       
-       s = (forcl)state;
-       
-       return(s->total_mse_method);
-}
-
-/*
- * for forecaster interface
- */
-int
-TotalMSEForecast(char *state, double *forecast)
-{
-       *forecast = MSEForecast(state);
-       
-       if(*forecast == FORE_ERROR_VAL)
-       {
-               return(0);
-       }
-       else
-       {
-               return(1);
-       }
-}
-
-double
-MAEForecast(char *i_forcl)
-{
-       int i;
-       int min_i;
-       double min_ae;
-       double err;
-       double forecast;
-       forcl l_forcl;
-       int ferr;
-       fbuff series;
-       
-       l_forcl = (forcl)i_forcl;
-
-       min_ae = DBIG_VAL;
-       min_i = 0;
-
-       /*
-        * find the forecaster that has the lowest current
-        * mean absolute error
-        */
-       for(i=0; i < l_forcl->derived_count; i++)
-       {
-               series = l_forcl->derived_forcs[i]->ae_series;
-               if(F_COUNT(series) > 0)
-               {
-                       err = 
-                       F_VAL(series,F_FIRST(series)) / F_COUNT(series);
-               }
-               else
-               {
-                       err = DBIG_VAL;
-               }
-
-               if(err < min_ae)
-               {
-                       min_i = i;
-                       min_ae = err;
-               }
-       }
-
-       /*
-        * report the best
-        */
-       ferr = 
-(l_forcl->derived_forcs[min_i])->forecast((l_forcl->derived_forcs[min_i])->state,
-                                 &forecast);
-       
-       /*
-        * if an error has occurred, print and error and report
-        * FORE_ERROR_VAL
-        */
-       if(ferr == 0)
-       {
-               forecast = F_VAL(l_forcl->forcs[0]->series, 
-                               F_FIRST(l_forcl->forcs[0]->series));
-       }
-
-       /*
-        * update the method that was used
-        */
-       l_forcl->total_mae_method = 
-               DerivedMethod(l_forcl->derived_forcs[min_i]->state);
-       return(forecast);
-}
-
-double
-MAEError(char *state)
-{
-       forcl s;
-       double val;
-       
-       s = (forcl)state;
-       
-       if(s->total_mae->count > 0.0)
-       {
-               val = s->total_mae->ae / s->total_mae->count;
-       }
-       else
-       {
-               val = 0.0;
-       }
-       
-       return(val);
-}
-
-int
-MAEMethod(char *state)
-{
-       forcl s;
-       
-       s = (forcl)state;
-       
-       return(s->total_mae_method);
-}
-
-int
-TotalMAEForecast(char *state, double *forecast)
-{
-       *forecast = MAEForecast(state);
-       
-       if(*forecast == FORE_ERROR_VAL)
-       {
-               return(0);
-       }
-       else
-       {
-               return(1);
-       }
-}
-
-char *
-InitWinMSE(fbuff series, fbuff time_stamps, char *params)
-{
-       struct mse_state *state;
-       int pcount;
-       forcl l_forcl;
-       int win;
-       
-       state = (struct mse_state *)malloc(sizeof(struct mse_state));
-       
-       if(state == NULL)
-       {
-               return(NULL);
-       }
-       
-       /*
-        * first parameter is the address of the forcl and the
-        * second is the window size
-        */
-       pcount = sscanf(params,"%p %d",
-                       &l_forcl,
-                       &win);
-       
-       if(pcount != 2)
-       {
-               free(state);
-               return(NULL);
-       }
-       
-       state->forc_list = l_forcl;
-       state->win = win;
-       
-       return((char *)state);
-}
-
-void
-FreeWinMSE(char *state)
-{
-       free(state);
-}
-
-char *
-InitWinMAE(fbuff series, fbuff time_stamps, char *params)
-{
-       return(InitWinMSE(series,time_stamps,params));
-}
-
-void
-FreeWinMAE(char *state)
-{
-       FreeWinMSE(state);
-}
-
-int
-LocalWinMSEForecast(char *state, double *out_f)
-{
-       struct mse_state *s;
-       int i;
-       int win;
-       int min_i;
-       double min_se;
-       double sq_err;
-       double forecast;
-       forcl l_forcl;
-       int ferr;
-       double temp_err;
-       int windex;
-       fbuff series;
-       
-       s = (struct mse_state *)state;
-       
-       l_forcl = s->forc_list;
-       win = s->win;
-
-
-       min_se = DBIG_VAL;
-       min_i = 0;
-       
-
-       /*
-        * find the forecaster that has the lowest current
-        * mean square error --
-        * 
-        * if the win size > 0, look only over the window
-        * using the cumulative series.  Otherwise, use the total
-        * cumulative value
-        */
-       for(i=0; i < l_forcl->count; i++)
-       {
-               if((l_forcl->forcs[i])->count > 0.0)
-               {
-                       series =
-                       (l_forcl->forcs[i])->se_series;
-                       
-                       /*
-                        * make sure we only window as much
-                        * as there is
-                        */
-                       if(win > (F_COUNT(series) - 1))
-                               win = F_COUNT(series) - 1;
-
-                       if(win == 0)
-                       {
-                               /*
-                                * get the first value which is
-                                * the current cumulative total
-                                */
-                               temp_err =
-                               F_VAL(series, F_FIRST(series));
-                               sq_err = temp_err / 
-                                       (l_forcl->forcs[i])->count;
-                       }
-                       else
-                       {
-                               /*
-                                * get the index of the end of the
-                                * window
-                                */
-                               windex = MODPLUS(F_FIRST(series),
-                                                win,
-                                                F_SIZE(series));
-                               /*
-                                * the difference is the cumulative
-                                * total over the window size
-                                */
-                               temp_err = F_VAL(series, F_FIRST(series)) -
-                                      F_VAL(series,windex);
-                               sq_err = temp_err / win;
-                       }
-               }
-               else
-               {
-                       sq_err = DBIG_VAL;
-               }
-
-               if(sq_err < min_se)
-               {
-                       min_i = i;
-                       min_se = sq_err;
-               }
-       }
-
-       /*
-        * report the best
-        */
-       ferr = 
-(l_forcl->forcs[min_i])->forecast((l_forcl->forcs[min_i])->state,&forecast);
-       
-       /*
-        * if an error has occurred, print and error and report
-        * FORE_ERROR_VAL
-        */
-       if(ferr == 0)
-       {
-               forecast = F_VAL(l_forcl->forcs[0]->series, 
-                               F_FIRST(l_forcl->forcs[0]->series));
-
-               return(0);
-       }
-
-       /*
-        * update the method that was used
-        */
-       s->method = min_i;
-       *out_f = forecast;
-       
-       return(1);
-}
-
-int
-LocalWinMAEForecast(char *state, double *out_f)
-{
-       struct mse_state *s;
-       int i;
-       int win;
-       int min_i;
-       double min_ae;
-       double err;
-       double forecast;
-       forcl l_forcl;
-       int ferr;
-       double temp_err;
-       int windex;
-       fbuff series;
-       
-       s = (struct mse_state *)state;
-       
-       l_forcl = s->forc_list;
-       win = s->win;
-
-
-       min_ae = DBIG_VAL;
-       min_i = 0;
-
-       /*
-        * find the forecaster that has the lowest current
-        * mean square error --
-        * 
-        * if the win size > 0, look only over the window
-        * using the cumulative series.  Otherwise, use the total
-        * cumulative value
-        */
-       for(i=0; i < l_forcl->count; i++)
-       {
-               if((l_forcl->forcs[i])->count > 0.0)
-               {
-                       series =
-                       (l_forcl->forcs[i])->ae_series;
-                       
-                       /*
-                        * make sure we only window as much
-                        * as there is
-                        */
-                       if(win > (F_COUNT(series) - 1))
-                               win = F_COUNT(series) - 1;
-
-                       if(win == 0)
-                       {
-                               /*
-                                * get the first value which is
-                                * the current cumulative total
-                                */
-                               temp_err =
-                               F_VAL(series, F_FIRST(series));
-                               err = temp_err / 
-                                       (l_forcl->forcs[i])->count;
-                       }
-                       else
-                       {
-                               /*
-                                * get the index of the end of the
-                                * window
-                                */
-                               windex = MODPLUS(F_FIRST(series),
-                                                win,
-                                                F_SIZE(series));
-                               /*
-                                * the difference is the cumulative
-                                * total over the window size
-                                */
-                               temp_err =
-                                       F_VAL(series, F_FIRST(series)) - 
-                                       F_VAL(series,windex);
-                               err = temp_err / win;
-                       }
-               }
-               else
-               {
-                       err = DBIG_VAL;
-               }
-
-               if(err < min_ae)
-               {
-                       min_i = i;
-                       min_ae = err;
-               }
-       }
-
-       /*
-        * report the best
-        */
-       ferr = 
-(l_forcl->forcs[min_i])->forecast((l_forcl->forcs[min_i])->state,&forecast);
-       
-       /*
-        * if an error has occurred, print and error and report
-        * FORE_ERROR_VAL
-        */
-       if(ferr == 0)
-       {
-               forecast = F_VAL(l_forcl->forcs[0]->series, 
-                               F_FIRST(l_forcl->forcs[0]->series));
-
-               *out_f = forecast;
-               return(0);
-       }
-
-       /*
-        * update the method that was used
-        */
-       s->method = min_i;
-       *out_f = forecast;
-       
-       return(1);
-}
-
-int
-DerivedMethod(char *state)
-{
-       struct mse_state *s;
-       
-       s = (struct mse_state *)state;
-       
-       return(s->method);
-}
-
-/*
- * lifetime versions
- */
-double
-MSELifetimeForecast(char *state)
-{
-       forclife flife;
-       forcl l_forcl;
-       
-       flife = (forclife)state;
-       l_forcl = (forcl)flife->forc_list;
-       if(F_COUNT(l_forcl->forcs[0]->series) == 0)
-       {
-               if(flife->count == 0.0)
-                       return(0.0);
-               return(flife->total / flife->count);
-       }
-       return(MSEForecast((char *)flife->forc_list));
-}
-
-double
-MSELifetimeError(char *state)
-{
-       forclife flife;
-       flife = (forclife)state;
-       return(MSEError((char *)flife->forc_list));
-}
-
-int
-MSELifetimeMethod(char *state)
-{
-       forclife flife;
-       flife = (forclife)state;
-       return(MSEMethod((char *)flife->forc_list));
-}
-
-double
-MSELifetimeEpoch(char *state)
-{
-       forclife flife;
-       flife = (forclife)state;
-       return(flife->epoch_end);
-}
-
-double
-MAELifetimeForecast(char *state)
-{
-       forclife flife;
-       forcl l_forcl;
-       
-       flife = (forclife)state;
-       l_forcl = (forcl)flife->forc_list;
-
-       if(F_COUNT(l_forcl->forcs[0]->series) == 0)
-       {
-               if(flife->count == 0.0)
-                       return(0.0);
-               return(flife->total / flife->count);
-       }
-       return(MAEForecast((char *)flife->forc_list));
-}
-
-double
-MAELifetimeError(char *state)
-{
-       forclife flife;
-       flife = (forclife)state;
-       return(MAEError((char *)flife->forc_list));
-}
-
-int
-MAELifetimeMethod(char *state)
-{
-       forclife flife;
-       flife = (forclife)state;
-       return(MAEMethod((char *)flife->forc_list));
-}
-
-double
-MAELifetimeEpoch(char *state)
-{
-       forclife flife;
-       flife = (forclife)state;
-       return(flife->epoch_end);
-}
diff --git a/src/nws_portability/Forecast/predictor.c b/src/nws_portability/Forecast/predictor.c
deleted file mode 100644 (file)
index 1299c08..0000000
+++ /dev/null
@@ -1,607 +0,0 @@
-/* $Id$ */
-
-#include "config_portability.h"
-#include <stdio.h>      /* fprintf() fflush() */
-#include "strutil.h"    /* SAFESTRCPY() */
-#include "predictor.h"
-
-/* These should be in a header file, median.h */
-extern double Median();
-extern double TrimmedMedian();
-extern void AdjustedMean();
-extern void AdjustedMedian();
-extern char *DefineHistogram();
-extern char *DefineHistogramPred();
-extern void PrintHistogram();
-extern void ModalDev();
-
-/* not yet
-char *Histogram;
-char *MeanPred;
-char *MedianPred;
-char *MiddlePred;
-int Histodim;
-int Histostates;
-double Histomax;
-double Histomin;
-*/
-
-double Onedev_mse;
-double Onedev_mpe;
-double Onedev_modal;
-double Twodev_mse;
-double Twodev_mpe;
-double Twodev_modal;
-double Devcounts;
-
-double Lifetime_mse[LIFETIMES];
-double Lifetime_mpe[LIFETIMES];
-int Lifetime_count = 0;
-extern int Median_sorted;
-
-const char *Names[PREDS];
-#define NAME(i) (Names[i])
-
-void
-PrintPredData(tp,where)
-struct thruput_pred *tp;
-int where;
-{
-       struct value_el *data = tp->data;
-       int prev = MODMINUS(where,1,HISTORYSIZE);
-       int i;
-
-       fprintf(stdout,"%d %3.4f ",(int)data[where].time, data[where].value);
-
-       for(i=0; i < PREDS; i++)
-       {
-               fprintf(stdout,"| %3.4f %3.4f %3.4f ",PRED(i,data[prev]),
-                       TPMSE(tp,i)/TPCOUNT(tp,i),
-                       TPMAE(tp,i)/TPCOUNT(tp,i));
-       }
-       fprintf(stdout,"| %d %d | ",MedWIN(6,data[prev]),MeanWIN(7,data[prev]));
-       for(i=STATIC_PREDS; i < SECOND_ORDER_PREDS; i++)
-       {
-               fprintf(stdout,"%d ",TPPREDNUM(tp,i));
-       }
-       fprintf(stdout,"| ");
-       for(i=SECOND_ORDER_PREDS; i < PREDS; i++)
-       {
-               fprintf(stdout,"%d ",TPPREDNUM(tp,i));
-       }
-       fprintf(stdout,"\n");
-       fflush(stdout);
-
-       return;
-}
-
-
-void
-ThruputPrediction(tp)
-struct thruput_pred *tp;
-{
-        int tail = tp->tail;
-        int head = tp->head;
-        int i;
-        int prev;
-        double error;
-        double sq_error;
-        struct value_el *data = tp->data;
-        double value;
-        double run_mean = tp->run_mean;
-        double total = tp->total;
-        double tot_sum;
-        double min_run_p_error = MAXDOUBLE;
-        int min_run_p_i = 0;
-        double min_run_sq_error = MAXDOUBLE;
-        int min_run_sq_i = 0;
-        double prev_pred;
-        double absolute_error;
-        int last_error;
-        double min_win_sq_error = MAXDOUBLE;
-        double min_win_p_error = MAXDOUBLE;
-        int min_win_sq_i = 0;
-        int min_win_p_i = 0;
-        double min_tot_sq_error = MAXDOUBLE;
-        double min_tot_p_error = MAXDOUBLE;
-        int min_tot_sq_i = 0;
-        int min_tot_p_i = 0;
-        double win_error;
-        int error_window;
-        int datasize;
-
-        datasize = MODMINUS(head,tail,HISTORYSIZE) - 1;
-        if(ERR_WIN > datasize)
-               error_window = datasize;
-        else
-               error_window = ERR_WIN;
-
-        last_error = MODMINUS(head,error_window,HISTORYSIZE);
-
-
-
-       value = data[head].value;
-       prev = MODMINUS(head,1,HISTORYSIZE);
-#ifdef GROT
-       /*
-        * was the value within one deviation of the total prediction?
-        */
-       avg_err = TPMAE(tp,TOT_MSE_PRED)/TPCOUNT(tp,TOT_MSE_PRED);
-       if((value > (PRED(TOT_MSE_PRED,data[prev])-avg_err)) &&
-          (value < (PRED(TOT_MSE_PRED,data[prev])+avg_err)))
-       {
-               Onedev_mse++;
-       }
-       if((value > (PRED(TOT_MSE_PRED,data[prev])-2*avg_err)) &&
-          (value < (PRED(TOT_MSE_PRED,data[prev])+2*avg_err)))
-       {
-               Twodev_mse++;
-       }
-
-       avg_err = TPMAE(tp,TOT_MAE_PRED)/TPCOUNT(tp,TOT_MAE_PRED);
-       if((value > (PRED(TOT_MAE_PRED,data[prev])-avg_err)) &&
-          (value < (PRED(TOT_MAE_PRED,data[prev])+avg_err)))
-       {
-               Onedev_mpe++;
-       }
-       if((value > (PRED(TOT_MAE_PRED,data[prev])-2*avg_err)) &&
-          (value < (PRED(TOT_MAE_PRED,data[prev])+2*avg_err)))
-       {
-               Twodev_mpe++;
-       }
-
-       ModalDev(Histogram,MedianPred,1.0,&hi,&lo);
-       if((value > lo) && (value < hi))
-               Onedev_modal++;
-       ModalDev(Histogram,MedianPred,2.0,&hi,&lo);
-       if((value > lo) && (value < hi))
-               Twodev_modal++;
-
-       Devcounts++;
-#endif
-
-       /*
-        * calculate the error our last prediction made
-        * now that we have the actual value
-        */
-       for(i=0; i < PREDS; i++)
-       {
-
-               error = data[head].value - PRED(i,data[prev]);
-               if(TPCOUNT(tp,i) < MIN_DATA_HISTORY)
-                       error = 0.0;
-               sq_error = error * error;
-
-               SQERR(i,data[head]) = SQERR(i,data[prev])+sq_error;
-               TPMSE(tp,i) += sq_error;
-               if(error < 0.0)
-                       error = -1.0 * error;
-               absolute_error = error;
-               ERR(i,data[head]) = ERR(i,data[prev])+absolute_error;
-               TPMAE(tp,i) += absolute_error;
-               TPCOUNT(tp,i) += 1.0;
-
-       }
-
-#ifdef GROT
-       /*
-        * now calculate MSE values over different lifetimes
-        */
-       if(datasize > LIFETIMES)
-       {
-               curr = prev;
-               for(i=0; i < LIFETIMES; i++)
-               {
-                       error = data[head].value - 
-                               PRED(TOT_MSE_PRED,data[curr]);
-                       Lifetime_mse[i] += (error * error); 
-                       error = data[head].value - 
-                               PRED(TOT_MAE_PRED,data[curr]);
-                       if(error < 0.0)
-                               error = -1.0 * error;
-                       Lifetime_mpe[i] += (error / data[head].value);
-                       curr = MODMINUS(curr,1,HISTORYSIZE);
-               }
-               Lifetime_count++;
-       }
-#endif
-
-
-
-
-
-       /*
-        * use the current running mean
-        */
-       NAME(0) = "Last value";
-       PRED(0,data[head]) = value;
-
-
-       /*
-        * use the current value as a prediction of the next value
-        */
-       tot_sum = run_mean * total;
-       tot_sum += data[head].value;
-       total++;
-       run_mean = tot_sum/total;
-       tp->run_mean = run_mean;
-       tp->total = total;
-       NAME(1) = "Running Mean";
-       PRED(1,data[head]) = run_mean;
-
-       /*
-        * use the Van Jacobson method
-        */
-       prev_pred = PRED(2,data[prev]);
-       NAME(2) = "Van Jacobson";
-       PRED(2,data[head]) = prev_pred + GAIN*(value - prev_pred);
-
-       /*
-        * tell the median routines that the array is no longer valid
-        */
-       Median_sorted = 0;
-       NAME(3) = "Median";
-       PRED(3,data[head]) = Median(tp,MED_N);
-       NAME(4) = "Trimmed Median";
-       PRED(4,data[head]) = TrimmedMedian(tp,MED_N,MED_ALPHA);
-
-       /*
-        * Now use TrimmedMean to give a sliding window mean
-        */
-       NAME(5) = "Sliding Window Mean";
-       PRED(5,data[head]) = TrimmedMedian(tp,MED_N,0.0);
-       NAME(6) = "Adjusted Median";
-       AdjustedMedian(tp,6,WIN_MIN,WIN_MAX);
-       NAME(7) = "Adjusted Mean";
-       AdjustedMean(tp,7,WIN_MIN,WIN_MAX);
-
-       for(i=0; i < STATIC_PREDS; i++)
-       {
-               if((TPMSE(tp,i)/TPCOUNT(tp,i)) < min_run_sq_error)
-               {
-                       min_run_sq_error = TPMSE(tp,i)/TPCOUNT(tp,i);
-                       min_run_sq_i = i;
-               }
-
-               if((TPMAE(tp,i)/TPCOUNT(tp,i)) < min_run_p_error)
-               {
-                       min_run_p_error = TPMAE(tp,i)/TPCOUNT(tp,i);
-                       min_run_p_i = i;
-               }
-
-               win_error = 
-                       (SQERR(i,data[head]) - SQERR(i,data[last_error])) /
-                               (double)error_window;
-               if(win_error < min_win_sq_error)
-               {
-                       min_win_sq_error = win_error;
-                       min_win_sq_i = i;
-               }
-
-               win_error = 
-                       (ERR(i,data[head]) - ERR(i,data[last_error])) /
-                               (double)error_window;
-               if(win_error < min_win_p_error)
-               {
-                       min_win_p_error = win_error;
-                       min_win_p_i = i;
-               }
-
-       }
-
-
-       NAME(MSE_PRED) = "Min MSE Pred";
-       PRED(MSE_PRED,data[head]) = PRED(min_run_sq_i,data[head]);
-       TPPREDNUM(tp,MSE_PRED) = min_run_sq_i;
-       NAME(MAE_PRED) = "Min MAE Pred";
-       PRED(MAE_PRED,data[head]) = PRED(min_run_p_i,data[head]);
-       TPPREDNUM(tp,MAE_PRED) = min_run_p_i;
-       NAME(WIN_MSE_PRED) = "Win MSE Pred";
-       PRED(WIN_MSE_PRED,data[head]) = PRED(min_win_sq_i,data[head]);
-       TPPREDNUM(tp,WIN_MSE_PRED) = min_win_sq_i;
-       NAME(WIN_MAE_PRED) = "Win MAE Pred";
-       PRED(WIN_MAE_PRED,data[head]) = PRED(min_win_p_i,data[head]);
-       TPPREDNUM(tp,WIN_MAE_PRED) = min_win_p_i;
-
-       for(i=STATIC_PREDS; i < SECOND_ORDER_PREDS; i++)
-       {
-               if((TPMSE(tp,i)/TPCOUNT(tp,i)) < min_tot_sq_error)
-               {
-                       min_tot_sq_error = TPMSE(tp,i)/TPCOUNT(tp,i);
-                       min_tot_sq_i = TPPREDNUM(tp,i);
-               }
-               if((TPMAE(tp,i)/TPCOUNT(tp,i)) < min_tot_p_error)
-               {
-                       min_tot_p_error = TPMAE(tp,i)/TPCOUNT(tp,i);
-                       min_tot_p_i = TPPREDNUM(tp,i);
-               }
-       }
-       NAME(TOT_MSE_PRED) = "Total MSE Pred";
-       PRED(TOT_MSE_PRED,data[head]) = PRED(min_tot_sq_i,data[head]);
-       TPPREDNUM(tp,TOT_MSE_PRED) = min_tot_sq_i;
-       NAME(TOT_MAE_PRED) = "Total MAE Pred";
-       PRED(TOT_MAE_PRED,data[head]) = PRED(min_tot_p_i,data[head]);
-       TPPREDNUM(tp,TOT_MAE_PRED) = min_tot_p_i;
-
-#ifdef PRINTPRED
-       ModalDev(Histogram,MedianPred,2.0,&hi,&lo);
-       fprintf(stdout,"%d %10.5f\n",data[head].time,
-               PRED(TOT_MAE_PRED,data[prev]));
-       
-       fflush(stdout);
-#endif
-
-       return;
-
-}
-
-void
-InitThruputPrediction(struct thruput_pred *tp)
-{
-       int i;
-
-       tp->head = 0;
-       tp->tail = 0;
-
-/* ** NOT yet as we don't quite know what min and max values to use
-
-       Histogram = DefineHistogram(MODES,
-                       DIM,
-                       Histomin,
-                       Histomax);
-       MeanPred = DefineHistogramPred(Histogram);
-       MedianPred = DefineHistogramPred(Histogram);
-       MiddlePred = DefineHistogramPred(Histogram);
-*/
-
-
-        tp->mean = 0.0;
-        tp->run_mean = 0.0;
-        tp->total = 0.0;
-       memset(tp->data,0,sizeof(tp->data));
-
-       for(i=0; i < PREDS; i++)
-       {
-               TPMSE(tp,i) = 0.0;
-               TPCOUNT(tp,i) = 0.0;
-       }
-
-       return;
-}
-
-/* not sure if exptime is right, I just wanted to avoid namespace collisions */
-void
-UpdateThruputPrediction(struct thruput_pred *tp,float value, time_t exptime)
-{
-
-       int head = tp->head;
-       int tail = tp->tail;
-       struct value_el *data = tp->data;
-       int i;
-        int data_size = MODMINUS(head,tail,HISTORYSIZE);
-
-       tp->data[tp->head].time = exptime;
-       tp->data[tp->head].value = value;
-
-       /*
-        * a negative tail value says that we haven't filled the
-        * pipe yet.  See if this does it.
-        */
-       if(data_size > MIN_DATA_HISTORY)
-       {
-               ThruputPrediction(tp);
-
-       }
-       else
-       {
-               for(i=0; i < PREDS; i++)
-               {
-                       PRED(i,data[head]) = tp->data[head].value;
-                       TPMSE(tp,i) = 0.0;
-                       TPMAE(tp,i) = 0.0;
-                       ERR(i,data[head]) = 0.0;
-                       SQERR(i,data[head]) = 0.0;
-                       MedWIN(i,data[head]) = WIN_INIT;
-                       MeanWIN(i,data[head]) = WIN_INIT;
-               }
-               TPPREDNUM(tp,TOT_MSE_PRED) = 0;
-               TPPREDNUM(tp,TOT_MAE_PRED) = 0;
-       }
-
-
-
-       tp->head = MODPLUS(head,1,HISTORYSIZE);
-
-       /*
-        * if we have incremented head forward to that it is sitting on
-        * top of tail, then we need to bump tail.  The entire buffer is
-        * being used to fill the window.
-        */
-       if(tp->head == tp->tail)
-               tp->tail = MODPLUS(tp->tail,1,HISTORYSIZE);
-
-       return;
-}
-
-#ifdef STANDALONE
-
-#define PRED_ARGS "f:d:s:l:h:"
-
-#include "format.h"
-
-CalculateThruputPredictors(fname,tp)
-char *fname;
-struct thruput_pred *tp;
-{
-       FILE *fd;
-       char line_buf[255];
-       char *cp;
-       time_t ltime;
-       float value;
-       int i;
-
-
-       fd = fopen(fname,"r");
-
-       if(fd == NULL)
-       {
-               fprintf(stderr,
-                       "CalculateThruputPredictors: unable to open file %s\n",
-                               fname);
-               fflush(stderr);
-               exit(1);
-       }
-
-       while(fgets(line_buf,255,fd))
-       {
-               cp = line_buf;
-
-               while(isspace(*cp))
-                       cp++;
-
-               for(i=1; i < TSFIELD; i++)
-               {
-                       while(!isspace(*cp))
-                               cp++;
-
-                       while(isspace(*cp))
-                               cp++;
-               }
-
-               ltime = atoi(cp);
-
-               cp = line_buf;
-
-               for(i=1; i < VALFIELD; i++)
-               {
-                       while(!isspace(*cp))
-                               cp++;
-
-                       while(isspace(*cp))
-                               cp++;
-               }
-
-               value = atof(cp);
-
-               if(value != 0.0)
-                       UpdateThruputPrediction(tp,value,ltime);
-
-       }
-
-       fclose(fd);
-}
-
-
-struct thruput_pred Tp;
-
-main(argc,argv)
-int argc;
-char *argv[];
-{
-
-       FILE *fd;
-       int i;
-       int j;
-       double temp_mse;
-       double temp_mpe;
-       char fname[255];
-       char c;
-
-
-       if(argc < 2)
-       {
-               fprintf(stderr,"usage: testpred filename\n");
-               fflush(stderr);
-               exit(1);
-       }
-
-       fname[0] = 0;
-       Histodim = DIM;
-       Histostates = STATES;
-       Histomax = HMAX;
-       Histomin = HMIN;
-
-       while((c = getopt(argc,argv,PRED_ARGS)) != EOF)
-       {
-               switch(c)
-               {
-                       case 'f':
-                               SAFESTRCPY(fname,optarg);
-                               break;
-                       case 'd':
-                               Histodim = atoi(optarg);
-                               break;
-                       case 's':
-                               Histostates = atoi(optarg);
-                               break;
-                       case 'l':
-                               Histomin = atof(optarg);
-                               break;
-                       case 'h':
-                               Histomax = atof(optarg);
-                               break;
-               }
-       }
-
-       if(fname[0] == 0)
-       {
-               fprintf(stderr,"usage: predictor -f fname [-d,s,l,h]\n");
-               fflush(stderr);
-               exit(1);
-       }
-
-       InitThruputPrediction(&Tp);
-                               
-#if !defined(PRINTPRED)
-       fprintf(stdout,"Calculating throughput predictors...");
-       fflush(stdout);
-#endif
-
-       CalculateThruputPredictors(fname,&Tp);
-
-       fprintf(stdout,"done.\n");
-       fflush(stdout);
-
-       for(i=0; i < PREDS; i++)
-       {
-
-               fprintf(stdout,"Predictor %d, MSE: %3.4f MAE: %3.4f, %s\n",
-                       i,TPMSE(&Tp,i)/TPCOUNT(&Tp,i),
-                               TPMAE(&Tp,i)/TPCOUNT(&Tp,i),
-                               NAME(i));
-       }
-
-       fprintf(stdout,"MSE within 1 dev: %3.2f, 2 dev: %3.2f\n",
-                       Onedev_mse/Devcounts,Twodev_mse/Devcounts);
-       fprintf(stdout,"MAE within 1 dev: %3.2f, 2 dev: %3.2f\n",
-                       Onedev_mpe/Devcounts,Twodev_mpe/Devcounts);
-       fprintf(stdout,"Modal within 1 dev: %3.2f, 2 dev: %3.2f\n",
-                       Onedev_modal/Devcounts,Twodev_modal/Devcounts);
-
-
-#ifdef GROT
-       fprintf(stdout,"\nlook ahead  MSE  MAE\n");
-       for(i=0; i < LIFETIMES; i++)
-       {
-               temp_mse = 0.0;
-               temp_mpe = 0.0;
-               for(j=0; j <= i; j++)
-               {
-                       temp_mse += (Lifetime_mse[j]/(double)Lifetime_count);
-                       temp_mpe += (Lifetime_mpe[j]/(double)Lifetime_count);
-               }
-               fprintf(stdout,"%d %f %f\n",i,
-                               temp_mse/(double)j,
-                               temp_mpe/(double)j);
-       }
-#endif
-
-       fprintf(stdout,"Histogram\n");
-       PrintHistogram(Histogram);
-       fprintf(stdout,"\n");
-
-       exit(0);
-
-       
-}
-#endif
diff --git a/src/nws_portability/Forecast/run_mean.c b/src/nws_portability/Forecast/run_mean.c
deleted file mode 100644 (file)
index a089124..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $Id$ */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <strings.h>
-
-#include "fbuff.h"
-#include "run_mean.h"
-
-struct run_mean_state
-{
-       fbuff series;                   /* the series so far */
-       fbuff time_stamps;              /* the time stamps */
-       double total;
-       double count;
-};
-
-/*
- * init local state.  can save a copy of the pointer to the
- * series and time stamps, if desired
- */
-char *
-InitRunMean(fbuff series, fbuff time_stamps, char *params)
-{
-       struct run_mean_state *state;
-       
-       state = (struct run_mean_state *)
-               malloc(sizeof(struct run_mean_state));
-       
-       if(state == NULL)
-       {
-               return(NULL);
-       }
-       
-       /*
-        * all functions take a forcb
-        */
-       state->series = series;
-       state->time_stamps = time_stamps;
-       state->total = 0.0;
-       state->count = 0.0;
-       
-       return((char *)state);
-}
-
-void
-FreeRunMean(char *state)
-{
-       free(state);
-       return;
-}
-
-void
-UpdateRunMean(char *state,
-               double ts,
-               double value)
-{
-       struct run_mean_state *s;
-       
-       s = (struct run_mean_state *)state;
-       
-       s->total += value;
-       s->count += 1.0;
-       return;
-}
-
-int
-ForcRunMean(char *state, double *v)
-{
-       double val;
-       struct run_mean_state *s = (struct run_mean_state *)state;
-       
-       if(s->count != 0.0)
-       {
-               val = s->total / s->count;
-               *v = val;
-               return(1);
-       }
-       else
-       {
-               *v = 0.0;
-               return(0);
-       }
-}
-
-
diff --git a/src/nws_portability/Include/.cvsignore b/src/nws_portability/Include/.cvsignore
deleted file mode 100644 (file)
index 8426c89..0000000
+++ /dev/null
@@ -1 +0,0 @@
-config_portability.h
diff --git a/src/nws_portability/Include/Makefile b/src/nws_portability/Include/Makefile
deleted file mode 100755 (executable)
index c018647..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Makefile for Include
-#
-# $Id$
-#
-
-# include common variables
-include ../Makedefs
-
-# headers to be installed 
-HEADERS =      diagnostic.h \
-               dnsutil.h \
-               formatutil.h \
-               messages.h \
-               osutil.h \
-               protocol.h \
-               config_portability.h \
-               strutil.h \
-               fbuff.h \
-               timeouts.h \
-               forecast_api.h
-
-.PHONY: all clean dist install
-
-all: 
-       @$(CP) $(HEADERS) $(buildincdir)
-
-clean:
-
-dist:
-       @$(INSTALL) -d $(DIST_ROOT)/Include
-       @$(CP) Makefile *.h.in *.h $(DIST_ROOT)/Include
-
-install:
-       @echo "Installing header files..."
-       @$(CP) $(HEADERS) $(incdir)
-
diff --git a/src/nws_portability/Include/config_portability.h.in b/src/nws_portability/Include/config_portability.h.in
deleted file mode 100644 (file)
index 7bf83a3..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/* $Id$ */
-
-#ifndef CONFIG_PORTABILITY_H
-#define CONFIG_PORTABILITY_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef NULL
-#  define NULL 0
-#endif
-
-/* Have standard C headers. */
-#undef STDC_HEADERS
-
-/* Preserve 2.0 interface with this definition */
-#undef NWS_API_COMPAT
-
-/* Define to `int' if <sys/types.h> doesn't define.  */
-#undef pid_t
-
-/* Define if you have the alarm function.  */
-#undef HAVE_ALARM
-
-/* Define if you have inet_ntoa */
-#undef HAVE_INET_ATON
-
-/* Define if you have inet_ntoa */
-#undef HAVE_INET_NTOA
-
-/* Define if you have gettimeofday */
-#undef HAVE_GETTIMEOFDAY
-
-/* Define if you have gethostname. Some OSes doesn't have the definition
- * in the include: define it here to avoid warning message. */
-#undef HAVE_GETHOSTNAME
-#ifdef HAVE_GETHOSTNAME
-int
-gethostname();  
-#endif
-
-/* Define if you have uname */
-#undef HAVE_UNAME
-
-/* Define if you have gethostbyname */
-#undef HAVE_GETHOSTBYNAME
-
-/* Define if you have gethostbyaddr */
-#undef HAVE_GETHOSTBYADDR
-
-/* Define if you have gethostbyaddr */
-#undef HAVE_GETHOSTBYADDR_R
-
-/* Define if you have the getrusage function.  */
-#undef HAVE_GETRUSAGE
-
-/* Define if you have the sqrt function.  */
-#undef HAVE_SQRT
-
-/* Define if we are going to use SIGALRM for our purposes */
-#undef USE_ALARM_SIGNAL
-
-/* Define if you have the sighold function.  */
-#undef HAVE_SIGHOLD
-
-/* Define if you have the sigrelse function.  */
-#undef HAVE_SIGRELSE
-
-/* Define if you have the siginterrupt function.  */
-#undef HAVE_SIGINTERRUPT
-
-/* Define if you have the statvfs function.  */
-#undef HAVE_STATVFS
-
-/* Define if you have the sys/vfs.h header.  */
-#undef HAVE_SYS_VFS_H
-
-/* Define if you have the math.h header.  */
-#undef HAVE_MATH_H
-
-/* Define if you have the inttypes.h header.  */
-#undef HAVE_INTTYPES_H
-
-/* Define if you have the declaration of uint32_t.  */
-#undef HAVE_UINT32_T
-/* I would love to use UINT32_T but not with autoconf 2.13 */
-/*#ifdef HAVE_UINT32_T
-* #    ifdef HAVE_INTTYPES_H
-* #            include <inttypes.h>
-* #    endif
-* typedef uint32_t IPAddress;
-* #else
-* typedef unsigned long IPAddress;
-* #endif */
-/* kludge to be sure we have uint32_t */
-#ifdef HAVE_INTTYPES_H
-#      include <inttypes.h>
-#endif
-#ifndef uint32_t
-#undef uint32_t
-#endif
-/* end kludge*/
-
-/* Define if you have the sysconf function.  */
-#undef HAVE_SYSCONF
-
-/* Define if you have the strnlen function.  */
-#undef HAVE_STRNLEN
-
-/* Define if you have the fileno function.  */
-#undef HAVE_FILENO
-
-/* Define to the type pointed to by the third parameter of getpeername(). */
-#undef SOCKLEN_T
-
-/* Define to the (char *) version of the NWS sources. */
-#undef VERSION
-
-/* Define as the path to the `uptime' program. */
-#undef UPTIME_PATH
-
-/* Define as the path to the `vmstat' program. */
-#undef VMSTAT_PATH
-
-/* in some realloc()s, realloc(ptr, 0) != free(ptr) */
-#undef REALLOC_NOT_POSIX
-
-/* do we have the pthread header? (and hopefully pthread support) */
-#undef HAVE_PTHREAD_H
-#ifdef HAVE_PTHREAD_H
-#define _REENTRANT
-#endif
-
-#undef PS
-
-#undef AWK
-
-#undef WITH_NETLOGGER
-
-#undef WITH_LDAP
-
-
-#define MALLOC(size) malloc ((size)==0?1:(size))
-
-#define FREE(ptr) \
-        if (ptr != NULL) { \
-               free(ptr); \
-               ptr = NULL; \
-       }
-
-
-#ifdef REALLOC_NOT_POSIX
-#define REALLOC(ptr,size) (((size > 0)?((ptr == NULL)?malloc(size):\
-       realloc(ptr,size)):((ptr == NULL)?NULL:(free(ptr),NULL))))
-#else
-#define REALLOC(ptr,size) realloc(ptr,size)
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* CONFIG_PORTABILITY_H */
diff --git a/src/nws_portability/Include/diagnostic.h b/src/nws_portability/Include/diagnostic.h
deleted file mode 100644 (file)
index d910eb9..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-/* $Id$ */
-
-
-#ifndef DIAGNOSTIC_H
-#define DIAGNOSTIC_H
-
-
-/*
- * This module manages the production of diagnostic messages.
- */
-
-
-#include <stdio.h> /* FILE */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
-** Different types of diagnostics.
-*/
-typedef enum {DIAGLOG, DIAGINFO, DIAGWARN, DIAGERROR, DIAGFATAL, DIAGDEBUG} DiagLevels;
-
-
-#define DIAGSUPPRESS 0
-
-/* 
- * Maximum size for the message and for filenames
- */
-#define MAX_MESSAGE_LENGTH 512
-#define MAX_FILENAME_LENGTH 512
-
-/*
-** Directs #level#-level diagnostic messages to the file #whereTo#.  Messages
-** for any level may be supressed by passing DIAGSUPPRESS as the second
-** parameter to this routine.  By default, all messages are suppressed.
-*/
-void
-DirectDiagnostics(DiagLevels level,
-                  FILE *whereTo);
-
-
-/*
-** Returns the file to which #level#-level diagnostics are being directed.  May
-** be used to save off the direction for a change/restore, or for writing out
-** non-message-based information.
-*/
-FILE *
-DiagnosticsDirection(DiagLevels level);
-
-
-/*
-** Produces the #level#-level diagnostic message #message#, which is used as
-** the format string in a call to fprintf().  #sourcefilename# and
-** #sourcelinenumber# are appended to the message.  Additional fprintf()
-** arguments may be passed after #message#.
-*/
-void
-PositionedDiagnostic(DiagLevels level,
-                     const char *fileName, 
-                     int line,
-                     const char *message,
-                     ...);
-
-
-/*
-** Produces the #level#-level diagnostic message #message#, which is used as
-** the format string in a call to fprintf().  Additional fprintf()
-** arguments may be passed after #message#.
-*/
-void
-Diagnostic(DiagLevels level,
-           const char *message,
-           ...);
-
-
-/*
-** These macros are provided for the usual case where DIAGFATAL messages are
-** emitted just before aborting the program and DIAGERROR messages just before
-** returning a failure value from a function.  The ERROR, WARN, INFO, and LOG
-** macros are just a handy shorthand.  Unfortunately, the varargs concept
-** doesn't extend to macros, which means separate macros have to be defined for
-** various parameter counts.  The peculiar use of do ... while here prevents
-** compilation problems in cases such as:
-** if (foo < bar) FAIL("ick!"); else something();
-** The embedded if (1) satisfies the picky compilers that complain about
-** execution not reaching the loop test otherwise.
-*/
-#define ABORT(message) \
-  do { \
-    PositionedDiagnostic(DIAGFATAL,__FILE__, __LINE__,message); \
-    if (1) exit(1); \
-  } while (0)
-#define ABORT1(message,a) \
-  do { \
-    PositionedDiagnostic(DIAGFATAL,__FILE__,__LINE__,message,a); \
-    if (1) exit(1); \
-  } while (0)
-#define ABORT2(message,a,b) \
-  do { \
-    PositionedDiagnostic(DIAGFATAL,__FILE__,__LINE__,message,a,b); \
-    if (1) exit(1); \
-  } while (0)
-#define ABORT3(message,a,b,c) \
-  do { \
-    PositionedDiagnostic(DIAGFATAL,__FILE__,__LINE__,message,a,b,c); \
-    if (1) exit(1); \
-  } while (0)
-#define ABORT4(message,a,b,c,d) \
-  do { \
-    PositionedDiagnostic(DIAGFATAL,__FILE__,__LINE__,message,a,b,c,d); \
-    if (1) exit(1); \
-  } while (0)
-#define ABORT5(message,a,b,c,d,e) \
-  do { \
-    PositionedDiagnostic(DIAGFATAL,__FILE__,__LINE__,message,a,b,c,d,e); \
-    if (1) exit(1); \
-  } while (0)
-
-#define FAIL(message) \
-  do { \
-    PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message); \
-    if (1) return(0); \
-  } while (0)
-#define FAIL1(message,a) \
-  do { \
-    PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a); \
-    if (1) return(0); \
-  } while (0)
-#define FAIL2(message,a,b) \
-  do { \
-    PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b); \
-    if (1) return(0); \
-  } while (0)
-#define FAIL3(message,a,b,c) \
-  do { \
-    PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b,c); \
-    if (1) return(0); \
-  } while (0)
-#define FAIL4(message,a,b,c,d) \
-  do { \
-    PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b,c,d); \
-    if (1) return(0); \
-  } while (0)
-#define FAIL5(message,a,b,c,d,e) \
-  do {PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b,c,d,e); \
-    if (1) return(0); \
-  } while (0)
-
-#define ERROR(message) \
-  PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message)
-#define ERROR1(message,a) \
-  PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a)
-#define ERROR2(message,a,b) \
-  PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b)
-#define ERROR3(message,a,b,c) \
-  PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b,c)
-#define ERROR4(message,a,b,c,d) \
-  PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b,c,d)
-#define ERROR5(message,a,b,c,d,e) \
-  PositionedDiagnostic(DIAGERROR,__FILE__,__LINE__,message,a,b,c,d,e)
-
-#define WARN(message) \
-  PositionedDiagnostic(DIAGWARN,__FILE__,__LINE__,message)
-#define WARN1(message,a) \
-  PositionedDiagnostic(DIAGWARN,__FILE__,__LINE__,message,a)
-#define WARN2(message,a,b) \
-  PositionedDiagnostic(DIAGWARN,__FILE__,__LINE__,message,a,b)
-#define WARN3(message,a,b,c) \
-  PositionedDiagnostic(DIAGWARN,__FILE__,__LINE__,message,a,b,c)
-#define WARN4(message,a,b,c,d) \
-  PositionedDiagnostic(DIAGWARN,__FILE__,__LINE__,message,a,b,c,d)
-#define WARN5(message,a,b,c,d,e) \
-  PositionedDiagnostic(DIAGWARN,__FILE__,__LINE__,message,a,b,c,d,e)
-
-#define INFO(message) \
-  PositionedDiagnostic(DIAGINFO,__FILE__,__LINE__,message)
-#define INFO1(message,a) \
-  PositionedDiagnostic(DIAGINFO,__FILE__,__LINE__,message,a)
-#define INFO2(message,a,b) \
-  PositionedDiagnostic(DIAGINFO,__FILE__,__LINE__,message,a,b)
-#define INFO3(message,a,b,c) \
-  PositionedDiagnostic(DIAGINFO,__FILE__,__LINE__,message,a,b,c)
-#define INFO4(message,a,b,c,d) \
-  PositionedDiagnostic(DIAGINFO,__FILE__,__LINE__,message,a,b,c,d)
-#define INFO5(message,a,b,c,d,e) \
-  PositionedDiagnostic(DIAGINFO,__FILE__,__LINE__,message,a,b,c,d,e)
-
-#define LOG(message) \
-  PositionedDiagnostic(DIAGLOG,__FILE__,__LINE__,message)
-#define LOG1(message,a) \
-  PositionedDiagnostic(DIAGLOG,__FILE__,__LINE__,message,a)
-#define LOG2(message,a,b) \
-  PositionedDiagnostic(DIAGLOG,__FILE__,__LINE__,message,a,b)
-#define LOG3(message,a,b,c) \
-  PositionedDiagnostic(DIAGLOG,__FILE__,__LINE__,message,a,b,c)
-#define LOG4(message,a,b,c,d) \
-  PositionedDiagnostic(DIAGLOG,__FILE__,__LINE__,message,a,b,c,d)
-#define LOG5(message,a,b,c,d,e) \
-  PositionedDiagnostic(DIAGLOG,__FILE__,__LINE__,message,a,b,c,d,e)
-
-/* /usr/include/macros.h defines a DEBUG macro, so we use DDEBUG instead. */
-#define DDEBUG(message) \
-  PositionedDiagnostic(DIAGDEBUG,__FILE__,__LINE__,message)
-#define DDEBUG1(message,a) \
-  PositionedDiagnostic(DIAGDEBUG,__FILE__,__LINE__,message,a)
-#define DDEBUG2(message,a,b) \
-  PositionedDiagnostic(DIAGDEBUG,__FILE__,__LINE__,message,a,b)
-#define DDEBUG3(message,a,b,c) \
-  PositionedDiagnostic(DIAGDEBUG,__FILE__,__LINE__,message,a,b,c)
-#define DDEBUG4(message,a,b,c,d) \
-  PositionedDiagnostic(DIAGDEBUG,__FILE__,__LINE__,message,a,b,c,d)
-#define DDEBUG5(message,a,b,c,d,e) \
-  PositionedDiagnostic(DIAGDEBUG,__FILE__,__LINE__,message,a,b,c,d,e)
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/src/nws_portability/Include/dnsutil.h b/src/nws_portability/Include/dnsutil.h
deleted file mode 100644 (file)
index 5db9e70..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/* $Id$ */
-
-
-#ifndef DNSUTIL_H
-#define DNSUTIL_H
-
-#include "config_portability.h"
-
-/**
- * This package defines some utilities for determining and converting DNS
- * machine names and IP addresses.
- */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define MAX_IP_IMAGE 15
-/* Maximum text length of an IP address, i.e. strlen("255.255.255.255") */
-
-
-/*
- * Common typedefs for all portability 
- */
-typedef uint32_t IPAddress;
-typedef int Socket;
-#define NO_SOCKET ((Socket)-1)
-
-/**
- * returns the address of the host connected to #sd#. Returns 0 on error.
- */
-IPAddress
-Peer(Socket sd);
-
-
-/**
- * Returns the DNS name of the host connected to #sd#, or descriptive text if
- * #sd# is not an inter-host connection: returns NULL in case of error
- * The value returned needs to be freed.
- */
-char *
-PeerName_r(Socket sd);
-
-/*
- * returns the port number on the other side of socket sd. -1 is returned
- * if pipes or unknown
- */
-unsigned short
-PeerNamePort(Socket sd);
-
-
-/**
- * Converts #addr# into a printable string and returns the result.  You
- * are responsible to free the returned string: can return NULL (out of
- * memory condition).
- */
-char *
-IPAddressImage_r(IPAddress addr);
-
-
-/**
- * Converts #addr# to a fully-qualified machine name and returns the result.
- * You are responsible to free the returned string: can return NULL 
- * (out of memory or error).
- */
-char *
-IPAddressMachine_r(IPAddress addr);
-
-/*
- * Converts #machineOrAddress#, which may be either a DNS name or an IP address
- * image, into a list of addresses.  Copies the list into the #atMost#-long
- * array #addressList#.  Returns the number of addresses copied, or zero on
- * error.  #atMost# may be zero, in which case the function simply returns one
- * or zero depending on whether or not #machineOrAddress# is a valid machine
- * name or IP address image.
- */
-int
-IPAddressValues(const char *machineOrAddress,
-                IPAddress *addressList,
-                unsigned int atMost);
-#define IPAddressValue(machineOrAddress,address) \
-        IPAddressValues(machineOrAddress,address,1)
-#define IsValidIP(machineOrAddress) IPAddressValues(machineOrAddress,NULL,0)
-
-
-/**
- * Returns the fully-qualified name of the host machine, or NULL if the name
- * cannot be determined.  Always returns the same value, so multiple calls
- * cause no problems.
- */
-const char *
-MyMachineName(void);
-
-
-/* DEPRECATED! These functions are going to go away: they are not thread
- * safe. */ 
-const char *
-IPAddressImage(IPAddress addr);
-const char *
-IPAddressMachine(IPAddress addr);
-const char *
-PeerName(Socket sd);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/src/nws_portability/Include/exp_smooth.h b/src/nws_portability/Include/exp_smooth.h
deleted file mode 100644 (file)
index eccb961..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/* $Id$ */
-
-#if !defined(EXP_SMOOTH_H)
-#define EXP_SMOOTH_H
-
-#include "fbuff.h"
-
-extern char *InitExpSmooth(fbuff series,
-                          fbuff time_stamps,
-                          char *params);
-
-extern void FreeExpSmooth(char *state);
-
-extern void UpdateExpSmooth(char *state,
-                           double ts,
-                           double value);
-
-extern int ForcExpSmooth(char *state, double *v);
-#endif
-
diff --git a/src/nws_portability/Include/fbuff.h b/src/nws_portability/Include/fbuff.h
deleted file mode 100644 (file)
index 2dd9181..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* $Id$ */
-
-#if !defined(FBUFF_H)
-#define FBUFF_H
-
-#define MODMINUS(a,b,m) ((a) - (b) + (((a) >= (b)) ? 0 : ((b) <= (m)) ? (m) : ((m) * (1 + (int)(b) / (int)(m)))))
-#define MODPLUS(a,b,m)  ((a) + (b) - ((((m) - (b)) > (a)) ? 0 : ((b) <= (m)) ? (m) : ((m) * (1 + (int)(b) / (int)(m)))))
-
-struct fbuff_stc
-{
-       int head;
-       int tail;
-       int size;
-       double *vals;
-};
-
-typedef struct fbuff_stc *fbuff;
-
-#define FBUFF_SIZE (sizeof(struct fbuff_stc))
-
-#define F_HEAD(fb) ((fb)->vals[(fb)->head])
-#define F_SIZE(fb) ((fb)->size)
-#define F_FIRST(fb) MODPLUS(((fb)->head),1,(fb)->size)
-#define F_LAST(fb) ((fb)->head)
-#define F_VAL(fb,i) ((fb)->vals[(i)])
-#define F_COUNT(fb) (MODMINUS((fb)->tail,(fb)->head,(fb)->size) - 1)
-#define F_TAIL(fb) ((fb)->tail)
-
-#define IS_EMPTY(fb) ((F_COUNT(fb) == 0) ? 1 : 0) 
-
-extern fbuff InitFBuff(int size);
-extern void FreeFBuff(fbuff fb);
-extern void UpdateFBuff(fbuff fb, double val);
-
-#endif
diff --git a/src/nws_portability/Include/forc.h b/src/nws_portability/Include/forc.h
deleted file mode 100644 (file)
index a1e9c30..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-#if !defined(FORC_H)
-
-#define FORC_H
-
-/*
- * forcb structure contains generic forecasting fields.  The individual
- * forecastres can see the current time series and time_stamps as well
- * as any other local state that wish to preserve.
- */
-
-#include "fbuff.h"
-#include "mse_forc.h"
-
-struct forcb_stc
-{
-       fbuff series;                   /* data series */
-       fbuff time_stamps;              /* time stamp series */
-       fbuff se_series;                /* cumulative sq. err. series */
-       fbuff ae_series;                /* cumulative ab err series */
-       double best_f;                  /* best forecast */
-       int best_i;                     /* best forecast number */
-       double best_err;                /* cum best err */
-       char *state;
-       double se;
-       double ae;
-       double count;
-       void (*update)();
-       int (*forecast)();
-       void (*free)();
-       char name[255];
-};
-
-typedef struct forcb_stc *forcb;
-
-#define FORCB_SIZE (sizeof(struct forcb_stc))
-
-
-/*
- * list of forcb structs -- used as a cookie through the interface
- */
-struct fork_list_stc
-{
-       forcb *forcs;
-       int count;
-       forcb *derived_forcs;
-       int derived_count;
-       forcb total_mse;
-       int total_mse_method;
-       forcb total_mae;
-       int total_mae_method;
-};
-
-#define FORCL_SIZE (sizeof(struct fork_list_stc))
-
-typedef struct fork_list_stc *forcl;
-
-struct forc_life_stc
-{
-       char *forc_list;
-       double lifetime;
-       double epoch_end;
-       double total;
-       double count;
-};
-#define FORCLIFE_SIZE (sizeof(struct forc_life_stc))
-
-typedef struct forc_life_stc *forclife;
-
-
-/*
- * initializes forecasting structure with as many as #max_forc_count#
- * forecasters and a circular buffer with #buff_size# values and
- * time_stamp entries.  Returns a cookie to be passed subsequently
- */
-char *
-InitForcl(int max_forc_count, int buff_size);
-
-/*
- * lifetime version 
- */
-char *
-InitForcLife(int max_forc_count, int buff_size, double lifetime);
-
-/*
- * frees forecaster state associated with cookie #i_forcl#
- */
-void
-FreeForcl(char *cookie);
-
-/*
- * lifetime version
- */
-void
-FreeForcLife(char *state);
-
-
-/*
- * updates forecaster state associated with #cookie# using #value#
- * and #time_stamp#.  Neither #value# nore #time_stamp# are checked
- * for validity
- */
-void
-UpdateForecasts(char *cookie, double time_stamp, double value);
-
-/*
- * lifetime version
- */
-void
-UpdateForcLife(char *state, double ts, double value);
-
-/*
- * returns value and lifetime from series (may be averages)
- */
-double
-LifetimeValue(char *state);
-
-double
-LifetimeTimestamp(char *state);
-
-
-
-/*
- * generates MSE nd MAE forecasts value for data associated with #cookie#
- */
-double MSEForecast(char *cookie);
-double MSEOptForecast(char *cookie);
-double MSEError(char *cookie);
-int MSEMethod(char *cookie);
-int MSEOptMethod(char *cookie);
-double MAEForecast(char *cookie);
-double MAEOptForecast(char *cookie);
-double MAEError(char *cookie);
-int MAEMethod(char *cookie);
-int MAEOptMethod(char *cookie);
-
-/*
- * same API for versions that take a lifetime and forecast the average
- */
-double MSELifetimeForecast(char *cookie);
-double MSELifetimeError(char *cookie);
-int MSELifetimeMethod(char *cookie);
-double MSELifetimeEpoch(char *cookie);
-double MAELifetimeForecast(char *cookie);
-double MAELifetimeError(char *cookie);
-int MAELifetimeMethod(char *cookie);
-double MAELifetimeEpoch(char *cookie);
-
-/*
- * prints the low and high forecasts and their forecast numbers
- */
-int
-ForcRange(char *cookie, double *low, double *high, int *low_i, int *high_i);
-
-/*
- * prints a summary of forecaster state
- */
-void PrintForecastSummary(char *state);
-void PrintLifetimeForecastSummary(char *state);
-
-/*
- * routine put in to support FORECASTAPI_MethodName which doesn't
- * take a state record
- */
-void GetForcNames(char *state, 
-                 char *methodNames[], 
-                 int max_size, 
-                 int *out_size);
-
-/*
- * generic interface requiring no size parameterization -- could waste
- * space
- */
-
-/*
- * maximum number of forecasters
- */
-#define MAX_FORC (35)
-
-/*
- * default size of circular buffer
- */
-#define MAX_DATA_ENTRIES (100)
-
-#define INITFORECASTER() (InitForcl(MAX_FORC,MAX_DATA_ENTRIES))
-#define FREEFORECASTER(cookie) (FreeForcl(cookie))
-#define UPDATEFORECASTER(cookie,ts,v) (UpdateForecasts((cookie),(ts),(v)))
-#define FORECAST(cookie) (MSEForecast((cookie)))
-
-#define DBIG_VAL (999999999999999999999999999.99)
-#define FORE_ERROR_VAL (DBIG_VAL)
-
-
-#endif
diff --git a/src/nws_portability/Include/forecast_api.h b/src/nws_portability/Include/forecast_api.h
deleted file mode 100644 (file)
index b1f6d17..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/* $Id$ */
-
-#ifndef FORECAST_API_H
-#define FORECAST_API_H
-
-
-#include <sys/types.h>  /* size_t */
-
-
-/*
- * This file defines the API for the Network Weather Service forecast-
- * generation library.  The functions defined here allow programs to compute
- * forecasts from time-stamp/value pairs. The logic of operation is: 
- *     - create a new ForecasterState
- *     - Update the state with values you observe
- *     - get a forecast back
- *
- * NOTE: In order to avoid name collisions, all names defined here begin with
- * FORECASTAPI_.  To avoid having to use this prefix, #define
- * FORECASTAPI_SHORTNAMES before #include'ing this file.
- */
-
-
-/*
- * A description of a measurement.  The time the measurement was taken
- * (represented as a number of seconds since midnight, 1/1/1970 GMT) and the
- * observed value.
- */
-typedef struct {
-  double timeStamp;
-  double measurement;
-} FORECASTAPI_Measurement;
-
-
-/*
- * A description of a forecast.  The forecast value itself, an estimate of the
- * precision of the forecast, and an index for the method used to generate it.
- */
-typedef struct {
-  double forecast;
-  double error;
-  unsigned int methodUsed;
-} FORECASTAPI_Forecast;
-
-
-/**
- * A description of a collection of forecasts, each one based on minimizing a
- * different measurement of the error (MAE == MEAN_ABSOLUTE_ERROR, MSE ==
- * MEAN_SQUARE_ERROR).  The actual measurement taken at the same time is
- * included for convenience when available.
- */
-#define FORECASTAPI_FORECAST_TYPE_COUNT 2
-#define FORECASTAPI_MAE_FORECAST 0
-#define FORECASTAPI_MSE_FORECAST 1
-typedef struct {
-       FORECASTAPI_Measurement measurement;
-       FORECASTAPI_Forecast forecasts[FORECASTAPI_FORECAST_TYPE_COUNT];
-} FORECASTAPI_ForecastCollection;
-
-
-/**
- * A description of a forecasting state.  Client code should obtain these
- * structures via NewForecastState(), update them with new values via
- * UpdateForecastState(), then delete them via FreeForecastState().
- */
-struct FORECASTAPI_ForecastStateStruct;
-typedef struct FORECASTAPI_ForecastStateStruct FORECASTAPI_ForecastState;
-
-
-/**
- * Frees the memory occupied by the forecasting state pointed to by #state#
- * and sets #state# to NULL.
- */
-void
-FORECASTAPI_FreeForecastState(FORECASTAPI_ForecastState **state);
-
-
-/**
- * Returns the name of the #methodIndex#th forecasting method used by the
- * forecasting library, or NULL if #methodIndex# is out of range.
- */
-const char *
-FORECASTAPI_MethodName(unsigned int methodIndex);
-
-
-/**
- * Allocates and returns a new forecasting state, or NULL if memory is
- * exhausted.  The caller should eventually call FreeForecastingState() to
- * free the memory.
- */
-FORECASTAPI_ForecastState *
-FORECASTAPI_NewForecastState(void);
-
-
-/**
- * Incorporates the #howManyMeasurements#-long series #measurements# into the
- * forecasting state #state#.  If #forecasts# is non-NULL, it points to a
- * #howManyForecasts#-long array into which the function should store
- * forecasts generated during the course of the update  If #howManyForecasts#
- * is less than #howManyMeasurements#, the forecasts derived from the later
- * measurements (which appear at the beginning of #measurements#) are stored.
- */
-void
-FORECASTAPI_UpdateForecastState(FORECASTAPI_ForecastState *state,
-                                const FORECASTAPI_Measurement *measurements,
-                                size_t howManyMeasurements,
-                                FORECASTAPI_ForecastCollection *forecasts,
-                                size_t howManyForecasts);
-#define FORECASTAPI_UpdateForecast(state, measurements, howMany) \
-       FORECASTAPI_UpdateForecastState(state, measurements, howMany, NULL, 0)
-
-/**
- * Return a set of forecast base on the current state of the forecaster.
- * #forecast# need to have space for at least one ForecastCollection.
- *
- * Return 1 in case of error, 0 otherwise.
- *
- * Warning: The measurement insite the Collection is not meaningful.
- */
-int
-FORECASTAPI_ComputeForecast(   FORECASTAPI_ForecastState *state,
-                               FORECASTAPI_ForecastCollection *forecast);
-
-#ifdef FORECASTAPI_SHORTNAMES
-
-#define Measurement FORECASTAPI_Measurement
-#define Forecast FORECASTAPI_Forecast
-#define FORECAST_TYPE_COUNT FORECASTAPI_FORECAST_TYPE_COUNT
-#define MAE_FORECAST FORECASTAPI_MAE_FORECAST
-#define MSE_FORECAST FORECASTAPI_MSE_FORECAST
-#define ForecastCollection FORECASTAPI_ForecastCollection
-#define ForecastStateStruct FORECASTAPI_ForecastStateStruct
-#define ForecastState FORECASTAPI_ForecastState
-#define FreeForecastState FORECASTAPI_FreeForecastState
-#define MethodName FORECASTAPI_MethodName
-#define NewForecastState FORECASTAPI_NewForecastState
-#define UpdateForecastState FORECASTAPI_UpdateForecastState
-#define UpdateForecast FORECASTAPI_UpdateForecast
-#define ComputeForecast FORECASTAPI_ComputeForecast
-
-#endif
-
-#endif
diff --git a/src/nws_portability/Include/forecasters.h b/src/nws_portability/Include/forecasters.h
deleted file mode 100644 (file)
index 9858f06..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/* $Id$ */
-
-#include "last_value.h"
-#include "exp_smooth.h"
-#include "median.h"
-#include "run_mean.h"
diff --git a/src/nws_portability/Include/formatutil.h b/src/nws_portability/Include/formatutil.h
deleted file mode 100644 (file)
index e18c225..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/* $Id$ */
-
-
-#ifndef FORMATUTIL_H
-#define FORMATUTIL_H
-
-
-/*
-** This package provides utilities for translating between host and network
-** data formats.  It may be thought of as an extention of the Unix {hn}to{nh}*
-** functions or as a lightweight version of XDR.  It handles big-to-little
-** endian translations, integer size discrepencies, and conversions to/from
-** IEEE floating point format.  It does *not* presently handle either non-two's
-** complement integer formats or mixed-endian (e.g., little endian bytes, big
-** endian words) ordering.  These are so rare and generally archaic that
-** handling them seems not worth the added code.  Note: compiling the body of
-** this package with NORMAL_FP_FORMAT defined will yield a tiny performance
-** improvement and a small savings in code size by eliminating the IEEE
-** conversion code.
-*/
-
-
-#include <stddef.h>    /* offsetof() */
-#include <sys/types.h> /* size_t */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
-** Supported data types.  "Network format" characters are one byte and longs
-** four bytes; otherwise, the formats are those used by Java: two byte shorts,
-** four byte ints and floats, eight byte doubles; two's compliment integer and
-** IEEE 754 floating point; most-significant bytes first.
-*/
-typedef enum
-  {CHAR_TYPE, DOUBLE_TYPE, FLOAT_TYPE, INT_TYPE, LONG_TYPE, SHORT_TYPE,
-   UNSIGNED_INT_TYPE, UNSIGNED_LONG_TYPE, UNSIGNED_SHORT_TYPE, STRUCT_TYPE}
-  DataTypes;
-#define SIMPLE_TYPE_COUNT 9
-typedef enum {HOST_FORMAT, NETWORK_FORMAT} FormatTypes;
-
-
-/*
-** A description of a collection of #type# data.  #repetitions# is used only
-** for arrays; it contains the number of elements.  #offset# is used only for
-** struct members in host format; it contains the offset of the member from the
-** beginning of the struct, taking into account internal padding added by the
-** compiler for alignment purposes.  #members#, #length#, and #tailPadding# are
-** used only for STRUCT_TYPE data; the #length#-long array #members# describes
-** the members of the nested struct, and #tailPadding# indicates how many
-** padding bytes the compiler adds to the end of the structure.
-*/
-typedef struct DataDescriptorStruct {
-  DataTypes type;
-  size_t repetitions;
-  size_t offset;
-  struct DataDescriptorStruct *members;
-  size_t length;
-  size_t tailPadding;
-} DataDescriptor;
-#ifndef NULL
-#define NULL 0
-#endif
-#define SIMPLE_DATA(type,repetitions) {type, repetitions, 0, NULL, 0, 0}
-#define SIMPLE_MEMBER(type,repetitions,offset) \
-  {type, repetitions, offset, NULL, 0, 0}
-#define PAD_BYTES(structType,lastMember,memberType,repetitions) \
-  sizeof(structType) - offsetof(structType, lastMember) - \
-  sizeof(memberType) * repetitions
-
-
-/*
-** Translates the data pointed to by #source# between host and network formats
-** and stores the result in #destination#.  The contents of #source# are
-** described by the #length#-long array #description#, and #sourceFormat#
-** indicates whether we're translating from host format to network format or
-** vice versa.  The caller must insure that the memory pointed to by
-** #destination# is of sufficient size to contain the translated data.
-*/
-void
-ConvertData(void *destination,
-            const void *source,
-            const DataDescriptor *description,
-            size_t length,
-            FormatTypes sourceFormat);
-
-
-/*
-** Returns the number of bytes required to hold the objects indicated by the
-** data described by the #length#-long array #description#.  #hostFormat#
-** indicates whether the host or network format size is desired.
-*/
-size_t
-DataSize(const DataDescriptor *description,
-         size_t length,
-         FormatTypes format);
-
-
-/*
-** Returns 1 or 0 depending on whether or not the host format for #whatType#
-** differs from the network format.
-*/
-int
-DifferentFormat(DataTypes whatType);
-
-
-/*
-** Returns 1 or 0 depending on whether or not the host architecture stores
-** data in little-endian (least significant byte first) order.
-*/
-int
-DifferentOrder(void);
-
-
-/*
-** Returns 1 or 0 depending on whether or not the host data size for #whatType#
-** differs from the network data size.
-*/
-int
-DifferentSize(DataTypes whatType);
-
-
-/*
-** These two functions are a convenience that allows callers to work with
-** homogenous blocks of data without setting up a DataDescriptor.  They perform
-** the same function as the more general function on a block of #repetitions#
-** occurrences of #whatType# data.
-*/
-void
-HomogenousConvertData(void *destination,
-                      const void *source,
-                      DataTypes whatType,
-                      size_t repetitions,
-                      FormatTypes sourceFormat);
-size_t
-HomogenousDataSize(DataTypes whatType,
-                   size_t repetitions,
-                   FormatTypes format);
-
-
-/*
-** Copies #repetitions# data items of type #whatType# from #source# to
-** #destination#, reversing the bytes of each item (i.e., translates between
-** network and host byte order).  #format# indicates whether the data to be
-** reversed is in network or host format.  This is an internal package function
-** which is included in the interface for convenience.
-*/
-void
-ReverseData(void *destination,
-            const void *source,
-            DataTypes whatType,
-            int repetitions,
-            FormatTypes format);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/src/nws_portability/Include/last_value.h b/src/nws_portability/Include/last_value.h
deleted file mode 100644 (file)
index 530738c..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/* $Id$ */
-
-#if !defined(LAST_VAL_H)
-#define LAST_VAL_H
-
-#include "fbuff.h"
-
-char *InitLastValue(fbuff series, fbuff time_stamps, char *params);
-void FreeLastValue(char *state);
-void UpdateLastValue(char *state, double ts, double value); 
-int ForcLastValue(char *state, double *v);
-#endif
-
diff --git a/src/nws_portability/Include/median.h b/src/nws_portability/Include/median.h
deleted file mode 100644 (file)
index 433078d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/* $Id$ */
-
-#ifndef MEDIAN_H
-#define MEDIAN_H
-
-#define MAX_MED_SIZE 100
-
-#include "fbuff.h"
-
-char *InitMedian(fbuff series, fbuff time_stamps, char *params);
-void FreeMedian(char *state);
-void UpdateMedian(char *state, double ts, double value);
-int ForcMedian(char *state, double *forecast);
-
-char *InitTrimMedian(fbuff series, fbuff time_stamps, char *params);
-void FreeTrimMedian(char *state);
-void UpdateTrimMedian(char *state, double ts, double value);
-int ForcTrimMedian(char *state, double *forecast);
-
-char *InitAdMedian(fbuff series, fbuff time_stamps, char *params);
-void FreeAdMedian(char *state);
-void UpdateAdMedian(char *state, double ts, double value);
-int ForcAdMedian(char *state, double *forecast);
-
-#endif
-
diff --git a/src/nws_portability/Include/messages.h b/src/nws_portability/Include/messages.h
deleted file mode 100644 (file)
index ffe3858..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/* $Id$ */
-
-#ifndef MESSAGES_H
-#define MESSAGES_H
-
-/*
- * This package defines NWS functions for sending messages between hosts.
- */
-
-#include <sys/types.h>  /* size_t */
-#include "formatutil.h" /* DataDescriptor */
-#include "protocol.h"   /* Socket */
-#ifdef WITH_LDAP
-#include <ldap.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * This is the four-byte NWS version number.  The first two bytes are
- * major and minor release numbers; the meaning of the other two bytes is
- * undefined.
- */
-#define NWS_VERSION 0x02030000
-
-
-typedef unsigned int MessageType;
-
-/** 
- * this is the message header: it contains the NWS version (if I don't
- * forget to update) so that we can try to be backward compatible, the
- * message type and the data size. Upwn recepit of a message this is
- * what is passed to the listener along with the open socket.
- */
-typedef struct {
-       unsigned int version;
-       MessageType message;
-       size_t dataSize;
-} MessageHeader;
-
-
-typedef void (*ListenFunction)(Socket *, MessageHeader);
-typedef int (*LdapListenFunction)(Socket *);
-
-
-/**
- * Waits up to #timeOut# seconds to see if a message comes in; if so,
- * calls the registered listener for that message (see
- * RegisterListener()).
- */
-void
-ListenForMessages(double timeOut);
-
-
-/**
- * Indicates a desire that the function #listener# be called whenever a
- * #message# message comes in.  #image# is a printable message name; it's
- * used to log the arrival of the message.
- */
-void
-RegisterListener(MessageType message,
-                 const char *image,
-                 ListenFunction listener);
-
-
-#ifdef WITH_LDAP
-/*
-** Indicates a desire that the function #listener# be called whenever an
-** LDAP message comes in.  Only one LDAP listener may be active at a time.
-*/
-void
-RegisterLdapListener(LdapListenFunction listener);
-
-
-/*
-** Sends an unsolicited notification of disconnection on *sd, then shut down
-** the socket.  See the LDAP RFC for details on this message.
-*/
-void
-SendLdapDisconnect (Socket *sd,
-                    ber_int_t resultCode);
-#endif
-
-
-/**
- * Receives on #sd#, into #data#, the data described by the #howMany#-long
- * array of descriptors #description#.  Returns 1 if successful within
- * #timeOut# seconds, else 0.
- * If #timeOut# is negative adaptive timeouts will be used, if it's 0 no
- * timeouts will be used.
- */
-int
-RecvData(Socket sd,
-         void *data,
-         const DataDescriptor *description,
-         size_t howMany,
-         double timeOut);
-
-
-/**
- * Waits for a #message# message to come in over #sd#.  If successful within
- * #timeOut# seconds, returns 1 and copies the size of the accompanying data
- * into #dataSize#; otherwise, returns 0.
- * If #timeOut# is negative adaptive timeouts will be used, if it's 0 no
- * timeouts will be used.
- */
-int
-RecvMessage(Socket sd,
-            MessageType message,
-            size_t *dataSize,
-            double timeOut);
-
-
-/**
- * Waits for a #message# message to come in over #sd#.  If successful within
- * #timeOut# seconds, returns 1 and copies the accompanying data into #data1#
- * and #data2#, which are described by the #howMany1# and #howMany3#-long
- * arrays of descriptors #description1# and #description2#, respectively;
- * otherwise, returns 0.
- * If #timeOut# is negative adaptive timeouts will be used, if it's 0 no
- * timeouts will be used.
- */
-int
-RecvMessageAndDatas(Socket sd,
-                    MessageType message,
-                    void *data1,
-                    const DataDescriptor *description1,
-                    size_t howMany1,
-                    void *data2,
-                    const DataDescriptor *description2,
-                    size_t howMany2,
-                    double timeOut);
-#define RecvMessageAndData(sd,message,data,description,howMany,timeOut) \
-  RecvMessageAndDatas(sd,message,data,description,howMany,NULL,NULL,0,timeOut)
-
-/**
- * Sends #data#, described by the #howMany#-long array of descriptors
- * #description#.  Returns 1 if successful in #timeOut# seconds, else 0.  This
- * fuction allows callers to extend the data that accompanies messages beyond
- * the two items provided for by SendMessageAndDatas().  Note, however, that
- * since the data sent via a call to this function is not packaged with a
- * message, the receiver will not be able to determine the data size directly.
- * The caller must assure that the data size is known to the recipient, either
- * because its length is predetermined, or because its length was enclosed in a
- * previously-transmitted message.
- * If #timeOut# is negative adaptive timeouts will be used, if it's 0 no
- * timeouts will be used.
- */
-int
-SendData(Socket sd,
-         const void *data,
-         const DataDescriptor *description,
-         size_t howMany,
-         double timeOut);
-
-
-/**
- * Sends a message of type #message# on #sd# followed by #data1# and #data2#,
- * which are described, respectively, by the #howMany1#-long and the
- * #howMany2#-long arrays of descriptors #description1# and #description2#.
- * Each data parameter may be NULL, in which case its description is ignored.
- * Returns 1 if successful within #timeOut# seconds, else 0.
- * If #timeOut# is negative adaptive timeouts will be used, if it's 0 no
- * timeouts will be used.
- */
-int
-SendMessageAndDatas(Socket sd,
-                    MessageType message,
-                    const void *data1,
-                    const DataDescriptor *description1,
-                    size_t howMany1,
-                    const void *data2,
-                    const DataDescriptor *description2,
-                    size_t howMany2,
-                    double timeOut);
-#define SendMessage(sd,message,timeOut) \
-   SendMessageAndDatas(sd,message,NULL,NULL,0,NULL,NULL,0,timeOut)
-#define SendMessageAndData(sd,message,data,descriptor,howMany,timeOut) \
-   SendMessageAndDatas(sd,message,data,descriptor,howMany,NULL,NULL,0,timeOut)
-
-/**
- * reads the NWS header associated with in incoming message and returns
- * the message type #message# as an integer.  returns -1 if the read fails
- * If #timeOut# is negative adaptive timeouts will be used, if it's 0 no
- * timeouts will be used.
- */
-int RecvMsgType(Socket sd, double timeout);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* MESSAGES_H */
diff --git a/src/nws_portability/Include/mse_forc.h b/src/nws_portability/Include/mse_forc.h
deleted file mode 100644 (file)
index 4e9e368..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef MSE_FORC_H
-
-#define MSE_FORC_H
-
-#define MAX_MSE_WIN (100)
-
-/*
- * API for forc.c
- */
-int TotalMSEForecast(char *state, double *forecast);
-int TotalMAEForecast(char *state, double *forecast);
-
-char *InitWinMSE(fbuff series, fbuff time_stamps, char *params);
-char *InitWinMAE(fbuff series, fbuff time_stamps, char *params);
-void FreeWinMSE(char *state);
-void FreeWinMAE(char *state);
-int LocalWinMSEForecast(char *state, double *forecast);
-int LocalWinMAEForecast(char *state, double *forecast);
-
-#endif
diff --git a/src/nws_portability/Include/osutil.h b/src/nws_portability/Include/osutil.h
deleted file mode 100644 (file)
index 9ef63b3..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/* $Id$ */
-
-
-#ifndef OSUTIL_H
-#define OSUTIL_H
-
-
-/*
-** This package defines functions for working with operating system facilities.
-*/
-
-
-#include <sys/types.h>  /* mode_t size_t */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Returns a best-guess estimate of the number of CPUs on the system.
-*/
-int
-CPUCount(void);
-
-
-/*
-** Returns the current time in number of seconds since midnight 1/1/1970, GMT.
-*/
-double
-CurrentTime(void);
-
-
-/*
-** Returns the environment value for the variable #name#.  This value is
-** determined in one of three ways: if an environment variable of that name is
-** set, its value is used; otherwise, if a file named #rcName# in one of the
-** colon-delimited set of directories #rcDirs# contains a line of the form
-** #name#=value, then that value is used; otherwise #defaultValue# is used.
-** For convenience, a directory of "~" in #rcDirs# is expanded to the contents
-** of the HOME environment variable.
-*/
-const char *
-GetEnvironmentValue(const char *name,
-                    const char *rcDirs,
-                    const char *rcName,
-                    const char *defaultValue);
-
-
-/*
-** Attempts to determine the login id of the user running the binary.  Returns
-** 1 and copies the name into the #length#-long array name if successful, else
-** returns 0.
-*/
-int
-GetUserName(char *name,
-            size_t length);
-
-
-/*
- * Wrapper around the system signal() for the SIGALRM signal.
- * new_hanlder is the handler to be installed and old_handler (if not
- * NULL) will contain the handler to be substituted.  
- * Return 1 upon * success and 0 otherwise.
- *
- */
-typedef void(* handler)(int sig);
-int
-SignalAlarm(   handler new_handler,
-               handler *old_handler);
-
-/*
-** Prevents the O/S from raising the signal #sig# until a subsequent call to
-** ReleaseSignal() is made.
-*/
-void
-HoldSignal(int sig);
-
-
-/*
-** Creates the directory specified by #path# with mode #mode#.  If
-** #makeEntirePath# is non-zero, any missing subpaths in #path# will also be
-** created.  Returns 1 if successful, else 0.
-*/
-int
-MakeDirectory(const char *path,
-              mode_t mode,
-              int makeEntirePath);
-
-
-/*
-** Returns the number of microseconds that have elapsed since midnight, local
-** time.
-*/
-long int
-MicroTime(void);
-
-
-/*
-** Allows the O/S to raise the signal #sig#.
-*/
-void
-ReleaseSignal(int sig);
-
-
-/*
-** Starts a timer that will raise a SIGALRM in #numberOfSecs# seconds.
-*/
-void
-SetRealTimer(unsigned int numberOfSecs);
-#define RESETREALTIMER SetRealTimer(0)
-
-/**
- * Locks are handled in a peculiar way: #lock# is a void * passed in by
- * the module. If #lock# is NULL, GetNWSLock() will assign to it a mutex
- * and then it will lock it. It's up to the module to keep track of the
- * different locks.
- * Returns 1 if succesfull 0 otherwise.
- */
-int
-GetNWSLock(void **lock);
-
-/**
- * release the NWS general lock. Returns 1 if succesful, 0 otherwise.
- */
-int
-ReleaseNWSLock(void **lock);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/nws_portability/Include/predictor.h b/src/nws_portability/Include/predictor.h
deleted file mode 100644 (file)
index bdd4b3c..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/* $Id$ */
-
-#include <sys/types.h>  /* time_t */
-
-/* linux defines this in /usr/include/values.h as 1.79769313486231570e+308 */
-#ifndef MAXDOUBLE
-#define MAXDOUBLE (999999999999.0)
-#endif
-/* #define HISTORYSIZE 200*/
-/* reduce memory footprint */
-#define HISTORYSIZE 100
-#define MAX_MED_N HISTORYSIZE
-#define MIN_DATA_HISTORY 10
-
-#define PREDS 14
-#define STATIC_PREDS (PREDS - 6)
-#define SECOND_ORDER_PREDS (PREDS - 2)
-#define MSE_PRED (STATIC_PREDS)
-#define MAE_PRED (STATIC_PREDS+1)
-#define WIN_MSE_PRED (STATIC_PREDS+2)
-#define WIN_MAE_PRED (STATIC_PREDS+3)
-#define TOT_MSE_PRED (SECOND_ORDER_PREDS)
-#define TOT_MAE_PRED (SECOND_ORDER_PREDS+1)
-
-#define DYNPRED TOT_MSE_PRED
-
-#define LIFETIMES 120
-
-#define MED_N 21
-#define MED_ALPHA (0.1)
-
-#define ERR_WIN 10
-
-#define STATES 2
-#define DIM 2
-#define HMAX 10.0
-#define HMIN 0.0
-
-/*
- * for adaptive window predictors
- */
-#define WIN_MIN 5
-#define WIN_MAX 50
-#define WIN_INIT 25
-
-/*
- * for AR predictor
- */
-#define AR_N 50
-#define AR_P 20
-
-struct pred_el
-{
-       float pred;
-       double error;
-       double sq_error;
-       int medwin;
-       int meanwin;
-};
-
-struct value_el
-{
-       time_t time;
-       float value;
-       struct pred_el preds[PREDS];
-};
-
-struct thruput_pred
-{
-       int head;
-       int tail;
-       struct value_el data[HISTORYSIZE];
-
-       double mean;
-       double run_mean;
-       double total;
-
-       double mses[PREDS];
-       double mpes[PREDS];
-       double counts[PREDS];
-       int pred_nums[PREDS-STATIC_PREDS];
-};
-
-#define MODPLUS(a,b,m) (((a) + (b)) % (m))
-#define MODMINUS(a,b,m) (((a) - (b) + (m)) % (m))
-
-#define PRED(n,v) ((v).preds[(n)].pred)
-#define ERR(n,v) ((v).preds[(n)].error)
-#define SQERR(n,v) ((v).preds[(n)].sq_error)
-#define MedWIN(n,v) ((v).preds[(n)].medwin)
-#define MeanWIN(n,v) ((v).preds[(n)].meanwin)
-
-#define TPPREDNUM(tp,n) ((tp)->pred_nums[(n)-STATIC_PREDS])
-#define TPMSE(tp,n) ((tp)->mses[(n)])
-#define TPMAE(tp,n) ((tp)->mpes[(n)])
-#define TPCOUNT(tp,n) ((tp)->counts[(n)])
-
-#define CURRVAL(tp) ((tp).data[MODMINUS((tp).head,1,HISTORYSIZE)].value)
-#define CURRTIME(tp) ((tp).data[MODMINUS((tp).head,1,HISTORYSIZE)].time)
-#define CURRPRED(tp) \
-       PRED(TOT_MSE_PRED,(tp).data[MODMINUS((tp).head,1,HISTORYSIZE)])
-#define CURRMSEPRED(tp) \
-       PRED(TOT_MSE_PRED,(tp).data[MODMINUS((tp).head,1,HISTORYSIZE)])
-#define CURRMAEPRED(tp) \
-       PRED(TOT_MAE_PRED,(tp).data[MODMINUS((tp).head,1,HISTORYSIZE)])
-#define CURRMSE(tp) \
-        (TPCOUNT(&(tp),TOT_MSE_PRED) != 0.0 ?\
-       (TPMSE(&(tp),TOT_MSE_PRED)/TPCOUNT(&(tp),TOT_MSE_PRED)) : 0.0)
-#define CURRMAE(tp) \
-        (TPCOUNT(&(tp),TOT_MAE_PRED) != 0.0 ?\
-       (TPMAE(&(tp),TOT_MAE_PRED)/TPCOUNT(&(tp),TOT_MAE_PRED)) : 0.0)
-#define CURRMSEPREDNUM(tp) TPPREDNUM(&(tp),TOT_MSE_PRED)
-#define CURRMAEPREDNUM(tp) TPPREDNUM(&(tp),TOT_MAE_PRED)
-
-
-void
-InitThruputPrediction(struct thruput_pred *tp);
-
-
-void
-UpdateThruputPrediction(struct thruput_pred *tp,
-                        float value,
-                        time_t update_time);
-
-#define GAIN (0.05)
-#define LN_GAIN (0.9)
-
-#define EL(a,i,j,n) ((a)[(i)*(n)+(j)])
diff --git a/src/nws_portability/Include/protocol.h b/src/nws_portability/Include/protocol.h
deleted file mode 100644 (file)
index 3aa1d69..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-/* $Id$ */
-
-
-#ifndef PROTOCOL_H
-#define PROTOCOL_H
-
-
-/*
- * This module defines functions useful in establishing and maintaining
- * connections to other processes on local or remote hosts.  The name is an
- * anachronism.
- */
-
-
-#include <sys/types.h>    /* pid_t */
-#include "dnsutil.h"      /* IPAddress */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* A definition for socket call-back functions (see NotifyOnDisconnection()). */
-typedef void (*SocketFunction)(Socket);
-
-
-/*
- * Attempts to establish a connection to the server listening to #addr#:#port#.
- * If successful within #timeOut# seconds, returns 1 and sets #sock# to the
- * socket bound to the connection, else returns 0. A #timeOut# of 0 will
- * disable timeouts while a negative value will use adaptive timeouts.
- */
-int
-CallAddr(IPAddress addr, 
-         short port, 
-         Socket *sock,
-         double timeOut);
-
-
-/*
- * Closes connections opened via calls to this module's functions.  Each
- * parameter is a boolean value indicated whether that type of connection
- * should be included in those closed.
- */
-void
-CloseConnections(int closeEars,
-                 int closePipes,
-                 int closeSockets);
-#define CloseAllConnections() CloseConnections(1, 1, 1)
-
-
-/*
- * Tests all connections opened via calls to this module's functions and
- * closes any that are no longer connected.  Returns the number of connections
- * closed.
- */
-int
-CloseDisconnections(void);
-
-
-/**
- * Tears down #sock#.  If #waitForPeer# is non-zero, the function waits this
- * many seconds for the host on the other end to close the connection and fails
- * if no such close is detected.  If this parameter is zero, the function
- * closes #sock# immediately.  Returns 1 and sets #sock# to NO_SOCKET if
- * successful, else returns 0.
- */
-int
-CloseSocket(Socket *sock,
-            int waitForPeer);
-#define DROP_SOCKET(sock) CloseSocket(sock, 0)
-
-
-/**
- * Removed all records of #sock# from our FD_SETs
- */
-void
-ClearSocket(Socket sock);
-
-/*
-** Spawns a new process, a duplicate of the running one.  Returns 1 if
-** successful, 0 otherwise.  Returns in #pid# a 0 to the child process and the
-** process id of the child to the parent.  Both processes are given a pair of
-** connections in the Socket parameters that can be used to communicate between
-** the parent and child.  The parent process should send information to the
-** child via #parentToChild# and receive information via #childToParent#; the
-** child reads from the former and writes to the latter.  The parameters may be
-** NULL indicating that communication is unidirectional (one parameter NULL),
-** or that no communication will take place (both NULL).
-*/
-int
-CreateLocalChild(pid_t *pid,
-                 Socket *parentToChild,
-                 Socket *childToParent);
-
-
-/*
-** Attempts to bind to any port between #startingPort# and #endingPort#,
-** inclusive.  If successful, returns 1 and sets #ear# to the bound socket and
-** #earPort# to the port to which it is bound, else returns 0.
-*/
-int
-EstablishAnEar(unsigned short startingPort,
-               unsigned short endingPort,
-               Socket *ear,
-               unsigned short *earPort);
-
-
-/**
- * Checks all connections established via calls to this module for
- * incoming messages.  If one is detected within #timeOut# seconds,
- * returns 1, sets #sd# to the socket containing the message, and sets
- * #ldap# to the type of message (0 if NWS, 1 if LDAP).  If no message
- * detected, returns 0. 
- * 
- * NOTE: you have to use SocketIsAvailable to notify IncomingRequest that
- * the socket is again available (once the socket is been returned from
- * IncomingRequest) */
-int 
-IncomingRequest(double timeOut,
-                Socket *sd,
-                int *ldap);
-
-
-/**
- * When a socket is returned by IncomingRequest, that socket won't be
- * listen till this function is called.
- * Return 0 upon failure.
- */
-int
-SocketIsAvailable(Socket sd);
-
-/**
- * Tell NWS that a specific socket is still in use and IncomingRequest
- * shouldn't listen to it.
- */
-int
-SocketInUse(Socket sd);
-
-/*
-** Returns 1 or 0 depending on whether or not #sd# is connected to another
-** process.
-*/
-int
-IsOkay(Socket sd);
-
-/**
- * returns 1 or 0 depending on wheter the socket is a pipe or not 
- */
-int
-IsPipe(Socket sd);
-
-
-/*
-** Registers a function that should be called whenever a socket is disconnected,
-** either directly via a call to CloseSocket(), or indirectly because the peer
-** termintes the connection.  The function is passed the closed socket after it
-** has been closed.
-*/
-void
-NotifyOnDisconnection(SocketFunction notifyFn);
-
-
-/*
-** Pass socket #sock# along to child #child# -- call after a successful call
-** to CreateLocalChild().  The parent process will no longer listen for
-** activity on #sock#.  Closing the socket will be put off until after the
-** child dies, just in case the parent and child share descriptors.
-*/
-int
-PassSocket(Socket *sock,
-           pid_t child);
-
-
-/**
- * Receives #byteSize# bytes from connection #sd# and stores them in the
- * memory referenced by #bytes#.  The caller must assure that #bytes# is at
- * least #byteSize# bytes long.  Returns 1 if successful within #timeOut#
- * seconds, else 0.  If #timeOut# is zero, timeout are disabled alltogether.
- */
-int
-RecvBytes(Socket sd,
-          void *byte,
-          size_t byteSize,
-          double timeOut);
-
-/*
- * Sends #bytesSize# bytes from the memory pointed to by #bytes# on connection
- * #sd#.  Returns 1 if successful within #timeOut# seconds, else 0.
- * If #timeOut# is zero, timeout are disabled alltogether..
- */
-int
-SendBytes(Socket sd,
-          const void *bytes,
-          size_t byteSize,
-          double timeOut);
-
-
-/*
-** A signal handler for dealing with signals (specifically SIGPIPE) that
-** indicate a bad socket.
-*/
-void
-SocketFailure(int sig);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/nws_portability/Include/run_mean.h b/src/nws_portability/Include/run_mean.h
deleted file mode 100644 (file)
index 7fc9e1d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/* $Id$ */
-
-#if !defined(RUN_MEAN_H)
-#define RUN_MEAN_H
-
-#include "fbuff.h"
-
-char *InitRunMean(fbuff series, fbuff time_stamps, char *params);
-void FreeRunMean(char *state);
-void UpdateRunMean(char *state, double ts, double value); 
-int ForcRunMean(char *state, double *v);
-#endif
-
diff --git a/src/nws_portability/Include/strutil.h b/src/nws_portability/Include/strutil.h
deleted file mode 100644 (file)
index 06a7e55..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $Id$ */
-
-
-#ifndef STRUTIL_H
-#define STRUTIL_H
-
-
-/*
-** This module defines some useful routines for maniputing strings.
-*/
-
-#include <string.h>     /* strlen() strncpy() */
-#include <sys/types.h>  /* size_t */
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/*
-** Replaces the characters in #string# with their lower- or upper-case
-** equivalents.  #toWhatCase# specifies whether the result to be ENTIRELY
-** UPPER, entirely lower, iNITIAL lOWER, or Initial Upper.
-*/
-typedef enum {ALL_LOWER, ALL_UPPER, INITIAL_LOWER, INITIAL_UPPER} CaseTypes;
-void
-strcase(char *string,
-        CaseTypes toWhatCase);
-
-
-/*
-** Returns 1 or 0 depending on whether or not the first #len# characters of
-** #string# matches #pattern#, which may contain wildcard characters (*).
-*/
-int
-strnmatch(const char *string,
-          const char *pattern,
-          size_t len);
-#define strmatch(string,pattern) strnmatch(string, pattern, strlen(string))
-
-
-/*
-** Copies a "token" -- a series of characters deliminated by one of the chars
-** in #delim# -- from #source# to the #len#-long string #dest#.  Terminates
-** #dest# with a null character.  Returns the position within #source# of the
-** character after the token in #end#.  Skips any leading delimiters in
-** #source#.  Returns 0 if the end of source is reached without finding any
-** non-delimiter characters, 1 otherwise.
-*/
-int
-strntok(char *dest,
-        const char *source,
-        int len,
-        const char *delim,
-        const char **end);
-#define GETTOK(dest,source,delim,end) strntok(dest,source,sizeof(dest),delim,end)
-#define GETWORD(dest,source,end) GETTOK(dest,source," \t\n",end)
-
-
-/*
- * Define strnlen in case there is no such a function in the library
- * (sometimes there is not the definition in the include so we define it
- * anyway).
- */
-size_t
-strnlen(const char *s, size_t maxlen);
-
-/*
-** Calls strncpy() passing #dest#, #src#, and #len#, then places a terminating
-** character in the last (len - 1) byte of #dest#.
-*/
-#define zstrncpy(dest,src,len) \
-  do {strncpy(dest, src, len); dest[len - 1] = '\0'; if (1) break;} while (0)
-#define SAFESTRCPY(dest,src) zstrncpy(dest, src, sizeof(dest))
-
-
-/*
-** Catenates the #count#-long set of source strings into #dest#.  Copies at
-** most #len# characters, including the null terminator.
-*/
-int
-vstrncpy(char *dest,
-         size_t len,
-         int count,
-         ...);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/src/nws_portability/Include/timeouts.h b/src/nws_portability/Include/timeouts.h
deleted file mode 100644 (file)
index 3783647..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $Id$ */
-
-#ifndef TIMEOUTS_H
-#define TIMEOUTS_H
-
-/*
- * This modules defines functions used to keep track of adaptive
- * timeouts. You can use these functions to (for example) keep track of
- * how long you should wait to receive a packet from a remote host.
- */
-
-#include "dnsutil.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * We reserve timeouts for receive and send packets, connection time and
- * we leave space for 3 user definable timeouts.
- */
-typedef enum {RECV, SEND, CONN, USER1, USER2, USER3} timeoutTypes;
-#define TIMEOUT_TYPES_NUMBER 6
-
-/**
- * Sets the bounds on a specific class of timeouts. 
- */
-void
-SetDefaultTimeout(timeoutTypes type, double min, double max);
-
-/**
- * get the current defaults timeouts
- */
-void
-GetDefaultTimeout(timeoutTypes type, double *min, double *max);
-
-
-/**
- * Returns the current timeouts value for the specific class given the
- * IPAddress and the #size# of the data to be sent/received. If #size# is
- * <= 0 it will be ignored.
- */
-double
-GetTimeOut(timeoutTypes type, IPAddress addr, long size);
-
-/**
- * Reports how long it took to perform the action (say send or receive a
- * packet) last time and if it timed out and how many bytes were
- * sent/received (if applicable).
- */
-void
-SetTimeOut(timeoutTypes type, IPAddress addr, double duration, long size,  int timedOut);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* TIMEOUTS_H */
diff --git a/src/nws_portability/Makedefs.in b/src/nws_portability/Makedefs.in
deleted file mode 100644 (file)
index cef5f61..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# autoconf variables for the Portability library
-#
-# $Id$
-
-# System we configured for 
-configured     = @host@
-
-# Distribution variables
-TOP            = @TOP@/../../
-DIST_NAME      = portability.tar
-DIST_ROOT      = $(TOP)/gras-0.0.040205/src/nws_portability
-
-# System-dependent values determined by the configuration script.
-AR             = @AR@
-ARFLAGS                = @ARFLAGS@
-CC             = @CC@
-CFLAGS         = @CFLAGS@
-INCLUDES       = @INCLUDES@
-LDFLAGS                = @LDFLAGS@
-PROFILE                = @PROFILE@
-RANLIB         = @RANLIB@
-INSTALL                = @TOP@/install-sh -c
-RM             = @RM@
-CP             = @CP@
-TAR            = @TAR@
-CTAGS          = @CTAGS@
-#VERSION               = @VERSION@
-
-# where we put the objects, libraries, binaries (for the build process) etc ...
-builddir       = @NWS_TOP@/build-${configured}
-buildbindir    = $(builddir)/bin
-buildlibdir    = $(builddir)/lib
-buildincdir    = $(builddir)/include
-buildobjdir    = $(builddir)/obj
-# ... and for the install process 
-prefix         = @prefix@
-exec_prefix    = @exec_prefix@
-bindir         = @bindir@
-libdir         = @libdir@
-incdir         = @includedir@
-mandir         = @mandir@
-
-# which directories we are going to compile
-SUBDIRS                = Include Forecast
diff --git a/src/nws_portability/Makefile b/src/nws_portability/Makefile
deleted file mode 100755 (executable)
index 8153d85..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-#
-# Makefile for the Portability library
-#
-# $Id$
-
-include Makedefs
-
-# extra files to be put into the distribution
-DIST_FILES     =       Makedefs.in \
-                       Makefile \
-                       config.guess \
-                       config.sub \
-                       install-sh \
-                       configure 
-
-# these are the targets
-LIBRARY =      $(buildlibdir)/libNwsPortability.a
-
-# what we are going to put in the library
-OBJS =                 $(buildobjdir)/diagnostic.o \
-               $(buildobjdir)/dnsutil.o \
-               $(buildobjdir)/formatutil.o \
-               $(buildobjdir)/osutil.o \
-               $(buildobjdir)/messages.o \
-               $(buildobjdir)/strutil.o \
-               $(buildobjdir)/timeouts.o \
-               $(buildobjdir)/protocol.o
-
-
-.PHONY: clean confclean distclean precondition dist all common
-
-all: precondition common $(OBJS)
-       $(AR) $(ARFLAGS) $(LIBRARY) $(OBJS)
-       $(RANLIB) $(LIBRARY)
-
-common: 
-       @for subdir in $(SUBDIRS); do \
-               (cd $$subdir && $(MAKE) all) || exit $$? ; done
-
-clean:
-       @for subdir in $(SUBDIRS); do \
-               (cd $$subdir && $(MAKE) clean) || exit $$? ; done
-       @$(RM) -f $(OBJS)
-
-confclean:
-       @echo "Removing configurations files ..."
-       @$(RM) -f Makedefs Include/config_portability.h config.status config.log config.cache
-       
-distclean: confclean
-       @echo "Removing build directories ..."
-       @$(RM) -rf $(builddir) $(DIST_NAME)
-
-distdir:
-       $(INSTALL) -d $(DIST_ROOT)
-       for subdir in $(SUBDIRS); do \
-               (cd $$subdir && $(MAKE) dist) || exit $$? ; done
-       $(CP)  $(DIST_FILES) $(DIST_ROOT)
-       $(CP) *.c $(DIST_ROOT)
-
-.PHONY: install
-install: all 
-       @$(INSTALL) -d $(prefix)
-       @$(INSTALL) -d $(exec_prefix)
-       @$(INSTALL) -d $(bindir)
-       @$(INSTALL) -d $(libdir)
-       @$(INSTALL) -d $(incdir)
-       @$(CP) $(buildbindir)/* $(bindir)
-       @$(CP) $(buildlibdir)/* $(libdir)
-       @$(CP) $(buildincdir)/* $(incdir)
-
-tags:
-       $(CTAGS) -R 
-
-precondition: 
-       @if test `./config.guess` != "$(configured)"; then \
-               echo "Portability was configured for $(configured): run make confclean and reconfigure for the `./config.guess`!";\
-               exit 1; fi
-       @$(INSTALL) -d $(buildobjdir)
-       @$(INSTALL) -d $(buildlibdir)
-       @$(INSTALL) -d $(buildincdir)
-       @$(INSTALL) -d $(buildbindir)
-
-Makedefs: Makedefs.in config.status
-       ./config.status
-
-config.status: configure
-       ./configure
-
-$(buildobjdir)/%.o : %.c Include/%.h Include/config_portability.h
-       $(CC) $(INCLUDES) $(CFLAGS) -g -c $< -o $@
-       
-
diff --git a/src/nws_portability/README b/src/nws_portability/README
deleted file mode 100755 (executable)
index 7aac2ff..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-$Id$
-
-Portability
------------
-
-Portability is a library used by the Network Weather System (NWS). It
-aims to be portable and to mask sockets, threads and other low level,
-system dependent calls. It can be used independetly from the NWS, but
-documentation is quite scarse: the header files will be your best
-friends. 
-
-Compiling and installing
-------------------------
-
-To compile Portability run
-       ./configure 
-       make all
-and you will find a library libNwsPortability.a and the needed file in
-the ./build-<your-architecture>/{lib,include}. You can install them with
-       make install
-
-You can configure where to install library and includes using --prefix
-etc ... (./configure --help for the options).
-
-You can configure Portability to be used with threads (--enable-threads)
-and to disable sigalarm (--disable-sigalarm).
-
-
-
-Adaptive Timeouts
------------------
-
-Some of Portability's functions take a timeout as argument. Portability
-provides a way to use adaptive timeouts: look at timeouts.h for the
-interface. In short you can use GetTimeOut to get a timeout estimate that
-is more accurate the more information you give Portability through
-SetTimeOut. If you call the Send{MessageAnd}Data with a timeout of -1
-you'll get the adaptive timeouts without having to tinker with Get/Set
-TimeOut.
-
diff --git a/src/nws_portability/config.guess b/src/nws_portability/config.guess
deleted file mode 100755 (executable)
index ed2e03b..0000000
+++ /dev/null
@@ -1,1321 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002 Free Software Foundation, Inc.
-
-timestamp='2002-03-20'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Originally written by Per Bothner <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
-  -h, --help         print this help, then exit
-  -t, --time-stamp   print date of last modification, then exit
-  -v, --version      print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
-  case $1 in
-    --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit 0 ;;
-    --version | -v )
-       echo "$version" ; exit 0 ;;
-    --help | --h* | -h )
-       echo "$usage"; exit 0 ;;
-    -- )     # Stop option processing
-       shift; break ;;
-    - )        # Use stdin as input.
-       break ;;
-    -* )
-       echo "$me: invalid option $1$help" >&2
-       exit 1 ;;
-    * )
-       break ;;
-  esac
-done
-
-if test $# != 0; then
-  echo "$me: too many arguments$help" >&2
-  exit 1
-fi
-
-
-dummy=dummy-$$
-trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script.
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,)    echo "int dummy(){}" > $dummy.c ;
-       for c in cc gcc c89 c99 ; do
-         ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
-         if test $? = 0 ; then
-            CC_FOR_BUILD="$c"; break ;
-         fi ;
-       done ;
-       rm -f $dummy.c $dummy.o $dummy.rel ;
-       if test x"$CC_FOR_BUILD" = x ; then
-         CC_FOR_BUILD=no_compiler_found ;
-       fi
-       ;;
- ,,*)   CC_FOR_BUILD=$CC ;;
- ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
-esac'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
-       PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
-    *:NetBSD:*:*)
-       # NetBSD (nbsd) targets should (where applicable) match one or
-       # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
-       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
-       # switched to ELF, *-*-netbsd* would select the old
-       # object file format.  This provides both forward
-       # compatibility and a consistent mechanism for selecting the
-       # object file format.
-       #
-       # Note: NetBSD doesn't particularly care about the vendor
-       # portion of the name.  We always set it to "unknown".
-       sysctl="sysctl -n hw.machine_arch"
-       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
-       case "${UNAME_MACHINE_ARCH}" in
-           arm*) machine=arm-unknown ;;
-           sh3el) machine=shl-unknown ;;
-           sh3eb) machine=sh-unknown ;;
-           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
-       esac
-       # The Operating System including object format, if it has switched
-       # to ELF recently, or will in the future.
-       case "${UNAME_MACHINE_ARCH}" in
-           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
-               eval $set_cc_for_build
-               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-                       | grep __ELF__ >/dev/null
-               then
-                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
-                   # Return netbsd for either.  FIX?
-                   os=netbsd
-               else
-                   os=netbsdelf
-               fi
-               ;;
-           *)
-               os=netbsd
-               ;;
-       esac
-       # The OS release
-       release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
-       # contains redundant information, the shorter form:
-       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-       echo "${machine}-${os}${release}"
-       exit 0 ;;
-    amiga:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    arc:OpenBSD:*:*)
-       echo mipsel-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    hp300:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    mac68k:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    macppc:OpenBSD:*:*)
-       echo powerpc-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    mvme68k:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    mvme88k:OpenBSD:*:*)
-       echo m88k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    mvmeppc:OpenBSD:*:*)
-       echo powerpc-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    pmax:OpenBSD:*:*)
-       echo mipsel-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    sgi:OpenBSD:*:*)
-       echo mipseb-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    sun3:OpenBSD:*:*)
-       echo m68k-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    wgrisc:OpenBSD:*:*)
-       echo mipsel-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    *:OpenBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
-       exit 0 ;;
-    alpha:OSF1:*:*)
-       if test $UNAME_RELEASE = "V4.0"; then
-               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
-       fi
-       # A Vn.n version is a released version.
-       # A Tn.n version is a released field test version.
-       # A Xn.n version is an unreleased experimental baselevel.
-       # 1.2 uses "1.2" for uname -r.
-       cat <<EOF >$dummy.s
-       .data
-\$Lformat:
-       .byte 37,100,45,37,120,10,0     # "%d-%x\n"
-
-       .text
-       .globl main
-       .align 4
-       .ent main
-main:
-       .frame \$30,16,\$26,0
-       ldgp \$29,0(\$27)
-       .prologue 1
-       .long 0x47e03d80 # implver \$0
-       lda \$2,-1
-       .long 0x47e20c21 # amask \$2,\$1
-       lda \$16,\$Lformat
-       mov \$0,\$17
-       not \$1,\$18
-       jsr \$26,printf
-       ldgp \$29,0(\$26)
-       mov 0,\$16
-       jsr \$26,exit
-       .end main
-EOF
-       eval $set_cc_for_build
-       $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
-       if test "$?" = 0 ; then
-               case `./$dummy` in
-                       0-0)
-                               UNAME_MACHINE="alpha"
-                               ;;
-                       1-0)
-                               UNAME_MACHINE="alphaev5"
-                               ;;
-                       1-1)
-                               UNAME_MACHINE="alphaev56"
-                               ;;
-                       1-101)
-                               UNAME_MACHINE="alphapca56"
-                               ;;
-                       2-303)
-                               UNAME_MACHINE="alphaev6"
-                               ;;
-                       2-307)
-                               UNAME_MACHINE="alphaev67"
-                               ;;
-                       2-1307)
-                               UNAME_MACHINE="alphaev68"
-                               ;;
-               esac
-       fi
-       rm -f $dummy.s $dummy
-       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-       exit 0 ;;
-    Alpha\ *:Windows_NT*:*)
-       # How do we know it's Interix rather than the generic POSIX subsystem?
-       # Should we change UNAME_MACHINE based on the output of uname instead
-       # of the specific Alpha model?
-       echo alpha-pc-interix
-       exit 0 ;;
-    21064:Windows_NT:50:3)
-       echo alpha-dec-winnt3.5
-       exit 0 ;;
-    Amiga*:UNIX_System_V:4.0:*)
-       echo m68k-unknown-sysv4
-       exit 0;;
-    *:[Aa]miga[Oo][Ss]:*:*)
-       echo ${UNAME_MACHINE}-unknown-amigaos
-       exit 0 ;;
-    *:[Mm]orph[Oo][Ss]:*:*)
-       echo ${UNAME_MACHINE}-unknown-morphos
-       exit 0 ;;
-    *:OS/390:*:*)
-       echo i370-ibm-openedition
-       exit 0 ;;
-    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
-       echo arm-acorn-riscix${UNAME_RELEASE}
-       exit 0;;
-    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
-       echo hppa1.1-hitachi-hiuxmpp
-       exit 0;;
-    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
-       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
-       if test "`(/bin/universe) 2>/dev/null`" = att ; then
-               echo pyramid-pyramid-sysv3
-       else
-               echo pyramid-pyramid-bsd
-       fi
-       exit 0 ;;
-    NILE*:*:*:dcosx)
-       echo pyramid-pyramid-svr4
-       exit 0 ;;
-    sun4H:SunOS:5.*:*)
-       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit 0 ;;
-    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit 0 ;;
-    i86pc:SunOS:5.*:*)
-       echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit 0 ;;
-    sun4*:SunOS:6*:*)
-       # According to config.sub, this is the proper way to canonicalize
-       # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
-       # it's likely to be more like Solaris than SunOS4.
-       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit 0 ;;
-    sun4*:SunOS:*:*)
-       case "`/usr/bin/arch -k`" in
-           Series*|S4*)
-               UNAME_RELEASE=`uname -v`
-               ;;
-       esac
-       # Japanese Language versions have a version number like `4.1.3-JL'.
-       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
-       exit 0 ;;
-    sun3*:SunOS:*:*)
-       echo m68k-sun-sunos${UNAME_RELEASE}
-       exit 0 ;;
-    sun*:*:4.2BSD:*)
-       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
-       case "`/bin/arch`" in
-           sun3)
-               echo m68k-sun-sunos${UNAME_RELEASE}
-               ;;
-           sun4)
-               echo sparc-sun-sunos${UNAME_RELEASE}
-               ;;
-       esac
-       exit 0 ;;
-    aushp:SunOS:*:*)
-       echo sparc-auspex-sunos${UNAME_RELEASE}
-       exit 0 ;;
-    # The situation for MiNT is a little confusing.  The machine name
-    # can be virtually everything (everything which is not
-    # "atarist" or "atariste" at least should have a processor
-    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
-    # to the lowercase version "mint" (or "freemint").  Finally
-    # the system name "TOS" denotes a system which is actually not
-    # MiNT.  But MiNT is downward compatible to TOS, so this should
-    # be no problem.
-    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-       exit 0 ;;
-    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
-       echo m68k-atari-mint${UNAME_RELEASE}
-        exit 0 ;;
-    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-       exit 0 ;;
-    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit 0 ;;
-    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit 0 ;;
-    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit 0 ;;
-    powerpc:machten:*:*)
-       echo powerpc-apple-machten${UNAME_RELEASE}
-       exit 0 ;;
-    RISC*:Mach:*:*)
-       echo mips-dec-mach_bsd4.3
-       exit 0 ;;
-    RISC*:ULTRIX:*:*)
-       echo mips-dec-ultrix${UNAME_RELEASE}
-       exit 0 ;;
-    VAX*:ULTRIX*:*:*)
-       echo vax-dec-ultrix${UNAME_RELEASE}
-       exit 0 ;;
-    2020:CLIX:*:* | 2430:CLIX:*:*)
-       echo clipper-intergraph-clix${UNAME_RELEASE}
-       exit 0 ;;
-    mips:*:*:UMIPS | mips:*:*:RISCos)
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h>  /* for printf() prototype */
-       int main (int argc, char *argv[]) {
-#else
-       int main (argc, argv) int argc; char *argv[]; {
-#endif
-       #if defined (host_mips) && defined (MIPSEB)
-       #if defined (SYSTYPE_SYSV)
-         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
-       #endif
-       #if defined (SYSTYPE_SVR4)
-         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
-       #endif
-       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
-         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
-       #endif
-       #endif
-         exit (-1);
-       }
-EOF
-       $CC_FOR_BUILD $dummy.c -o $dummy \
-         && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
-         && rm -f $dummy.c $dummy && exit 0
-       rm -f $dummy.c $dummy
-       echo mips-mips-riscos${UNAME_RELEASE}
-       exit 0 ;;
-    Motorola:PowerMAX_OS:*:*)
-       echo powerpc-motorola-powermax
-       exit 0 ;;
-    Night_Hawk:Power_UNIX:*:*)
-       echo powerpc-harris-powerunix
-       exit 0 ;;
-    m88k:CX/UX:7*:*)
-       echo m88k-harris-cxux7
-       exit 0 ;;
-    m88k:*:4*:R4*)
-       echo m88k-motorola-sysv4
-       exit 0 ;;
-    m88k:*:3*:R3*)
-       echo m88k-motorola-sysv3
-       exit 0 ;;
-    AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
-       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
-       then
-           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
-              [ ${TARGET_BINARY_INTERFACE}x = x ]
-           then
-               echo m88k-dg-dgux${UNAME_RELEASE}
-           else
-               echo m88k-dg-dguxbcs${UNAME_RELEASE}
-           fi
-       else
-           echo i586-dg-dgux${UNAME_RELEASE}
-       fi
-       exit 0 ;;
-    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
-       echo m88k-dolphin-sysv3
-       exit 0 ;;
-    M88*:*:R3*:*)
-       # Delta 88k system running SVR3
-       echo m88k-motorola-sysv3
-       exit 0 ;;
-    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
-       echo m88k-tektronix-sysv3
-       exit 0 ;;
-    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
-       echo m68k-tektronix-bsd
-       exit 0 ;;
-    *:IRIX*:*:*)
-       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
-       exit 0 ;;
-    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
-       echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
-       exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
-    i*86:AIX:*:*)
-       echo i386-ibm-aix
-       exit 0 ;;
-    ia64:AIX:*:*)
-       if [ -x /usr/bin/oslevel ] ; then
-               IBM_REV=`/usr/bin/oslevel`
-       else
-               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
-       fi
-       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
-       exit 0 ;;
-    *:AIX:2:3)
-       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-               eval $set_cc_for_build
-               sed 's/^                //' << EOF >$dummy.c
-               #include <sys/systemcfg.h>
-
-               main()
-                       {
-                       if (!__power_pc())
-                               exit(1);
-                       puts("powerpc-ibm-aix3.2.5");
-                       exit(0);
-                       }
-EOF
-               $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
-               rm -f $dummy.c $dummy
-               echo rs6000-ibm-aix3.2.5
-       elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
-               echo rs6000-ibm-aix3.2.4
-       else
-               echo rs6000-ibm-aix3.2
-       fi
-       exit 0 ;;
-    *:AIX:*:[45])
-       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
-       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
-               IBM_ARCH=rs6000
-       else
-               IBM_ARCH=powerpc
-       fi
-       if [ -x /usr/bin/oslevel ] ; then
-               IBM_REV=`/usr/bin/oslevel`
-       else
-               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
-       fi
-       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
-       exit 0 ;;
-    *:AIX:*:*)
-       echo rs6000-ibm-aix
-       exit 0 ;;
-    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
-       echo romp-ibm-bsd4.4
-       exit 0 ;;
-    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
-       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
-       exit 0 ;;                           # report: romp-ibm BSD 4.3
-    *:BOSX:*:*)
-       echo rs6000-bull-bosx
-       exit 0 ;;
-    DPX/2?00:B.O.S.:*:*)
-       echo m68k-bull-sysv3
-       exit 0 ;;
-    9000/[34]??:4.3bsd:1.*:*)
-       echo m68k-hp-bsd
-       exit 0 ;;
-    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
-       echo m68k-hp-bsd4.4
-       exit 0 ;;
-    9000/[34678]??:HP-UX:*:*)
-       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-       case "${UNAME_MACHINE}" in
-           9000/31? )            HP_ARCH=m68000 ;;
-           9000/[34]?? )         HP_ARCH=m68k ;;
-           9000/[678][0-9][0-9])
-               if [ -x /usr/bin/getconf ]; then
-                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-                    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
-                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
-               fi
-               if [ "${HP_ARCH}" = "" ]; then
-                   eval $set_cc_for_build
-                   sed 's/^              //' << EOF >$dummy.c
-
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
-
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
-
-                  switch (cpu)
-               {
-               case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-               case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-               case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-                   switch (bits)
-                       {
-                       case 64: puts ("hppa2.0w"); break;
-                       case 32: puts ("hppa2.0n"); break;
-                       default: puts ("hppa2.0"); break;
-                       } break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-                   puts ("hppa2.0"); break;
-              #endif
-               default: puts ("hppa1.0"); break;
-               }
-                  exit (0);
-              }
-EOF
-                   (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
-                   if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
-                   rm -f $dummy.c $dummy
-               fi ;;
-       esac
-       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-       exit 0 ;;
-    ia64:HP-UX:*:*)
-       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-       echo ia64-hp-hpux${HPUX_REV}
-       exit 0 ;;
-    3050*:HI-UX:*:*)
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-       #include <unistd.h>
-       int
-       main ()
-       {
-         long cpu = sysconf (_SC_CPU_VERSION);
-         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
-            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
-            results, however.  */
-         if (CPU_IS_PA_RISC (cpu))
-           {
-             switch (cpu)
-               {
-                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
-                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
-                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
-                 default: puts ("hppa-hitachi-hiuxwe2"); break;
-               }
-           }
-         else if (CPU_IS_HP_MC68K (cpu))
-           puts ("m68k-hitachi-hiuxwe2");
-         else puts ("unknown-hitachi-hiuxwe2");
-         exit (0);
-       }
-EOF
-       $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
-       rm -f $dummy.c $dummy
-       echo unknown-hitachi-hiuxwe2
-       exit 0 ;;
-    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
-       echo hppa1.1-hp-bsd
-       exit 0 ;;
-    9000/8??:4.3bsd:*:*)
-       echo hppa1.0-hp-bsd
-       exit 0 ;;
-    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
-       echo hppa1.0-hp-mpeix
-       exit 0 ;;
-    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
-       echo hppa1.1-hp-osf
-       exit 0 ;;
-    hp8??:OSF1:*:*)
-       echo hppa1.0-hp-osf
-       exit 0 ;;
-    i*86:OSF1:*:*)
-       if [ -x /usr/sbin/sysversion ] ; then
-           echo ${UNAME_MACHINE}-unknown-osf1mk
-       else
-           echo ${UNAME_MACHINE}-unknown-osf1
-       fi
-       exit 0 ;;
-    parisc*:Lites*:*:*)
-       echo hppa1.1-hp-lites
-       exit 0 ;;
-    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
-       echo c1-convex-bsd
-        exit 0 ;;
-    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
-       if getsysinfo -f scalar_acc
-       then echo c32-convex-bsd
-       else echo c2-convex-bsd
-       fi
-        exit 0 ;;
-    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
-       echo c34-convex-bsd
-        exit 0 ;;
-    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
-       echo c38-convex-bsd
-        exit 0 ;;
-    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
-       echo c4-convex-bsd
-        exit 0 ;;
-    CRAY*Y-MP:*:*:*)
-       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit 0 ;;
-    CRAY*[A-Z]90:*:*:*)
-       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
-       | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-             -e 's/\.[^.]*$/.X/'
-       exit 0 ;;
-    CRAY*TS:*:*:*)
-       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit 0 ;;
-    CRAY*T3D:*:*:*)
-       echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit 0 ;;
-    CRAY*T3E:*:*:*)
-       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit 0 ;;
-    CRAY*SV1:*:*:*)
-       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit 0 ;;
-    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit 0 ;;
-    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
-       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
-       exit 0 ;;
-    sparc*:BSD/OS:*:*)
-       echo sparc-unknown-bsdi${UNAME_RELEASE}
-       exit 0 ;;
-    *:BSD/OS:*:*)
-       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
-       exit 0 ;;
-    *:FreeBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-       exit 0 ;;
-    i*:CYGWIN*:*)
-       echo ${UNAME_MACHINE}-pc-cygwin
-       exit 0 ;;
-    i*:MINGW*:*)
-       echo ${UNAME_MACHINE}-pc-mingw32
-       exit 0 ;;
-    i*:PW*:*)
-       echo ${UNAME_MACHINE}-pc-pw32
-       exit 0 ;;
-    x86:Interix*:3*)
-       echo i386-pc-interix3
-       exit 0 ;;
-    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
-       # How do we know it's Interix rather than the generic POSIX subsystem?
-       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
-       # UNAME_MACHINE based on the output of uname instead of i386?
-       echo i386-pc-interix
-       exit 0 ;;
-    i*:UWIN*:*)
-       echo ${UNAME_MACHINE}-pc-uwin
-       exit 0 ;;
-    p*:CYGWIN*:*)
-       echo powerpcle-unknown-cygwin
-       exit 0 ;;
-    prep*:SunOS:5.*:*)
-       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit 0 ;;
-    *:GNU:*:*)
-       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
-       exit 0 ;;
-    i*86:Minix:*:*)
-       echo ${UNAME_MACHINE}-pc-minix
-       exit 0 ;;
-    arm*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
-    ia64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
-    m68*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
-    mips:Linux:*:*)
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-       #undef CPU
-       #undef mips
-       #undef mipsel
-       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-       CPU=mipsel
-       #else
-       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-       CPU=mips
-       #else
-       CPU=
-       #endif
-       #endif
-EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
-       rm -f $dummy.c
-       test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
-       ;;
-    ppc:Linux:*:*)
-       echo powerpc-unknown-linux-gnu
-       exit 0 ;;
-    ppc64:Linux:*:*)
-       echo powerpc64-unknown-linux-gnu
-       exit 0 ;;
-    alpha:Linux:*:*)
-       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-         EV5)   UNAME_MACHINE=alphaev5 ;;
-         EV56)  UNAME_MACHINE=alphaev56 ;;
-         PCA56) UNAME_MACHINE=alphapca56 ;;
-         PCA57) UNAME_MACHINE=alphapca56 ;;
-         EV6)   UNAME_MACHINE=alphaev6 ;;
-         EV67)  UNAME_MACHINE=alphaev67 ;;
-         EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-       objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
-       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
-       exit 0 ;;
-    parisc:Linux:*:* | hppa:Linux:*:*)
-       # Look for CPU level
-       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-         PA7*) echo hppa1.1-unknown-linux-gnu ;;
-         PA8*) echo hppa2.0-unknown-linux-gnu ;;
-         *)    echo hppa-unknown-linux-gnu ;;
-       esac
-       exit 0 ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-       echo hppa64-unknown-linux-gnu
-       exit 0 ;;
-    s390:Linux:*:* | s390x:Linux:*:*)
-       echo ${UNAME_MACHINE}-ibm-linux
-       exit 0 ;;
-    sh*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
-    sparc:Linux:*:* | sparc64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit 0 ;;
-    x86_64:Linux:*:*)
-       echo x86_64-unknown-linux-gnu
-       exit 0 ;;
-    i*86:Linux:*:*)
-       # The BFD linker knows what the default object file format is, so
-       # first see if it will tell us. cd to the root directory to prevent
-       # problems with other programs or directories called `ld' in the path.
-       # Set LC_ALL=C to ensure ld outputs messages in English.
-       ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
-                        | sed -ne '/supported targets:/!d
-                                   s/[         ][      ]*/ /g
-                                   s/.*supported targets: *//
-                                   s/ .*//
-                                   p'`
-        case "$ld_supported_targets" in
-         elf32-i386)
-               TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
-               ;;
-         a.out-i386-linux)
-               echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-               exit 0 ;;               
-         coff-i386)
-               echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-               exit 0 ;;
-         "")
-               # Either a pre-BFD a.out linker (linux-gnuoldld) or
-               # one that does not give us useful --help.
-               echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
-               exit 0 ;;
-       esac
-       # Determine whether the default compiler is a.out or elf
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-       #include <features.h>
-       #ifdef __ELF__
-       # ifdef __GLIBC__
-       #  if __GLIBC__ >= 2
-       LIBC=gnu
-       #  else
-       LIBC=gnulibc1
-       #  endif
-       # else
-       LIBC=gnulibc1
-       # endif
-       #else
-       #ifdef __INTEL_COMPILER
-       LIBC=gnu
-       #else
-       LIBC=gnuaout
-       #endif
-       #endif
-EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
-       rm -f $dummy.c
-       test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
-       test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
-       ;;
-    i*86:DYNIX/ptx:4*:*)
-       # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
-       # earlier versions are messed up and put the nodename in both
-       # sysname and nodename.
-       echo i386-sequent-sysv4
-       exit 0 ;;
-    i*86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
-       # I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
-       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
-       exit 0 ;;
-    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
-       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
-       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
-       else
-               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
-       fi
-       exit 0 ;;
-    i*86:*:5:[78]*)
-       case `/bin/uname -X | grep "^Machine"` in
-           *486*)           UNAME_MACHINE=i486 ;;
-           *Pentium)        UNAME_MACHINE=i586 ;;
-           *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
-       esac
-       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
-       exit 0 ;;
-    i*86:*:3.2:*)
-       if test -f /usr/options/cb.name; then
-               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
-               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
-       elif /bin/uname -X 2>/dev/null >/dev/null ; then
-               UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
-               (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
-               (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
-                       && UNAME_MACHINE=i586
-               (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
-                       && UNAME_MACHINE=i686
-               (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
-                       && UNAME_MACHINE=i686
-               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
-       else
-               echo ${UNAME_MACHINE}-pc-sysv32
-       fi
-       exit 0 ;;
-    i*86:*DOS:*:*)
-       echo ${UNAME_MACHINE}-pc-msdosdjgpp
-       exit 0 ;;
-    pc:*:*:*)
-       # Left here for compatibility:
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i386.
-       echo i386-pc-msdosdjgpp
-        exit 0 ;;
-    Intel:Mach:3*:*)
-       echo i386-pc-mach3
-       exit 0 ;;
-    paragon:*:*:*)
-       echo i860-intel-osf1
-       exit 0 ;;
-    i860:*:4.*:*) # i860-SVR4
-       if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
-         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
-       else # Add other i860-SVR4 vendors below as they are discovered.
-         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
-       fi
-       exit 0 ;;
-    mini*:CTIX:SYS*5:*)
-       # "miniframe"
-       echo m68010-convergent-sysv
-       exit 0 ;;
-    M68*:*:R3V[567]*:*)
-       test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
-    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
-       OS_REL=''
-       test -r /etc/.relid \
-       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
-       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-         && echo i486-ncr-sysv4.3${OS_REL} && exit 0
-       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-         && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
-    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && echo i486-ncr-sysv4 && exit 0 ;;
-    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-       echo m68k-unknown-lynxos${UNAME_RELEASE}
-       exit 0 ;;
-    mc68030:UNIX_System_V:4.*:*)
-       echo m68k-atari-sysv4
-       exit 0 ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
-       echo i386-unknown-lynxos${UNAME_RELEASE}
-       exit 0 ;;
-    TSUNAMI:LynxOS:2.*:*)
-       echo sparc-unknown-lynxos${UNAME_RELEASE}
-       exit 0 ;;
-    rs6000:LynxOS:2.*:*)
-       echo rs6000-unknown-lynxos${UNAME_RELEASE}
-       exit 0 ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
-       echo powerpc-unknown-lynxos${UNAME_RELEASE}
-       exit 0 ;;
-    SM[BE]S:UNIX_SV:*:*)
-       echo mips-dde-sysv${UNAME_RELEASE}
-       exit 0 ;;
-    RM*:ReliantUNIX-*:*:*)
-       echo mips-sni-sysv4
-       exit 0 ;;
-    RM*:SINIX-*:*:*)
-       echo mips-sni-sysv4
-       exit 0 ;;
-    *:SINIX-*:*:*)
-       if uname -p 2>/dev/null >/dev/null ; then
-               UNAME_MACHINE=`(uname -p) 2>/dev/null`
-               echo ${UNAME_MACHINE}-sni-sysv4
-       else
-               echo ns32k-sni-sysv
-       fi
-       exit 0 ;;
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                      # says <Richard.M.Bartel@ccMail.Census.GOV>
-        echo i586-unisys-sysv4
-        exit 0 ;;
-    *:UNIX_System_V:4*:FTX*)
-       # From Gerald Hewes <hewes@openmarket.com>.
-       # How about differentiating between stratus architectures? -djm
-       echo hppa1.1-stratus-sysv4
-       exit 0 ;;
-    *:*:*:FTX*)
-       # From seanf@swdc.stratus.com.
-       echo i860-stratus-sysv4
-       exit 0 ;;
-    *:VOS:*:*)
-       # From Paul.Green@stratus.com.
-       echo hppa1.1-stratus-vos
-       exit 0 ;;
-    mc68*:A/UX:*:*)
-       echo m68k-apple-aux${UNAME_RELEASE}
-       exit 0 ;;
-    news*:NEWS-OS:6*:*)
-       echo mips-sony-newsos6
-       exit 0 ;;
-    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
-       if [ -d /usr/nec ]; then
-               echo mips-nec-sysv${UNAME_RELEASE}
-       else
-               echo mips-unknown-sysv${UNAME_RELEASE}
-       fi
-        exit 0 ;;
-    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
-       echo powerpc-be-beos
-       exit 0 ;;
-    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
-       echo powerpc-apple-beos
-       exit 0 ;;
-    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
-       echo i586-pc-beos
-       exit 0 ;;
-    SX-4:SUPER-UX:*:*)
-       echo sx4-nec-superux${UNAME_RELEASE}
-       exit 0 ;;
-    SX-5:SUPER-UX:*:*)
-       echo sx5-nec-superux${UNAME_RELEASE}
-       exit 0 ;;
-    Power*:Rhapsody:*:*)
-       echo powerpc-apple-rhapsody${UNAME_RELEASE}
-       exit 0 ;;
-    *:Rhapsody:*:*)
-       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
-       exit 0 ;;
-    *:Darwin:*:*)
-       echo `uname -p`-apple-darwin${UNAME_RELEASE}
-       exit 0 ;;
-    *:procnto*:*:* | *:QNX:[0123456789]*:*)
-       UNAME_PROCESSOR=`uname -p`
-       if test "$UNAME_PROCESSOR" = "x86"; then
-               UNAME_PROCESSOR=i386
-               UNAME_MACHINE=pc
-       fi
-       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
-       exit 0 ;;
-    *:QNX:*:4*)
-       echo i386-pc-qnx
-       exit 0 ;;
-    NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
-       echo nsr-tandem-nsk${UNAME_RELEASE}
-       exit 0 ;;
-    *:NonStop-UX:*:*)
-       echo mips-compaq-nonstopux
-       exit 0 ;;
-    BS2000:POSIX*:*:*)
-       echo bs2000-siemens-sysv
-       exit 0 ;;
-    DS/*:UNIX_System_V:*:*)
-       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
-       exit 0 ;;
-    *:Plan9:*:*)
-       # "uname -m" is not consistent, so use $cputype instead. 386
-       # is converted to i386 for consistency with other x86
-       # operating systems.
-       if test "$cputype" = "386"; then
-           UNAME_MACHINE=i386
-       else
-           UNAME_MACHINE="$cputype"
-       fi
-       echo ${UNAME_MACHINE}-unknown-plan9
-       exit 0 ;;
-    i*86:OS/2:*:*)
-       # If we were able to find `uname', then EMX Unix compatibility
-       # is probably installed.
-       echo ${UNAME_MACHINE}-pc-os2-emx
-       exit 0 ;;
-    *:TOPS-10:*:*)
-       echo pdp10-unknown-tops10
-       exit 0 ;;
-    *:TENEX:*:*)
-       echo pdp10-unknown-tenex
-       exit 0 ;;
-    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
-       echo pdp10-dec-tops20
-       exit 0 ;;
-    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
-       echo pdp10-xkl-tops20
-       exit 0 ;;
-    *:TOPS-20:*:*)
-       echo pdp10-unknown-tops20
-       exit 0 ;;
-    *:ITS:*:*)
-       echo pdp10-unknown-its
-       exit 0 ;;
-    i*86:XTS-300:*:STOP)
-       echo ${UNAME_MACHINE}-unknown-stop
-       exit 0 ;;
-    i*86:atheos:*:*)
-       echo ${UNAME_MACHINE}-unknown-atheos
-       exit 0 ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
-  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
-     I don't know....  */
-  printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
-  printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
-          "4"
-#else
-         ""
-#endif
-         ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
-  printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
-  int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  if (version < 4)
-    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
-  else
-    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
-  exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
-  printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
-  printf ("ns32k-encore-mach\n"); exit (0);
-#else
-  printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
-  printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
-  printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
-  printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
-    struct utsname un;
-
-    uname(&un);
-
-    if (strncmp(un.version, "V2", 2) == 0) {
-       printf ("i386-sequent-ptx2\n"); exit (0);
-    }
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
-       printf ("i386-sequent-ptx1\n"); exit (0);
-    }
-    printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-#  include <sys/param.h>
-#  if defined (BSD)
-#   if BSD == 43
-      printf ("vax-dec-bsd4.3\n"); exit (0);
-#   else
-#    if BSD == 199006
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
-#    else
-      printf ("vax-dec-bsd\n"); exit (0);
-#    endif
-#   endif
-#  else
-    printf ("vax-dec-bsd\n"); exit (0);
-#  endif
-# else
-    printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
-  printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
-  exit (1);
-}
-EOF
-
-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
-rm -f $dummy.c $dummy
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
-    case `getsysinfo -f cpu_type` in
-    c1*)
-       echo c1-convex-bsd
-       exit 0 ;;
-    c2*)
-       if getsysinfo -f scalar_acc
-       then echo c32-convex-bsd
-       else echo c2-convex-bsd
-       fi
-       exit 0 ;;
-    c34*)
-       echo c34-convex-bsd
-       exit 0 ;;
-    c38*)
-       echo c38-convex-bsd
-       exit 0 ;;
-    c4*)
-       echo c4-convex-bsd
-       exit 0 ;;
-    esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
-    ftp://ftp.gnu.org/pub/gnu/config/
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo               = `(hostinfo) 2>/dev/null`
-/bin/universe          = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch              = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM  = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/src/nws_portability/config.sub b/src/nws_portability/config.sub
deleted file mode 100644 (file)
index f365797..0000000
+++ /dev/null
@@ -1,1443 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002 Free Software Foundation, Inc.
-
-timestamp='2002-03-07'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support.  The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
-  -h, --help         print this help, then exit
-  -t, --time-stamp   print date of last modification, then exit
-  -v, --version      print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
-  case $1 in
-    --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit 0 ;;
-    --version | -v )
-       echo "$version" ; exit 0 ;;
-    --help | --h* | -h )
-       echo "$usage"; exit 0 ;;
-    -- )     # Stop option processing
-       shift; break ;;
-    - )        # Use stdin as input.
-       break ;;
-    -* )
-       echo "$me: invalid option $1$help"
-       exit 1 ;;
-
-    *local*)
-       # First pass through any local machine types.
-       echo $1
-       exit 0;;
-
-    * )
-       break ;;
-  esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
-    exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
-    exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
-  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
-    os=-$maybe_os
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-    ;;
-  *)
-    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
-    if [ $basic_machine != $1 ]
-    then os=`echo $1 | sed 's/.*-/-/'`
-    else os=; fi
-    ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work.  We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
-       -sun*os*)
-               # Prevent following clause from handling this invalid input.
-               ;;
-       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-       -apple | -axis)
-               os=
-               basic_machine=$1
-               ;;
-       -sim | -cisco | -oki | -wec | -winbond)
-               os=
-               basic_machine=$1
-               ;;
-       -scout)
-               ;;
-       -wrs)
-               os=-vxworks
-               basic_machine=$1
-               ;;
-       -chorusos*)
-               os=-chorusos
-               basic_machine=$1
-               ;;
-       -chorusrdb)
-               os=-chorusrdb
-               basic_machine=$1
-               ;;
-       -hiux*)
-               os=-hiuxwe2
-               ;;
-       -sco5)
-               os=-sco3.2v5
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco4)
-               os=-sco3.2v4
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco3.2.[4-9]*)
-               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco3.2v[4-9]*)
-               # Don't forget version if it is 3.2v4 or newer.
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco*)
-               os=-sco3.2v2
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -udk*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -isc)
-               os=-isc2.2
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -clix*)
-               basic_machine=clipper-intergraph
-               ;;
-       -isc*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -lynx*)
-               os=-lynxos
-               ;;
-       -ptx*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
-               ;;
-       -windowsnt*)
-               os=`echo $os | sed -e 's/windowsnt/winnt/'`
-               ;;
-       -psos*)
-               os=-psos
-               ;;
-       -mint | -mint[0-9]*)
-               basic_machine=m68k-atari
-               os=-mint
-               ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
-       # Recognize the basic CPU types without company name.
-       # Some are omitted here because they have special meanings below.
-       1750a | 580 \
-       | a29k \
-       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
-       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
-       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
-       | c4x | clipper \
-       | d10v | d30v | dsp16xx \
-       | fr30 \
-       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
-       | i370 | i860 | i960 | ia64 \
-       | m32r | m68000 | m68k | m88k | mcore \
-       | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \
-       | mips64vr4100 | mips64vr4100el | mips64vr4300 \
-       | mips64vr4300el | mips64vr5000 | mips64vr5000el \
-       | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
-       | mipsisa32 | mipsisa64 \
-       | mn10200 | mn10300 \
-       | ns16k | ns32k \
-       | openrisc | or32 \
-       | pdp10 | pdp11 | pj | pjl \
-       | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
-       | pyramid \
-       | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \
-       | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
-       | strongarm \
-       | tahoe | thumb | tic80 | tron \
-       | v850 | v850e \
-       | we32k \
-       | x86 | xscale | xstormy16 | xtensa \
-       | z8k)
-               basic_machine=$basic_machine-unknown
-               ;;
-       m6811 | m68hc11 | m6812 | m68hc12)
-               # Motorola 68HC11/12.
-               basic_machine=$basic_machine-unknown
-               os=-none
-               ;;
-       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
-               ;;
-
-       # We use `pc' rather than `unknown'
-       # because (1) that's what they normally are, and
-       # (2) the word "unknown" tends to confuse beginning users.
-       i*86 | x86_64)
-         basic_machine=$basic_machine-pc
-         ;;
-       # Object if more than one company name word.
-       *-*-*)
-               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-               exit 1
-               ;;
-       # Recognize the basic CPU types with company name.
-       580-* \
-       | a29k-* \
-       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
-       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
-       | arm-*  | armbe-* | armle-* | armv*-* \
-       | avr-* \
-       | bs2000-* \
-       | c[123]* | c30-* | [cjt]90-* | c54x-* \
-       | clipper-* | cydra-* \
-       | d10v-* | d30v-* \
-       | elxsi-* \
-       | f30[01]-* | f700-* | fr30-* | fx80-* \
-       | h8300-* | h8500-* \
-       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
-       | i*86-* | i860-* | i960-* | ia64-* \
-       | m32r-* \
-       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-       | m88110-* | m88k-* | mcore-* \
-       | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
-       | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
-       | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
-       | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \
-       | none-* | np1-* | ns16k-* | ns32k-* \
-       | orion-* \
-       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
-       | pyramid-* \
-       | romp-* | rs6000-* \
-       | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \
-       | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
-       | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
-       | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
-       | v850-* | v850e-* | vax-* \
-       | we32k-* \
-       | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
-       | xtensa-* \
-       | ymp-* \
-       | z8k-*)
-               ;;
-       # Recognize the various machine names and aliases which stand
-       # for a CPU type and a company and sometimes even an OS.
-       386bsd)
-               basic_machine=i386-unknown
-               os=-bsd
-               ;;
-       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
-               basic_machine=m68000-att
-               ;;
-       3b*)
-               basic_machine=we32k-att
-               ;;
-       a29khif)
-               basic_machine=a29k-amd
-               os=-udi
-               ;;
-       adobe68k)
-               basic_machine=m68010-adobe
-               os=-scout
-               ;;
-       alliant | fx80)
-               basic_machine=fx80-alliant
-               ;;
-       altos | altos3068)
-               basic_machine=m68k-altos
-               ;;
-       am29k)
-               basic_machine=a29k-none
-               os=-bsd
-               ;;
-       amdahl)
-               basic_machine=580-amdahl
-               os=-sysv
-               ;;
-       amiga | amiga-*)
-               basic_machine=m68k-unknown
-               ;;
-       amigaos | amigados)
-               basic_machine=m68k-unknown
-               os=-amigaos
-               ;;
-       amigaunix | amix)
-               basic_machine=m68k-unknown
-               os=-sysv4
-               ;;
-       apollo68)
-               basic_machine=m68k-apollo
-               os=-sysv
-               ;;
-       apollo68bsd)
-               basic_machine=m68k-apollo
-               os=-bsd
-               ;;
-       aux)
-               basic_machine=m68k-apple
-               os=-aux
-               ;;
-       balance)
-               basic_machine=ns32k-sequent
-               os=-dynix
-               ;;
-       c90)
-               basic_machine=c90-cray
-               os=-unicos
-               ;;
-       convex-c1)
-               basic_machine=c1-convex
-               os=-bsd
-               ;;
-       convex-c2)
-               basic_machine=c2-convex
-               os=-bsd
-               ;;
-       convex-c32)
-               basic_machine=c32-convex
-               os=-bsd
-               ;;
-       convex-c34)
-               basic_machine=c34-convex
-               os=-bsd
-               ;;
-       convex-c38)
-               basic_machine=c38-convex
-               os=-bsd
-               ;;
-       cray | j90)
-               basic_machine=j90-cray
-               os=-unicos
-               ;;
-       crds | unos)
-               basic_machine=m68k-crds
-               ;;
-       cris | cris-* | etrax*)
-               basic_machine=cris-axis
-               ;;
-       da30 | da30-*)
-               basic_machine=m68k-da30
-               ;;
-       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
-               basic_machine=mips-dec
-               ;;
-       decsystem10* | dec10*)
-               basic_machine=pdp10-dec
-               os=-tops10
-               ;;
-       decsystem20* | dec20*)
-               basic_machine=pdp10-dec
-               os=-tops20
-               ;;
-       delta | 3300 | motorola-3300 | motorola-delta \
-             | 3300-motorola | delta-motorola)
-               basic_machine=m68k-motorola
-               ;;
-       delta88)
-               basic_machine=m88k-motorola
-               os=-sysv3
-               ;;
-       dpx20 | dpx20-*)
-               basic_machine=rs6000-bull
-               os=-bosx
-               ;;
-       dpx2* | dpx2*-bull)
-               basic_machine=m68k-bull
-               os=-sysv3
-               ;;
-       ebmon29k)
-               basic_machine=a29k-amd
-               os=-ebmon
-               ;;
-       elxsi)
-               basic_machine=elxsi-elxsi
-               os=-bsd
-               ;;
-       encore | umax | mmax)
-               basic_machine=ns32k-encore
-               ;;
-       es1800 | OSE68k | ose68k | ose | OSE)
-               basic_machine=m68k-ericsson
-               os=-ose
-               ;;
-       fx2800)
-               basic_machine=i860-alliant
-               ;;
-       genix)
-               basic_machine=ns32k-ns
-               ;;
-       gmicro)
-               basic_machine=tron-gmicro
-               os=-sysv
-               ;;
-       go32)
-               basic_machine=i386-pc
-               os=-go32
-               ;;
-       h3050r* | hiux*)
-               basic_machine=hppa1.1-hitachi
-               os=-hiuxwe2
-               ;;
-       h8300hms)
-               basic_machine=h8300-hitachi
-               os=-hms
-               ;;
-       h8300xray)
-               basic_machine=h8300-hitachi
-               os=-xray
-               ;;
-       h8500hms)
-               basic_machine=h8500-hitachi
-               os=-hms
-               ;;
-       harris)
-               basic_machine=m88k-harris
-               os=-sysv3
-               ;;
-       hp300-*)
-               basic_machine=m68k-hp
-               ;;
-       hp300bsd)
-               basic_machine=m68k-hp
-               os=-bsd
-               ;;
-       hp300hpux)
-               basic_machine=m68k-hp
-               os=-hpux
-               ;;
-       hp3k9[0-9][0-9] | hp9[0-9][0-9])
-               basic_machine=hppa1.0-hp
-               ;;
-       hp9k2[0-9][0-9] | hp9k31[0-9])
-               basic_machine=m68000-hp
-               ;;
-       hp9k3[2-9][0-9])
-               basic_machine=m68k-hp
-               ;;
-       hp9k6[0-9][0-9] | hp6[0-9][0-9])
-               basic_machine=hppa1.0-hp
-               ;;
-       hp9k7[0-79][0-9] | hp7[0-79][0-9])
-               basic_machine=hppa1.1-hp
-               ;;
-       hp9k78[0-9] | hp78[0-9])
-               # FIXME: really hppa2.0-hp
-               basic_machine=hppa1.1-hp
-               ;;
-       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
-               # FIXME: really hppa2.0-hp
-               basic_machine=hppa1.1-hp
-               ;;
-       hp9k8[0-9][13679] | hp8[0-9][13679])
-               basic_machine=hppa1.1-hp
-               ;;
-       hp9k8[0-9][0-9] | hp8[0-9][0-9])
-               basic_machine=hppa1.0-hp
-               ;;
-       hppa-next)
-               os=-nextstep3
-               ;;
-       hppaosf)
-               basic_machine=hppa1.1-hp
-               os=-osf
-               ;;
-       hppro)
-               basic_machine=hppa1.1-hp
-               os=-proelf
-               ;;
-       i370-ibm* | ibm*)
-               basic_machine=i370-ibm
-               ;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
-       i*86v32)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-sysv32
-               ;;
-       i*86v4*)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-sysv4
-               ;;
-       i*86v)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-sysv
-               ;;
-       i*86sol2)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-solaris2
-               ;;
-       i386mach)
-               basic_machine=i386-mach
-               os=-mach
-               ;;
-       i386-vsta | vsta)
-               basic_machine=i386-unknown
-               os=-vsta
-               ;;
-       iris | iris4d)
-               basic_machine=mips-sgi
-               case $os in
-                   -irix*)
-                       ;;
-                   *)
-                       os=-irix4
-                       ;;
-               esac
-               ;;
-       isi68 | isi)
-               basic_machine=m68k-isi
-               os=-sysv
-               ;;
-       m88k-omron*)
-               basic_machine=m88k-omron
-               ;;
-       magnum | m3230)
-               basic_machine=mips-mips
-               os=-sysv
-               ;;
-       merlin)
-               basic_machine=ns32k-utek
-               os=-sysv
-               ;;
-       mingw32)
-               basic_machine=i386-pc
-               os=-mingw32
-               ;;
-       miniframe)
-               basic_machine=m68000-convergent
-               ;;
-       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
-               basic_machine=m68k-atari
-               os=-mint
-               ;;
-       mips3*-*)
-               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
-               ;;
-       mips3*)
-               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
-               ;;
-       mmix*)
-               basic_machine=mmix-knuth
-               os=-mmixware
-               ;;
-       monitor)
-               basic_machine=m68k-rom68k
-               os=-coff
-               ;;
-       morphos)
-               basic_machine=powerpc-unknown
-               os=-morphos
-               ;;
-       msdos)
-               basic_machine=i386-pc
-               os=-msdos
-               ;;
-       mvs)
-               basic_machine=i370-ibm
-               os=-mvs
-               ;;
-       ncr3000)
-               basic_machine=i486-ncr
-               os=-sysv4
-               ;;
-       netbsd386)
-               basic_machine=i386-unknown
-               os=-netbsd
-               ;;
-       netwinder)
-               basic_machine=armv4l-rebel
-               os=-linux
-               ;;
-       news | news700 | news800 | news900)
-               basic_machine=m68k-sony
-               os=-newsos
-               ;;
-       news1000)
-               basic_machine=m68030-sony
-               os=-newsos
-               ;;
-       news-3600 | risc-news)
-               basic_machine=mips-sony
-               os=-newsos
-               ;;
-       necv70)
-               basic_machine=v70-nec
-               os=-sysv
-               ;;
-       next | m*-next )
-               basic_machine=m68k-next
-               case $os in
-                   -nextstep* )
-                       ;;
-                   -ns2*)
-                     os=-nextstep2
-                       ;;
-                   *)
-                     os=-nextstep3
-                       ;;
-               esac
-               ;;
-       nh3000)
-               basic_machine=m68k-harris
-               os=-cxux
-               ;;
-       nh[45]000)
-               basic_machine=m88k-harris
-               os=-cxux
-               ;;
-       nindy960)
-               basic_machine=i960-intel
-               os=-nindy
-               ;;
-       mon960)
-               basic_machine=i960-intel
-               os=-mon960
-               ;;
-       nonstopux)
-               basic_machine=mips-compaq
-               os=-nonstopux
-               ;;
-       np1)
-               basic_machine=np1-gould
-               ;;
-       nsr-tandem)
-               basic_machine=nsr-tandem
-               ;;
-       op50n-* | op60c-*)
-               basic_machine=hppa1.1-oki
-               os=-proelf
-               ;;
-       or32 | or32-*)
-               basic_machine=or32-unknown
-               os=-coff
-               ;;
-       OSE68000 | ose68000)
-               basic_machine=m68000-ericsson
-               os=-ose
-               ;;
-       os68k)
-               basic_machine=m68k-none
-               os=-os68k
-               ;;
-       pa-hitachi)
-               basic_machine=hppa1.1-hitachi
-               os=-hiuxwe2
-               ;;
-       paragon)
-               basic_machine=i860-intel
-               os=-osf
-               ;;
-       pbd)
-               basic_machine=sparc-tti
-               ;;
-       pbb)
-               basic_machine=m68k-tti
-               ;;
-        pc532 | pc532-*)
-               basic_machine=ns32k-pc532
-               ;;
-       pentium | p5 | k5 | k6 | nexgen | viac3)
-               basic_machine=i586-pc
-               ;;
-       pentiumpro | p6 | 6x86 | athlon)
-               basic_machine=i686-pc
-               ;;
-       pentiumii | pentium2)
-               basic_machine=i686-pc
-               ;;
-       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
-               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pentiumpro-* | p6-* | 6x86-* | athlon-*)
-               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pentiumii-* | pentium2-*)
-               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pn)
-               basic_machine=pn-gould
-               ;;
-       power)  basic_machine=power-ibm
-               ;;
-       ppc)    basic_machine=powerpc-unknown
-               ;;
-       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ppcle | powerpclittle | ppc-le | powerpc-little)
-               basic_machine=powerpcle-unknown
-               ;;
-       ppcle-* | powerpclittle-*)
-               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ppc64)  basic_machine=powerpc64-unknown
-               ;;
-       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
-               basic_machine=powerpc64le-unknown
-               ;;
-       ppc64le-* | powerpc64little-*)
-               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ps2)
-               basic_machine=i386-ibm
-               ;;
-       pw32)
-               basic_machine=i586-unknown
-               os=-pw32
-               ;;
-       rom68k)
-               basic_machine=m68k-rom68k
-               os=-coff
-               ;;
-       rm[46]00)
-               basic_machine=mips-siemens
-               ;;
-       rtpc | rtpc-*)
-               basic_machine=romp-ibm
-               ;;
-       s390 | s390-*)
-               basic_machine=s390-ibm
-               ;;
-       s390x | s390x-*)
-               basic_machine=s390x-ibm
-               ;;
-       sa29200)
-               basic_machine=a29k-amd
-               os=-udi
-               ;;
-       sequent)
-               basic_machine=i386-sequent
-               ;;
-       sh)
-               basic_machine=sh-hitachi
-               os=-hms
-               ;;
-       sparclite-wrs | simso-wrs)
-               basic_machine=sparclite-wrs
-               os=-vxworks
-               ;;
-       sps7)
-               basic_machine=m68k-bull
-               os=-sysv2
-               ;;
-       spur)
-               basic_machine=spur-unknown
-               ;;
-       st2000)
-               basic_machine=m68k-tandem
-               ;;
-       stratus)
-               basic_machine=i860-stratus
-               os=-sysv4
-               ;;
-       sun2)
-               basic_machine=m68000-sun
-               ;;
-       sun2os3)
-               basic_machine=m68000-sun
-               os=-sunos3
-               ;;
-       sun2os4)
-               basic_machine=m68000-sun
-               os=-sunos4
-               ;;
-       sun3os3)
-               basic_machine=m68k-sun
-               os=-sunos3
-               ;;
-       sun3os4)
-               basic_machine=m68k-sun
-               os=-sunos4
-               ;;
-       sun4os3)
-               basic_machine=sparc-sun
-               os=-sunos3
-               ;;
-       sun4os4)
-               basic_machine=sparc-sun
-               os=-sunos4
-               ;;
-       sun4sol2)
-               basic_machine=sparc-sun
-               os=-solaris2
-               ;;
-       sun3 | sun3-*)
-               basic_machine=m68k-sun
-               ;;
-       sun4)
-               basic_machine=sparc-sun
-               ;;
-       sun386 | sun386i | roadrunner)
-               basic_machine=i386-sun
-               ;;
-        sv1)
-               basic_machine=sv1-cray
-               os=-unicos
-               ;;
-       symmetry)
-               basic_machine=i386-sequent
-               os=-dynix
-               ;;
-       t3d)
-               basic_machine=alpha-cray
-               os=-unicos
-               ;;
-       t3e)
-               basic_machine=alphaev5-cray
-               os=-unicos
-               ;;
-       t90)
-               basic_machine=t90-cray
-               os=-unicos
-               ;;
-       tic54x | c54x*)
-               basic_machine=tic54x-unknown
-               os=-coff
-               ;;
-       tx39)
-               basic_machine=mipstx39-unknown
-               ;;
-       tx39el)
-               basic_machine=mipstx39el-unknown
-               ;;
-       toad1)
-               basic_machine=pdp10-xkl
-               os=-tops20
-               ;;
-       tower | tower-32)
-               basic_machine=m68k-ncr
-               ;;
-       udi29k)
-               basic_machine=a29k-amd
-               os=-udi
-               ;;
-       ultra3)
-               basic_machine=a29k-nyu
-               os=-sym1
-               ;;
-       v810 | necv810)
-               basic_machine=v810-nec
-               os=-none
-               ;;
-       vaxv)
-               basic_machine=vax-dec
-               os=-sysv
-               ;;
-       vms)
-               basic_machine=vax-dec
-               os=-vms
-               ;;
-       vpp*|vx|vx-*)
-               basic_machine=f301-fujitsu
-               ;;
-       vxworks960)
-               basic_machine=i960-wrs
-               os=-vxworks
-               ;;
-       vxworks68)
-               basic_machine=m68k-wrs
-               os=-vxworks
-               ;;
-       vxworks29k)
-               basic_machine=a29k-wrs
-               os=-vxworks
-               ;;
-       w65*)
-               basic_machine=w65-wdc
-               os=-none
-               ;;
-       w89k-*)
-               basic_machine=hppa1.1-winbond
-               os=-proelf
-               ;;
-       windows32)
-               basic_machine=i386-pc
-               os=-windows32-msvcrt
-               ;;
-        xps | xps100)
-               basic_machine=xps100-honeywell
-               ;;
-       ymp)
-               basic_machine=ymp-cray
-               os=-unicos
-               ;;
-       z8k-*-coff)
-               basic_machine=z8k-unknown
-               os=-sim
-               ;;
-       none)
-               basic_machine=none-none
-               os=-none
-               ;;
-
-# Here we handle the default manufacturer of certain CPU types.  It is in
-# some cases the only manufacturer, in others, it is the most popular.
-       w89k)
-               basic_machine=hppa1.1-winbond
-               ;;
-       op50n)
-               basic_machine=hppa1.1-oki
-               ;;
-       op60c)
-               basic_machine=hppa1.1-oki
-               ;;
-       romp)
-               basic_machine=romp-ibm
-               ;;
-       rs6000)
-               basic_machine=rs6000-ibm
-               ;;
-       vax)
-               basic_machine=vax-dec
-               ;;
-       pdp10)
-               # there are many clones, so DEC is not a safe bet
-               basic_machine=pdp10-unknown
-               ;;
-       pdp11)
-               basic_machine=pdp11-dec
-               ;;
-       we32k)
-               basic_machine=we32k-att
-               ;;
-       sh3 | sh4 | sh3eb | sh4eb)
-               basic_machine=sh-unknown
-               ;;
-       sh64)
-               basic_machine=sh64-unknown
-               ;;
-       sparc | sparcv9 | sparcv9b)
-               basic_machine=sparc-sun
-               ;;
-        cydra)
-               basic_machine=cydra-cydrome
-               ;;
-       orion)
-               basic_machine=orion-highlevel
-               ;;
-       orion105)
-               basic_machine=clipper-highlevel
-               ;;
-       mac | mpw | mac-mpw)
-               basic_machine=m68k-apple
-               ;;
-       pmac | pmac-mpw)
-               basic_machine=powerpc-apple
-               ;;
-       c4x*)
-               basic_machine=c4x-none
-               os=-coff
-               ;;
-       *-unknown)
-               # Make sure to match an already-canonicalized machine name.
-               ;;
-       *)
-               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-               exit 1
-               ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
-       *-digital*)
-               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
-               ;;
-       *-commodore*)
-               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
-               ;;
-       *)
-               ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
-       # -solaris* is a basic system type, with this one exception.
-       -solaris1 | -solaris1.*)
-               os=`echo $os | sed -e 's|solaris1|sunos4|'`
-               ;;
-       -solaris)
-               os=-solaris2
-               ;;
-       -svr4*)
-               os=-sysv4
-               ;;
-       -unixware*)
-               os=-sysv4.2uw
-               ;;
-       -gnu/linux*)
-               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
-               ;;
-       # First accept the basic system types.
-       # The portable systems comes first.
-       # Each alternative MUST END IN A *, to match a version number.
-       # -sysv* is not here because it comes later, after sysvr4.
-       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-             | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
-             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
-             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-             | -aos* \
-             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
-             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-             | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
-             | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
-             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
-             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-             | -chorusos* | -chorusrdb* \
-             | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-             | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
-             | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
-             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
-             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
-             | -morphos* | -superux* | -rtmk* | -rtmk-nova*)
-       # Remember, each alternative MUST END IN *, to match a version number.
-               ;;
-       -qnx*)
-               case $basic_machine in
-                   x86-* | i*86-*)
-                       ;;
-                   *)
-                       os=-nto$os
-                       ;;
-               esac
-               ;;
-       -nto*)
-               os=-nto-qnx
-               ;;
-       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-             | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
-             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
-               ;;
-       -mac*)
-               os=`echo $os | sed -e 's|mac|macos|'`
-               ;;
-       -linux*)
-               os=`echo $os | sed -e 's|linux|linux-gnu|'`
-               ;;
-       -sunos5*)
-               os=`echo $os | sed -e 's|sunos5|solaris2|'`
-               ;;
-       -sunos6*)
-               os=`echo $os | sed -e 's|sunos6|solaris3|'`
-               ;;
-       -opened*)
-               os=-openedition
-               ;;
-       -wince*)
-               os=-wince
-               ;;
-       -osfrose*)
-               os=-osfrose
-               ;;
-       -osf*)
-               os=-osf
-               ;;
-       -utek*)
-               os=-bsd
-               ;;
-       -dynix*)
-               os=-bsd
-               ;;
-       -acis*)
-               os=-aos
-               ;;
-       -atheos*)
-               os=-atheos
-               ;;
-       -386bsd)
-               os=-bsd
-               ;;
-       -ctix* | -uts*)
-               os=-sysv
-               ;;
-       -nova*)
-               os=-rtmk-nova
-               ;;
-       -ns2 )
-               os=-nextstep2
-               ;;
-       -nsk*)
-               os=-nsk
-               ;;
-       # Preserve the version number of sinix5.
-       -sinix5.*)
-               os=`echo $os | sed -e 's|sinix|sysv|'`
-               ;;
-       -sinix*)
-               os=-sysv4
-               ;;
-       -triton*)
-               os=-sysv3
-               ;;
-       -oss*)
-               os=-sysv3
-               ;;
-       -svr4)
-               os=-sysv4
-               ;;
-       -svr3)
-               os=-sysv3
-               ;;
-       -sysvr4)
-               os=-sysv4
-               ;;
-       # This must come after -sysvr4.
-       -sysv*)
-               ;;
-       -ose*)
-               os=-ose
-               ;;
-       -es1800*)
-               os=-ose
-               ;;
-       -xenix)
-               os=-xenix
-               ;;
-        -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-               os=-mint
-               ;;
-       -none)
-               ;;
-       *)
-               # Get rid of the `-' at the beginning of $os.
-               os=`echo $os | sed 's/[^-]*-//'`
-               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
-               exit 1
-               ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system.  Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
-       *-acorn)
-               os=-riscix1.2
-               ;;
-       arm*-rebel)
-               os=-linux
-               ;;
-       arm*-semi)
-               os=-aout
-               ;;
-       # This must come before the *-dec entry.
-       pdp10-*)
-               os=-tops20
-               ;;
-        pdp11-*)
-               os=-none
-               ;;
-       *-dec | vax-*)
-               os=-ultrix4.2
-               ;;
-       m68*-apollo)
-               os=-domain
-               ;;
-       i386-sun)
-               os=-sunos4.0.2
-               ;;
-       m68000-sun)
-               os=-sunos3
-               # This also exists in the configure program, but was not the
-               # default.
-               # os=-sunos4
-               ;;
-       m68*-cisco)
-               os=-aout
-               ;;
-       mips*-cisco)
-               os=-elf
-               ;;
-       mips*-*)
-               os=-elf
-               ;;
-       or32-*)
-               os=-coff
-               ;;
-       *-tti)  # must be before sparc entry or we get the wrong os.
-               os=-sysv3
-               ;;
-       sparc-* | *-sun)
-               os=-sunos4.1.1
-               ;;
-       *-be)
-               os=-beos
-               ;;
-       *-ibm)
-               os=-aix
-               ;;
-       *-wec)
-               os=-proelf
-               ;;
-       *-winbond)
-               os=-proelf
-               ;;
-       *-oki)
-               os=-proelf
-               ;;
-       *-hp)
-               os=-hpux
-               ;;
-       *-hitachi)
-               os=-hiux
-               ;;
-       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
-               os=-sysv
-               ;;
-       *-cbm)
-               os=-amigaos
-               ;;
-       *-dg)
-               os=-dgux
-               ;;
-       *-dolphin)
-               os=-sysv3
-               ;;
-       m68k-ccur)
-               os=-rtu
-               ;;
-       m88k-omron*)
-               os=-luna
-               ;;
-       *-next )
-               os=-nextstep
-               ;;
-       *-sequent)
-               os=-ptx
-               ;;
-       *-crds)
-               os=-unos
-               ;;
-       *-ns)
-               os=-genix
-               ;;
-       i370-*)
-               os=-mvs
-               ;;
-       *-next)
-               os=-nextstep3
-               ;;
-        *-gould)
-               os=-sysv
-               ;;
-        *-highlevel)
-               os=-bsd
-               ;;
-       *-encore)
-               os=-bsd
-               ;;
-        *-sgi)
-               os=-irix
-               ;;
-        *-siemens)
-               os=-sysv4
-               ;;
-       *-masscomp)
-               os=-rtu
-               ;;
-       f30[01]-fujitsu | f700-fujitsu)
-               os=-uxpv
-               ;;
-       *-rom68k)
-               os=-coff
-               ;;
-       *-*bug)
-               os=-coff
-               ;;
-       *-apple)
-               os=-macos
-               ;;
-       *-atari*)
-               os=-mint
-               ;;
-       *)
-               os=-none
-               ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer.  We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
-       *-unknown)
-               case $os in
-                       -riscix*)
-                               vendor=acorn
-                               ;;
-                       -sunos*)
-                               vendor=sun
-                               ;;
-                       -aix*)
-                               vendor=ibm
-                               ;;
-                       -beos*)
-                               vendor=be
-                               ;;
-                       -hpux*)
-                               vendor=hp
-                               ;;
-                       -mpeix*)
-                               vendor=hp
-                               ;;
-                       -hiux*)
-                               vendor=hitachi
-                               ;;
-                       -unos*)
-                               vendor=crds
-                               ;;
-                       -dgux*)
-                               vendor=dg
-                               ;;
-                       -luna*)
-                               vendor=omron
-                               ;;
-                       -genix*)
-                               vendor=ns
-                               ;;
-                       -mvs* | -opened*)
-                               vendor=ibm
-                               ;;
-                       -ptx*)
-                               vendor=sequent
-                               ;;
-                       -vxsim* | -vxworks*)
-                               vendor=wrs
-                               ;;
-                       -aux*)
-                               vendor=apple
-                               ;;
-                       -hms*)
-                               vendor=hitachi
-                               ;;
-                       -mpw* | -macos*)
-                               vendor=apple
-                               ;;
-                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-                               vendor=atari
-                               ;;
-                       -vos*)
-                               vendor=stratus
-                               ;;
-               esac
-               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
-               ;;
-esac
-
-echo $basic_machine$os
-exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/src/nws_portability/configure b/src/nws_portability/configure
deleted file mode 100755 (executable)
index 1ac4ddf..0000000
+++ /dev/null
@@ -1,2684 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13 
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
-  --enable-debug         include debugging info when compiling"
-ac_help="$ac_help
-  --enable-threads        test for threads support"
-ac_help="$ac_help
-  --disable-sigalarm        don't use SIGALRM"
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-for ac_option
-do
-
-  # If the previous option needs an argument, assign it.
-  if test -n "$ac_prev"; then
-    eval "$ac_prev=\$ac_option"
-    ac_prev=
-    continue
-  fi
-
-  case "$ac_option" in
-  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-  *) ac_optarg= ;;
-  esac
-
-  # Accept the important Cygnus configure options, so we can diagnose typos.
-
-  case "$ac_option" in
-
-  -bindir | --bindir | --bindi | --bind | --bin | --bi)
-    ac_prev=bindir ;;
-  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
-    bindir="$ac_optarg" ;;
-
-  -build | --build | --buil | --bui | --bu)
-    ac_prev=build ;;
-  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
-    build="$ac_optarg" ;;
-
-  -cache-file | --cache-file | --cache-fil | --cache-fi \
-  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
-    ac_prev=cache_file ;;
-  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
-  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-    cache_file="$ac_optarg" ;;
-
-  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
-    ac_prev=datadir ;;
-  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
-  | --da=*)
-    datadir="$ac_optarg" ;;
-
-  -disable-* | --disable-*)
-    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
-    # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
-      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
-    fi
-    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
-    eval "enable_${ac_feature}=no" ;;
-
-  -enable-* | --enable-*)
-    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
-    # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
-      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
-    fi
-    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
-    case "$ac_option" in
-      *=*) ;;
-      *) ac_optarg=yes ;;
-    esac
-    eval "enable_${ac_feature}='$ac_optarg'" ;;
-
-  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
-  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
-  | --exec | --exe | --ex)
-    ac_prev=exec_prefix ;;
-  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
-  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
-  | --exec=* | --exe=* | --ex=*)
-    exec_prefix="$ac_optarg" ;;
-
-  -gas | --gas | --ga | --g)
-    # Obsolete; use --with-gas.
-    with_gas=yes ;;
-
-  -help | --help | --hel | --he)
-    # Omit some internal or obsolete options to make the list less imposing.
-    # This message is too long to be a string in the A/UX 3.1 sh.
-    cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
-  --cache-file=FILE       cache test results in FILE
-  --help                  print this message
-  --no-create             do not create output files
-  --quiet, --silent       do not print \`checking...' messages
-  --version               print the version of autoconf that created configure
-Directory and file names:
-  --prefix=PREFIX         install architecture-independent files in PREFIX
-                          [$ac_default_prefix]
-  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                          [same as prefix]
-  --bindir=DIR            user executables in DIR [EPREFIX/bin]
-  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
-  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
-  --datadir=DIR           read-only architecture-independent data in DIR
-                          [PREFIX/share]
-  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
-  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
-                          [PREFIX/com]
-  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
-  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
-  --includedir=DIR        C header files in DIR [PREFIX/include]
-  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
-  --infodir=DIR           info documentation in DIR [PREFIX/info]
-  --mandir=DIR            man documentation in DIR [PREFIX/man]
-  --srcdir=DIR            find the sources in DIR [configure dir or ..]
-  --program-prefix=PREFIX prepend PREFIX to installed program names
-  --program-suffix=SUFFIX append SUFFIX to installed program names
-  --program-transform-name=PROGRAM
-                          run sed PROGRAM on installed program names
-EOF
-    cat << EOF
-Host type:
-  --build=BUILD           configure for building on BUILD [BUILD=HOST]
-  --host=HOST             configure for HOST [guessed]
-  --target=TARGET         configure for TARGET [TARGET=HOST]
-Features and packages:
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
-  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --x-includes=DIR        X include files are in DIR
-  --x-libraries=DIR       X library files are in DIR
-EOF
-    if test -n "$ac_help"; then
-      echo "--enable and --with options recognized:$ac_help"
-    fi
-    exit 0 ;;
-
-  -host | --host | --hos | --ho)
-    ac_prev=host ;;
-  -host=* | --host=* | --hos=* | --ho=*)
-    host="$ac_optarg" ;;
-
-  -includedir | --includedir | --includedi | --included | --include \
-  | --includ | --inclu | --incl | --inc)
-    ac_prev=includedir ;;
-  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
-  | --includ=* | --inclu=* | --incl=* | --inc=*)
-    includedir="$ac_optarg" ;;
-
-  -infodir | --infodir | --infodi | --infod | --info | --inf)
-    ac_prev=infodir ;;
-  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
-    infodir="$ac_optarg" ;;
-
-  -libdir | --libdir | --libdi | --libd)
-    ac_prev=libdir ;;
-  -libdir=* | --libdir=* | --libdi=* | --libd=*)
-    libdir="$ac_optarg" ;;
-
-  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
-  | --libexe | --libex | --libe)
-    ac_prev=libexecdir ;;
-  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
-  | --libexe=* | --libex=* | --libe=*)
-    libexecdir="$ac_optarg" ;;
-
-  -localstatedir | --localstatedir | --localstatedi | --localstated \
-  | --localstate | --localstat | --localsta | --localst \
-  | --locals | --local | --loca | --loc | --lo)
-    ac_prev=localstatedir ;;
-  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
-  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
-  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
-    localstatedir="$ac_optarg" ;;
-
-  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
-    ac_prev=mandir ;;
-  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
-    mandir="$ac_optarg" ;;
-
-  -nfp | --nfp | --nf)
-    # Obsolete; use --without-fp.
-    with_fp=no ;;
-
-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c)
-    no_create=yes ;;
-
-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
-    no_recursion=yes ;;
-
-  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
-  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
-  | --oldin | --oldi | --old | --ol | --o)
-    ac_prev=oldincludedir ;;
-  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
-  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
-  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
-    oldincludedir="$ac_optarg" ;;
-
-  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
-    ac_prev=prefix ;;
-  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-    prefix="$ac_optarg" ;;
-
-  -program-prefix | --program-prefix | --program-prefi | --program-pref \
-  | --program-pre | --program-pr | --program-p)
-    ac_prev=program_prefix ;;
-  -program-prefix=* | --program-prefix=* | --program-prefi=* \
-  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-    program_prefix="$ac_optarg" ;;
-
-  -program-suffix | --program-suffix | --program-suffi | --program-suff \
-  | --program-suf | --program-su | --program-s)
-    ac_prev=program_suffix ;;
-  -program-suffix=* | --program-suffix=* | --program-suffi=* \
-  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-    program_suffix="$ac_optarg" ;;
-
-  -program-transform-name | --program-transform-name \
-  | --program-transform-nam | --program-transform-na \
-  | --program-transform-n | --program-transform- \
-  | --program-transform | --program-transfor \
-  | --program-transfo | --program-transf \
-  | --program-trans | --program-tran \
-  | --progr-tra | --program-tr | --program-t)
-    ac_prev=program_transform_name ;;
-  -program-transform-name=* | --program-transform-name=* \
-  | --program-transform-nam=* | --program-transform-na=* \
-  | --program-transform-n=* | --program-transform-=* \
-  | --program-transform=* | --program-transfor=* \
-  | --program-transfo=* | --program-transf=* \
-  | --program-trans=* | --program-tran=* \
-  | --progr-tra=* | --program-tr=* | --program-t=*)
-    program_transform_name="$ac_optarg" ;;
-
-  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-  | -silent | --silent | --silen | --sile | --sil)
-    silent=yes ;;
-
-  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
-    ac_prev=sbindir ;;
-  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
-  | --sbi=* | --sb=*)
-    sbindir="$ac_optarg" ;;
-
-  -sharedstatedir | --sharedstatedir | --sharedstatedi \
-  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
-  | --sharedst | --shareds | --shared | --share | --shar \
-  | --sha | --sh)
-    ac_prev=sharedstatedir ;;
-  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
-  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
-  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
-  | --sha=* | --sh=*)
-    sharedstatedir="$ac_optarg" ;;
-
-  -site | --site | --sit)
-    ac_prev=site ;;
-  -site=* | --site=* | --sit=*)
-    site="$ac_optarg" ;;
-
-  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
-    ac_prev=srcdir ;;
-  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-    srcdir="$ac_optarg" ;;
-
-  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
-  | --syscon | --sysco | --sysc | --sys | --sy)
-    ac_prev=sysconfdir ;;
-  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
-  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
-    sysconfdir="$ac_optarg" ;;
-
-  -target | --target | --targe | --targ | --tar | --ta | --t)
-    ac_prev=target ;;
-  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-    target="$ac_optarg" ;;
-
-  -v | -verbose | --verbose | --verbos | --verbo | --verb)
-    verbose=yes ;;
-
-  -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.13"
-    exit 0 ;;
-
-  -with-* | --with-*)
-    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
-    # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
-      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
-    fi
-    ac_package=`echo $ac_package| sed 's/-/_/g'`
-    case "$ac_option" in
-      *=*) ;;
-      *) ac_optarg=yes ;;
-    esac
-    eval "with_${ac_package}='$ac_optarg'" ;;
-
-  -without-* | --without-*)
-    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
-    # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
-      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
-    fi
-    ac_package=`echo $ac_package| sed 's/-/_/g'`
-    eval "with_${ac_package}=no" ;;
-
-  --x)
-    # Obsolete; use --with-x.
-    with_x=yes ;;
-
-  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
-  | --x-incl | --x-inc | --x-in | --x-i)
-    ac_prev=x_includes ;;
-  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
-  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-    x_includes="$ac_optarg" ;;
-
-  -x-libraries | --x-libraries | --x-librarie | --x-librari \
-  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
-    ac_prev=x_libraries ;;
-  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
-  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-    x_libraries="$ac_optarg" ;;
-
-  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
-    ;;
-
-  *)
-    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
-      echo "configure: warning: $ac_option: invalid host type" 1>&2
-    fi
-    if test "x$nonopt" != xNONE; then
-      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
-    fi
-    nonopt="$ac_option"
-    ;;
-
-  esac
-done
-
-if test -n "$ac_prev"; then
-  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
-  exec 6>/dev/null
-else
-  exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
-  case "$ac_arg" in
-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c) ;;
-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
-  *" "*|*"     "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
-  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
-  esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set.  These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=protocol.c
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
-  ac_srcdir_defaulted=yes
-  # Try the directory containing this script, then its parent.
-  ac_prog=$0
-  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
-  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
-  srcdir=$ac_confdir
-  if test ! -r $srcdir/$ac_unique_file; then
-    srcdir=..
-  fi
-else
-  ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
-  if test "$ac_srcdir_defaulted" = yes; then
-    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
-  else
-    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
-  fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
-  if test "x$prefix" != xNONE; then
-    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
-  else
-    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
-  fi
-fi
-for ac_site_file in $CONFIG_SITE; do
-  if test -r "$ac_site_file"; then
-    echo "loading site script $ac_site_file"
-    . "$ac_site_file"
-  fi
-done
-
-if test -r "$cache_file"; then
-  echo "loading cache $cache_file"
-  . $cache_file
-else
-  echo "creating cache $cache_file"
-  > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
-  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
-  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
-    ac_n= ac_c='
-' ac_t='       '
-  else
-    ac_n=-n ac_c= ac_t=
-  fi
-else
-  ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-
-# Checks the host we are running on.
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
-  if test -f $ac_dir/install-sh; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f $ac_dir/install.sh; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:560: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
-  case $nonopt in
-  NONE)
-    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
-    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
-    fi ;;
-  *) host_alias=$nonopt ;;
-  esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-
-# Set paths and common variables and NWS top directory (if compiling with
-# NWS)
-if test -n "$TOP"; then
-       NWS_TOP="${TOP}"
-else 
-       NWS_TOP=`pwd`
-fi
-TOP=`pwd`
-INCLUDES="-I${TOP}/Include"
-ARFLAGS="cr"
-test_debug="no"
-test_thread="no"
-use_alarm_signal="no"
-
-# Set default for CFLAGS
-CFLAGS="-DHAVE_CONFIG_H"
-
-# test for command line options
-# Check whether --enable-debug or --disable-debug was given.
-if test "${enable_debug+set}" = set; then
-  enableval="$enable_debug"
-  if test "${withval}" != "yes"; then
-                       test_debug="yes"
-               fi
-fi
-
-
-# Check whether --enable-threads or --disable-threads was given.
-if test "${enable_threads+set}" = set; then
-  enableval="$enable_threads"
-  if test "${enableval}" != "no"; then
-                       test_thread="yes"
-               fi
-fi
-
-
-# Check whether --enable-sigalarm or --disable-sigalarm was given.
-if test "${enable_sigalarm+set}" = set; then
-  enableval="$enable_sigalarm"
-  if test "${enableval}" != "no"; then
-                       use_alarm_signal="yes"
-                       cat >> confdefs.h <<\EOF
-#define USE_ALARM_SIGNAL 1
-EOF
-
-               fi
-else
-  cat >> confdefs.h <<\EOF
-#define USE_ALARM_SIGNAL 1
-EOF
-
-        use_alarm_signal="yes"
-fi
-
-
-# Checks for programs.
-# Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:640: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  case "$AR" in
-  /*)
-  ac_cv_path_AR="$AR" # Let the user override the test with a path.
-  ;;
-  ?:/*)                         
-  ac_cv_path_AR="$AR" # Let the user override the test with a dos path.
-  ;;
-  *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_AR="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac
-fi
-AR="$ac_cv_path_AR"
-if test -n "$AR"; then
-  echo "$ac_t""$AR" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:675: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_CC="gcc"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:705: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_prog_rejected=no
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
-        ac_prog_rejected=yes
-       continue
-      fi
-      ac_cv_prog_CC="cc"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# -gt 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    set dummy "$ac_dir/$ac_word" "$@"
-    shift
-    ac_cv_prog_CC="$@"
-  fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-  if test -z "$CC"; then
-    case "`uname -s`" in
-    *win32* | *WIN32*)
-      # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:756: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_CC="cl"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
- ;;
-    esac
-  fi
-  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:788: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 799 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  ac_cv_prog_cc_works=yes
-  # If we can't run a trivial program, we are probably using a cross compiler.
-  if (./conftest; exit) 2>/dev/null; then
-    ac_cv_prog_cc_cross=no
-  else
-    ac_cv_prog_cc_cross=yes
-  fi
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
-  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:830: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:835: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.c <<EOF
-#ifdef __GNUC__
-  yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:844: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
-  ac_cv_prog_gcc=yes
-else
-  ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
-  GCC=yes
-else
-  GCC=
-fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:863: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
-  ac_cv_prog_cc_g=yes
-else
-  ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-if test "$ac_test_CFLAGS" = set; then
-  CFLAGS="$ac_save_CFLAGS"
-elif test $ac_cv_prog_cc_g = yes; then
-  if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
-  else
-    CFLAGS="-g"
-  fi
-else
-  if test "$GCC" = yes; then
-    CFLAGS="-O2"
-  else
-    CFLAGS=
-  fi
-fi
-
-# Setting up debug options
-if test "${test_debug}" = "yes"; then
-       CFLAGS="${CFLAGS} -g "
-else 
-       CFLAGS="${CFLAGS} -O2"
-       if test "${GCC}" = "yes" ; then
-               CFLAGS="${CFLAGS} -finline-functions"
-       fi
-fi
-
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:916: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-    IFS="${IFS=        }"; ac_save_IFS="$IFS"; IFS=":"
-  for ac_dir in $PATH; do
-    # Account for people who put trailing slashes in PATH elements.
-    case "$ac_dir/" in
-    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
-    *)
-      # OSF1 and SCO ODT 3.0 have their own names for install.
-      # Don't use installbsd from OSF since it installs stuff as root
-      # by default.
-      for ac_prog in ginstall scoinst install; do
-        if test -f $ac_dir/$ac_prog; then
-         if test $ac_prog = install &&
-            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
-           # AIX install.  It has an incompatible calling convention.
-           :
-         else
-           ac_cv_path_install="$ac_dir/$ac_prog -c"
-           break 2
-         fi
-       fi
-      done
-      ;;
-    esac
-  done
-  IFS="$ac_save_IFS"
-
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL="$ac_cv_path_install"
-  else
-    # As a last resort, use the slow shell script.  We don't cache a
-    # path for INSTALL within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the path is relative.
-    INSTALL="$ac_install_sh"
-  fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:971: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -n "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_RANLIB="ranlib"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
-  echo "$ac_t""$RANLIB" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-# Extract the first word of "rm", so it can be a program name with args.
-set dummy rm; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1001: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  case "$RM" in
-  /*)
-  ac_cv_path_RM="$RM" # Let the user override the test with a path.
-  ;;
-  ?:/*)                         
-  ac_cv_path_RM="$RM" # Let the user override the test with a dos path.
-  ;;
-  *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_RM="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac
-fi
-RM="$ac_cv_path_RM"
-if test -n "$RM"; then
-  echo "$ac_t""$RM" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-# Extract the first word of "cp", so it can be a program name with args.
-set dummy cp; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1036: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_CP'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  case "$CP" in
-  /*)
-  ac_cv_path_CP="$CP" # Let the user override the test with a path.
-  ;;
-  ?:/*)                         
-  ac_cv_path_CP="$CP" # Let the user override the test with a dos path.
-  ;;
-  *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_CP="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac
-fi
-CP="$ac_cv_path_CP"
-if test -n "$CP"; then
-  echo "$ac_t""$CP" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-# Extract the first word of "tar", so it can be a program name with args.
-set dummy tar; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1071: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_TAR'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  case "$TAR" in
-  /*)
-  ac_cv_path_TAR="$TAR" # Let the user override the test with a path.
-  ;;
-  ?:/*)                         
-  ac_cv_path_TAR="$TAR" # Let the user override the test with a dos path.
-  ;;
-  *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_TAR="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac
-fi
-TAR="$ac_cv_path_TAR"
-if test -n "$TAR"; then
-  echo "$ac_t""$TAR" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-# Extract the first word of "ctags", so it can be a program name with args.
-set dummy ctags; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1106: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_CTAGS'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  case "$CTAGS" in
-  /*)
-  ac_cv_path_CTAGS="$CTAGS" # Let the user override the test with a path.
-  ;;
-  ?:/*)                         
-  ac_cv_path_CTAGS="$CTAGS" # Let the user override the test with a dos path.
-  ;;
-  *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_CTAGS="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac
-fi
-CTAGS="$ac_cv_path_CTAGS"
-if test -n "$CTAGS"; then
-  echo "$ac_t""$CTAGS" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-
-# Set compiler and linker switches 
-if test "${CC}" = "gcc"; then
-       # Adding all annoying warning compilers message
-       CFLAGS="${CFLAGS} -Wall -pedantic -Wshadow -Wpointer-arith -Wwrite-strings"
-       # Extract the first word of "gprof", so it can be a program name with args.
-set dummy gprof; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1146: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_PROFILE'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  case "$PROFILE" in
-  /*)
-  ac_cv_path_PROFILE="$PROFILE" # Let the user override the test with a path.
-  ;;
-  ?:/*)                         
-  ac_cv_path_PROFILE="$PROFILE" # Let the user override the test with a dos path.
-  ;;
-  *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_PROFILE="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac
-fi
-PROFILE="$ac_cv_path_PROFILE"
-if test -n "$PROFILE"; then
-  echo "$ac_t""$PROFILE" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-else
-       # Extract the first word of "prof", so it can be a program name with args.
-set dummy prof; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1182: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_PROFILE'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  case "$PROFILE" in
-  /*)
-  ac_cv_path_PROFILE="$PROFILE" # Let the user override the test with a path.
-  ;;
-  ?:/*)                         
-  ac_cv_path_PROFILE="$PROFILE" # Let the user override the test with a dos path.
-  ;;
-  *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_PROFILE="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac
-fi
-PROFILE="$ac_cv_path_PROFILE"
-if test -n "$PROFILE"; then
-  echo "$ac_t""$PROFILE" 1>&6
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-fi
-
-# Checks for libraries.
-echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6
-echo "configure:1218: checking for inet_ntoa in -lnsl" >&5
-ac_lib_var=`echo nsl'_'inet_ntoa | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lnsl  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1226 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char inet_ntoa();
-
-int main() {
-inet_ntoa()
-; return 0; }
-EOF
-if { (eval echo configure:1237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
-  LIBS="-lnsl $LIBS"
-
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:1265: checking for socket in -lsocket" >&5
-ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lsocket  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1273 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char socket();
-
-int main() {
-socket()
-; return 0; }
-EOF
-if { (eval echo configure:1284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
-  LIBS="-lsocket $LIBS"
-
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-if test "${test_thread}" = "yes"; then
-       echo $ac_n "checking for pthread_mutex_lock in -lpthread""... $ac_c" 1>&6
-echo "configure:1313: checking for pthread_mutex_lock in -lpthread" >&5
-ac_lib_var=`echo pthread'_'pthread_mutex_lock | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lpthread  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1321 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char pthread_mutex_lock();
-
-int main() {
-pthread_mutex_lock()
-; return 0; }
-EOF
-if { (eval echo configure:1332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo pthread | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
-  LIBS="-lpthread $LIBS"
-
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-fi
-
-# Checks for header files and symbols declared in headers.
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1363: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-    # This must be in double quotes, not single quotes, because CPP may get
-  # substituted into the Makefile and "${CC-cc}" will confuse make.
-  CPP="${CC-cc} -E"
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp.
-  cat > conftest.$ac_ext <<EOF
-#line 1378 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1384: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  :
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP="${CC-cc} -E -traditional-cpp"
-  cat > conftest.$ac_ext <<EOF
-#line 1395 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1401: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  :
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP="${CC-cc} -nologo -E"
-  cat > conftest.$ac_ext <<EOF
-#line 1412 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1418: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  :
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-  ac_cv_prog_CPP="$CPP"
-fi
-  CPP="$ac_cv_prog_CPP"
-else
-  ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1443: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1448 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1456: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  ac_cv_header_stdc=yes
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1473 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "memchr" >/dev/null 2>&1; then
-  :
-else
-  rm -rf conftest*
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1491 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "free" >/dev/null 2>&1; then
-  :
-else
-  rm -rf conftest*
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-if test "$cross_compiling" = yes; then
-  :
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1512 "configure"
-#include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
-
-EOF
-if { (eval echo configure:1523: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
-  :
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_header_stdc=no
-fi
-rm -fr conftest*
-fi
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
-  cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
-
-fi
-
-echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1547: checking for sys/wait.h that is POSIX.1 compatible" >&5
-if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1552 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/wait.h>
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
-#endif
-int main() {
-int s;
-wait (&s);
-s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
-; return 0; }
-EOF
-if { (eval echo configure:1568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ac_cv_header_sys_wait_h=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_header_sys_wait_h=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
-if test $ac_cv_header_sys_wait_h = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_SYS_WAIT_H 1
-EOF
-
-fi
-
-for ac_hdr in arpa/inet.h errno.h netdb.h netinet/in.h stddef.h stdlib.h string.h strings.h sys/socket.h sys/time.h unistd.h math.h inttypes.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1592: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1597 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1602: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-fi
-done
-
-if test "${test_thread}" = "yes"; then
-       for ac_hdr in pthread.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1633: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1638 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1643: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-fi
-done
-
-fi
-echo $ac_n "checking for uint32_t""... $ac_c" 1>&6
-echo "configure:1671: checking for uint32_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_uint32_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1676 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])uint32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ac_cv_type_uint32_t=yes
-else
-  rm -rf conftest*
-  ac_cv_type_uint32_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_uint32_t" 1>&6
-if test $ac_cv_type_uint32_t = no; then
-  cat >> confdefs.h <<\EOF
-#define uint32_t unsigned long
-EOF
-
-fi
-
-
-
-
-
-
-# The third parameter to getpeername() is a pointer to socklen_t, size_t, or
-# int on various systems.  Worse yet, some systems define socklen_t but use a
-# different type in the getpeername() prototype, and Solaris Intel defines
-# Psocklen_t, which is a pointer to either socklen_t or void.  We use SOCKLEN_T
-# in the NWS code, defining it the proper type for the system.
-cat > conftest.$ac_ext <<EOF
-#line 1714 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-   #include <sys/socket.h>
-int main() {
-extern int getpeername(int socket, struct sockaddr *addr, socklen_t *len);
-; return 0; }
-EOF
-if { (eval echo configure:1722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  SOCKLEN_T=socklen_t
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  cat > conftest.$ac_ext <<EOF
-#line 1730 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-     #include <sys/socket.h>
-int main() {
-extern int getpeername(int socket, struct sockaddr *addr, size_t *len);
-; return 0; }
-EOF
-if { (eval echo configure:1738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  SOCKLEN_T=size_t
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  cat > conftest.$ac_ext <<EOF
-#line 1746 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-       #include <sys/socket.h>
-int main() {
-socklen_t len; Psocklen_t lenP = &len;
-       (void)getpeername(0, 0, lenP);
-; return 0; }
-EOF
-if { (eval echo configure:1755: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  SOCKLEN_T=socklen_t
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  SOCKLEN_T=int
-    
-fi
-rm -f conftest*
-  
-fi
-rm -f conftest*
-
-fi
-rm -f conftest*
-
-
-# Checks for typedefs, structures, and compiler characteristics.
-echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1776: checking for working const" >&5
-if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1781 "configure"
-#include "confdefs.h"
-
-int main() {
-
-/* Ultrix mips cc rejects this.  */
-typedef int charset[2]; const charset x;
-/* SunOS 4.1.1 cc rejects this.  */
-char const *const *ccp;
-char **p;
-/* NEC SVR4.0.2 mips cc rejects this.  */
-struct point {int x, y;};
-static struct point const zero = {0,0};
-/* AIX XL C 1.02.0.0 rejects this.
-   It does not let you subtract one const X* pointer from another in an arm
-   of an if-expression whose if-part is not a constant expression */
-const char *g = "string";
-ccp = &g + (g ? g-g : 0);
-/* HPUX 7.0 cc rejects these. */
-++ccp;
-p = (char**) ccp;
-ccp = (char const *const *) p;
-{ /* SCO 3.2v4 cc rejects this.  */
-  char *t;
-  char const *s = 0 ? (char *) 0 : (char const *) 0;
-
-  *t++ = 0;
-}
-{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
-  int x[] = {25, 17};
-  const int *foo = &x[0];
-  ++foo;
-}
-{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
-  typedef const int *iptr;
-  iptr p = 0;
-  ++p;
-}
-{ /* AIX XL C 1.02.0.0 rejects this saying
-     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-  struct s { int j; const int *ap[3]; };
-  struct s *b; b->j = 5;
-}
-{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
-  const int foo = 10;
-}
-
-; return 0; }
-EOF
-if { (eval echo configure:1830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ac_cv_c_const=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_c_const=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_c_const" 1>&6
-if test $ac_cv_c_const = no; then
-  cat >> confdefs.h <<\EOF
-#define const 
-EOF
-
-fi
-
-echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:1851: checking for mode_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1856 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ac_cv_type_mode_t=yes
-else
-  rm -rf conftest*
-  ac_cv_type_mode_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_mode_t" 1>&6
-if test $ac_cv_type_mode_t = no; then
-  cat >> confdefs.h <<\EOF
-#define mode_t int
-EOF
-
-fi
-
-echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:1884: checking for pid_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1889 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ac_cv_type_pid_t=yes
-else
-  rm -rf conftest*
-  ac_cv_type_pid_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_pid_t" 1>&6
-if test $ac_cv_type_pid_t = no; then
-  cat >> confdefs.h <<\EOF
-#define pid_t int
-EOF
-
-fi
-
-echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1917: checking for size_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1922 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ac_cv_type_size_t=yes
-else
-  rm -rf conftest*
-  ac_cv_type_size_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_size_t" 1>&6
-if test $ac_cv_type_size_t = no; then
-  cat >> confdefs.h <<\EOF
-#define size_t unsigned
-EOF
-
-fi
-
-echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1950: checking whether time.h and sys/time.h may both be included" >&5
-if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1955 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-int main() {
-struct tm *tp;
-; return 0; }
-EOF
-if { (eval echo configure:1964: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ac_cv_header_time=yes
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_header_time=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_header_time" 1>&6
-if test $ac_cv_header_time = yes; then
-  cat >> confdefs.h <<\EOF
-#define TIME_WITH_SYS_TIME 1
-EOF
-
-fi
-
-echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:1985: checking whether struct tm is in sys/time.h or time.h" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1990 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <time.h>
-int main() {
-struct tm *tp; tp->tm_sec;
-; return 0; }
-EOF
-if { (eval echo configure:1998: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ac_cv_struct_tm=time.h
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_struct_tm=sys/time.h
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_struct_tm" 1>&6
-if test $ac_cv_struct_tm = sys/time.h; then
-  cat >> confdefs.h <<\EOF
-#define TM_IN_SYS_TIME 1
-EOF
-
-fi
-
-
-# Checks for library functions.
-echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2021: checking return type of signal handlers" >&5
-if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 2026 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <signal.h>
-#ifdef signal
-#undef signal
-#endif
-#ifdef __cplusplus
-extern "C" void (*signal (int, void (*)(int)))(int);
-#else
-void (*signal ()) ();
-#endif
-
-int main() {
-int i;
-; return 0; }
-EOF
-if { (eval echo configure:2043: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ac_cv_type_signal=void
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_type_signal=int
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_type_signal" 1>&6
-cat >> confdefs.h <<EOF
-#define RETSIGTYPE $ac_cv_type_signal
-EOF
-
-
-echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:2062: checking for vprintf" >&5
-if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 2067 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char vprintf(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char vprintf();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_vprintf) || defined (__stub___vprintf)
-choke me
-#else
-vprintf();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_vprintf=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_vprintf=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
-#define HAVE_VPRINTF 1
-EOF
-
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-if test "$ac_cv_func_vprintf" != yes; then
-echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:2114: checking for _doprnt" >&5
-if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 2119 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char _doprnt(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char _doprnt();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub__doprnt) || defined (__stub____doprnt)
-choke me
-#else
-_doprnt();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func__doprnt=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func__doprnt=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
-#define HAVE_DOPRNT 1
-EOF
-
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-fi
-
-
-if test "$use_alarm_signal" != "no"; then
-       echo $ac_n "checking for alarm""... $ac_c" 1>&6
-echo "configure:2169: checking for alarm" >&5
-if eval "test \"`echo '$''{'ac_cv_func_alarm'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 2174 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char alarm(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char alarm();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_alarm) || defined (__stub___alarm)
-choke me
-#else
-alarm();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_alarm=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_alarm=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'alarm`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
-#define HAVE_ALARM 1
-EOF
-
-else
-  echo "$ac_t""no" 1>&6
-{ echo "configure: error: Can't do without alarm!! Try to configure with --disable-sigalarm" 1>&2; exit 1; }
-fi
-
-fi
-
-for ac_func in endpwent ftruncate gethostbyaddr gethostbyaddr_r gethostbyname gethostname uname gettimeofday inet_aton inet_ntoa memset mkdir select socket strcasecmp strchr strdup strerror sysconf getrusage siginterrupt sighold sigrelse strnlen fileno sqrt
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2225: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 2230 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-fi
-done
-
-
-# Substitute these variables.
-
-
-
-
-# the following should be automatically substitute by autoconf but for
-# consistency we put them here
-
-
-
-
-
-
-
-
-
-
-
-# Define new variables to substitute.
-cat >> confdefs.h <<EOF
-#define SOCKLEN_T ${SOCKLEN_T}
-EOF
-
-
-
-
-cat >> confdefs.h <<EOF
-#define TOP "$TOP"
-EOF
-
-
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs.  It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already.  You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
-  case `(ac_space=' '; set | grep ac_space) 2>&1` in
-  *ac_space=\ *)
-    # `set' does not quote correctly, so add quotes (double-quote substitution
-    # turns \\\\ into \\, and sed turns \\ into \).
-    sed -n \
-      -e "s/'/'\\\\''/g" \
-      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
-    ;;
-  *)
-    # `set' quotes correctly as required by POSIX, so do not add quotes.
-    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
-    ;;
-  esac >> confcache
-if cmp -s $cache_file confcache; then
-  :
-else
-  if test -w $cache_file; then
-    echo "updating cache $cache_file"
-    cat confcache > $cache_file
-  else
-    echo "not updating unwritable cache $cache_file"
-  fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
-  ac_vpsub='/^[        ]*VPATH[        ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-DEFS=-DHAVE_CONFIG_H
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
-  case "\$ac_option" in
-  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
-    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.13"
-    exit 0 ;;
-  -help | --help | --hel | --he | --h)
-    echo "\$ac_cs_usage"; exit 0 ;;
-  *) echo "\$ac_cs_usage"; exit 1 ;;
-  esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makedefs Include/config_portability.h:Include/config_portability.h.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@AR@%$AR%g
-s%@CC@%$CC%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@RANLIB@%$RANLIB%g
-s%@RM@%$RM%g
-s%@CP@%$CP%g
-s%@TAR@%$TAR%g
-s%@CTAGS@%$CTAGS%g
-s%@PROFILE@%$PROFILE%g
-s%@CPP@%$CPP%g
-s%@ARFLAGS@%$ARFLAGS%g
-s%@INCLUDES@%$INCLUDES%g
-s%@PREFIX_DIR@%$PREFIX_DIR%g
-s%@TOP@%$TOP%g
-s%@NWS_TOP@%$NWS_TOP%g
-s%@uint32_t@%$uint32_t%g
-s%@SOCKLEN_T@%$SOCKLEN_T%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
-  if test $ac_beg -gt 1; then
-    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
-  else
-    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
-  fi
-  if test ! -s conftest.s$ac_file; then
-    ac_more_lines=false
-    rm -f conftest.s$ac_file
-  else
-    if test -z "$ac_sed_cmds"; then
-      ac_sed_cmds="sed -f conftest.s$ac_file"
-    else
-      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
-    fi
-    ac_file=`expr $ac_file + 1`
-    ac_beg=$ac_end
-    ac_end=`expr $ac_end + $ac_max_sed_cmds`
-  fi
-done
-if test -z "$ac_sed_cmds"; then
-  ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makedefs"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
-  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-  case "$ac_file" in
-  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
-       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
-  *) ac_file_in="${ac_file}.in" ;;
-  esac
-
-  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
-  # Remove last slash and all that follows it.  Not all systems have dirname.
-  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
-  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-    # The file is in a subdirectory.
-    test ! -d "$ac_dir" && mkdir "$ac_dir"
-    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
-    # A "../" for each directory in $ac_dir_suffix.
-    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
-  else
-    ac_dir_suffix= ac_dots=
-  fi
-
-  case "$ac_given_srcdir" in
-  .)  srcdir=.
-      if test -z "$ac_dots"; then top_srcdir=.
-      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
-  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
-  *) # Relative path.
-    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
-    top_srcdir="$ac_dots$ac_given_srcdir" ;;
-  esac
-
-  case "$ac_given_INSTALL" in
-  [/$]*) INSTALL="$ac_given_INSTALL" ;;
-  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
-  esac
-
-  echo creating "$ac_file"
-  rm -f "$ac_file"
-  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
-  case "$ac_file" in
-  *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
-  *) ac_comsub= ;;
-  esac
-
-  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
-  sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s%^\([  ]*\)#\([        ]*define[       ][      ]*\)'
-ac_dB='\([     ][      ]*\)[^  ]*%\1#\2'
-ac_dC='\3'
-ac_dD='%g'
-# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
-ac_uA='s%^\([  ]*\)#\([        ]*\)undef\([    ][      ]*\)'
-ac_uB='\([     ]\)%\1#\2define\3'
-ac_uC=' '
-ac_uD='\4%g'
-# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_eA='s%^\([  ]*\)#\([        ]*\)undef\([    ][      ]*\)'
-ac_eB='$%\1#\2define\3'
-ac_eC=' '
-ac_eD='%g'
-
-if test "${CONFIG_HEADERS+set}" != set; then
-EOF
-cat >> $CONFIG_STATUS <<EOF
-  CONFIG_HEADERS="Include/config_portability.h:Include/config_portability.h.in"
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-fi
-for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
-  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-  case "$ac_file" in
-  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
-       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
-  *) ac_file_in="${ac_file}.in" ;;
-  esac
-
-  echo creating $ac_file
-
-  rm -f conftest.frag conftest.in conftest.out
-  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
-  cat $ac_file_inputs > conftest.in
-
-EOF
-
-# Transform confdefs.h into a sed script conftest.vals that substitutes
-# the proper values into config.h.in to produce config.h.  And first:
-# Protect against being on the right side of a sed subst in config.status.
-# Protect against being in an unquoted here document in config.status.
-rm -f conftest.vals
-cat > conftest.hdr <<\EOF
-s/[\\&%]/\\&/g
-s%[\\$`]%\\&%g
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
-s%ac_d%ac_u%gp
-s%ac_u%ac_e%gp
-EOF
-sed -n -f conftest.hdr confdefs.h > conftest.vals
-rm -f conftest.hdr
-
-# This sed command replaces #undef with comments.  This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-cat >> conftest.vals <<\EOF
-s%^[   ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
-EOF
-
-# Break up conftest.vals because some shells have a limit on
-# the size of here documents, and old seds have small limits too.
-
-rm -f conftest.tail
-while :
-do
-  ac_lines=`grep -c . conftest.vals`
-  # grep -c gives empty output for an empty file on some AIX systems.
-  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
-  # Write a limited-size here document to conftest.frag.
-  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
-  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
-  echo 'CEOF
-  sed -f conftest.frag conftest.in > conftest.out
-  rm -f conftest.in
-  mv conftest.out conftest.in
-' >> $CONFIG_STATUS
-  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
-  rm -f conftest.vals
-  mv conftest.tail conftest.vals
-done
-rm -f conftest.vals
-
-cat >> $CONFIG_STATUS <<\EOF
-  rm -f conftest.frag conftest.h
-  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
-  cat conftest.in >> conftest.h
-  rm -f conftest.in
-  if cmp -s $ac_file conftest.h 2>/dev/null; then
-    echo "$ac_file is unchanged"
-    rm -f conftest.h
-  else
-    # Remove last slash and all that follows it.  Not all systems have dirname.
-      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
-      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-      # The file is in a subdirectory.
-      test ! -d "$ac_dir" && mkdir "$ac_dir"
-    fi
-    rm -f $ac_file
-    mv conftest.h $ac_file
-  fi
-fi; done
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
diff --git a/src/nws_portability/configure.in b/src/nws_portability/configure.in
deleted file mode 100644 (file)
index 74fd55d..0000000
+++ /dev/null
@@ -1,186 +0,0 @@
-#
-# configure.in for the Portability library used mainly in NWS
-#
-# $Id$
-#
-
-# Process this file with autoconf to produce a configure script.
-AC_INIT(protocol.c)
-AC_CONFIG_HEADER([Include/config_portability.h:Include/config_portability.h.in])
-
-# Checks the host we are running on.
-AC_CANONICAL_HOST
-
-# Set paths and common variables and NWS top directory (if compiling with
-# NWS)
-if test -n "$TOP"; then
-       NWS_TOP="${TOP}"
-else 
-       NWS_TOP=`pwd`
-fi
-TOP=`pwd`
-INCLUDES="-I${TOP}/Include"
-ARFLAGS="cr"
-test_debug="no"
-test_thread="no"
-use_alarm_signal="no"
-
-# Set default for CFLAGS
-CFLAGS="-DHAVE_CONFIG_H"
-
-# test for command line options
-AC_ARG_ENABLE(debug,
-       [  --enable-debug         include debugging info when compiling],
-               [if test "${withval}" != "yes"; then
-                       test_debug="yes"
-               fi])
-
-AC_ARG_ENABLE(threads,
-       [  --enable-threads        test for threads support],
-               [if test "${enableval}" != "no"; then
-                       test_thread="yes"
-               fi])
-
-AC_ARG_ENABLE(sigalarm,
-       [  --disable-sigalarm        don't use SIGALRM],
-               [if test "${enableval}" != "no"; then
-                       use_alarm_signal="yes"
-                       AC_DEFINE(USE_ALARM_SIGNAL)
-               fi],
-       [AC_DEFINE(USE_ALARM_SIGNAL)
-        use_alarm_signal="yes"])
-
-# Checks for programs.
-AC_PATH_PROG(AR, ar)
-AC_PROG_CC
-# Setting up debug options
-if test "${test_debug}" = "yes"; then
-       CFLAGS="${CFLAGS} -g "
-else 
-       CFLAGS="${CFLAGS} -O2"
-       if test "${GCC}" = "yes" ; then
-               CFLAGS="${CFLAGS} -finline-functions"
-       fi
-fi
-
-AC_PROG_INSTALL
-AC_PROG_RANLIB
-AC_PATH_PROG(RM, rm)
-AC_PATH_PROG(CP, cp)
-AC_PATH_PROG(TAR, tar)
-AC_PATH_PROG(CTAGS, ctags)
-
-# Set compiler and linker switches 
-if test "${CC}" = "gcc"; then
-       # Adding all annoying warning compilers message
-       CFLAGS="${CFLAGS} -Wall -pedantic -Wshadow -Wpointer-arith -Wwrite-strings"
-       AC_PATH_PROG(PROFILE, gprof)
-else
-       AC_PATH_PROG(PROFILE, prof)
-fi
-
-# Checks for libraries.
-dnl LDFLAGS="${LDFLAGS} -lm"
-AC_CHECK_LIB(nsl, inet_ntoa)
-AC_CHECK_LIB(socket, socket)
-if test "${test_thread}" = "yes"; then
-       AC_CHECK_LIB(pthread, pthread_mutex_lock)
-fi
-
-# Checks for header files and symbols declared in headers.
-AC_HEADER_STDC
-AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([arpa/inet.h errno.h netdb.h netinet/in.h stddef.h stdlib.h string.h strings.h sys/socket.h sys/time.h unistd.h math.h inttypes.h])
-if test "${test_thread}" = "yes"; then
-       AC_CHECK_HEADERS(pthread.h)
-fi
-dnl TYPES is only for autoconf2.50 and 2.13 has a broken TYPE: cheap workaround
-dnl AC_CHECK_TYPES(uint32_t)
-AC_CHECK_TYPE(uint32_t, unsigned long)
-
-dnl IPADDRESS="unsigned int"
-dnl if test "${SIZEOF_LONG}" = "4" ; then
-dnl    IPADDRESS="unsigned long"
-dnl fi
-
-dnl end workaround
-
-
-
-# The third parameter to getpeername() is a pointer to socklen_t, size_t, or
-# int on various systems.  Worse yet, some systems define socklen_t but use a
-# different type in the getpeername() prototype, and Solaris Intel defines
-# Psocklen_t, which is a pointer to either socklen_t or void.  We use SOCKLEN_T
-# in the NWS code, defining it the proper type for the system.
-AC_TRY_COMPILE(
-  [#include <sys/types.h>
-   #include <sys/socket.h>],
-  [extern int getpeername(int socket, struct sockaddr *addr, socklen_t *len);],
-  SOCKLEN_T=socklen_t,
-  AC_TRY_COMPILE(
-    [#include <sys/types.h>
-     #include <sys/socket.h>],
-    [extern int getpeername(int socket, struct sockaddr *addr, size_t *len);],
-    SOCKLEN_T=size_t,
-    AC_TRY_COMPILE(
-      [#include <sys/types.h>
-       #include <sys/socket.h>],
-      [socklen_t len; Psocklen_t lenP = &len;
-       (void)getpeername(0, 0, lenP);],
-       SOCKLEN_T=socklen_t,
-       SOCKLEN_T=int
-    )
-  )
-)
-
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_TYPE_MODE_T
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-AC_HEADER_TIME
-AC_STRUCT_TM
-
-# Checks for library functions.
-dnl AC_FUNC_FORK
-dnl AC_FUNC_MALLOC
-dnl AC_FUNC_STAT
-AC_TYPE_SIGNAL
-AC_FUNC_VPRINTF
-
-if test "$use_alarm_signal" != "no"; then
-       AC_CHECK_FUNC(alarm, AC_DEFINE(HAVE_ALARM), AC_MSG_ERROR([Can't do without alarm!! Try to configure with --disable-sigalarm]))
-fi
-
-AC_CHECK_FUNCS([endpwent ftruncate gethostbyaddr gethostbyaddr_r gethostbyname gethostname uname gettimeofday inet_aton inet_ntoa memset mkdir select socket strcasecmp strchr strdup strerror sysconf getrusage siginterrupt sighold sigrelse strnlen fileno sqrt])
-
-# Substitute these variables.
-AC_SUBST(AR)
-AC_SUBST(ARFLAGS)
-AC_SUBST(INCLUDES)
-AC_SUBST(PREFIX_DIR)
-# the following should be automatically substitute by autoconf but for
-# consistency we put them here
-AC_SUBST(CC)
-AC_SUBST(CFLAGS)
-AC_SUBST(LDFLAGS)
-AC_SUBST(RM)
-AC_SUBST(TAR)
-AC_SUBST(CP)
-AC_SUBST(CTAGS)
-AC_SUBST(TOP)
-AC_SUBST(NWS_TOP)
-AC_SUBST(uint32_t)
-
-# Define new variables to substitute.
-AC_DEFINE_UNQUOTED(SOCKLEN_T, ${SOCKLEN_T})
-AC_SUBST(SOCKLEN_T)
-
-dnl AC_DEFINE_UNQUOTED(IPADDRESS, ${IPADDRESS})
-dnl AC_SUBST(IPADDRESS)
-
-AC_DEFINE_UNQUOTED(TOP, "$TOP")
-
-
-AC_OUTPUT([Makedefs])
diff --git a/src/nws_portability/diagnostic.c b/src/nws_portability/diagnostic.c
deleted file mode 100644 (file)
index 533c218..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $Id$ */
-
-#include "config_portability.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <limits.h>
-
-#include "diagnostic.h"
-#include "osutil.h"
-#include "strutil.h"
-
-#define MAXRECORDS 2500
-
-static FILE *diagDestinations[] =
-       {DIAGSUPPRESS, DIAGSUPPRESS, DIAGSUPPRESS,
-       DIAGSUPPRESS, DIAGSUPPRESS, DIAGSUPPRESS};
-static long recordCounts[] =
-       {0, 0, 0, 0, 0, 0};
-static void *lock = NULL;                      /* mutex for this modules */
-
-/* we look quite extensively because I'm not quite sure what fprintf will
- * do if the FILE* changes on the way */
-static void
-PrintDiagnostic(DiagLevels level,
-                const char *message,
-                va_list arguments) {
-
-       static const char *level_tags[] = {"", "", "Warning: ", "Error: ", "Fatal: ", "Debug: " };
-
-       /* we need a lock because we write recordCounts and we use
-        * diagDestinations[] */
-       if (GetNWSLock(&lock) == 0) {
-               fprintf(stderr, "PrintDiagnostic: Error: Couldn't obtain the lock\n");
-       }
-       if(diagDestinations[level] != DIAGSUPPRESS) {
-               if( (recordCounts[level]++ >= MAXRECORDS) &&
-                               (diagDestinations[level] != stdout) &&
-                               (diagDestinations[level] != stderr) ) {
-               /* We want to avoid filling up the disk space when the
-                * system is running for weeks at a time.  It might be
-                * nice to save the old file under another name (maybe in
-                * /tmp), then reopen.  That requires changing the
-                * DirectDiagnostics() interface to take a file name
-                * instead of a FILE *.  */
-                       rewind(diagDestinations[level]);
-                       recordCounts[level] = 0;
-               }
-
-               fprintf(diagDestinations[level], "%.0f %d ", CurrentTime(), (int)getpid());
-               fprintf(diagDestinations[level], level_tags[level]);
-               vfprintf(diagDestinations[level], message, arguments);
-               fflush(diagDestinations[level]);
-       }
-       if (ReleaseNWSLock(&lock) == 0) {
-               fprintf(stderr, "PrintDiagnostic: Error: Couldn't release the lock\n");
-       }
-}
-
-
-void
-DirectDiagnostics(DiagLevels level,
-                  FILE *whereTo) {
-
-#ifdef HAVE_FILENO
-       int f = 0;
-
-       /* just an extra check */
-       if (whereTo != NULL) {
-               f = fileno(whereTo);
-       } 
-       if (f < 0) {
-               PrintDiagnostic(DIAGERROR, "DirectDiagnostic: fileno failed", NULL);
-               return;
-       }
-#endif
-       GetNWSLock(&lock);
-       diagDestinations[level] = whereTo;
-       ReleaseNWSLock(&lock);
-}
-
-
-FILE *
-DiagnosticsDirection(DiagLevels level) {
-       return diagDestinations[level];
-}
-
-
-void
-PositionedDiagnostic(DiagLevels level,
-                     const char *fileName, 
-                     int line,
-                     const char *message,
-                     ...) {
-
-       va_list arguments;
-       char *extendedMessage;
-
-       /* we assume that NWS lines won't be past 10 digits */
-       extendedMessage = (char *)MALLOC(strnlen(fileName, MAX_FILENAME_LENGTH)
-                               + strnlen(message, MAX_MESSAGE_LENGTH) + 11);
-       if (extendedMessage == NULL) {
-               /* out of memory */
-               PrintDiagnostic(DIAGERROR, "PositionedDiagnostic: out of memory", NULL);
-               return;
-       }
-
-       va_start(arguments, message);
-       sprintf(extendedMessage, "%s:%d %s", fileName, line, message);
-       PrintDiagnostic(level, extendedMessage, arguments);
-       va_end(arguments);
-
-       free(extendedMessage);
-}
-
-
-void
-Diagnostic(DiagLevels level,
-           const char *message,
-           ...) {
-       va_list arguments;
-
-       va_start(arguments, message);
-       PrintDiagnostic(level, message, arguments);
-       va_end(arguments);
-}
diff --git a/src/nws_portability/dnsutil.c b/src/nws_portability/dnsutil.c
deleted file mode 100644 (file)
index 39e9a7f..0000000
+++ /dev/null
@@ -1,613 +0,0 @@
-/* $Id$ */
-
-#include "config_portability.h"
-
-#include <stdio.h>
-#include <stdlib.h>     /* REALLOC() */
-#include <string.h>
-#include <sys/types.h>  /* sometimes required for #include <sys/socket.h> */
-#include <sys/socket.h> /* AF_INET */
-#include <netinet/in.h> /* struct in_addr */
-#include <arpa/inet.h>  /* inet_addr() inet_ntoa() */
-#include <netdb.h>      /* {end,set}hostent() gethostby{addr,name}() */
-
-#include "diagnostic.h"
-#include "osutil.h"
-#include "dnsutil.h"
-#include "protocol.h"
-
-
-/*
-** NOTE: The man pages for {end,set}hostent() seem to imply that endhostent()
-** needs/should only be called after sethostent(1).  Below, we call
-** endhostent() after calling sethostent(0).  So far, this hasn't seemed to
-** cause any problems, and it also appears to have squished a bug on some
-** version of Unix where the O/S DNS cache was losing entries.
-*/
-
-static void *lock = NULL;              /* local lock */
-
-/*
- * We cache host entries locally to avoid going to the DNS too often.  This
- * also gets around an old Solaris bug which leaks memory whenever dlopen is
- * called (such as on the dynamic DNS lookup library). 
- *
- * Cached values timeout after CACHE_TIMEOUT seconds.
- */
-#define CACHE_TIMEOUT 1800
-static unsigned int cacheCount = 0;
-static struct hostent **cache = NULL;
-static double *cacheTimeout = NULL;
-
-
-/*
-** Looks in the name and alias entries of #hostEntry# for a fully-qualified
-** name.  Returns the fqn if found; otherwise, returns the name entry.
-*/
-static const char *
-BestHostName(const struct hostent *hostEntry) {
-       int i;
-
-       if (hostEntry == NULL) {
-               return NULL;
-       }
-
-       if (!strchr(hostEntry->h_name, '.')) {
-               for (i = 0; hostEntry->h_aliases[i] != NULL; i++) {
-                       if (strchr(hostEntry->h_aliases[i], '.'))
-                               return hostEntry->h_aliases[i]; /* found! */
-               }
-       }
-
-       /* If we don't have a fully-qualified name, do the best we can.  */
-       return hostEntry->h_name;
-}
-
-/* 
- * free a struct hostent *. 
- */
-void
-FreeStructHostent(struct hostent *toFree) {
-       int i;
-
-       /* sanity check */
-       if (toFree == NULL) {
-               return;
-       }
-
-       /* let's start to free */
-       if (toFree->h_aliases != NULL) {
-               for (i=0; toFree->h_aliases[i] != NULL; i++) {
-                       free(toFree->h_aliases[i]);
-               }
-               free(toFree->h_aliases);
-       }
-       if (toFree->h_name != NULL) {
-               free(toFree->h_name);
-       }
-       if (toFree->h_addr_list != NULL) {
-               for (i=0; toFree->h_addr_list[i] != NULL; i++) {
-                       free(toFree->h_addr_list[i]);
-               }
-               free(toFree->h_addr_list);
-       }
-       free(toFree);
-
-       return;
-}
-
-/*
- * copy a struct hostent * into a newly allocated struct hostent * that
- * you need to free when you are done using. Returns NULL in case of
- * errors.
- */
-struct hostent *
-CopyStructHostent(const struct hostent *orig) {
-       struct hostent *ret;
-       int i,j;
-
-       /* sanity check */
-       if (orig == NULL) {
-               return NULL;
-       }
-
-       ret = (struct hostent *)MALLOC(sizeof(struct hostent));
-       if (ret == NULL) {
-               ERROR("Out of memory\n");
-               return NULL;            /* out of memory */
-       }
-       memset((void *)ret, 0,  sizeof(struct hostent));
-       
-       /* make room for the name */
-       ret->h_name = strdup(orig->h_name);
-       if (ret->h_name == NULL) {
-               free(ret);
-               ERROR("Out of memory\n");
-               return NULL;            /* out of memory */
-       }
-
-       /* count aliases and copy them */
-       for (i=0; orig->h_aliases != NULL && orig->h_aliases[i] != NULL; i++) {
-               ;
-       }
-       ret->h_aliases = (char **)MALLOC(sizeof(char *) * (i+1));
-       if (ret->h_aliases == NULL) {
-               FreeStructHostent(ret);
-               ERROR("Out of memory\n");
-               return NULL;
-       }
-       for (j=0; j < i; j++) {
-               ret->h_aliases[j] = strdup(orig->h_aliases[j]);
-               if (ret->h_aliases[j] == NULL) {
-                       FreeStructHostent(ret);
-                       ERROR("Out of memory\n");
-                       return NULL;
-               }
-       }
-       ret->h_aliases[i] = NULL;
-
-       /* copy the easy stuff */
-       ret->h_addrtype = orig->h_addrtype;
-       ret->h_length = orig->h_length;
-
-       /* copy the addresses */
-       for (i=0; orig->h_addr_list != NULL && orig->h_addr_list[i] != NULL; i++) {
-               ;
-       }
-       ret->h_addr_list = (char **)MALLOC(sizeof(struct in_addr *) * (i+1));
-       if (ret->h_addr_list == NULL) {
-               FreeStructHostent(ret);
-               ERROR("Out of memory\n");
-               return NULL;
-       }
-       for (j=0; j < i; j++) {
-               ret->h_addr_list[j] = (char *)MALLOC(ret->h_length + 1);
-               if (ret->h_addr_list[j] == NULL) {
-                       FreeStructHostent(ret);
-                       ERROR("Out of memory\n");
-                       return NULL;
-               }
-               memcpy(ret->h_addr_list[j], orig->h_addr_list[j], ret->h_length);
-       }
-       ret->h_addr_list[i] = NULL;
-
-       /* done */
-       return ret;
-}
-
-
-/*
- * Appends #hostEntry# (not a copy) to the global map cache. 
- *
- * cache is a global structure and need to be protected by locks to be
- * thread safe.
- */
-void
-CacheHostent(struct hostent *hostEntry) {
-       int ind;
-       struct hostent **extendedCache;
-       double *tmp_touts, now;
-
-
-       /* sanity check */
-       if (hostEntry == NULL) {
-               return;
-       }
-       
-       /* look for an expired entry */
-       now = CurrentTime();
-       if (!GetNWSLock(&lock)) {
-               ERROR("CacheHostent: couldn't obtain the lock\n");
-       }
-       for (ind=0; ind < cacheCount; ind++) {
-               if (now > cacheTimeout[ind]) {
-                       FreeStructHostent(cache[ind]);
-                       break;
-               }
-       }
-
-       if (ind >= cacheCount) {
-               /* no found, we need to add memory */
-               extendedCache = (struct hostent**)REALLOC(cache, sizeof(struct hostent *) * (cacheCount + 1));
-               if(extendedCache == NULL) {
-                       ReleaseNWSLock(&lock);
-                       ERROR("Out of memory\n");
-                       return;
-               }
-               cache = extendedCache;
-               tmp_touts = (double *)REALLOC(cacheTimeout, sizeof(double) * (cacheCount +1));
-               if(tmp_touts == NULL) {
-                       ReleaseNWSLock(&lock);
-                       ERROR("Out of memory\n");
-                       return; 
-               }
-               cacheTimeout = tmp_touts;
-               ind = cacheCount++;
-       }
-
-       cache[ind] = CopyStructHostent(hostEntry);
-       if (cache[ind] == NULL) {
-               cacheTimeout[ind] = 1;
-       } else {
-               cacheTimeout[ind] = now + CACHE_TIMEOUT;
-       }
-       ReleaseNWSLock(&lock);
-
-       return;
-}
-
-
-/*
- * Searches the DNS mapping cache for #address#, adding a new entry 
- * if needed.  Returns a copy of the the mapping entry, or 
- * NULL on error. The memory returned needs to be freed.
- */
-struct hostent*
-LookupByAddress(IPAddress address) {
-       struct in_addr addr;
-       struct hostent *tmp, *addrEntry;
-       struct in_addr **cachedAddr;
-       int i;
-       double now;
-
-       /* look if we have it in the cache and it's not expired */
-       now = CurrentTime();
-       if (!GetNWSLock(&lock)) {
-               ERROR("LookupByAddress: couldn't obtain the lock\n");
-       }
-       for(i = 0; i < cacheCount; i++) {
-               if (now > cacheTimeout[i]) {
-                       continue;
-               }
-               for(cachedAddr = (struct in_addr**)cache[i]->h_addr_list;
-                               *cachedAddr != NULL;
-                               cachedAddr++) {
-                       if((**cachedAddr).s_addr == address) {
-                               tmp = CopyStructHostent(cache[i]);
-                               ReleaseNWSLock(&lock);
-                               return tmp;
-                       }
-               }
-       }
-
-       addr.s_addr = address;
-       sethostent(0);
-       tmp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET);
-       addrEntry = CopyStructHostent(tmp);
-       endhostent();
-       
-       ReleaseNWSLock(&lock);
-
-       if(addrEntry != NULL && addrEntry->h_length != sizeof(struct in_addr)) {
-               /* We don't (yet) handle non-in_addr addresses. */
-               FreeStructHostent(addrEntry);
-               addrEntry = NULL;
-       }
-
-       /* the NULL case is handled by the functions directly */
-       CacheHostent(addrEntry);
-
-       /* addrEntry will need to be freed after */
-       return addrEntry;
-}
-
-
-/*
- * Searches the DNS mapping cache for #name#, adding a new entry if needed.
- * Returns a pointer to the mapping entry, or NULL on error. The returned
- * value need to be freed.
- */
-struct hostent*
-LookupByName(const char *name) {
-
-       char **cachedName;
-       char **extendedAliases;
-       struct hostent *tmp, *nameEntry;
-       double now;
-       int i, listLen;
-
-       /* look in the cache for non expired entry */
-       now = CurrentTime();
-       if (!GetNWSLock(&lock)) {
-               ERROR("LookupByName: failed to obtain the lock\n");
-       }
-       for(i = 0; i < cacheCount; i++) {
-               if (now > cacheTimeout[i]) {
-                       continue;
-               }
-               if(strcasecmp(name, cache[i]->h_name) == 0) {
-                       tmp = CopyStructHostent(cache[i]);
-                       ReleaseNWSLock(&lock);
-                       return tmp;
-               }
-               for(cachedName = cache[i]->h_aliases; *cachedName != NULL; cachedName++) {
-                       if(strcasecmp(*cachedName, name) == 0) {
-                               tmp = CopyStructHostent(cache[i]);
-                               ReleaseNWSLock(&lock);
-                               return tmp;
-                       }
-               }
-       }
-
-       sethostent(0);
-       tmp = gethostbyname(name);
-       nameEntry = CopyStructHostent(tmp);
-       endhostent();
-
-       ReleaseNWSLock(&lock);
-
-       if(nameEntry == NULL) {
-               return NULL;
-       } else if(nameEntry->h_length != sizeof(struct in_addr)) {
-               FreeStructHostent(nameEntry);
-               return NULL; /* We don't (yet) handle non-in_addr addresses. */
-       }
-
-       /* We extend cached entries' h_aliases lists to include nicknames. */
-       for(listLen = 0; nameEntry->h_aliases[listLen] != NULL; listLen++) {
-               ;
-       }
-       extendedAliases = (char **)REALLOC(nameEntry->h_aliases, sizeof(char **) * (listLen + 2));
-       if(extendedAliases != NULL) {
-               extendedAliases[listLen] = strdup(name);
-               if (extendedAliases[listLen] != NULL) {
-                       extendedAliases[listLen + 1] = NULL;
-                       nameEntry->h_aliases = extendedAliases;
-               }
-       }
-
-       /* let's invalidate the old (if there is) entry in the cache */
-       if (!GetNWSLock(&lock)) {
-               ERROR("LookupByName: failed to obtain the lock\n");
-       }
-       for(i = 0; i < cacheCount; i++) {
-               if (now > cacheTimeout[i]) {
-                       continue;
-               }
-               if(strcmp(nameEntry->h_name, cache[i]->h_name) == 0) {
-                       cacheTimeout[i] = 1;
-                       break;
-               }
-       }
-       ReleaseNWSLock(&lock);
-
-       /* update the cache entry */
-       CacheHostent(nameEntry);
-
-       /* nameEntry will need to be freed */
-       return nameEntry;
-}
-
-/* thread safe */
-IPAddress
-Peer(Socket sd) {
-       struct sockaddr peer;
-       SOCKLEN_T peer_size = sizeof(peer);
-       int returnValue = 0;
-
-       if (!IsPipe(sd) && (getpeername(sd, &peer, &peer_size) == 0)) {
-               if (peer.sa_family == AF_INET) {
-                       returnValue = (((struct sockaddr_in *)&peer)->sin_addr.s_addr);
-               }
-       }
-
-       return returnValue;
-}
-
-/* thread safe */
-char *
-PeerName_r(Socket sd) {
-       struct sockaddr peer;
-       SOCKLEN_T peer_size = sizeof(peer);
-       char *returnValue;
-
-       if (IsPipe(sd)) {
-               returnValue = strdup("pipe");
-       } else if (getpeername(sd, &peer, &peer_size) < 0) {
-               returnValue = strdup("unknown");
-       } else {
-               if (peer.sa_family != AF_INET) {
-                       returnValue = strdup("unknown");
-               } else {
-                       returnValue = IPAddressImage_r(((struct sockaddr_in *)&peer)->sin_addr.s_addr);
-               }
-       }
-
-       if (returnValue == NULL) {
-               ERROR("PeerName_r: out of memory\n");
-       }
-       return returnValue;
-}
-
-
-/* thread safe */
-unsigned short
-PeerNamePort(Socket sd) {
-       unsigned short tmp;
-       struct sockaddr peer;
-       SOCKLEN_T peer_size = sizeof(peer);
-
-       /* connectedPipes is global */
-       if (!GetNWSLock(&lock)) {
-               ERROR("PeerNamePort: failed to obtain the lock\n");
-       }
-       tmp = (IsPipe(sd) ? -1 : (getpeername(sd, &peer, &peer_size) < 0) ?  -1
-                       : ((struct sockaddr_in *)&peer)->sin_port);
-       ReleaseNWSLock(&lock);
-       return tmp;
-}
-
-
-/* thread safe: we allocate memory for the returned char * */
-char *
-IPAddressImage_r(IPAddress addr) {
-       struct in_addr addrAsInAddr;
-       char *returned, *tmp;
-
-       addrAsInAddr.s_addr = addr;
-
-       if (!GetNWSLock(&lock)) {
-               ERROR("IPAddressImage_r: failed to obtain the lock\n");
-       }
-       tmp = inet_ntoa(addrAsInAddr);
-       if (tmp != NULL) {
-               returned = strdup(inet_ntoa(addrAsInAddr));
-       } else {
-               returned = strdup("unknown");
-       }
-       ReleaseNWSLock(&lock);
-
-       if (returned == NULL) {
-               ERROR("IPAddressImage_r: out of memory\n");
-       }
-
-       return returned;
-}
-
-
-/* thread safe: we allocate memory for the returned char. NULL have to be
- * checked by the caller. */
-char *
-IPAddressMachine_r(IPAddress addr) {
-       struct hostent *hostEntry;
-       char *returnValue;
-
-       hostEntry = LookupByAddress(addr);
-       if (hostEntry == NULL) {
-               return NULL;
-       }
-
-       returnValue = strdup(BestHostName(hostEntry));
-
-       /* free allocated memory */
-       FreeStructHostent(hostEntry);
-
-       return returnValue;
-}
-
-
-/* thread safe. */
-int
-IPAddressValues(const char *machineOrAddress,
-                IPAddress *addressList,
-                unsigned int atMost) {
-       struct hostent *hostEntry;
-       int i = 0, itsAnAddress = 0;
-       IPAddress temp = 0;
-#ifdef HAVE_INET_ATON
-       struct in_addr in;
-
-       if (inet_aton(machineOrAddress, &in) != 0) {
-               itsAnAddress = 1;
-               temp = in.s_addr;
-       }
-#else
-       /* inet_addr() has the weird behavior of returning an unsigned
-        * quantity but using -1 as an error value.  Furthermore, the
-        * value returned is sometimes int and sometimes long,
-        * complicating the test.  Once inet_aton() is more widely
-        * available, we should switch to using it instead.  */
-       temp = inet_addr(machineOrAddress);
-       if (temp != -1) {
-               itsAnAddress = 1;
-       }
-#endif
-       if(itsAnAddress && (atMost == 1)) {
-               *addressList = temp;
-               return 1;
-       }
-
-       hostEntry = itsAnAddress ?  LookupByAddress(temp) : LookupByName(machineOrAddress);
-
-       /* sanity check */
-       if(hostEntry == NULL) {
-               return 0;
-       } 
-
-       /* if atMost == 0 means we are checking if the address is
-        * correct. It is */
-       if(atMost == 0) {
-               i = 1;
-       } 
-
-       for(; i < atMost && hostEntry->h_addr_list[i] != NULL; i++) {
-               memcpy(&addressList[i], hostEntry->h_addr_list[i], hostEntry->h_length);
-       }
-
-       FreeStructHostent(hostEntry);
-       return i;
-}
-
-
-/* well, the name is always the same so we can use a static variable.
- * Changed to never return NULL but at the very worse localhost. */
-const char *
-MyMachineName(void) {
-
-       struct hostent *myEntry;
-       static char returnValue[255] = "";
-
-       /* If we have a value in returnValue, done */
-       if(returnValue[0] != '\0') {
-               return returnValue;
-       }
-
-       /* try the simple case first */
-       if(gethostname(returnValue, sizeof(returnValue)) == -1) {
-               ERROR("gethostname() failed! using localhost instead.\n");
-               /* setting the name to a safe bet */
-               if (!GetNWSLock(&lock)) {
-                       ERROR("MyMachineName: failed to obtain the lock\n");
-               }
-               strncpy(returnValue, "localhost", sizeof(returnValue));
-               ReleaseNWSLock(&lock);
-       } else if(!strchr(returnValue, '.')) {
-               /* Okay, that didn't work; try the DNS. */
-               myEntry = LookupByName(returnValue);
-               if(myEntry != NULL) {
-                       if (!GetNWSLock(&lock)) {
-                               ERROR("MyMachineName: failed to obtain the lock\n");
-                       }
-                       strncpy(returnValue,BestHostName(myEntry),sizeof(returnValue));
-                       returnValue[sizeof(returnValue) - 1] = '\0';
-                       ReleaseNWSLock(&lock);
-                       FreeStructHostent(myEntry);
-               }
-       }
-
-       return returnValue;
-}
-
-
-/* DEPRECATED: these are not thread-safe */
-const char *
-IPAddressImage(IPAddress addr) {
-       struct in_addr addrAsInAddr;
-       addrAsInAddr.s_addr = addr;
-       return inet_ntoa(addrAsInAddr);
-}
-const char *
-IPAddressMachine(IPAddress addr) {
-       struct hostent *hostEntry;
-       static char returnValue[63 + 1];
-       hostEntry = LookupByAddress(addr);
-       strncpy(returnValue,
-               (hostEntry == NULL) ? "" : BestHostName(hostEntry),
-               sizeof(returnValue));
-       FreeStructHostent(hostEntry);
-       return returnValue;
-}
-
-const char *
-PeerName(Socket sd) {
-   struct sockaddr peer;
-   SOCKLEN_T peer_size = sizeof(peer);
-   static char returnValue[200];
-   strcpy(returnValue, IsPipe(sd) ? "pipe" :
-               (getpeername(sd, &peer, &peer_size) < 0) ?
-               "(unknown)" :
-               inet_ntoa(((struct sockaddr_in *)&peer)->sin_addr));
-   return returnValue;
-}
-
-
diff --git a/src/nws_portability/formatutil.c b/src/nws_portability/formatutil.c
deleted file mode 100644 (file)
index 937ac1f..0000000
+++ /dev/null
@@ -1,533 +0,0 @@
-/* $Id$ */
-
-
-#include <string.h>  /* memcpy() */
-#include "diagnostic.h"
-#include "formatutil.h"
-#include "osutil.h"
-
-
-#ifndef NORMAL_FP_FORMAT
-#define INCLUDE_FORMAT_CHECKING
-#else
-#ifndef NORMAL_INT_FORMAT
-#define INCLUDE_FORMAT_CHECKING
-#endif
-#endif
-
-
-static void *lock = NULL;                      /* local mutex */
-static const size_t HOST_SIZE[SIMPLE_TYPE_COUNT] =
-       {sizeof(char), sizeof(double), sizeof(float), sizeof(int), sizeof(long),
-       sizeof(short), sizeof(unsigned int), sizeof(unsigned long),
-       sizeof(unsigned short)};
-static const size_t NETWORK_SIZE[SIMPLE_TYPE_COUNT] =
-       {1, 8, 4, 4, 4, 2, 4, 4, 2};
-
-/* how this host treat int, floats and big/little endianness */
-static int unusualFPFormat = 0;
-static int unusualIntFormat = 0;
-static int bytesReversed = -1;
-
-#ifndef NORMAL_FP_FORMAT
-/*
-** Copies #source# to #destination#, converting between IEEE and host floating-
-** point format.  #whatType# must be DOUBLETYPE or FLOATTYPE.  #hostToIEEE#
-** indicates whether the conversion is from host format to IEEE or vice versa.
-** The IEEE version of the data will be in big-endian byte order even if the
-** host machine is little-endian.  For IEEE 754 floating point info, look at
-** http://www.research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html
-*/
-/* It should be thread safe */
-void
-ConvertIEEE(   const void *destination,
-               const void *source,
-               DataTypes whatType,
-               int hostToIEEE) {
-
-#define DOUBLEBIAS 1023
-#define QUADBIAS 16383
-#define SINGLEBIAS 127
-
-       struct DoublePrecision {
-               unsigned sign : 1;
-               unsigned exponent : 11;
-               unsigned leading : 4;
-               unsigned char mantissa[6];
-       } doublePrecision;
-
-       struct Expanded {
-               unsigned char sign;
-               int exponent;
-               unsigned char mantissa[16];
-       } expanded;
-
-       struct QuadPrecision {
-               unsigned sign : 1;
-               unsigned exponent : 15;
-               unsigned char mantissa[14];
-       }; /* For future reference. */
-
-       struct SinglePrecision {
-               unsigned sign : 1;
-               unsigned exponent : 8;
-               unsigned leading : 7;
-               unsigned char mantissa[2];
-       } singlePrecision;
-
-       double doubleValue;
-       unsigned exponentBias;
-       double factor;
-       int i;
-       size_t mantissaLength;
-
-       if(whatType == DOUBLE_TYPE) {
-               exponentBias = DOUBLEBIAS;
-               mantissaLength = sizeof(doublePrecision.mantissa) + 1;
-               factor = 16.0; /* 2.0 ^ bitsize(doublePrecision.leading) */
-       } else {
-               exponentBias = SINGLEBIAS;
-               mantissaLength = sizeof(singlePrecision.mantissa) + 1;
-               factor = 128.0; /* 2.0 ^ bitsize(singlePrecision.leading) */
-       }
-
-       if(hostToIEEE) {
-               if(whatType == DOUBLE_TYPE)
-                       doubleValue = *(double *)source;
-               else
-                       doubleValue = *(float *)source;
-
-               if(doubleValue < 0.0) {
-                       expanded.sign = 1;
-                       doubleValue = -doubleValue;
-               } else {
-                       expanded.sign = 0;
-               }
-               expanded.exponent = 0;
-               if(doubleValue != 0.0) {
-               /* Determine the exponent value by iterative shifts
-                * (mult/div by 2) */
-                       while(doubleValue >= 2.0) {
-                               expanded.exponent += 1;
-                               doubleValue /= 2.0;
-                       }
-                       while(doubleValue < 1.0) {
-                               expanded.exponent -= 1;
-                               doubleValue *= 2.0;
-                       }
-                       expanded.exponent += exponentBias;
-                       doubleValue -= 1.0;
-               }
-
-               /* Set the bytes of the mantissa by iterative shift and
-                * truncate. */
-               for(i = 0; i < 16; i++) {
-                       doubleValue *= factor;
-                       expanded.mantissa[i] = (int)doubleValue;
-                       doubleValue -= expanded.mantissa[i];
-                       factor = 256.0;
-               }
-               /* Pack the expanded version into the destination. */
-               if(whatType == DOUBLE_TYPE) {
-                       memcpy(doublePrecision.mantissa, &expanded.mantissa[1], sizeof(doublePrecision.mantissa));
-                       doublePrecision.leading = expanded.mantissa[0];
-                       doublePrecision.exponent = expanded.exponent;
-                       doublePrecision.sign = expanded.sign;
-                       *(struct DoublePrecision *)destination = doublePrecision;
-               } else {
-                       memcpy(singlePrecision.mantissa, &expanded.mantissa[1], sizeof(singlePrecision.mantissa));
-                       singlePrecision.leading = expanded.mantissa[0];
-                       singlePrecision.exponent = expanded.exponent;
-                       singlePrecision.sign = expanded.sign;
-                       *(struct SinglePrecision *)destination = singlePrecision;
-               }
-       } else {
-               /* Unpack the source into the expanded version. */
-               if(whatType == DOUBLE_TYPE) {
-                       doublePrecision = *(struct DoublePrecision *)source;
-                       expanded.sign = doublePrecision.sign;
-                       expanded.exponent = doublePrecision.exponent;
-                       expanded.mantissa[0] = doublePrecision.leading;
-                       memcpy(&expanded.mantissa[1], doublePrecision.mantissa, sizeof(doublePrecision.mantissa));
-               } else {
-                       singlePrecision = *(struct SinglePrecision *)source;
-                       expanded.sign = singlePrecision.sign;
-                       expanded.exponent = singlePrecision.exponent;
-                       expanded.mantissa[0] = singlePrecision.leading;
-                       memcpy(&expanded.mantissa[1], singlePrecision.mantissa, sizeof(singlePrecision.mantissa));
-               }
-               /* Set mantissa by via shifts and adds; allow for
-                * denormalized values. */
-               doubleValue = (expanded.exponent == 0) ? 0.0 : 1.0;
-
-               for(i = 0; i < mantissaLength; i++) {
-                       doubleValue += (double)expanded.mantissa[i] / factor;
-                       factor *= 256.0;
-               }
-               /* Set the exponent by iterative mults/divs by 2. */
-               if(expanded.exponent == 0)
-                       ; /* Nothing to do. */
-               else if(expanded.exponent == (exponentBias * 2 + 1))
-                       /*
-                        * An exponent of all ones represents one of
-                        * three things: Infinity: mantissa of all zeros
-                        * Indeterminate: sign of 1, mantissa leading one
-                        * followed by all zeros NaN: all other values
-                        * None of these can be reliably produced by C
-                        * operations.  We might be able to get Infinity
-                        * by dividing by zero, but, on a non-IEEE
-                        * machine, we're more likely to cause some sort
-                        * of floating-point exception.
-                        */
-                       ;
-               else
-                       expanded.exponent -= exponentBias;
-
-               if(expanded.exponent < 0) {
-                       for(i = expanded.exponent; i < 0; i++)
-                               doubleValue /= 2.0;
-               } else {
-                       for(i = 0; i < expanded.exponent; i++)
-                       doubleValue *= 2.0;
-               }
-
-               if(expanded.sign)
-                       doubleValue *= -1.0;
-
-               if(whatType == DOUBLE_TYPE)
-                       *(double *)destination = doubleValue;
-               else
-                       *(float *)destination = doubleValue;
-       }
-}
-#endif
-
-
-/*
- * Copies the integer value of size #sourceSize# stored in #source# to the
- * #destinationSize#-long area #destination#.  #signedType# indicates whether
- * or not the source integer is signed; #lowOrderFirst# whether or not the
- * bytes run least-significant to most-significant.
- *
- * It should be thread safe (operates on local variables and calls mem*)
- */
-void
-ResizeInt(     void *destination,
-               size_t destinationSize,
-               const void *source,
-               size_t sourceSize,
-               int signedType,
-               int lowOrderFirst) {
-
-       unsigned char *destinationSign;
-       int padding;
-       int sizeChange = destinationSize - sourceSize;
-       unsigned char *sourceSign;
-
-       if(sizeChange == 0) {
-               memcpy(destination, source, destinationSize);
-       } else if(sizeChange < 0) {
-               /* Truncate high-order bytes. */
-               memcpy(destination, lowOrderFirst?source:((char*)source-sizeChange), destinationSize);
-               if(signedType) {
-                       /* Make sure the high order bit of source and
-                        * destination are the same */
-                       destinationSign = lowOrderFirst ? ((unsigned char*)destination + destinationSize - 1) : (unsigned char*)destination;
-                       sourceSign = lowOrderFirst ? ((unsigned char*)source + sourceSize - 1) : (unsigned char*)source;
-                       if((*sourceSign > 127) != (*destinationSign > 127)) {
-                               if(*sourceSign > 127)
-                                       *destinationSign += 128;
-                               else
-                                       *destinationSign -= 128;
-                       }
-               }
-       } else {
-               /* Pad with zeros or extend sign, as appropriate. */
-               if(!signedType)
-                       padding = 0;
-               else {
-                       sourceSign = lowOrderFirst ? ((unsigned char*)source + sourceSize - 1) : (unsigned char*)source;
-                       padding = (*sourceSign > 127) ? 0xff : 0;
-               }
-               memset(destination, padding, destinationSize);
-               memcpy(lowOrderFirst ? destination : ((char *)destination + sizeChange), source, sourceSize);
-       }
-}
-
-
-/*
- * Copies #length# bytes from #from# to #to# in reverse order.  Will work
- * properly if #from# and #to# are the same address.
- *
- * It should be thread safe.
- */
-void
-ReverseBytes(  void *to,
-               const void *from,
-               size_t length) {
-
-       char charBegin;
-       const char *fromBegin;
-       const char *fromEnd;
-       char *toBegin;
-       char *toEnd;
-
-       for(fromBegin = (const char *)from, fromEnd = fromBegin + length - 1, toBegin = (char *)to, toEnd = toBegin + length - 1; fromBegin <= fromEnd; fromBegin++, fromEnd--, toBegin++, toEnd--) {
-               charBegin = *fromBegin;
-               *toBegin = *fromEnd;
-               *toEnd = charBegin;
-       }
-}
-
-
-void
-ConvertData(   void *destination,
-               const void *source,
-               const DataDescriptor *description,
-               size_t length,
-               FormatTypes sourceFormat) {
-
-       size_t destStructSize;
-       int i;
-       int j;
-       size_t networkBytesConverted;
-       char *nextDest;
-       const char *nextSource;
-       size_t sourceStructSize;
-
-       networkBytesConverted = 0;
-
-       for(i = 0; i < length; i++, description++) {
-               if(sourceFormat == HOST_FORMAT) {
-                       nextDest = (char *)destination + networkBytesConverted;
-                       nextSource = (char *)source + description->offset;
-               } else {
-                       nextDest = (char *)destination + description->offset;
-                       nextSource = (char *)source + networkBytesConverted;
-               }
-               if(description->type == STRUCT_TYPE) {
-                       if(sourceFormat == HOST_FORMAT) {
-                               destStructSize = DataSize(description->members, description->length, NETWORK_FORMAT);
-                               sourceStructSize = DataSize(description->members, description->length, HOST_FORMAT) + description->tailPadding;
-                       } else {
-                               destStructSize = DataSize(description->members, description->length, HOST_FORMAT) + description->tailPadding;
-                               sourceStructSize = DataSize(description->members, description->length, NETWORK_FORMAT);
-                       }
-                       for(j = 0; j < description->repetitions; j++) {
-                               ConvertData(nextDest, nextSource, description->members, description->length, sourceFormat);
-                               nextDest += destStructSize;
-                               nextSource += sourceStructSize;
-                       }
-               } else {
-                       HomogenousConvertData(nextDest, nextSource, description->type, description->repetitions, sourceFormat);
-               }
-               networkBytesConverted += DataSize(description, 1, NETWORK_FORMAT);
-       }
-}
-
-
-/* I believe is thread safe (HomogenousDataSize is thread safe) */
-size_t
-DataSize(      const DataDescriptor *description,
-               size_t length,
-               FormatTypes format) {
-
-       int i;
-       const DataDescriptor *lastMember;
-       size_t totalSize;
-
-       if(format == HOST_FORMAT) {
-               lastMember = description;
-               for(i = 0; i < length; i++) {
-                       if(description[i].offset > lastMember->offset) {
-                               lastMember = &description[i];
-                       }
-               }
-               return lastMember->offset + ((lastMember->type == STRUCT_TYPE) ?  ((DataSize(lastMember->members, lastMember->length, HOST_FORMAT) + lastMember->tailPadding) * lastMember->repetitions) : HomogenousDataSize(lastMember->type, lastMember->repetitions, HOST_FORMAT));
-       } else {
-               totalSize = 0;
-               for(i = 0; i < length; i++, description++) {
-                       totalSize += (description->type == STRUCT_TYPE) ?  (DataSize(description->members, description->length, NETWORK_FORMAT) * description->repetitions) : HomogenousDataSize(description->type, description->repetitions, NETWORK_FORMAT);
-               }
-               return totalSize;
-       }
-}
-
-
-/*
- * Internal call to be done only once. We find the fomrat of this host:
- * once done we re-use the results
- * 
- * Some of the checking could have been done at compile time, but to be
- * sure and to cover exoteric machine (doesn't ppc can behave as little
- * and bin endian?) we do it at runtime.
- *
- * I believe it is thread safe (uses the lock if it modifies global
- * variables)
- */
-void
-FirstCall() {
-
-       /* we do the checking only once: next time bytesReversed will be
-        * set */
-       if (bytesReversed == -1) {
-               /* I think we could avoid this lock, but just to be safe */
-               GetNWSLock(&lock);
-
-               /* check endiannes */
-               {
-               typedef int IntTestType;
-               union {
-                       IntTestType testInt;
-                       unsigned char bytes[sizeof(IntTestType)];
-               } orderTester;
-
-               orderTester.testInt = 1;
-               bytesReversed = (orderTester.bytes[0] == 1);
-               }
-
-#ifdef INCLUDE_FORMAT_CHECKING
-#      ifndef NORMAL_FP_FORMAT
-               {
-               typedef double FPTestType;
-               union {
-                       FPTestType testFP;
-                       unsigned char bytes[sizeof(FPTestType)];
-               } fpTester;
-               
-               memset(&fpTester, 0, sizeof(fpTester));
-               /* Set sign, low-order bit of exponent and high-order bit 
-                * of mantissa. */
-               fpTester.bytes[bytesReversed ? sizeof(FPTestType) - 1 : 0]=192;
-               fpTester.bytes[bytesReversed ? sizeof(FPTestType) - 2 : 1] =
-               (sizeof(FPTestType) == 4)  ? 128 :
-               (sizeof(FPTestType) == 8)  ? 16 :
-               (sizeof(FPTestType) == 16) ? 1 : 0;
-               unusualFPFormat = fpTester.testFP != -4.0;
-               }
-#      endif
-
-#      ifndef NORMAL_INT_FORMAT
-               /* Converting non-twos-compliment is a pain, but
-                * detecting it is easy, so we go ahead and include a
-                * check and leave it to the caller to handle.  */
-               {
-               typedef int IntTestType;
-               union {
-                       IntTestType testInt;
-                       unsigned char bytes[sizeof(IntTestType)];
-               } intTester;
-
-               intTester.testInt = -2;
-               unusualIntFormat = ((unsigned int)intTester.bytes[0] +
-                       (unsigned int)intTester.bytes[sizeof(IntTestType) - 1]) != 509;
-               }
-#      endif
-#endif
-
-               ReleaseNWSLock(&lock);
-       }
-       return;
-}
-
-/* I believe is thread safe (FirstCall is thread safe and we just read
- * the global variables) */
-int
-DifferentFormat(DataTypes whatType) {
-
-       FirstCall();
-       return ((whatType == DOUBLE_TYPE) || (whatType == FLOAT_TYPE)) ?
-                       unusualFPFormat : unusualIntFormat;
-}
-
-
-/* I believe is thread safe (FirstCall is thread safe and we just read
- * the global variable) */
-int
-DifferentOrder(void) {
-
-       FirstCall();
-       return bytesReversed;
-}
-
-
-/* It should be thread sage (only reads global variables) */
-int
-DifferentSize(DataTypes whatType) {
-       return HOST_SIZE[whatType] != NETWORK_SIZE[whatType];
-}
-
-
-/* It should be thread safe (ConvertIEEE, ReverseData
- * and mem* are thread safe) */
-void
-HomogenousConvertData( void *destination,
-                       const void *source,
-                       DataTypes whatType,
-                       size_t repetitions,
-                       FormatTypes sourceFormat) {
-
-       int bytesReverse = DifferentOrder();
-       FormatTypes destFormat;
-       const void *from;
-       size_t fromSize;
-       int i;
-       void *to;
-       size_t toSize;
-
-       destFormat = (sourceFormat == HOST_FORMAT) ? NETWORK_FORMAT : HOST_FORMAT;
-       fromSize = (sourceFormat == HOST_FORMAT) ?
-               HOST_SIZE[whatType] : NETWORK_SIZE[whatType];
-       toSize = (destFormat == HOST_FORMAT) ?
-               HOST_SIZE[whatType] : NETWORK_SIZE[whatType];
-
-#ifndef NORMAL_FP_FORMAT
-       if(((whatType == DOUBLE_TYPE) || (whatType == FLOAT_TYPE)) &&
-                       (DifferentFormat(whatType) || (fromSize != toSize))) {
-               for(i = 0, from = source, to = destination; i < repetitions; i++, from = (char *)from + fromSize, to = (char *)to + toSize) {
-                       ConvertIEEE(to, from, whatType, (sourceFormat == HOST_FORMAT));
-               }
-               /* Note: ConvertIEEE also handles byte ordering. */
-               return;
-       }
-#endif
-
-       if(fromSize != toSize) {
-               for(i = 0, from = source, to = destination; i < repetitions; i++, from = (char *)from + fromSize, to = (char *)to + toSize) {
-                       ResizeInt(to, toSize, from, fromSize, whatType < UNSIGNED_INT_TYPE, (sourceFormat == HOST_FORMAT) && bytesReverse);
-               }
-               if(bytesReverse && (toSize > 1))
-                       ReverseData(destination, destination, whatType, repetitions, destFormat);
-       } else if(bytesReverse && (toSize > 1))
-               ReverseData(destination, source, whatType, repetitions, destFormat);
-       else if(destination != source)
-               memcpy(destination, source, fromSize * repetitions);
-}
-
-
-/* I believe is thread safe (*_SIZE are static and global but are
- * constant and initialize when created) */
-size_t
-HomogenousDataSize(    DataTypes whatType,
-                       size_t repetitions,
-                       FormatTypes format) {
-       return ((format == HOST_FORMAT) ?
-               HOST_SIZE[whatType] : NETWORK_SIZE[whatType]) * repetitions;
-}
-
-
-/* It should be thread safe (ReverseByte is thread safe */
-void
-ReverseData(   void *destination,
-               const void *source,
-               DataTypes whatType,
-               int repetitions,
-               FormatTypes format) {
-       int i;
-       size_t size;
-
-       size = (format == HOST_FORMAT) ? HOST_SIZE[whatType] : NETWORK_SIZE[whatType];
-       for(i = 0; i < repetitions; i++, destination = (char *)destination + size, source = (char *)source + size) {
-               ReverseBytes(destination, source, size);
-       }
-}
diff --git a/src/nws_portability/install-sh b/src/nws_portability/install-sh
deleted file mode 100755 (executable)
index ebc6691..0000000
+++ /dev/null
@@ -1,250 +0,0 @@
-#! /bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission.  M.I.T. makes no representations about the
-# suitability of this software for any purpose.  It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.  It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
-    case $1 in
-       -c) instcmd="$cpprog"
-           shift
-           continue;;
-
-       -d) dir_arg=true
-           shift
-           continue;;
-
-       -m) chmodcmd="$chmodprog $2"
-           shift
-           shift
-           continue;;
-
-       -o) chowncmd="$chownprog $2"
-           shift
-           shift
-           continue;;
-
-       -g) chgrpcmd="$chgrpprog $2"
-           shift
-           shift
-           continue;;
-
-       -s) stripcmd="$stripprog"
-           shift
-           continue;;
-
-       -t=*) transformarg=`echo $1 | sed 's/-t=//'`
-           shift
-           continue;;
-
-       -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
-           shift
-           continue;;
-
-       *)  if [ x"$src" = x ]
-           then
-               src=$1
-           else
-               # this colon is to work around a 386BSD /bin/sh bug
-               :
-               dst=$1
-           fi
-           shift
-           continue;;
-    esac
-done
-
-if [ x"$src" = x ]
-then
-       echo "install:  no input file specified"
-       exit 1
-else
-       true
-fi
-
-if [ x"$dir_arg" != x ]; then
-       dst=$src
-       src=""
-       
-       if [ -d $dst ]; then
-               instcmd=:
-       else
-               instcmd=mkdir
-       fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad 
-# if $src (and thus $dsttmp) contains '*'.
-
-       if [ -f $src -o -d $src ]
-       then
-               true
-       else
-               echo "install:  $src does not exist"
-               exit 1
-       fi
-       
-       if [ x"$dst" = x ]
-       then
-               echo "install:  no destination specified"
-               exit 1
-       else
-               true
-       fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
-       if [ -d $dst ]
-       then
-               dst="$dst"/`basename $src`
-       else
-               true
-       fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-#  this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='   
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
-       pathcomp="${pathcomp}${1}"
-       shift
-
-       if [ ! -d "${pathcomp}" ] ;
-        then
-               $mkdirprog "${pathcomp}"
-       else
-               true
-       fi
-
-       pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
-       $doit $instcmd $dst &&
-
-       if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
-       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
-       if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
-       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
-       if [ x"$transformarg" = x ] 
-       then
-               dstfile=`basename $dst`
-       else
-               dstfile=`basename $dst $transformbasename | 
-                       sed $transformarg`$transformbasename
-       fi
-
-# don't allow the sed command to completely eliminate the filename
-
-       if [ x"$dstfile" = x ] 
-       then
-               dstfile=`basename $dst`
-       else
-               true
-       fi
-
-# Make a temp file name in the proper directory.
-
-       dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
-       $doit $instcmd $src $dsttmp &&
-
-       trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing.  If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
-       if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
-       if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
-       if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
-       if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
-       $doit $rmcmd -f $dstdir/$dstfile &&
-       $doit $mvcmd $dsttmp $dstdir/$dstfile 
-
-fi &&
-
-
-exit 0
diff --git a/src/nws_portability/messages.c b/src/nws_portability/messages.c
deleted file mode 100644 (file)
index b0bbf5b..0000000
+++ /dev/null
@@ -1,508 +0,0 @@
-/* $Id$ */
-
-
-#include "config_portability.h"
-
-#include <stddef.h>          /* offsetof() */
-#include <stdlib.h>          /* free() malloc() REALLOC() */
-#ifdef WITH_LDAP
-#include <ldap.h>
-#endif
-#ifdef WITH_THREAD
-#include <pthread.h>
-#endif
-
-#include "diagnostic.h"      /* FAIL() LOG() */
-#include "protocol.h"        /* Socket functions */
-#include "messages.h"
-#include "osutil.h"
-#include "timeouts.h"
-
-#if defined(WITH_THREAD)
-pthread_mutex_t Message_lock = PTHREAD_MUTEX_INITIALIZER;
-pthread_cond_t Message_wait = PTHREAD_COND_INITIALIZER;
-int Message_busy = 0;
-pthread_t Message_holding = (pthread_t)-1;
-#endif
-
-static void *lock = NULL;                      /* local mutex */
-
-/*
- * Info on registered listeners.  #message# is the message for which #listener#
- * is registered; #image# the message image.  Note that, since we provide no
- * way to terminate listening for messages, we can simply expand the list by
- * one every time a new listener is registered.
- */
-typedef struct {
-       MessageType message;
-       const char *image;
-       ListenFunction listener;
-} ListenerInfo;
-
-static ListenerInfo *listeners = NULL;
-static unsigned listenerCount = 0;
-#ifdef WITH_LDAP
-static LdapListenFunction ldapListener = NULL;
-#endif
-
-/*
- * A header sent with messages.  #version# is the NWS version and is presently
- * ignored, but it could be used for compatibility.  #message# is the actual
- * message.  #dataSize# is the number of bytes that accompany the message.
- */
-static const DataDescriptor headerDescriptor[] =
-       {SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(MessageHeader, version)),
-       SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(MessageHeader, message)),
-       SIMPLE_MEMBER(UNSIGNED_INT_TYPE, 1, offsetof(MessageHeader, dataSize))};
-#define headerDescriptorLength 3
-
-
-#if defined(WITH_THREAD)
- /*
-  * ** uses mutex (which might spin) to test and set a global variable
-  * **
-  * ** note that the pthread condition variable allows waiting under a lock
-  * ** and will block the calling thread
-  * */
-void LockMessageSystem()
-{
-       pthread_mutex_lock(&Message_lock);
-       while(Message_busy == 1)
-       {
-               pthread_cond_wait(&Message_wait,&Message_lock);
-       }
-
-       Message_busy = 1;
-       Message_holding = pthread_self(); /* debugging info only */
-
-       pthread_mutex_unlock(&Message_lock);
-
-       return;
-}
-
-void UnlockMessageSystem()
-{
-       pthread_mutex_lock(&Message_lock);
-
-       Message_busy = 0;
-       Message_holding = (pthread_t)-1; /* debugging info only */
-       pthread_cond_signal(&Message_wait);
-
-       pthread_mutex_unlock(&Message_lock);
-       return;
-}
-#else
-#define LockMessageSystem()
-#define UnlockMessageSystem()
-#endif
-
-/*
- * Returns 1 or 0 depending on whether or not format conversion is required for
- * data with the format described by the #howMany#-long array #description#.
- *
- *  I believe is thread safe (DataSize & DifferentFOrmat are thread safe)
- */
-static int
-ConversionRequired(    const DataDescriptor *description,
-                       size_t howMany) {
-       int i;
-
-       if(DataSize(description, howMany, HOST_FORMAT) !=
-                       DataSize(description, howMany, NETWORK_FORMAT)) {
-               return 1;
-       }
-
-       for(i = 0; i < howMany; i++) {
-               if(description[i].type == STRUCT_TYPE) {
-                       if(ConversionRequired(description[i].members, description[i].length)) {
-                               return 1;
-                       }
-               } else if(DifferentFormat(description[i].type))
-                       return 1;
-       }
-
-       return 0;
-}
-
-
-/* it should be thread safe (all the conversions routines should be
- * thread safe).
- * */
-int
-RecvData(      Socket sd,
-               void *data,
-               const DataDescriptor *description,
-               size_t howMany,
-               double timeOut) {
-
-       void *converted;
-       int convertIt;
-       void *destination;
-       int recvResult;
-       size_t totalSize = DataSize(description, howMany, NETWORK_FORMAT);
-
-       LockMessageSystem();
-
-       converted = NULL;
-       convertIt = ConversionRequired(description, howMany);
-
-       if(convertIt) {
-               converted = malloc(totalSize);
-               if(converted == NULL) {
-                       UnlockMessageSystem();
-                       FAIL1("RecvData: memory allocation of %d bytes failed\n", totalSize);
-               }
-               destination = converted;
-       } else {
-               destination = data;
-       }
-
-       /* use adaptive timeouts? */
-       if (timeOut < 0) {
-               double start;
-
-               /* adaptive timeout */
-               start = CurrentTime();
-
-               recvResult = RecvBytes(sd, destination, totalSize, GetTimeOut(RECV, Peer(sd), totalSize));
-               /* we assume a failure is a timeout ... Shouldn't hurt
-                * too much getting a bigger timeout anyway */
-               SetTimeOut(RECV, Peer(sd), CurrentTime()-start, totalSize, !recvResult);
-       } else {
-               recvResult = RecvBytes(sd, destination, totalSize, timeOut);
-       }
-       if (recvResult != 0) {
-               if(DifferentOrder() || convertIt)
-                       ConvertData(data, destination, description, 
-                               howMany, NETWORK_FORMAT);
-
-               if(converted != NULL)
-                       free(converted);
-       }
-       UnlockMessageSystem();
-
-       return recvResult;
-}
-
-
-/* It should be thread safe (just read headerDescriptor[Lenght] and
- * RecvByte is thread safe) */
-int
-RecvMessage(Socket sd,
-            MessageType message,
-            size_t *dataSize,
-            double timeOut) {
-       char *garbage;
-       MessageHeader header;
-
-       if(!RecvData(   sd,
-                       (void *)&header,
-                       headerDescriptor,
-                       headerDescriptorLength,
-                       timeOut)) {
-               FAIL("RecvMessage: no message received\n");
-       }
-
-       LockMessageSystem();
-
-       if(header.message != message) {
-               garbage = malloc(2048);
-               if (garbage == NULL) {
-                       FAIL("RecvMessage: out of memory!");
-               }
-               /* get the rigth timeout */
-               if (timeOut < 0) {
-                       timeOut = GetTimeOut(RECV, Peer(sd), 1);
-               }
-               while(header.dataSize > 0) {
-                       /* if we time out let's drop the socket */
-                       if (!RecvBytes(sd, garbage, (header.dataSize > sizeof(garbage)) ? sizeof(garbage) : header.dataSize, timeOut)) {
-                               DROP_SOCKET(&sd);
-                               WARN("RecvMessage: timeout on receiving non-handled message: dropping socket\n");
-                               break;
-                       }
-                       header.dataSize -= sizeof(garbage);
-               }
-               free(garbage);
-
-               UnlockMessageSystem();
-               FAIL1("RecvMessage: unexpected message %d received\n", header.message);
-       }
-       *dataSize = header.dataSize;
-       UnlockMessageSystem();
-       return(1);
-}
-
-/* it should be thread safe */
-int
-RecvMessageAndDatas(Socket sd,
-                    MessageType message,
-                    void *data1,
-                    const DataDescriptor *description1,
-                    size_t howMany1,
-                    void *data2,
-                    const DataDescriptor *description2,
-                    size_t howMany2,
-                    double timeOut) {
-       size_t dataSize;
-
-       if (RecvMessage(sd, message, &dataSize, timeOut) != 1) {
-               /* failed to receive message: errors already printed out
-                * by RecvMessage() */
-               return 0;
-       }
-
-       if(data1 != NULL) {
-               if(!RecvData(sd, data1, description1, howMany1, timeOut)) {
-                       FAIL("RecvMessageAndDatas: data receive failed\n");
-               }
-       }
-
-       if(data2 != NULL) {
-               if(!RecvData(sd, data2, description2, howMany2, timeOut)) {
-                       FAIL("RecvMessageAndDatas: data receive failed\n");
-               }
-       }
-
-       return(1);
-}
-
-/* 
- * waits for timeOut seconds for incoming messages and calls the
- * appropriate (registered) listener function.
- */
-void
-ListenForMessages(double timeOut) {
-
-       MessageHeader header;
-       int i, ldap;
-       Socket sd;
-
-       if(!IncomingRequest(timeOut, &sd, &ldap))
-               return;
-
-#ifdef WITH_LDAP
-  /*
-   ** WARNING!  Not sure if ldapListener is thread safe (yet)
-   */
-  if (ldap) {
-    if (ldapListener == NULL) {
-      WARN2("Unexpected LDAP message received from %s on %d\n",
-            PeerName(sd), sd);
-      SendLdapDisconnect(&sd, LDAP_UNAVAILABLE);
-    }
-    else {
-      LOG2("Received LDAP message from %s on %d\n", PeerName(sd), sd);
-      ldapListener(&sd);
-    }
-  } else {
-#endif
-
-       /* let's use the adaptive timeouts on receiving the header */
-       if(!RecvData(sd, (void *)&header, headerDescriptor, headerDescriptorLength, -1)) {
-               /* Likely a connection closed by the other side.  There
-                * doesn't seem to be any reliable way to detect this,
-                * and, for some reason, select() reports it as a
-                * connection ready for reading.  */
-               DROP_SOCKET(&sd);
-               return;
-       }
-
-       LockMessageSystem();
-
-       for(i = 0; i < listenerCount; i++) {
-               if(listeners[i].message == header.message) {
-                       LOG3("Received %s message from %s on %d\n", listeners[i].image, PeerName(sd), sd);
-                       listeners[i].listener(&sd, header);
-                       break;
-               }
-       }
-
-       if(i == listenerCount) {
-               WARN3("Unknown message %d received from %s on %d\n", header.message, PeerName(sd), sd);
-               DROP_SOCKET(&sd);
-       }
-#ifdef WITH_LDAP
-   }
-#endif
-}
-
-
-
-/* regsiters the functions which should be called upon the receive of the
- * messageType message. Should be thread safe */
-void
-RegisterListener(MessageType message,
-                 const char *image,
-                 ListenFunction listener) {
-       LockMessageSystem();
-       if (!GetNWSLock(&lock)) {
-               ERROR("RegisterListener: couldn't obtain the lock\n");
-       }
-       listeners = REALLOC(listeners, (listenerCount+1)*sizeof(ListenerInfo));
-       listeners[listenerCount].message = message;
-       listeners[listenerCount].image = image;
-       listeners[listenerCount].listener = listener;
-       listenerCount++;
-       ReleaseNWSLock(&lock);
-       UnlockMessageSystem();
-}
-
-
-#ifdef WITH_LDAP
-void
-RegisterLdapListener(LdapListenFunction listener) {
-  ldapListener = listener;
-}
-
-
-void
-SendLdapDisconnect (Socket *sd,
-                    ber_int_t resultCode)
-{
-  /*
-  ** Send an unsolicitied notice of disconnection, in compliance with the
-  ** LDAP RFC.  This notice is pre-created to allow us to send it
-  ** even if the lber libraries have failed (for example, due to a memory
-  ** shortage).
-  **
-  ** abortMessage contains the unsolicited notice of disconnection.  
-  ** abortMessageLength gives the length of the message, needed
-  ** due to the message's embedded NULLs.  errorOffset gives the location
-  ** of the error code within the message.
-  **
-  ** To create this message using the ber libraries, call ber_print as follows:
-  **   ber_printf(ber, "{it{essts}}", 0, LDAP_RES_EXTENDED, resultCode,
-  **     "", "", LDAP_TAG_EXOP_RES_OID, LDAP_NOTICE_OF_DISCONNECTION);
-  ** The components of an unsolicited disconnect message (and hence the
-  ** parameters for the above ber_printf) are as follows:
-  **   messageID (must be zero for unsoliticed notification), protocolOp,
-  **   resultCode, matchedDN, errorMessage, responseName (optional, and omitted
-  **   for an unsolicited disconnect), response (with tag)
-  **
-  */
-  static char abortMessage[] = "0$\x02\x01\x00x\x1f\x0a\x01\x02\x04\x00\x04"
-    "\x00\x8a\x16" "1.3.6.1.4.1.1466.20036";
-  int abortMessageLength = 38;
-  int errorOffset = 9;
-  abortMessage[errorOffset] = resultCode;
-  SendBytes(*sd, abortMessage, abortMessageLength, -1);
-  DROP_SOCKET(sd);
-}
-#endif
-
-/* it should be thread safe (Convert*, SendBytes, DataSize abd
- * DifferentOrder are thread safe) */
-int
-SendData(Socket sd,
-         const void *data,
-         const DataDescriptor *description,
-         size_t howMany,
-         double timeOut) {
-
-       void *converted;
-       int sendResult;
-       const void *source;
-       size_t totalSize = DataSize(description, howMany, NETWORK_FORMAT);
-
-       LockMessageSystem();
-       converted = NULL;
-
-       if(DifferentOrder() || ConversionRequired(description, howMany)) {
-               converted = malloc(totalSize);
-               if(converted == NULL) {
-                       UnlockMessageSystem();
-                       FAIL("SendData: memory allocation failed\n");
-               }
-               ConvertData(converted, data, description, howMany, HOST_FORMAT);
-               source = converted;
-       } else {
-               source = data;
-       }
-
-       /* use adaptive timeouts? */
-       if (timeOut < 0) {
-               double start;
-
-               /* adaptive timeout */
-               start = CurrentTime();
-               sendResult = SendBytes(sd, source, totalSize, GetTimeOut(SEND, Peer(sd),totalSize));
-               /* we assume a failure is a timeout ... Shouldn't hurt
-                * too much getting a bigger timeout anyway */
-               SetTimeOut(SEND, Peer(sd), CurrentTime()-start, totalSize, !sendResult);
-       } else {
-               sendResult = SendBytes(sd, source, totalSize, timeOut);
-       }
-       if(converted != NULL)
-               free((void *)converted);
-
-       UnlockMessageSystem();
-       return sendResult;
-}
-
-/* it should be thread safe (SendData, DataSize are thread safe) */
-int
-SendMessageAndDatas(Socket sd,
-                    MessageType message,
-                    const void *data1,
-                    const DataDescriptor *description1,
-                    size_t howMany1,
-                    const void *data2,
-                    const DataDescriptor *description2,
-                    size_t howMany2,
-                    double timeOut) {
-
-       MessageHeader header;
-
-       LockMessageSystem();
-
-       header.version = NWS_VERSION;
-       header.message = message;
-       header.dataSize = 0;
-       if(data1 != NULL)
-               header.dataSize += DataSize(description1, howMany1, NETWORK_FORMAT);
-       if(data2 != NULL)
-               header.dataSize += DataSize(description2, howMany2, NETWORK_FORMAT);
-
-       UnlockMessageSystem();
-
-       if(!SendData(sd,
-                       &header,
-                       headerDescriptor,
-                       headerDescriptorLength,
-                       timeOut)) {
-               FAIL("SendMessageAndDatas: header send failed \n");
-       }
-       if((data1 != NULL) && !SendData(sd, data1, description1, howMany1, timeOut)) {
-               FAIL("SendMessageAndDatas: data1 send failed\n");
-       }
-       if((data2 != NULL) && !SendData(sd, data2, description2, howMany2, timeOut)) {
-               FAIL("SendMessageAndDatas: data2 send failed\n");
-       }
-       return 1;
-}
-
-/*
- * reads the NWS header associated with in incoming message and returns
- * the message type.  returns -1 if the read fails
- *
- * it should be thread safe (RecvData is thread safe and header* are only
- * read) 
- */
-int RecvMsgType(Socket sd, double timeout)
-{
-       int status;
-       MessageHeader header;
-
-       status = RecvData(sd,
-                         &header,
-                         headerDescriptor,
-                         headerDescriptorLength,
-                         timeout);
-
-       if(status <= 0) {
-               return(-1);
-       }
-
-       return((int)header.message);
-}
diff --git a/src/nws_portability/osutil.c b/src/nws_portability/osutil.c
deleted file mode 100644 (file)
index 9296fd2..0000000
+++ /dev/null
@@ -1,348 +0,0 @@
-/* $Id$ */
-
-
-#include "config_portability.h"
-
-#include <ctype.h>      /* isspace() */
-#include <errno.h>      /* errno values */
-#include <pwd.h>        /* endpwent() getpwuid() */
-#include <signal.h>     /* sig{add,empty}set() sigprocmask() */
-#include <stdio.h>      /* file functions */
-#include <stdlib.h>     /* getenv() */
-#include <string.h>     /* memset() strchr() strlen() */
-#include <unistd.h>     /* alarm() getuid() sysconf() (where available) */
-#include <sys/stat.h>   /* stat() */
-#include <sys/time.h>   /* gettimeofday() */
-#include <sys/types.h>  /* size_t time_t */
-#include <time.h>       /* time() */
-
-#include "osutil.h"
-
-#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
-
-/* this is the lock for this module. Every other module will use a void *
- * as a variable as mutex. */
-pthread_mutex_t nwsLock = PTHREAD_MUTEX_INITIALIZER;
-#endif
-
-
-/* 
- * These are defined here only becasue they are not found (sometimes) in
- * the headers but only in libraries. To avoid annoying compilation warnings
- */
-#ifdef HAVE_SIGHOLD
-int sighold(int sig);
-#endif
-#ifdef HAVE_SIGRELSE
-int sigrelse(int sig);
-#endif
-
-
-int
-CPUCount( ) {
-#ifdef HAVE_SYSCONF
-#      ifdef _SC_CRAY_NCPU
-#              define SYSCONF_PROCESSOR_COUNT_PARAMETER _SC_CRAY_NCPU
-#      elif defined(_SC_NPROC_CONF)
-#              define SYSCONF_PROCESSOR_COUNT_PARAMETER _SC_NPROC_CONF
-#      elif defined(_SC_NPROCESSORS_CONF)
-#              define SYSCONF_PROCESSOR_COUNT_PARAMETER _SC_NPROCESSORS_CONF
-#      endif
-#      ifdef SYSCONF_PROCESSOR_COUNT_PARAMETER 
-  /* Try to gracefully handle mis-configuration. */
-  int sysconfCount = sysconf(SYSCONF_PROCESSOR_COUNT_PARAMETER);
-  return (sysconfCount == 0) ? 1 : sysconfCount;
-#      else
-  return 1;
-#      endif
-#else
-  return 1;
-#endif
-}
-
-
-/* It should be thread safe (time should be thread safe) */
-double
-CurrentTime(void) {
-       return((double)time(NULL));
-}
-
-
-const char *
-GetEnvironmentValue(const char *name,
-                    const char *rcDirs,
-                    const char *rcName,
-                    const char *defaultValue) {
-
-       const char *dirEnd;
-       const char *dirStart;
-       char *from;
-       const char *homeDir;
-       size_t nameLen;
-       FILE *rcFile;
-       static char rcLine[255 + 1];
-       char rcPath[255 + 1];
-       const char *returnValue;
-       char *to;
-
-       returnValue = getenv(name);
-       if(returnValue != NULL) {
-               /* easy way out: we got the environmental variable */
-               return returnValue;
-       }
-
-       if(*rcName != '\0') {
-               nameLen = strlen(name);
-
-               for(dirStart = rcDirs, dirEnd = dirStart; dirEnd != NULL; dirStart = dirEnd + 1) {
-                       /* Construct a file path from the next dir in
-                        * rcDirs and rcName. */
-                       dirEnd = strchr(dirStart, ':');
-                       memset(rcPath, '\0', sizeof(rcPath));
-                       strncpy(rcPath, dirStart, (dirEnd == NULL) ? strlen(dirStart) : (dirEnd - dirStart));
-                       if((strcmp(rcPath, "~") == 0) || (strcmp(rcPath, "~/") == 0)) {
-                               homeDir = getenv("HOME");
-                               if(homeDir != NULL) {
-                                       strcpy(rcPath, homeDir);
-                               }
-                       }
-                       strcat(rcPath, "/");
-                       strcat(rcPath, rcName);
-                       rcFile = fopen(rcPath, "r");
-
-                       if(rcFile == NULL) {
-                               /* no luck, try the next one */
-                               continue;
-                       }
-
-                       while(fgets(rcLine, sizeof(rcLine), rcFile) != NULL) {
-                               /* Test against pattern " *#name# =". */
-                               for(from = rcLine; (*from != '\0') && isspace((int)*from); from++)
-                                       ; /* Nothing more to do. */
-                               if(strncmp(from, name, nameLen) != 0) {
-                                       continue;
-                               }
-                               for(from += nameLen; (*from != '\0') && isspace((int)*from); from++)
-                                       ; /* Nothing more to do. */
-                               if(*from != '=') {
-                                       continue;
-                               }
-
-                               /* We found a line that sets the variable. */
-                               (void)fclose(rcFile);
-                               for(from++; (*from != '\0') && isspace((int)*from); from++)
-                                       ; /* Nothing more to do. */
-
-                               /* Return a single word to allow for
-                                * future free-format input. */
-                               if(*from == '"') {
-                                       returnValue = from + 1;
-                                       for(from++, to = from; (*from != '\0') && (*from != '"'); from++, to++) {
-                                               if(*from == '\\') {
-                                                       from++;
-                                                       switch(*from) {
-                                                       case 'b':
-                                                               *to = '\b';
-                                                               break;
-                                                       case 'f':
-                                                               *to = '\f';
-                                                               break;
-                                                       case 'n':
-                                                               *to = '\n';
-                                                               break;
-                                                       case 'r':
-                                                               *to = '\r';
-                                                               break;
-                                                       case 't':
-                                                               *to = '\t';
-                                                               break;
-                                                       case 'v':
-                                                               *to = '\v';
-                                                               break;
-                                                       default:
-                                                               *to = *from;
-                                                               break;
-                                                       }
-                                               } else {
-                                                       *to = *from;
-                                               }
-                                       }
-                               } else {
-                                       returnValue = from;
-                                       for(to = from; (*to != '\0') && !isspace((int)*to); to++)
-                                               ; /* Nothing more to do. */
-                               }
-                               *to = '\0';
-
-                               if (returnValue != NULL) 
-                                       return(returnValue);
-                               else 
-                                       break;
-                       }
-               (void)fclose(rcFile);
-               }
-       }
-       return(defaultValue);
-}
-
-
-int
-GetUserName(char *name,
-            size_t length) {
-  struct passwd *myPasswd;
-  myPasswd = getpwuid(getuid());
-  if(myPasswd != NULL) {
-    strncpy(name, myPasswd->pw_name, length);
-    name[length - 1] = '\0';
-  }
-  endpwent();
-  return(myPasswd != NULL);
-}
-
-void
-HoldSignal(int sig) {
-#ifdef HAVE_SIGHOLD
-  sighold(sig);
-#else
-  sigset_t set, oset;
-  sigemptyset(&set);
-  sigaddset(&set, sig);\
-  sigprocmask(SIG_BLOCK, &set, &oset);
-#endif
-}
-
-
-int
-MakeDirectory(const char *path,
-              mode_t mode,
-              int makeEntirePath) {
-
-  const char *endSubPath;
-  struct stat pathStat;
-  char subPath[255 + 1];
-
-  if(makeEntirePath) {
-    endSubPath = path;  /* This will ignore leading '/' */
-    while((endSubPath = strchr(endSubPath + 1, '/')) != NULL) {
-      memset(subPath, '\0', sizeof(subPath));
-      strncpy(subPath, path, endSubPath - path);
-      if((stat(subPath, &pathStat) == -1) && (errno == ENOENT)) {
-        if(mkdir(subPath, mode) == -1) {
-          return 0;
-        }
-      }
-      else if(!S_ISDIR(pathStat.st_mode)) {
-        return 0;
-      }
-    }
-  }
-
-  if((stat(path, &pathStat) == -1) && (errno == ENOENT)) {
-    return(mkdir(path, mode) != -1);
-  }
-  else {
-    return(S_ISDIR(pathStat.st_mode));
-  }
-}
-
-
-
-int
-GetNWSLock(void **lock) {
-#ifdef HAVE_PTHREAD_H
-       int ret;
-
-       if (lock == NULL) {
-               return 0;
-       }
-       if (*lock == NULL) {
-               /* let's play it safe: let's do one mutex at the time (in
-                * case multiple threads are running on the same lock */
-               if (pthread_mutex_lock(&nwsLock) != 0) {
-                       return 0;
-               }
-               /* there is no mutex yet: let's create it. We double
-                * check in the pretty rare condition of having 2 threads
-                * creating lock at the same time */
-               if (*lock == NULL) {
-                       *lock = (void *)MALLOC(sizeof(pthread_mutex_t));
-                       pthread_mutex_init((pthread_mutex_t *)(*lock), NULL);
-               }
-               if (*lock == NULL || pthread_mutex_unlock(&nwsLock) != 0) {
-                       return 0;
-               }
-       }
-       ret = pthread_mutex_lock((pthread_mutex_t *)(*lock));
-       if  (ret != 0) {
-               fprintf(stderr, "GetNWSLock: Unable to lock (errno = %d)!\n", ret);
-               return 0;
-       }
-#endif
-       return 1;
-}
-
-int 
-ReleaseNWSLock(void **lock) {
-
-#ifdef HAVE_PTHREAD_H
-       if (lock == NULL || pthread_mutex_unlock((pthread_mutex_t *)*lock) != 0) {
-               return 0;
-       }
-#endif
-       return 1;
-}
-
-long
-MicroTime(void) {
-  struct timeval tv;
-  gettimeofday(&tv, NULL);
-  return(tv.tv_sec * 1000000 + tv.tv_usec);
-}
-
-
-void
-ReleaseSignal(int sig) {
-#ifdef HAVE_SIGRELSE
-  sigrelse(sig);
-#else
-  sigset_t set, oset;
-  sigemptyset(&set);
-  sigaddset(&set, sig);
-  sigprocmask(SIG_UNBLOCK, &set, &oset);
-#endif
-}
-
-
-int
-SignalAlarm(   handler h, 
-               handler *old) {
-#ifdef USE_ALARM_SIGNAL
-       handler tmp;
-       
-       tmp = signal(SIGALRM, h);
-       if (tmp == SIG_ERR) {
-               return 0;
-       }
-       if (old != NULL)
-               *old = tmp;
-
-#endif
-       return 1;
-}
-
-/* It should be thread safe (alarm is thread safe) */
-void
-SetRealTimer(unsigned int numberOfSecs) {
-#ifdef USE_ALARM_SIGNAL
-#ifdef HAVE_SIGINTERRUPT
-       if (numberOfSecs > 0) {
-               /* just interrupt a system call upon receipt of interrupt */
-               siginterrupt(SIGALRM, 1);
-       }
-#endif
-
-       alarm(numberOfSecs);
-#endif
-}
-
diff --git a/src/nws_portability/protocol.c b/src/nws_portability/protocol.c
deleted file mode 100644 (file)
index 75a5509..0000000
+++ /dev/null
@@ -1,1107 +0,0 @@
-/* $Id$ */
-
-#include "config_portability.h"
-
-#include <unistd.h>       /* close() pipe() read() write() */
-#include <signal.h>       /* close() pipe() read() write() */
-#include <netinet/in.h>   /* sometimes required for #include <arpa/inet.h> */
-#include <netinet/tcp.h>  /* TCP_NODELAY */
-#ifdef HAVE_INTTYPES_H
-#      include <inttypes.h>
-#endif
-#include <arpa/inet.h>    /* inet_ntoa() */
-#include <netdb.h>        /* getprotobyname() */
-#include <sys/time.h>     /* struct timeval */
-#include <errno.h>        /* errno */
-#include <sys/wait.h>     /* waitpid() */
-#include <sys/socket.h>   /* getpeername() socket() */
-#include <stdlib.h>
-#ifdef WITH_LDAP
-#include <lber.h>
-#endif
-
-#include "diagnostic.h"
-#include "osutil.h"
-#include "protocol.h"
-#include "strutil.h"
-#include "dnsutil.h"
-#include "timeouts.h"
-
-
-static void *lock = NULL;              /* local mutex */
-
-/* Global variables: they need to be protected with locks when accessed */
-#define MAX_NOTIFIES 40
-static SocketFunction disconnectFunctions[MAX_NOTIFIES];
-static fd_set connectedEars;
-static fd_set connectedPipes;
-static fd_set connectedSockets;
-static fd_set inUse;
-
-/* IncomingRequest requires some care in case we have thread. I
- * don't want multiple IncomingRequest called at the same time:
- * if that happens you may need to rewrite your code. Just to be
- * sure this doesn't happen I use a cheat test-and-set relying
- * upon the global lock. It may be easier to use semaphores, but
- * given that we don't use them anywhere else ....
- */
-#ifdef HAVE_PTHREAD_H
-static short running = 0;
-#endif
-
-/* This is used when it's time to call CloseDisconnections(): when
- * receiving a SIGPIPE, this flag is set to 1 so that IncomingRequest,
- * SendBytes and RecvBytes (the functions which operates on sockets) will
- * call CloseDisconnections to pick up the disconnected socket */
-static short needDisconnect = 0;
-
-#ifdef WITH_THREAD
-extern void LockMessageSystem();
-extern void UnlockMessageSystem();
-#else
-#define LockMessageSystem()
-#define UnlockMessageSystem()
-#endif
-
-
-/*
- * Beginning of connection functions.
- */
-
-
-static int
-TcpProtoNumber(void);
-
-
-/*
- * Remove #sock# from all maintained socket sets.
- *
- * It should be thread safe.
- */
-void
-ClearSocket(Socket sock) {
-       /* operates on global variables */
-       GetNWSLock(&lock);
-       FD_CLR(sock, &connectedPipes);
-       FD_CLR(sock, &connectedSockets);
-       FD_CLR(sock, &connectedEars);
-       /* clear also the inUse state */
-       FD_CLR(sock, &inUse);
-       ReleaseNWSLock(&lock);
-}
-
-
-/* It should be thread safe */
-int
-ConditionSocket(Socket sd) {
-       int one = 1;
-
-       if(setsockopt(sd, SOL_SOCKET, SO_KEEPALIVE, (char *)&one, sizeof(int)) < 0) {
-               WARN("ConditionSocket: keepalive option failed\n");
-       }
-
-       if(setsockopt(sd, TcpProtoNumber(), TCP_NODELAY, (char *)&one, sizeof(int)) < 0) {
-               WARN("ConditionSocket: couldn't set NODELAY flag\n");
-       }
-
-       return (1);
-}
-
-
-/*
- * Time-out signal handler for CallAddr().
- */
-void
-ConnectTimeOut(int sig) {
-       WARN("Connect timed out\n");
-}
-
-
-/*
- * Notifies all registered functions that #sock# has been closed.
- *
- * We should lock the call ...
- */
-static void
-DoDisconnectNotification(Socket sock) {
-       int i;
-
-       for(i = 0; i < MAX_NOTIFIES; i++) {
-               if(disconnectFunctions[i] != NULL) {
-                       disconnectFunctions[i](sock);
-               }
-       }
-}
-
-
-/*
- * Time-out signal handler for RecvBytes().
- */
-void
-RecvTimeOut(int sig) {
-       WARN("Send/Receive timed out\n");
-}
-
-
-/*
- * Returns the tcp protocol number from the network protocol data base.
- * 
- * getprotobyname() is not thread safe. We need to lock it.
- */
-static int
-TcpProtoNumber(void) {
-       struct protoent *fetchedEntry;
-       static int returnValue = 0;
-
-       if(returnValue == 0) {
-               GetNWSLock(&lock);
-               fetchedEntry = getprotobyname("tcp");
-               if(fetchedEntry != NULL) {
-                       returnValue = fetchedEntry->p_proto;
-               }
-               ReleaseNWSLock(&lock);
-       }
-
-       return returnValue;
-}
-
-
-/* thread safe */
-int
-CallAddr(IPAddress addr,
-         short port,
-         Socket *sock,
-         double timeOut) {
-
-       struct sockaddr_in server; /* remote host address */
-       Socket sd;
-       double start;
-       double ltimeout = 0;
-       void (*was)(int);
-       int tmp_errno, ret = 0;
-       char *peer;
-
-       memset((char *)&server, 0, sizeof(server));
-       server.sin_addr.s_addr = addr;
-       server.sin_family = AF_INET;
-       server.sin_port = htons((u_short)port);
-
-       sd = socket(AF_INET, SOCK_STREAM, 0);
-
-       if(sd < 0) {
-               *sock = NO_SOCKET;
-               ERROR("CallAddr: cannot create socket to server\n");
-               return 0;
-       }
-
-       ConditionSocket(sd);
-
-       /* set the adaptive timeout or the user selected one */
-       if (timeOut >= 0) {
-               ltimeout = timeOut;
-       } else {
-               /* adaptive timeouts */
-               ltimeout = GetTimeOut(CONN, addr, 0);
-       }
-       if (ltimeout > 0) {
-               DDEBUG1("CallAddr: setting timer to %.2f\n", ltimeout);
-               if (SignalAlarm(ConnectTimeOut, &was) == 0) {
-                       WARN("Failed to set the alarm signal! exiting\n");
-                       return 0;
-               }
-               SetRealTimer((unsigned int)ltimeout);
-       }
-
-       /* let's time it */
-       start = CurrentTime();
-  
-       if(connect(sd, (struct sockaddr *)&server, sizeof(server)) < 0) {
-               GetNWSLock(&lock);
-               /* save a copy or errno */
-               tmp_errno = errno;
-               ReleaseNWSLock(&lock);
-
-               shutdown(sd, 2);
-               close(sd);
-
-               /* get how long it took to get it wrong */
-               start = CurrentTime() - start;
-
-               if(tmp_errno == EINTR) {
-                       WARN("CallAddr: connect timed out\n");
-               } else {
-                       ERROR1("CallAddr: connect failed (errno=%d)\n", tmp_errno);
-               }
-               *sock = NO_SOCKET;
-       } else {
-               /* get how long it took */
-               start = CurrentTime() - start;
-
-               *sock = sd;
-
-               /* print log message */
-               peer = IPAddressMachine_r(addr);
-               LOG4("CallAddr: connected socket %d to %s:%d in %.2f seconds\n", 
-                    sd, peer, port, start);
-               FREE(peer);
-
-               GetNWSLock(&lock);
-               FD_SET(sd, &connectedSockets);
-               ReleaseNWSLock(&lock);
-       
-               /* everything is cool */
-               ret = 1;
-       }
-
-       if (timeOut != 0) {
-               RESETREALTIMER;
-               SignalAlarm(was, NULL);
-               if (timeOut < 0) {
-                       /* adaptive timeouts */
-                       SetTimeOut(CONN, addr, start, 0, (ret==0));
-               }
-       }
-
-       return ret;
-}
-
-
-/* it should be thread safe (we lock up access to connected*) */
-void
-CloseConnections(int closeEars,
-                 int closePipes,
-                 int closeSockets) {
-       Socket dead;
-       int i, tmp;
-
-       if(closeEars) {
-               for(i = 0; i < FD_SETSIZE; i++) {
-                       GetNWSLock(&lock);
-                       tmp = FD_ISSET(i, &connectedEars);
-                       ReleaseNWSLock(&lock);
-                       if(tmp) {
-                               dead = i;
-                               DROP_SOCKET(&dead);
-                       }
-               }
-       }
-       if(closePipes) {
-               for(i = 0; i < FD_SETSIZE; i++) {
-                       GetNWSLock(&lock);
-                       tmp = FD_ISSET(i, &connectedPipes);
-                       ReleaseNWSLock(&lock);
-                       if(tmp) {
-                               dead = i;
-                               DROP_SOCKET(&dead);
-                       }
-               }
-       }
-       if(closeSockets) {
-               for(i = 0; i < FD_SETSIZE; i++) {
-                       GetNWSLock(&lock);
-                       tmp = FD_ISSET(i, &connectedSockets);
-                       ReleaseNWSLock(&lock);
-                       if(tmp) {
-                               dead = i;
-                               DROP_SOCKET(&dead);
-                       }
-               }
-       }
-}
-
-
-/*
- * Returns 1 or 0 depending on whether or not #sd# is a connected socket.
- *
- * it should be thread safe.
- */
-static int
-IsConnected(Socket sd) {
-       struct sockaddr peer_name_buff;
-
-       SOCKLEN_T peer_name_buff_size = sizeof(peer_name_buff);
-       return(getpeername(sd, &peer_name_buff, &peer_name_buff_size) >= 0);
-}
-
-
-/* thread safe */
-int
-CloseDisconnections(void) {
-       Socket dead, i;
-       int returnValue = 0, tmp;
-
-       for(i = 0; i < FD_SETSIZE; i++) {
-               GetNWSLock(&lock);
-               tmp = FD_ISSET(i, &connectedSockets);
-               ReleaseNWSLock(&lock);
-               if(tmp && !IsConnected(i)) {
-                       dead = i;
-                       DROP_SOCKET(&dead);
-                       returnValue++;
-               }
-       }
-
-       return(returnValue);
-}
-
-
-/* (cross finger): thread safe */
-int
-CloseSocket(Socket *sock,
-            int waitForPeer) {
-
-       fd_set readFDs;
-       Socket sd = *sock;
-       struct timeval timeout;
-       int tmp_errno;
-
-       DDEBUG1("CloseSocket: Closing connection %d\n", *sock);
-
-       if(*sock == NO_SOCKET) {
-               return 1;  /* Already closed; nothing to do. */
-       }
-
-       if(waitForPeer > 0) {
-               FD_ZERO(&readFDs);
-               FD_SET(sd, &readFDs);
-               timeout.tv_sec = waitForPeer;
-               timeout.tv_usec = 0;
-
-               if(select(FD_SETSIZE, &readFDs, NULL, NULL, &timeout) < 0) {
-                       ERROR2("CloseSocket: no response on select %d %d\n", sd, errno);
-                       return 0;
-               }
-       }
-
-       GetNWSLock(&lock);
-       tmp_errno = FD_ISSET(sd, &connectedPipes);
-       ReleaseNWSLock(&lock);
-       if(!tmp_errno) {
-               if(shutdown(sd, 2) < 0) {
-                       GetNWSLock(&lock);
-                       tmp_errno = errno;
-                       ReleaseNWSLock(&lock);
-
-                       /* The other side may have beaten us to the reset. */
-                       if ((tmp_errno!=ENOTCONN) && (tmp_errno!=ECONNRESET)) {
-                               WARN1("CloseSocket: shutdown error %d\n", tmp_errno);
-                       }
-               }
-       }
-
-       if(close(sd) < 0) {
-               GetNWSLock(&lock);
-               tmp_errno = errno;
-               ReleaseNWSLock(&lock);
-
-               WARN2("CloseSocket: close error %d (%s)\n", tmp_errno, strerror(tmp_errno));
-       }
-
-       ClearSocket(sd);
-       DoDisconnectNotification(sd);
-       *sock = NO_SOCKET;
-
-       return(1);
-}
-
-
-#define READ_END 0
-#define WRITE_END 1
-
-int
-CreateLocalChild(pid_t *pid,
-                 Socket *parentToChild,
-                 Socket *childToParent) {
-
-  int childWrite[2];
-  int parentWrite[2];
-  int myEnd;
-
-  if(parentToChild != NULL) {
-    if(pipe(parentWrite) == -1) {
-      FAIL1("CreateLocalChild: couldn't get pipe, errno: %d\n", errno);
-    }
-  }
-  if(childToParent != NULL) {
-    if(pipe(childWrite) == -1) {
-      if(parentToChild != NULL) {
-        close(parentWrite[0]);
-        close(parentWrite[1]);
-      }
-      FAIL1("CreateLocalChild: couldn't get pipe, errno: %d\n", errno);
-    }
-  }
-
-  *pid = fork();
-
-  if(*pid == -1) {
-    if(parentToChild != NULL) {
-      close(parentWrite[0]);
-      close(parentWrite[1]);
-    }
-    if(childToParent != NULL) {
-      close(childWrite[0]);
-      close(childWrite[1]);
-    }
-    FAIL2("CreateLocalChild: couldn't fork, errno: %d (%s)\n",
-          errno, strerror(errno));
-  }
-
-  /* Close descriptors that this process won't be using. */
-  if(parentToChild != NULL) {
-    myEnd = (*pid == 0) ? READ_END : WRITE_END;
-    close(parentWrite[1 - myEnd]);
-    FD_SET(parentWrite[myEnd], &connectedPipes);
-    *parentToChild = parentWrite[myEnd];
-  }
-
-  if(childToParent != NULL) {
-    myEnd = (*pid == 0) ? WRITE_END : READ_END;
-    close(childWrite[1 - myEnd]);
-    FD_SET(childWrite[myEnd], &connectedPipes);
-    *childToParent = childWrite[myEnd];
-  }
-
-  return(1);
-
-}
-
-
-/* it should be thread safe (provided that setsockopt, bind and listen
- * are thread safe) */
-int
-EstablishAnEar(unsigned short startingPort,
-               unsigned short endingPort,
-               Socket *ear,
-               unsigned short *earPort) {
-
-       int k32 = 32 * 1024;
-       int on = 1;
-       unsigned short port;
-       Socket sd = NO_SOCKET;
-       struct sockaddr_in server;
-
-       for(port = startingPort; port <= endingPort; port++) {
-               server.sin_port = htons((u_short)port);
-               server.sin_addr.s_addr = INADDR_ANY;
-               server.sin_family = AF_INET;
-               if((sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
-                       ERROR("EstablishAnEar: socket allocation failed\n");
-                       return 0;
-               }
-               (void)setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on));
-               /* Set the socket buffer sizes to 32k, which just happens
-                * to correspond to the most common option value for
-                * tcpMessageMonitor activities.  This allows us to use a
-                * client connection to conduct the experiment, rather
-                * than needing to configure and open a new connection.
-                * */
-               (void)setsockopt(sd, SOL_SOCKET, SO_RCVBUF, (char *)&k32, sizeof(k32));
-               (void)setsockopt(sd, SOL_SOCKET, SO_SNDBUF, (char *)&k32, sizeof(k32));
-               if(bind(sd, (struct sockaddr *)&server, sizeof(server)) != -1 &&
-                                       listen(sd, 5) != -1) {
-                       break;
-               }
-               close(sd);
-       }
-
-       if(port > endingPort) {
-               FAIL2("EstablishAnEar: couldn't find a port between %d and %d\n", startingPort, endingPort);
-       }
-
-       GetNWSLock(&lock);
-       FD_SET(sd, &connectedEars);
-        DDEBUG1("Openned an ear on sock %d\n",sd);
-       ReleaseNWSLock(&lock);
-
-       *ear = sd;
-       *earPort = port;
-
-       DDEBUG1("EstablistAnEar: connected socket %d\n", sd);
-
-       return(1);
-}
-
-
-/* thread safe ... hopefully. We #ifdef HAVE_THREAD_H for performance
- * reasons when threads are not required. */
-int
-IncomingRequest(double timeOut,
-                Socket *sd,
-                int *ldap) {
-
-       Socket dead;
-       Socket i;
-       char lookahead;
-       Socket newSock;
-       double now;
-       struct sockaddr_in peer_in;
-       SOCKLEN_T peer_in_len = sizeof(peer_in);
-       fd_set readFds;
-       struct timeval tout;
-       double wakeup;
-       int tmp_errno, done = -1;
-
-       /* nextToService is used to make sure that every connection gets
-        * a chance to be serviced.  If we always started checking at 0,
-        * very active connections with small descriptor numbers could
-        * starve larger-descriptor connections.  */
-       /* static Socket nextToService = 0; */
-       /* Obi: I don't use the "static" approach since may be trouble
-        * with thread. Instead of locking I use the CurrentTime() to
-        * (hopefully) start from a different place each time */
-       Socket nextToService = ((int)CurrentTime() % FD_SETSIZE);
-
-       /* let's check we are the only one running here ... */
-#ifdef HAVE_PTHREAD_H
-       GetNWSLock(&lock);
-       if (running != 0) {
-               ReleaseNWSLock(&lock);
-               ERROR("IncomingRequest: another instance is running!\n");
-               return 0;
-       }
-       running = 1;
-       ReleaseNWSLock(&lock);
-#endif
-
-       *sd = NO_SOCKET;
-       tout.tv_usec = 0;
-       wakeup = CurrentTime() + timeOut;
-
-       while (done == -1) {
-
-               /* let's see if we need to check disconnected socket */
-               if (needDisconnect == 1) {
-                       needDisconnect = 0;
-                       (void)CloseDisconnections();
-               }
-
-               /* is the timeout expired? */
-               now = CurrentTime();
-               if (now == -1 || now >= wakeup) {
-                       if (now == -1) {
-                               WARN("IncomingRequest: time() failed.\n");
-                       }
-                       done = 0;       /* didn't find anything */
-                       break;          /* let's get out of here */
-               }
-
-               /* Construct in readFds the union of connected ears,
-                * pipes, and sockets. */
-               /* connected* are global variables and even though we
-                * only read them we play safe and we lock */
-               FD_ZERO(&readFds);
-               GetNWSLock(&lock);
-               for(i = 0; i < FD_SETSIZE; i++) {
-                       if (FD_ISSET(i, &connectedSockets) && !FD_ISSET(i, &inUse)) {
-                               FD_SET(i, &readFds);
-                       }
-                       if(FD_ISSET(i, &connectedPipes)) {
-                               FD_SET(i, &readFds);
-                       }
-                       if(FD_ISSET(i, &connectedEars)) {
-                               FD_SET(i, &readFds);
-                       }
-               }
-               ReleaseNWSLock(&lock);
-
-               /* set the timeout */
-               tout.tv_sec = (unsigned int)wakeup - (unsigned int)now;
-               tout.tv_usec = 0;
-
-               tmp_errno = select(FD_SETSIZE, &readFds, NULL, NULL, &tout);
-               if (tmp_errno == -1) {
-                       /* save the errno value */
-                       GetNWSLock(&lock);
-                       tmp_errno = errno;
-                       ReleaseNWSLock(&lock);
-
-                       /* EINTR we have to go ahead and retry: nothing
-                        * to do here */
-                       if(tmp_errno == EINTR) {
-                               continue;
-                       } else if(tmp_errno == EINVAL) {
-                               /* we blew it somehow -- (osf likely) */
-                               /* can be because (from man page):
-                               [EINVAL] The time limit specified by the
-                               timeout parameter is invalid.  The nfds
-                               parameter is less than 0, or greater than
-                               or equal to FD_SETSIZE.  One of the
-                               specified file descriptors refers to a
-                               STREAM or multiplexer that is linked
-                               (directly or indirectly) downstream from
-                               a multiplexer.  */
-
-                               ERROR4("IncomingRequest: invalid select - nfds: %d, rfds: %d, timeout: %d.%d", FD_SETSIZE, readFds, tout.tv_sec, tout.tv_usec);
-                       } else {
-                               ERROR1("IncomingRequest: select error %d\n", tmp_errno);
-                       }
-                       done = 0;       /* didn't find anything */
-                       break;                   /* done here */
-               } else if (tmp_errno == 0) {
-                       /* this was a timeout */
-                       continue;
-               } 
-
-               /* let's find out what socket is available and for what */
-
-               /* we do an all around loop to check all sockets
-                * starting from nextToService until we have one
-                * to service */
-               for (i = -1; i != nextToService; i=(i+1) % FD_SETSIZE) {
-                       if (i == -1) {
-                               /* first time around */
-                               i = nextToService;
-                       }
-
-                       if(!FD_ISSET(i, &readFds)) {
-                               /* nothing to do here */
-                               continue;
-                       }
-
-                       if(FD_ISSET(i, &connectedEars)) {
-                               /* Add the new connection
-                                * to connectedSockets. */
-                               newSock = accept(i, (struct sockaddr *)&peer_in, &peer_in_len);
-                               if(newSock == -1) {
-                                       SocketFailure(SIGPIPE);
-                               } else {
-                                       char *peer;
-
-                                       ConditionSocket(newSock);
-                                       peer = PeerName_r(newSock);
-
-                                       DDEBUG2("IncomingRequest: connected socket %d to %s\n", newSock, peer);
-                                       FREE(peer);
-
-                                       /* operating on a global variable */
-                                       GetNWSLock(&lock);
-                                       FD_SET(newSock, &connectedSockets);
-                                       ReleaseNWSLock(&lock);
-                               }
-                       } else if(FD_ISSET(i, &connectedPipes)) {
-                               /* we found a good one */
-                               *sd = i;
-                               *ldap = 0;
-                               done = 1;
-                               break;
-                       } else {
-                               /* Existing socket connection. */
-                               if(recv(i, &lookahead, 1, MSG_PEEK) > 0) {
-                                       *sd = i;
-#ifdef WITH_LDAP
-                                       *ldap = ((int) lookahead == LBER_SEQUENCE);
-#else
-                                       *ldap = 0;
-#endif
-#ifdef HAVE_PTHREAD_H
-                                       /* the socket is in use:
-                                        * client needs to call
-                                        * SocketIsAvailable to
-                                        * free it */
-                                       /* it only makes sense in
-                                        * a threaded environment */
-                                       GetNWSLock(&lock);
-                                       FD_SET(i, &inUse);
-                                       ReleaseNWSLock(&lock);
-#endif
-                                       done = 1;
-                                       break;
-                               } else {
-                                       /* This is how we find
-                                        * out about connections
-                                        * closed by a peer.
-                                        * Drop it from our list
-                                        * of known connections.
-                                        */
-                                       DDEBUG1("IncomingRequest: Dropping closed connection %d\n", i);
-
-                                       dead = i;
-                                       DROP_SOCKET(&dead);
-                               }
-                       }
-               }
-       }
-
-       /* done */
-#ifdef HAVE_PTHREAD_H
-       GetNWSLock(&lock);
-       running = 0;
-       ReleaseNWSLock(&lock);
-#endif
-
-       return done;
-}
-
-
-/* thread safe */
-int 
-SocketIsAvailable(Socket sd) {
-       int ret = 1;
-
-       /* sanity check */
-       if (sd < 0) {
-               WARN("SocketIsAvailable: socket is negative\n");
-               return 0;
-       }
-
-       /* check if the socket is in connectedSockets and is in use */
-       GetNWSLock(&lock);
-       FD_CLR(sd, &inUse);
-       ReleaseNWSLock(&lock);
-
-       return ret;
-}
-
-/* thread safe */
-int
-SocketInUse(Socket sd) {
-
-       /* sanity check */
-       if (sd < 0) {
-               WARN("SocketInUse: socket is negative\n");
-               return 0;
-       }
-
-       GetNWSLock(&lock);
-       FD_SET(sd, &inUse);
-       ReleaseNWSLock(&lock);
-
-       return 1;
-}
-
-/* thread safe */
-int
-IsOkay(Socket sd) {
-       fd_set readFds;
-       fd_set writeFds;
-       struct timeval timeout;
-
-       if(sd < 0) {
-               return 0;
-       }
-
-       FD_ZERO(&readFds);
-       FD_ZERO(&writeFds);
-       FD_SET(sd, &readFds);
-       FD_SET(sd, &writeFds);
-       timeout.tv_sec  = GetTimeOut(SEND, Peer(sd), 1);
-       timeout.tv_usec = 0;
-
-       return(select(FD_SETSIZE, NULL, &writeFds, NULL, &timeout) == 1);
-
-}
-
-
-/* thread safe */
-void
-NotifyOnDisconnection(SocketFunction notifyFn) {
-       int i;
-
-       /* operating on global variables */
-       GetNWSLock(&lock);
-       for(i = 0; i < MAX_NOTIFIES; i++) {
-               if(disconnectFunctions[i] == NULL) {
-                       disconnectFunctions[i] = notifyFn;
-                       break;
-               }
-       }
-       ReleaseNWSLock(&lock);
-}
-
-
-#define MAXPASSES 40
-static pid_t passedPids[MAXPASSES];
-static Socket passedSockets[MAXPASSES];
-
-
-int
-PassSocket(Socket *sock,
-           pid_t child) {
-
-  int i, childStat;
-
-  /* Clean up any sockets previously passed to children who have exited. */
-  for(i = 0; i < MAXPASSES; i++) {
-    if(passedPids[i] != 0) {
-      if((waitpid(passedPids[i], &childStat, WNOHANG) < 0) ||
-         WIFEXITED(childStat)) {
-        LOG1("PassSocket: Reclaiming connection %d\n", passedSockets[i]);
-        (void)shutdown(passedSockets[i], 2);
-        (void)close(passedSockets[i]);
-        DoDisconnectNotification(passedSockets[i]);
-        passedPids[i] = 0;
-      }
-    }
-  }
-
-  /* Record this socket in passedSockets and remove all other memory of it. */
-  for(i = 0; i < MAXPASSES; i++) {
-    if(passedPids[i] == 0) {
-      LOG2("PassSocket: Passing connection %d to %d\n", *sock, child);
-      passedPids[i] = child;
-      passedSockets[i] = *sock;
-      ClearSocket(*sock);
-      *sock = NO_SOCKET;
-      return(1);
-    }
-  }
-
-  return(0);
-
-}
-
-
-/* here to be used by dnsutil.c (GetPeerName) */
-int
-IsPipe(Socket sd) {
-       int ret = 0;
-
-       GetNWSLock(&lock);
-       if (FD_ISSET(sd, &connectedPipes)) {
-               ret = 1;
-       }
-       ReleaseNWSLock(&lock);
-
-       return ret;
-}
-       
-int
-RecvBytes(Socket sd,
-          void *bytes,
-          size_t byteSize,
-          double timeOut) {
-
-       double start = 0, myTimeOut = 0;
-       int isPipe, tmp, done=1;
-       char *nextByte;
-       fd_set readFds;
-       int recvd = 0, totalRecvd=0;
-       struct timeval tout, *tv;
-       void (*was)(int);
-
-       /* let's see if we need to check disconnected socket */
-       if (needDisconnect == 1) {
-               needDisconnect = 0;
-               (void)CloseDisconnections();
-       }
-
-       /* sanity check */
-       if (sd < 0 || bytes == NULL) {
-               WARN("RecvBytes: parameters out of range!\n");
-               return 0;
-       }
-
-       /* connectedPipes is global */
-       GetNWSLock(&lock);
-       isPipe = FD_ISSET(sd, &connectedPipes);
-       ReleaseNWSLock(&lock);
-
-       FD_ZERO(&readFds);
-       FD_SET(sd, &readFds);
-
-       /* select the adaptive timeouts or the passed in one. */
-       if (timeOut > 0) {
-               myTimeOut = (int)timeOut;
-               if (SignalAlarm(RecvTimeOut, &was) == 0) {
-                       WARN("Failed to set the alarm signal! Exiting\n");
-                       exit(1);
-               }
-               /* let's start the clock */
-               start = CurrentTime();
-       }
-
-       for(nextByte=(char*)bytes; totalRecvd < byteSize; totalRecvd += recvd) {
-               recvd = 0;
-               UnlockMessageSystem();
-
-               /* set the timeout if requested by the user */
-               if (timeOut > 0) {
-                       myTimeOut = timeOut - (CurrentTime() - start);
-                       if (myTimeOut < 0) {
-                               done = 0;
-                               break;
-                       }
-                       tout.tv_usec = 0;
-                       tout.tv_sec = (int) myTimeOut;
-                       tv = &tout;
-               } else {
-                       /* 0 is the special flag for don't use touts */
-                       tv = NULL;
-               }
-
-               tmp =  select(FD_SETSIZE, &readFds, NULL, NULL, tv);
-               if (tmp == -1) {
-                       LockMessageSystem();
-
-                       /* just in case another call modify errno */
-                       GetNWSLock(&lock);
-                       tmp = errno;
-                       ReleaseNWSLock(&lock);
-
-                       /* if interrupted, let's try again */
-                       if(tmp == EINTR) {
-                               continue;
-                       }
-
-                       ERROR2("RecvBytes: select on %d failed (%s)\n", sd, strerror(tmp));
-                       done = 0;
-                       break;
-               } else if (tmp == 0) {
-                       LockMessageSystem();
-
-                       /* timed out */
-                       ERROR1("RecvBytes: Socket %d timed out\n", sd);
-
-                       done = 0;
-                       break;
-               }
-
-               /* let's read the data */
-               if (timeOut > 0) {
-                       myTimeOut = timeOut - (CurrentTime() - start);
-                       /* should always be > 0 since we didn't
-                        * timed out on select */
-                       if (myTimeOut > 0) {
-                               SetRealTimer((unsigned int)myTimeOut);
-                       } else {
-                               ERROR1("RecvBytes: trying to set negative timeout on socket %d\n", sd);
-                               done = 0;
-                               break;
-                       }
-               }
-
-               if (isPipe) {
-                       /* pipe */
-                       recvd = read(sd, nextByte, byteSize - totalRecvd);
-               } else {
-                       /* socket */
-                       recvd = recv(sd, nextByte, byteSize - totalRecvd, 0);
-               }
-               /* just in case another call modify errno */
-               GetNWSLock(&lock);
-               tmp = errno;
-               ReleaseNWSLock(&lock);
-
-               if (timeOut > 0) {
-                       RESETREALTIMER;
-               }
-               LockMessageSystem();
-
-               if(recvd <= 0) {
-                       WARN2("RecvBytes: read failed errno:%d, %s\n", tmp, strerror(tmp));
-                       ERROR3("RecvBytes: socket %d failed after %d of %d bytes\n", sd, totalRecvd, byteSize);
-                       done = 0;
-                       break;
-               }
-               nextByte += recvd;
-       }
-
-       /* resetting the sigalarm */
-       if (timeOut > 0) {
-               SignalAlarm(was, NULL);
-       }
-       
-       return totalRecvd;
-}
-
-
-/* it should be thread safe. */
-int
-SendBytes(     Socket sd,
-               const void *bytes,
-               size_t byteSize,
-               double timeOut) {
-
-       char *nextByte;
-       int sent =0, totalSent = 0;
-       int isPipe, tmp, done = 1;
-       struct timeval tout, *tv;
-       double start, myTimeOut = 0;
-       void (*was)(int);
-
-
-       /* let's see if we need to check disconnected socket */
-       if (needDisconnect == 1) {
-               needDisconnect = 0;
-               (void)CloseDisconnections();
-       }
-
-       /* connectedPipes is global */
-       GetNWSLock(&lock);
-       isPipe = FD_ISSET(sd, &connectedPipes);
-       ReleaseNWSLock(&lock);
-
-       /* select the adaptive timeouts or the passed in one. */
-       if (timeOut > 0) {
-               myTimeOut = (double) timeOut;
-               if (SignalAlarm(RecvTimeOut, &was) == 0) {
-                       ERROR("Failed to set the alarm signal! Exiting\n");
-                       exit(1);
-               }
-       }
-
-       /* let's start the timer */
-       start = CurrentTime();
-
-       for(nextByte = (char*)bytes; totalSent < byteSize; totalSent += sent) {
-               UnlockMessageSystem();
-
-               /* set the timeout, and if we timed out get out */
-               if (timeOut > 0) {
-                       /* 0 is the special flag for don't use touts */
-                       myTimeOut = timeOut - (CurrentTime() - start);
-                       if (myTimeOut < 0) {
-                               done = 0;
-                               break;
-                       } 
-                       tout.tv_usec = 0;
-                       tout.tv_sec = (int) myTimeOut;
-                       tv = &tout;
-                       SetRealTimer((unsigned int)myTimeOut);
-               } 
-
-               if (isPipe) {
-                       /* pipe */
-                       sent = write(sd, nextByte, byteSize - totalSent);
-               } else {
-                       /* socket */
-                       sent = send(sd, nextByte, byteSize - totalSent, 0);
-               }
-
-               /* errno could be modified by another thread */
-               GetNWSLock(&lock);
-               tmp = errno;
-               ReleaseNWSLock(&lock);
-
-               if (timeOut > 0) {
-                       RESETREALTIMER;
-               }
-
-               LockMessageSystem();
-               if(sent <= 0) {
-                       ERROR3("SendBytes: send on socket %d failed (errno=%d %s)\n", sd, tmp, strerror(tmp));
-                       done = 0;
-                       break;
-               }
-               nextByte += sent;
-       }
-
-       /* reset sigalalrm */
-       if (timeOut > 0) {
-               SignalAlarm(was, NULL);
-       }
-
-       return done;
-}
-
-
-void
-SocketFailure(int sig) {
-       HoldSignal(SIGPIPE);
-       needDisconnect = 1;
-       if(signal(SIGPIPE, SocketFailure) == SIG_ERR) {
-               WARN("SocketFailure: error resetting signal\n");
-       }
-       ReleaseSignal(SIGPIPE);
-}
diff --git a/src/nws_portability/strutil.c b/src/nws_portability/strutil.c
deleted file mode 100644 (file)
index c01291a..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $Id$ */
-
-#include <ctype.h>
-#include <string.h>
-#include <stdarg.h>
-
-#include "strutil.h"
-
-
-#define EOS '\0'
-
-
-void
-strcase(char *string,
-        CaseTypes toWhatCase) {
-
-  char *c;
-  int raiseIt;
-
-  raiseIt = (toWhatCase == ALL_UPPER) || (toWhatCase == INITIAL_UPPER);
-
-  for(c = string; *c != EOS; c++) {
-    *c = raiseIt ? toupper((int)*c) : tolower((int)*c);
-    raiseIt = (toWhatCase == ALL_UPPER) ||
-              ((toWhatCase == INITIAL_UPPER) && !isalpha((int)*c));
-  }
-
-}
-
-
-int
-strnmatch(const char *string,
-          const char *pattern,
-          size_t len) {
-
-  const char *lastChance;
-  const char *nextWild;
-  int tameLen;
-
-  if(*pattern == '*') {
-    do pattern++; while (*pattern == '*');
-    if(*pattern == '\0')
-      return 1; /* Trailing star matches everything. */
-    nextWild = strchr(pattern, '*');
-    tameLen = (nextWild == NULL) ? strlen(pattern) : nextWild - pattern;
-    /*
-    ** The wildcard we're processing can match any string of characters up to
-    ** an occurrence of the following non-wild subpattern.  For each subpattern
-    ** occurrence, see if the remaining string matches the remaining pattern.
-    */
-    lastChance = string + len - tameLen;
-    for(; string <= lastChance; string++) {
-      if((strncmp(string, pattern, tameLen) == 0) &&
-         strnmatch(string + tameLen, pattern + tameLen, lastChance - string)) {
-        return 1;
-      }
-    }
-    return 0;
-  }
-  else {
-    nextWild = strchr(pattern, '*');
-    if(nextWild == NULL)
-      /* No wildcards in pattern; check for exact match. */
-      return (strlen(pattern) == len) && (strncmp(string, pattern, len) == 0);
-    else {
-      /* Check for leading exact match followed by a wildcard match. */
-      tameLen = nextWild - pattern;
-      return (tameLen <= len) &&
-             (strncmp(string, pattern, tameLen) == 0) &&
-             strnmatch(string + tameLen, nextWild, len - tameLen);
-    }
-  }
-
-}
-
-
-#ifndef HAVE_STRNLEN
-size_t
-strnlen(       const char *s,
-               size_t maxlen) {
-       size_t i;
-
-       if (maxlen <= 0 || s == NULL) {
-               return 0;
-       }
-
-       for (i=0; i<maxlen; i++) {
-               if (s[i] == '\0') {
-                       /* done */
-                       break;
-               }
-       }
-       return i;
-}
-#endif
-
-int
-strntok(char *dest,
-        const char *source,
-        int len,
-        const char *delim,
-        const char **end) {
-
-       char *last = dest + len - 1;
-
-       /* Skip leading delimiters. */
-       while( (*source != EOS) && (strchr(delim, *source) != NULL) ) {
-               source++;
-       }
-
-       if(*source == EOS) {
-               return 0;
-       }
-
-       while( (dest < last) && (*source != EOS) &&
-                       (strchr(delim, *source) == NULL) ) {
-               *dest++ = *source++;
-       }
-
-       if(end != NULL) {
-               *end = (const char *)source;
-       }
-       *dest = EOS;
-
-       return 1;
-}
-
-
-int
-vstrncpy(char *dest,
-         size_t len,
-         int count,
-         ...) {
-
-  va_list paramList;
-  int i;
-  const char *source;
-  char *end = dest + len - 1;
-  char *start = dest;
-
-  va_start(paramList, count);
-  for (i = 0; i < count; i++) {
-    for (source = va_arg(paramList, const char*);
-         (dest < end) && (*source != EOS); dest++, source++)
-      *dest = *source;
-  }
-  *dest = EOS;
-  va_end(paramList);
-  return dest - start;
-
-}
diff --git a/src/nws_portability/timeouts.c b/src/nws_portability/timeouts.c
deleted file mode 100644 (file)
index f725a07..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-/* $Id$ */
-
-#include "config_portability.h"
-
-#include <stdlib.h>
-#include <string.h>
-#ifdef HAVE_MATH_H
-#include <math.h>
-#endif
-
-#include "timeouts.h"
-#include "diagnostic.h"
-#include "forecast_api.h"
-#include "osutil.h"
-
-/* the default MAX timeout */
-#define DEFAULT_MAX_TIMEOUT (120.0)
-#define DEFAULT_MIN_TIMEOUT (5.0)
-
-/* we have this number of entries */
-#define HOW_MANY_ENTRIES (1024)
-
-/* keep track of the measurements we got */
-typedef struct {
-       IPAddress addr;
-       FORECASTAPI_ForecastState *state[TIMEOUT_TYPES_NUMBER];
-} timeOutStruct;
-
-static void *lock = NULL;                      /* local mutex */
-
-/* we have few types to keep track of */
-static timeOutStruct timeOuts[HOW_MANY_ENTRIES]; 
-
-/* keep track of the current limits on the timeouts */
-static double to_limits[TIMEOUT_TYPES_NUMBER*2];
-
-/* helper to work with modulo HOW_MANY_ENTRIES */
-#define MODPLUS(a,b,m) (((a) + (b)) % (m))
-#define MODMINUS(a,b,m) (((a) - (b) + (m)) % (m))
-
-/*
- * Initialize the Hash structure 
- */
-static void 
-InitHashStructure() {
-       unsigned int i,j;
-       static int initialized = 0;
-
-       /* let's do it only once */
-       if (initialized != 0) {
-               return;
-       }
-
-       GetNWSLock(&lock);
-       initialized = 1;
-
-       for (i=0; i < HOW_MANY_ENTRIES; i++) {
-               timeOuts[i].addr = 0;
-               for (j=0; j < TIMEOUT_TYPES_NUMBER; j++) {
-                       timeOuts[i].state[j] = NULL;
-               }
-       }
-       ReleaseNWSLock(&lock);
-
-       for (j=0; j < TIMEOUT_TYPES_NUMBER; j++) {
-               /* set defaults to sane state */
-               SetDefaultTimeout(j, DEFAULT_MIN_TIMEOUT, DEFAULT_MAX_TIMEOUT);
-       }
-}
-
-/* we use a simple hash table structure to speed up the access to the
- * timeout structures. If #addr# is not in the table it is added and if
- * the table is full, space is made for the addr.  
- * Returns     # the index at which addr is been found
- */
-static int 
-HashIndex(IPAddress addr) {
-       unsigned int i, end;
-
-       /* initialize the structure */
-       InitHashStructure();
-
-       i = addr % HOW_MANY_ENTRIES;
-       end = MODMINUS(i, 1, HOW_MANY_ENTRIES);
-
-       GetNWSLock(&lock);
-       for (; i != end; i = MODPLUS(i, 1, HOW_MANY_ENTRIES)) {
-               if ((timeOuts[i].addr == addr) || (timeOuts[i].addr == 0)) {
-                       /* either we found it, or emtpy slot: is good */
-                       break;
-               }
-                       
-       }
-       if (i == end) {
-               /* table is full: emtpying one slot */
-               i = addr % HOW_MANY_ENTRIES;
-               timeOuts[i].addr = 0;
-       }
-
-       /* if this is the first time we have the item, get it to a sane
-        * state */
-       if (timeOuts[i].addr == 0) {
-               timeOuts[i].addr = addr;
-               for (end=0; end < TIMEOUT_TYPES_NUMBER; end++) {
-                       /* Initialize the forecaster state */
-                       if (timeOuts[i].state[end] != NULL) {
-                               FORECASTAPI_FreeForecastState(&timeOuts[i].state[end]);
-                       }
-                       timeOuts[i].state[end] = FORECASTAPI_NewForecastState();
-               }
-       }
-
-       ReleaseNWSLock(&lock);
-
-       return i;
-}
-
-void
-SetDefaultTimeout(timeoutTypes type, double min, double max) {
-       /* sanity check */
-       if (type < RECV || type > USER3) {
-               WARN("SetDefaultTimeout: unknown type\n");
-               return;
-       }
-       if (min < 0) {
-               min = 1;
-       }
-       if (max < min) {
-               max = 2*min;
-       }
-
-       GetNWSLock(&lock);
-       to_limits[type*2] = min;
-       to_limits[type*2 + 1] = max;
-       ReleaseNWSLock(&lock);
-}
-
-void 
-GetDefaultTimeout(timeoutTypes type, double *min, double *max) {
-       /* sanity check */
-       if (type < RECV || type > USER3) {
-               WARN("SetDefaultTimeout: unknown type\n");
-               return;
-       }
-       GetNWSLock(&lock);
-       *min = to_limits[type*2];
-       *max = to_limits[type*2 + 1];
-       ReleaseNWSLock(&lock);
-}
-
-
-double 
-GetTimeOut(timeoutTypes type, IPAddress addr, long size) {
-       unsigned int i = -1;
-       double ret;
-       FORECASTAPI_ForecastCollection forecast;
-
-       /* sanity check */
-       if (type < 0 || type > USER3) {
-               WARN("GetTimeOut: type out of range\n");
-               return 0;
-       }
-
-       /* if addr is 0 (for example if it's a pipe) we pick the minimums
-        * timeout */
-       if (addr == 0) {
-               return to_limits[type*2];
-       }
-
-       i = HashIndex(addr);
-
-       /* let's get a forecast */
-       GetNWSLock(&lock);
-       if (FORECASTAPI_ComputeForecast(timeOuts[i].state[type], &forecast) != 0) {
-               forecast.forecasts[type].forecast = to_limits[type*2 + 1];
-       }
-       ReleaseNWSLock(&lock);
-
-       /* let's get 3 standard deviations (if we have sqrt) */
-#ifdef HAVE_SQRT
-       ret = forecast.forecasts[0].forecast + 3 * sqrt(forecast.forecasts[FORECASTAPI_MSE_FORECAST].error);
-#else
-       ret = forecast.forecasts[0].forecast + 2 * forecast.forecasts[FORECASTAPI_MAE_FORECAST].error;
-#endif
-
-       /* adjust for the size of the packet */
-       if (size > 0) {
-               ret = ret * size;
-       }
-
-       if (ret > to_limits[type*2 + 1]) {
-               ret = to_limits[type*2 + 1];
-       } else if (ret < to_limits[type*2]) {
-               ret = to_limits[type*2];
-       }
-
-       return ret;
-}
-
-void
-SetTimeOut(timeoutTypes type, IPAddress addr, double duration, long size, int timedOut) {
-       unsigned int i;
-       FORECASTAPI_Measurement m;
-
-       /* sanity check */
-       if (type < 0 || type > USER3) {
-               WARN("SetTimeOut: type out of range\n");
-               return;
-       }
-       if (duration < 0) {
-               WARN("SetTimeOut: duration negative?\n");
-               return;
-       }
-
-       /* if addr is 0 (for example if it's a pipe) we return */
-       if (addr == 0) {
-               return;
-       }
-
-       i = HashIndex(addr);
-
-       m.timeStamp = CurrentTime();
-       /* adjust for the size of the packet */
-       if (size > 0) {
-               m.measurement = duration / size;
-       } else {
-               m.measurement = duration;
-       }
-
-       /* adjustments if we timed out before */
-       if (timedOut) {
-               m.measurement += 5;
-       }
-       GetNWSLock(&lock);
-       FORECASTAPI_UpdateForecast(timeOuts[i].state[type], &m, 1);
-       ReleaseNWSLock(&lock);
-}