Discontinue HPUX support

This commit is contained in:
Chase
2022-07-22 21:42:06 -05:00
committed by Jon Trulson
parent bd83b53d56
commit edf4319548
235 changed files with 198 additions and 6290 deletions

View File

@@ -37,15 +37,11 @@
#include <sys/param.h> /* MAXPATHLEN */
#include <errno.h> /* errno(2) */
#ifdef __hpux
#include <ndir.h> /* opendir(), directory(3C) */
#else
#if defined(sun) || defined(CSRG_BASED)
#include <dirent.h> /* opendir(), directory(3C) */
#else
#include <sys/dir.h>
#endif /* sun || CSRG_BASED */
#endif /* __hpux */
#include <X11/Xlib.h>
#include <X11/Intrinsic.h> /* Xt stuff */

View File

@@ -44,116 +44,10 @@
#else
#include <X11/Intrinsic.h>
#include <DtSvcLock.h>
#endif /* NO_XLIB */
#endif
#include <Dt/MsgCatP.h>
#if defined(hpV4) && !defined(NO_XLIB)
typedef struct _dt_msg_cache
{
char ***cached_msgs;
int nmsgs_per_set;
int nsets;
nl_catd catd;
struct _dt_msg_cache *next;
} _DtMsgCache;
static _DtMsgCache *catalog_message_caches = NULL;
static _DtMsgCache *get_msg_cache(nl_catd catd)
{
const int initial_nmsgs_per_set = 300;
const int initial_nsets = 50;
_DtMsgCache *c;
for (c=catalog_message_caches; NULL!=c; c=c->next)
if (catd == c->catd) return c;
c = (_DtMsgCache*) XtMalloc(sizeof(_DtMsgCache));
c->cached_msgs = NULL;
c->nmsgs_per_set = initial_nmsgs_per_set;
c->nsets = initial_nsets;
c->catd = catd;
c->next = catalog_message_caches;
catalog_message_caches = c;
return c;
}
/*
* Wrapper around catgets -- this makes sure the message string is saved
* in a safe location; so repeated calls to catgets() do not overwrite
* the catgets() internal buffer. This has been a problem on HP systems.
*/
char *_DtCatgetsCached(nl_catd catd, int set, int num, const char *dflt)
{
char *message = NULL;
_DtMsgCache *c;
char **setptr;
int i, multiplier;
int size;
/* convert to a zero based index */
int setIdx = set - 1;
int numIdx = num - 1;
c = get_msg_cache(catd);
if (NULL == c)
{
message = catgets(catd, set, num, dflt);
return message;
}
if (NULL == c->cached_msgs)
{
size = sizeof(char**) * c->nsets;
c->cached_msgs = (char***) XtMalloc(size);
memset((char*) c->cached_msgs, 0, size);
}
else if (setIdx >= c->nsets)
{
for (multiplier=2; setIdx > multiplier*c->nsets; multiplier++) {}
size = sizeof(char**) * c->nsets;
c->cached_msgs =
(char***) XtRealloc((char*) c->cached_msgs, multiplier*size);
memset((char*) (c->cached_msgs + size), 0, multiplier*size);
c->nsets *= multiplier;
}
if (NULL == c->cached_msgs[setIdx])
{
size = sizeof(char*) * c->nmsgs_per_set;
c->cached_msgs[setIdx] = (char**) XtMalloc(size);
memset((char*) c->cached_msgs[setIdx], 0, size);
}
else if (numIdx >= c->nmsgs_per_set)
{
for (multiplier=2; numIdx > multiplier*c->nsets; multiplier++) {}
size = sizeof(char*) * c->nmsgs_per_set;
for (i=0; i<c->nmsgs_per_set; i++)
{
if (NULL != c->cached_msgs[i])
{
c->cached_msgs[i] =
(char**) XtRealloc((char*)c->cached_msgs[i], multiplier*size);
memset((char*) (c->cached_msgs[i] + size), 0, multiplier*size);
}
}
c->nmsgs_per_set *= multiplier;
}
setptr = c->cached_msgs[setIdx];
if (NULL == setptr[numIdx])
setptr[numIdx] = strdup(catgets(catd, set, num, dflt));
message = setptr[numIdx];
return message;
}
#endif /* hpV4 */
int _DtCatclose(nl_catd catd)
{
return (catd == (nl_catd) -1) ? 0 : catclose(catd);
@@ -169,11 +63,7 @@ char *_DtCatgets(nl_catd catd, int set, int num, const char *dflt)
} else {
/* Per POSIX, we cannot assume catgets() is thread-safe. */
_DtSvcProcessLock();
#if defined(hpV4) && !defined(NO_XLIB)
msg = _DtCatgetsCached(catd, set, num, dflt);
#else
msg = catgets(catd, set, num, dflt);
#endif /* hpV4 */
_DtSvcProcessUnlock();
}

View File

@@ -35,15 +35,11 @@
#include <stdio.h>
#include <sys/types.h>
#ifdef __hpux
#include <ndir.h>
#else
#if defined(sun) || defined(CSRG_BASED)
#include <dirent.h>
#else
#include <sys/dir.h>
#endif
#endif
#include <ctype.h>
#ifdef NLS16