unifdef __UNIXOS2__

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
Alan Coopersmith 2024-02-11 14:56:22 -08:00
parent 0df284b450
commit 225a4bbbbd
14 changed files with 4 additions and 185 deletions

View file

@ -50,13 +50,9 @@ in this Software without prior written authorization from The Open Group.
#ifndef X_WCHAR
#include <stddef.h>
#else
#ifdef __UNIXOS2__
#include <stdlib.h>
#else
/* replace this with #include or typedef appropriate for your system */
typedef unsigned long wchar_t;
#endif
#endif
extern int

View file

@ -1327,12 +1327,6 @@ struct _XConnWatchInfo { /* info from XAddConnectionWatch */
struct _XConnWatchInfo *next;
};
#ifdef __UNIXOS2__
extern char* __XOS2RedirRoot(
char*
);
#endif
extern int _XTextHeight(
XFontStruct* /* font_struct */,
_Xconst char* /* string */,

View file

@ -31,10 +31,6 @@ in this Software without prior written authorization from The Open Group.
#ifdef USE_DYNAMIC_XCURSOR
#ifdef __UNIXOS2__
#define RTLD_LAZY 1
#define LIBXCURSOR "Xcursor.dll"
#endif
#include <stdio.h>
#include <string.h>
#if defined(hpux)

View file

@ -184,10 +184,6 @@ XGetDefault(
#ifdef WIN32
char *progname2;
#endif
#ifdef __UNIXOS2__
char *progname2;
char *dotpos;
#endif
/*
* strip path off of program name (XXX - this is OS specific)
@ -198,13 +194,6 @@ XGetDefault(
if (progname2 && (!progname || progname < progname2))
progname = progname2;
#endif
#ifdef __UNIXOS2__ /* Very similar to WIN32 */
progname2 = strrchr (prog, '\\');
if (progname2 && (!progname || progname < progname2))
progname = progname2;
dotpos = strrchr (prog, '.');
if (dotpos && (dotpos>progname2)) *dotpos='\0';
#endif /* We take out the .exe suffix */
if (progname)
progname++;

View file

@ -129,9 +129,6 @@ XReadBitmapFileData (
int hx = -1; /* x hotspot */
int hy = -1; /* y hotspot */
#ifdef __UNIXOS2__
filename = __XOS2RedirRoot(filename);
#endif
if (!(fstream = fopen(filename, "r")))
return BitmapOpenFailed;

View file

@ -99,7 +99,7 @@ _XlcMapOSLocaleName(
char *osname,
char *siname)
{
#if defined(hpux) || defined(CSRG_BASED) || defined(sun) || defined(SVR4) || defined(sgi) || defined(WIN32) || defined(__UNIXOS2__) || defined(linux)
#if defined(hpux) || defined(CSRG_BASED) || defined(sun) || defined(SVR4) || defined(sgi) || defined(WIN32) || defined(linux)
# ifdef hpux
# ifndef _LastCategory
/* HPUX 9 and earlier */
@ -111,7 +111,7 @@ _XlcMapOSLocaleName(
# define ENDCHAR ' '
# endif
# else
# if defined(WIN32) || defined(__UNIXOS2__)
# if defined(WIN32)
# define SKIPCOUNT 1
# define STARTCHAR '='
# define ENDCHAR ';'

View file

@ -122,14 +122,6 @@ void XSetWMProperties (
* systems will have to change this.
*/
char *cp = strrchr (argv[0], '/');
#ifdef __UNIXOS2__
char *os2_cp = strrchr (argv[0],'\\');
char *dot_cp = strrchr (argv[0],'.');
if (os2_cp && (os2_cp > cp)) {
if(dot_cp && (dot_cp > os2_cp)) *dot_cp = '\0';
cp=os2_cp;
}
#endif
tmp.res_name = (cp ? cp + 1 : argv[0]);
}
tmp.res_class = classHints->res_class;

View file

@ -106,9 +106,6 @@ XWriteBitmapFile(
else
name++;
#ifdef __UNIXOS2__
filename = (char*)__XOS2RedirRoot(filename);
#endif
if (!(stream = fopen(filename, "w")))
return(BitmapOpenFailed);

View file

@ -98,19 +98,10 @@ xthread_t (*_Xthread_self_fn)(void) = NULL;
#define ECHECK(err) (WSAGetLastError() == err)
#define ESET(val) WSASetLastError(val)
#else
#ifdef __UNIXOS2__
#define ECHECK(err) (errno == err)
#define ESET(val)
#else
#define ECHECK(err) (errno == err)
#define ESET(val) errno = val
#endif
#endif
#ifdef __UNIXOS2__
#include <limits.h>
#define MAX_PATH _POSIX_PATH_MAX
#endif
/*
* The following routines are internal routines used by Xlib for protocol
@ -1857,10 +1848,6 @@ static int AccessFile (path, pathbuf, len_pathbuf, pathret)
/* try the places set in the environment */
drive = getenv ("_XBASEDRIVE");
#ifdef __UNIXOS2__
if (!drive)
drive = getenv ("X11ROOT");
#endif
if (!drive)
drive = "C:";
len = strlen (drive) + strlen (path);
@ -1873,7 +1860,6 @@ static int AccessFile (path, pathbuf, len_pathbuf, pathret)
return 1;
}
#ifndef __UNIXOS2__
/* one last place to look */
drive = getenv ("HOMEDRIVE");
if (drive) {
@ -1908,7 +1894,6 @@ static int AccessFile (path, pathbuf, len_pathbuf, pathret)
}
}
}
#endif
return 0;
}

View file

@ -305,7 +305,7 @@ typedef unsigned char XrmBits;
static XrmBits const xrmtypes[256] = {
EOS,0,0,0,0,0,0,0,
0,SPACE,EOL,0,0,
#if defined(WIN32) || defined(__UNIXOS2__)
#ifdef WIN32
EOL, /* treat CR the same as LF, just in case */
#else
0,
@ -1575,9 +1575,6 @@ ReadInFile(_Xconst char *filename)
register int fd, size;
char * filebuf;
#ifdef __UNIXOS2__
filename = __XOS2RedirRoot(filename);
#endif
/*
* MS-Windows and OS/2 note: Default open mode includes O_TEXT
@ -1609,18 +1606,6 @@ ReadInFile(_Xconst char *filename)
return (char *)NULL;
}
size = read (fd, filebuf, size);
#ifdef __UNIXOS2__
{ /* kill CRLF */
int i,k;
for (i=k=0; i<size; i++)
if (filebuf[i] != 0x0d) {
filebuf[k++] = filebuf[i];
}
filebuf[k] = 0;
}
#endif
if (size < 0) {
close (fd);
Xfree(filebuf);

View file

@ -734,9 +734,6 @@ LoadColornameDB(void)
if ((pathname = getenv("XCMSDB")) == NULL) {
pathname = XCMSDB;
}
#ifdef __UNIXOS2__
pathname = __XOS2RedirRoot(pathname);
#endif
length = (int)strlen(pathname);
if ((length == 0) || (length >= (BUFSIZ - 5))){

View file

@ -276,11 +276,7 @@ _XkbGetCharset(void)
else {
struct stat sbuf;
FILE *file;
#ifndef __UNIXOS2__
char *cf = CHARSET_FILE;
#else
char *cf = __XOS2RedirRoot(CHARSET_FILE);
#endif
#ifndef S_ISREG
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)

View file

@ -345,15 +345,6 @@ read_line(
cur += len;
str[cur] = '\0';
#ifdef __UNIXOS2__ /* Take out carriage returns under OS/2 */
if (cur>1) {
if (str[cur-2] == '\r' && str[cur-1] == '\n') {
str[cur-2] = '\n';
str[cur-1] = '\0';
cur--;
}
}
#endif
if (!quoted && cur > 1 && str[cur - 2] == SYM_BACKSLASH &&
(str[cur - 1] == SYM_NEWLINE || str[cur-1] == SYM_CR)) {
/* the line is ended backslash followed by newline.
@ -1289,11 +1280,7 @@ _XlcCreateLocaleDataBase(
if (name == NULL)
return (XPointer)NULL;
#ifndef __UNIXOS2__
name_q = XrmStringToQuark(name);
#else
name_q = XrmStringToQuark((char*)__XOS2RedirRoot(name));
#endif
for (list = _db_list; list; list = list->next) {
if (name_q == list->name_q) {
list->ref_count++;

View file

@ -46,11 +46,7 @@
#define isreadable(f) ((access((f), R_OK) != -1) ? 1 : 0)
#endif
#ifndef __UNIXOS2__
#define LC_PATHDELIM ':'
#else
#define LC_PATHDELIM ';'
#endif
#define XLC_BUFSIZE 256
@ -92,75 +88,6 @@ parse_line(
return argc;
}
#ifdef __UNIXOS2__
/* fg021216: entries in locale files are separated by colons while under
OS/2, path entries are separated by semicolon, so we need two functions */
static int
parse_line1(
char *line,
char **argv,
int argsize)
{
int argc = 0;
char *p = line;
while (argc < argsize) {
while (isspace(*p)) {
++p;
}
if (*p == '\0') {
break;
}
argv[argc++] = p;
while (*p != ';' && *p != '\n' && *p != '\0') {
++p;
}
if (*p == '\0') {
break;
}
*p++ = '\0';
}
return argc;
}
#elif defined(WIN32)
/* this is parse_line but skips drive letters at the beginning of the entry */
static int
parse_line1(
char *line,
char **argv,
int argsize)
{
int argc = 0;
char *p = line;
while (argc < argsize) {
while (isspace(*p)) {
++p;
}
if (*p == '\0') {
break;
}
argv[argc++] = p;
if (isalpha(*p) && p[1] == ':') {
p+= 2; /* skip drive letters */
}
while (*p != ':' && *p != '\n' && *p != '\0') {
++p;
}
if (*p == '\0') {
break;
}
*p++ = '\0';
}
return argc;
}
#endif /* __UNIXOS2__ */
/* Splits a colon separated list of directories, and returns the constituent
paths (without trailing slash). At most argsize constituents are stored
@ -174,7 +101,7 @@ _XlcParsePath(
char *p = path;
int n, i;
#if !defined(__UNIXOS2__) && !defined(WIN32)
#ifndef WIN32
n = parse_line(path, argv, argsize);
#else
n = parse_line1(path, argv, argsize);
@ -265,11 +192,7 @@ xlocaledir(
#endif /* NO_XLOCALEDIR */
if (len < buf_len)
#ifndef __UNIXOS2__
strncpy(p, XLOCALEDIR, (size_t) (buf_len - len));
#else
strncpy(p,__XOS2RedirRoot(XLOCALEDIR), buf_len - len);
#endif
buf[buf_len-1] = '\0';
}
@ -343,11 +266,7 @@ xlocalelibdir(
#endif /* NO_XLOCALEDIR */
if (len < buf_len)
#ifndef __UNIXOS2__
strncpy(p, XLOCALELIBDIR, (size_t) (buf_len - len));
#else
strncpy(p,__XOS2RedirRoot(XLOCALELIBDIR), (size_t) (buf_len - len));
#endif
buf[buf_len-1] = '\0';
}
@ -374,17 +293,6 @@ resolve_name(
char *p = buf;
int n;
char *args[2], *from, *to;
#ifdef __UNIXOS2__ /* Take out CR under OS/2 */
int len;
len = strlen(p);
if (len > 1) {
if (*(p+len-2) == '\r' && *(p+len-1) == '\n') {
*(p+len-2) = '\n';
*(p+len-1) = '\0';
}
}
#endif
while (isspace(*p)) {
++p;
}