*** ./unix/Makefile.gtk.ORIG Thu Mar 9 22:34:27 2017 --- ./unix/Makefile.gtk Sun Mar 19 11:39:04 2017 *************** *** 95,103 **** # completely insecure -- a FUZZING build should never be used to # connect to a real server. # You can define this path to point at your tools if you need to # TOOLPATH = /opt/gcc/bin ! CC = $(TOOLPATH)cc # If necessary set the path to krb5-config here KRB5CONFIG=krb5-config # You can manually set this to `gtk-config' or `pkg-config gtk+-1.2' --- 95,106 ---- # completely insecure -- a FUZZING build should never be used to # connect to a real server. + XFLAGS=-DDEBUG + VER=-DRELEASE="0.68 for AIX" + # You can define this path to point at your tools if you need to # TOOLPATH = /opt/gcc/bin ! CC = $(TOOLPATH)xlc_r -D_LINUX_SOURCE_COMPAT # If necessary set the path to krb5-config here KRB5CONFIG=krb5-config # You can manually set this to `gtk-config' or `pkg-config gtk+-1.2' *************** *** 105,120 **** # building with GTK 1.2, or you can set it to `pkg-config gtk+-2.0 x11' # if you want to enforce 2.0. The default is to try 2.0 and fall back # to 1.2 if it isn't found. ! GTK_CONFIG = sh -c 'pkg-config gtk+-3.0 x11 $$0 2>/dev/null || pkg-config gtk+-2.0 x11 $$0 2>/dev/null || gtk-config $$0' -include Makefile.local unexport CFLAGS # work around a weird issue with krb5-config ! CFLAGS = -O2 -Wall -Werror -g -I.././ -I../charset/ -I../windows/ -I../unix/ \ ! $(shell $(GTK_CONFIG) --cflags) -D _FILE_OFFSET_BITS=64 ! XLDFLAGS = $(LDFLAGS) $(shell $(GTK_CONFIG) --libs) ! ULDFLAGS = $(LDFLAGS) ifeq (,$(findstring NO_GSSAPI,$(COMPAT))) ifeq (,$(findstring STATIC_GSSAPI,$(COMPAT))) XLDFLAGS+= -ldl --- 108,123 ---- # building with GTK 1.2, or you can set it to `pkg-config gtk+-2.0 x11' # if you want to enforce 2.0. The default is to try 2.0 and fall back # to 1.2 if it isn't found. ! GTK_CONFIG = pkg-config gtk+-2.0 x11 -include Makefile.local unexport CFLAGS # work around a weird issue with krb5-config ! CFLAGS = -O3 -I.././ -I../charset/ -I../windows/ -I../unix/ \ ! $(shell $(GTK_CONFIG) --cflags) -D _FILE_OFFSET_BITS=64 -D_LARGE_FILES ! XLDFLAGS = $(LDFLAGS) $(shell $(GTK_CONFIG) --libs) -lbsd ! ULDFLAGS = $(LDFLAGS) -lbsd ifeq (,$(findstring NO_GSSAPI,$(COMPAT))) ifeq (,$(findstring STATIC_GSSAPI,$(COMPAT))) XLDFLAGS+= -ldl *************** *** 128,134 **** INSTALL=install INSTALL_PROGRAM=$(INSTALL) INSTALL_DATA=$(INSTALL) ! prefix=/usr/local exec_prefix=$(prefix) bindir=$(exec_prefix)/bin mandir=$(prefix)/man --- 131,137 ---- INSTALL=install INSTALL_PROGRAM=$(INSTALL) INSTALL_DATA=$(INSTALL) ! prefix=/opt/freeware exec_prefix=$(prefix) bindir=$(exec_prefix)/bin mandir=$(prefix)/man *************** *** 259,265 **** terminal.o time.o timing.o toucs.o tree234.o utf8.o uxcfg.o \ uxmisc.o uxprint.o uxpterm.o uxpty.o uxsel.o uxsignal.o \ uxstore.o uxucs.o version.o wcwidth.o x11misc.o xenc.o \ ! xkeysym.o xpmptcfg.o xpmpterm.o $(CC) -o $@ be_none.o callback.o cmdline.o conf.o config.o dialog.o \ fromucs.o gtkcfg.o gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o \ gtkmain.o gtkmisc.o gtkwin.o ldisc.o ldiscucs.o localenc.o \ --- 262,268 ---- terminal.o time.o timing.o toucs.o tree234.o utf8.o uxcfg.o \ uxmisc.o uxprint.o uxpterm.o uxpty.o uxsel.o uxsignal.o \ uxstore.o uxucs.o version.o wcwidth.o x11misc.o xenc.o \ ! xkeysym.o xpmptcfg.o xpmpterm.o xutf8.o $(CC) -o $@ be_none.o callback.o cmdline.o conf.o config.o dialog.o \ fromucs.o gtkcfg.o gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o \ gtkmain.o gtkmisc.o gtkwin.o ldisc.o ldiscucs.o localenc.o \ *************** *** 268,274 **** slookup.o terminal.o time.o timing.o toucs.o tree234.o \ utf8.o uxcfg.o uxmisc.o uxprint.o uxpterm.o uxpty.o uxsel.o \ uxsignal.o uxstore.o uxucs.o version.o wcwidth.o x11misc.o \ ! xenc.o xkeysym.o xpmptcfg.o xpmpterm.o $(XLDFLAGS) ptermapp: be_none.o callback.o cmdline.o conf.o config.o dialog.o fromucs.o \ gtkapp.o gtkcfg.o gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o \ --- 271,277 ---- slookup.o terminal.o time.o timing.o toucs.o tree234.o \ utf8.o uxcfg.o uxmisc.o uxprint.o uxpterm.o uxpty.o uxsel.o \ uxsignal.o uxstore.o uxucs.o version.o wcwidth.o x11misc.o \ ! xenc.o xkeysym.o xpmptcfg.o xpmpterm.o xutf8.o $(XLDFLAGS) -lXmu -lXt ptermapp: be_none.o callback.o cmdline.o conf.o config.o dialog.o fromucs.o \ gtkapp.o gtkcfg.o gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o \ *************** *** 287,293 **** slookup.o terminal.o time.o timing.o toucs.o tree234.o \ utf8.o uxcfg.o uxmisc.o uxprint.o uxpterm.o uxpty.o uxsel.o \ uxsignal.o uxstore.o uxucs.o version.o wcwidth.o x11misc.o \ ! xenc.o xkeysym.o xpmptcfg.o xpmpterm.o $(XLDFLAGS) putty: aqsync.o be_all_s.o be_misc.o callback.o cmdline.o conf.o config.o \ cproxy.o dialog.o fromucs.o gtkcfg.o gtkcols.o gtkcomm.o \ --- 290,296 ---- slookup.o terminal.o time.o timing.o toucs.o tree234.o \ utf8.o uxcfg.o uxmisc.o uxprint.o uxpterm.o uxpty.o uxsel.o \ uxsignal.o uxstore.o uxucs.o version.o wcwidth.o x11misc.o \ ! xenc.o xkeysym.o xpmptcfg.o xpmpterm.o $(XLDFLAGS) -lXmu -lXt putty: aqsync.o be_all_s.o be_misc.o callback.o cmdline.o conf.o config.o \ cproxy.o dialog.o fromucs.o gtkcfg.o gtkcols.o gtkcomm.o \ *************** *** 304,310 **** uxpeer.o uxprint.o uxproxy.o uxputty.o uxsel.o uxser.o \ uxshare.o uxsignal.o uxstore.o uxucs.o version.o wcwidth.o \ wildcard.o x11fwd.o x11misc.o xenc.o xkeysym.o xpmpucfg.o \ ! xpmputty.o $(CC) -o $@ aqsync.o be_all_s.o be_misc.o callback.o cmdline.o \ conf.o config.o cproxy.o dialog.o fromucs.o gtkcfg.o \ gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o gtkmain.o gtkmisc.o \ --- 307,313 ---- uxpeer.o uxprint.o uxproxy.o uxputty.o uxsel.o uxser.o \ uxshare.o uxsignal.o uxstore.o uxucs.o version.o wcwidth.o \ wildcard.o x11fwd.o x11misc.o xenc.o xkeysym.o xpmpucfg.o \ ! xpmputty.o xutf8.o $(CC) -o $@ aqsync.o be_all_s.o be_misc.o callback.o cmdline.o \ conf.o config.o cproxy.o dialog.o fromucs.o gtkcfg.o \ gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o gtkmain.o gtkmisc.o \ *************** *** 320,326 **** uxnoise.o uxpeer.o uxprint.o uxproxy.o uxputty.o uxsel.o \ uxser.o uxshare.o uxsignal.o uxstore.o uxucs.o version.o \ wcwidth.o wildcard.o x11fwd.o x11misc.o xenc.o xkeysym.o \ ! xpmpucfg.o xpmputty.o $(XLDFLAGS) puttyapp: aqsync.o be_all_s.o be_misc.o callback.o cmdline.o conf.o config.o \ cproxy.o dialog.o fromucs.o gtkapp.o gtkcfg.o gtkcols.o \ --- 323,329 ---- uxnoise.o uxpeer.o uxprint.o uxproxy.o uxputty.o uxsel.o \ uxser.o uxshare.o uxsignal.o uxstore.o uxucs.o version.o \ wcwidth.o wildcard.o x11fwd.o x11misc.o xenc.o xkeysym.o \ ! xpmpucfg.o xpmputty.o xutf8.o $(XLDFLAGS) -lXmu -lXt puttyapp: aqsync.o be_all_s.o be_misc.o callback.o cmdline.o conf.o config.o \ cproxy.o dialog.o fromucs.o gtkapp.o gtkcfg.o gtkcols.o \ *************** *** 337,343 **** uxpeer.o uxprint.o uxproxy.o uxputty.o uxsel.o uxser.o \ uxshare.o uxsignal.o uxstore.o uxucs.o version.o wcwidth.o \ wildcard.o x11fwd.o x11misc.o xenc.o xkeysym.o xpmpucfg.o \ ! xpmputty.o $(CC) -o $@ aqsync.o be_all_s.o be_misc.o callback.o cmdline.o \ conf.o config.o cproxy.o dialog.o fromucs.o gtkapp.o \ gtkcfg.o gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o gtkmisc.o \ --- 340,346 ---- uxpeer.o uxprint.o uxproxy.o uxputty.o uxsel.o uxser.o \ uxshare.o uxsignal.o uxstore.o uxucs.o version.o wcwidth.o \ wildcard.o x11fwd.o x11misc.o xenc.o xkeysym.o xpmpucfg.o \ ! xpmputty.o xutf8.o $(CC) -o $@ aqsync.o be_all_s.o be_misc.o callback.o cmdline.o \ conf.o config.o cproxy.o dialog.o fromucs.o gtkapp.o \ gtkcfg.o gtkcols.o gtkcomm.o gtkdlg.o gtkfont.o gtkmisc.o \ *************** *** 353,359 **** uxnoise.o uxpeer.o uxprint.o uxproxy.o uxputty.o uxsel.o \ uxser.o uxshare.o uxsignal.o uxstore.o uxucs.o version.o \ wcwidth.o wildcard.o x11fwd.o x11misc.o xenc.o xkeysym.o \ ! xpmpucfg.o xpmputty.o $(XLDFLAGS) puttygen: cmdgen.o conf.o import.o misc.o notiming.o sshaes.o sshbcrypt.o \ sshblowf.o sshbn.o sshdes.o sshdss.o sshdssg.o sshecc.o \ --- 356,362 ---- uxnoise.o uxpeer.o uxprint.o uxproxy.o uxputty.o uxsel.o \ uxser.o uxshare.o uxsignal.o uxstore.o uxucs.o version.o \ wcwidth.o wildcard.o x11fwd.o x11misc.o xenc.o xkeysym.o \ ! xpmpucfg.o xpmputty.o xutf8.o $(XLDFLAGS) -lXmu -lXt puttygen: cmdgen.o conf.o import.o misc.o notiming.o sshaes.o sshbcrypt.o \ sshblowf.o sshbn.o sshdes.o sshdss.o sshdssg.o sshecc.o \ *************** *** 377,383 **** time.o timing.o toucs.o tree234.o utf8.o uxcfg.o uxmisc.o \ uxnet.o uxpeer.o uxprint.o uxproxy.o uxputty.o uxsel.o \ uxser.o uxsignal.o uxstore.o uxucs.o version.o wcwidth.o \ ! x11misc.o xenc.o xkeysym.o xpmpucfg.o xpmputty.o $(CC) -o $@ be_misc.o be_nos_s.o callback.o cmdline.o conf.o \ config.o dialog.o fromucs.o gtkcfg.o gtkcols.o gtkcomm.o \ gtkdlg.o gtkfont.o gtkmain.o gtkmisc.o gtkwin.o ldisc.o \ --- 380,386 ---- time.o timing.o toucs.o tree234.o utf8.o uxcfg.o uxmisc.o \ uxnet.o uxpeer.o uxprint.o uxproxy.o uxputty.o uxsel.o \ uxser.o uxsignal.o uxstore.o uxucs.o version.o wcwidth.o \ ! x11misc.o xenc.o xkeysym.o xpmpucfg.o xpmputty.o xutf8.o $(CC) -o $@ be_misc.o be_nos_s.o callback.o cmdline.o conf.o \ config.o dialog.o fromucs.o gtkcfg.o gtkcols.o gtkcomm.o \ gtkdlg.o gtkfont.o gtkmain.o gtkmisc.o gtkwin.o ldisc.o \ *************** *** 388,399 **** tree234.o utf8.o uxcfg.o uxmisc.o uxnet.o uxpeer.o uxprint.o \ uxproxy.o uxputty.o uxsel.o uxser.o uxsignal.o uxstore.o \ uxucs.o version.o wcwidth.o x11misc.o xenc.o xkeysym.o \ ! xpmpucfg.o xpmputty.o $(XLDFLAGS) testbn: conf.o misc.o sshbn.o testbn.o tree234.o uxmisc.o uxnogtk.o \ version.o $(CC) -o $@ conf.o misc.o sshbn.o testbn.o tree234.o uxmisc.o \ uxnogtk.o version.o $(ULDFLAGS) aqsync.o: ../aqsync.c ../putty.h ../puttyps.h ../network.h ../misc.h \ ../windows/winstuff.h ../unix/unix.h ../puttymem.h \ --- 391,405 ---- tree234.o utf8.o uxcfg.o uxmisc.o uxnet.o uxpeer.o uxprint.o \ uxproxy.o uxputty.o uxsel.o uxser.o uxsignal.o uxstore.o \ uxucs.o version.o wcwidth.o x11misc.o xenc.o xkeysym.o \ ! xpmpucfg.o xpmputty.o xutf8.o $(XLDFLAGS) -lXmu -lXt testbn: conf.o misc.o sshbn.o testbn.o tree234.o uxmisc.o uxnogtk.o \ version.o $(CC) -o $@ conf.o misc.o sshbn.o testbn.o tree234.o uxmisc.o \ uxnogtk.o version.o $(ULDFLAGS) + + xutf8.o: ./xutf8.c ./xutf8.h + $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) -c ./xutf8.c aqsync.o: ../aqsync.c ../putty.h ../puttyps.h ../network.h ../misc.h \ ../windows/winstuff.h ../unix/unix.h ../puttymem.h \ *** ./unix/uxnet.c.ORIG Sun Mar 19 10:54:28 2017 --- ./unix/uxnet.c Thu Mar 9 22:33:41 2017 *************** *** 1484,1489 **** --- 1484,1493 ---- uxsel_tell(s); } + #if (defined(_AIX51) || defined(_AIX52) || defined(_AIX53)) && !(defined(_AIX61)) + #define ss_family __ss_family + #endif + static char *sk_tcp_peer_info(Socket sock) { Actual_Socket s = (Actual_Socket) sock; *** ./unix/xutf8.c.ORIG Sun Mar 19 11:12:31 2017 --- ./unix/xutf8.c Sun Mar 19 11:12:17 2017 *************** *** 0 **** --- 1,301 ---- + /* $XFree86: xc/programs/xterm/xutf8.c,v 1.3 2002/10/09 16:38:20 tsi Exp $ */ + /* + Copyright (c) 2001 by Juliusz Chroboczek + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + */ + + #include + + #include + #include + #include + #include + + #include + + #undef XA_UTF8_STRING + + Atom + _xa_utf8_string(Display * dpy) + { + static AtomPtr p = NULL; + + if (p == NULL) + p = XmuMakeAtom("UTF8_STRING"); + + return XmuInternAtom(dpy, p); + } + #define XA_UTF8_STRING(dpy) _xa_utf8_string(dpy) + + static void + utf8insert(char *dest, int c, int *len_return) + { + if (c < 0) + return; + + if (c <= 0x7F) { + dest[0] = c; + *len_return = 1; + } else if (c <= 0x7FF) { + dest[0] = 0xC0 | ((c >> 6) & 0x1F); + dest[1] = 0x80 | (c & 0x3F); + *len_return = 2; + } else if (c <= 0xFFFF) { + dest[0] = 0xE0 | ((c >> 12) & 0x0F); + dest[1] = 0x80 | ((c >> 6) & 0x3F); + dest[2] = 0x80 | (c & 0x3F); + *len_return = 3; + } else { + dest[0] = 0xF0 | ((c >> 18) & 0x07); + dest[1] = 0x80 | ((c >> 12) & 0x3f); + dest[2] = 0x80 | ((c >> 6) & 0x3f); + dest[3] = 0x80 | (c & 0x3f); + *len_return = 4; + } + } + + static int + l1countUtf8Bytes(char *s, int len) + { + int l = 0; + while (len > 0) { + if ((*s & 0x80) == 0) + l++; + else + l += 2; + s++; + len--; + } + return l; + } + + static void + l1utf8copy(char *d, char *s, int len) + { + int l; + while (len > 0) { + utf8insert(d, (*s) & 0xFF, &l); + d += l; + s++; + len--; + } + } + + static void + utf8l1strcpy(char *d, char *s) + { + #define SKIP do { s++; } while(((*s & 0x80) != 0) && (*s & 0xC0) != 0xC0) + while (*s) { + if ((*s & 0x80) == 0) + *d++ = *s++; + else if ((*s & 0x7C) == 0x40) { + if ((s[1] & 0x80) == 0) { + s++; /* incorrect UTF-8 */ + continue; + } else if ((*s & 0x7C) == 0x40) { + *d++ = ((*s & 0x03) << 6) | (s[1] & 0x3F); + s += 2; + } else { + *d++ = '?'; + SKIP; + } + } else { + *d++ = '?'; + SKIP; + } + } + *d = 0; + #undef SKIP + } + + /* Keep this in sync with utf8l1strcpy! */ + static int + utf8l1strlen(char *s) + { + #define SKIP do { s++; } while(((*s & 0x80) != 0) && (*s & 0xC0) != 0xC0) + int len = 0; + while (*s) { + if ((*s & 0x80) == 0) { + s++; + len++; + } else if ((*s & 0x7C) == 0x40) { + if ((s[1] & 0x80) == 0) { + s++; + continue; + } else if ((*s & 0x7C) == 0x40) { + len++; + s += 2; + } else { + len++; + SKIP; + } + } else { + len++; + SKIP; + } + } + #undef SKIP + return len; + } + + int + Xutf8TextPropertyToTextList(Display * dpy, + const XTextProperty * tp, + char ***list_return, + int *count_return) + { + int utf8; + char **list; + int nelements; + register char *cp; + char *start; + int i, j; + int datalen = (int) tp->nitems; + int len; + + if (tp->format != 8) + return XConverterNotFound; + + if (tp->encoding == XA_STRING) + utf8 = 0; + else if (tp->encoding == XA_UTF8_STRING(dpy)) + utf8 = 1; + else + return XConverterNotFound; + + if (datalen == 0) { + *list_return = NULL; + *count_return = 0; + return 0; + } + + nelements = 1; + for (cp = (char *) tp->value, i = datalen; i > 0; cp++, i--) { + if (*cp == '\0') + nelements++; + } + + list = (char **) malloc(nelements * sizeof(char *)); + if (!list) + return XNoMemory; + + if (utf8) + len = datalen; + else + len = l1countUtf8Bytes((char *) tp->value, datalen); + + start = (char *) malloc((len + 1) * sizeof(char)); + if (!start) { + free((char *) list); + return XNoMemory; + } + + if (utf8) + memcpy(start, (char *) tp->value, datalen); + else + l1utf8copy(start, (char *) tp->value, datalen); + start[len] = '\0'; + + for (cp = start, i = len + 1, j = 0; i > 0; cp++, i--) { + if (*cp == '\0') { + list[j] = start; + start = (cp + 1); + j++; + } + } + + list[j] = NULL; + *list_return = list; + *count_return = nelements; + return 0; + } + + int + Xutf8TextListToTextProperty(Display * dpy, + char **list, + int count, + XICCEncodingStyle style, + XTextProperty * text_prop) + { + XTextProperty proto; + unsigned int nbytes; + int i; + + if (style != XStringStyle && + style != XCompoundTextStyle && + style != XStdICCTextStyle && + style != XUTF8StringStyle) + return XConverterNotFound; + + if (style == XUTF8StringStyle) { + for (i = 0, nbytes = 0; i < count; i++) { + nbytes += (unsigned) ((list[i] ? strlen(list[i]) : 0) + 1); + } + } else { + for (i = 0, nbytes = 0; i < count; i++) { + nbytes += (unsigned) ((list[i] ? utf8l1strlen(list[i]) : 0) + 1); + } + } + + if (style == XCompoundTextStyle) + proto.encoding = XA_COMPOUND_TEXT(dpy); + else if (style == XUTF8StringStyle) + proto.encoding = XA_UTF8_STRING(dpy); + else + proto.encoding = XA_STRING; + proto.format = 8; + if (nbytes) + proto.nitems = nbytes - 1; + else + proto.nitems = 0; + proto.value = NULL; + + if (nbytes > 0) { + register char *buf = malloc(nbytes); + if (!buf) + return XNoMemory; + + proto.value = (unsigned char *) buf; + for (i = 0; i < count; i++) { + char *arg = list[i]; + + if (arg) { + if (style == XUTF8StringStyle) { + strcpy(buf, arg); + } else { + utf8l1strcpy(buf, arg); + } + buf += (strlen(buf) + 1); + } else { + *buf++ = '\0'; + } + } + } else { + proto.value = (unsigned char *) malloc(1); /* easier for client */ + if (!proto.value) + return XNoMemory; + + proto.value[0] = '\0'; + } + + *text_prop = proto; + return 0; + } + *** ./unix/xutf8.h.ORIG Sun Mar 19 11:12:38 2017 --- ./unix/xutf8.h Sun Mar 19 11:12:17 2017 *************** *** 0 **** --- 1,57 ---- + /* $XFree86: xc/programs/xterm/xutf8.h,v 1.1 2001/06/18 19:09:28 dickey Exp $ */ + /* + Copyright (c) 2001 by Juliusz Chroboczek + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + */ + + #ifndef _XLIB_H_ + #error Please include before "xutf8.h" + #endif + + #undef XA_UTF8_STRING + Atom _xa_utf8_string(Display*); + #define XA_UTF8_STRING(dpy) _xa_utf8_string(dpy) + + #undef XUTF8StringStyle + #define XUTF8StringStyle 4 + + int Xutf8TextPropertyToTextList( + Display *, + const XTextProperty *, + char ***, + int * + ); + int + Xutf8TextListToTextProperty( + Display *, + char **, + int, + XICCEncodingStyle, + XTextProperty * + ); + int Xutf8LookupString( + XIC, + XKeyPressedEvent *, + char *, + int, + KeySym *, + Status * + ); + *** ./unix/uxpty.c.ORIG Sun Mar 19 11:29:56 2017 --- ./unix/uxpty.c Sun Mar 19 11:34:28 2017 *************** *** 2,9 **** --- 2,23 ---- * Pseudo-tty backend for pterm. */ + #ifndef _AIX + #define _XOPEN_SOURCE 600 + #define _XOPEN_SOURCE_EXTENDED + #endif #define _GNU_SOURCE + #ifndef _AIX + #include + #endif + #ifdef _AIX + //#define TIOCSCTTY 0x540E + #define HAVE_NO_SETRESUID + #undef HAVE_UPDWTMPX + #define BSD_PTYS + #endif + #include #include #include *************** *** 194,199 **** --- 208,216 ---- #endif struct passwd *pw; struct timeval tv; + #ifdef _AIX + FILE *wtmp; + #endif pw = getpwuid(getuid()); memset(&utmp_entry, 0, sizeof(utmp_entry)); *************** *** 212,222 **** --- 229,246 ---- utmp_entry.ut_tv.tv_sec = tv.tv_sec; utmp_entry.ut_tv.tv_usec = tv.tv_usec; + #ifndef _AIX setutxent(); pututxline(&utmp_entry); endutxent(); updwtmpx(WTMPX_FILE, &utmp_entry); + #else + if ((wtmp = fopen(WTMP_FILE, "a")) != NULL) { + fwrite(&utmp_entry, 1, sizeof(utmp_entry), wtmp); + fclose(wtmp); + } + #endif #ifdef HAVE_LASTLOG memset(&lastlog_entry, 0, sizeof(lastlog_entry)); *************** *** 237,242 **** --- 261,269 ---- static void cleanup_utmp(void) { struct timeval tv; + #ifdef _AIX + FILE *wtmp; + #endif if (!pty_stamped_utmp) return; *************** *** 247,253 **** --- 274,287 ---- utmp_entry.ut_tv.tv_sec = tv.tv_sec; utmp_entry.ut_tv.tv_usec = tv.tv_usec; + #ifndef _AIX updwtmpx(WTMPX_FILE, &utmp_entry); + #else + if ((wtmp = fopen(WTMP_FILE, "a")) != NULL) { + fwrite(&utmp_entry, 1, sizeof(utmp_entry), wtmp); + fclose(wtmp); + } + #endif memset(utmp_entry.ut_line, 0, lenof(utmp_entry.ut_line)); utmp_entry.ut_tv.tv_sec = 0; *************** *** 724,729 **** --- 758,802 ---- */ uxsel_set(pty_signal_pipe[0], 1, pty_select_result); } + + + /*************************************************************************** + unsetenv() + ****************************************************************************/ + + #if defined(_AIX) && !defined(_AIX52) + int + unsetenv( const char *name ) + { + size_t len; + char **ep; + + if ((name == NULL) || (*name == '\0') || (strchr( name, '=' ) != NULL)) + { + errno = EINVAL; + return( -1 ); + } + + len = strlen( name ); + + ep = environ; + while (*ep != NULL) + if (! strncmp( *ep, name, len ) && (*ep)[len] == '=') + { + /* Found it. Remove this pointer by moving later ones back. */ + char **dp = ep; + + do + dp[0] = dp[1]; + while (*dp++); + /* Continue the loop in case NAME appears again. */ + } + else + ++ep; + + return( 0 ); + } + #endif /* * Called to set up the pty. *** ./unix/gtkcompat.h.ORIG Fri Sep 22 12:02:56 2017 --- ./unix/gtkcompat.h Fri Sep 22 12:16:55 2017 *************** *** 156,161 **** --- 156,239 ---- #define GDK_KEY_greater GDK_greater #define GDK_KEY_less GDK_less + #else + + #define gdk_visual_get_depth(v) ((v)->depth) + #define gdk_window_get_screen(w) gdk_drawable_get_screen(w) + #define gtk_combo_box_new_with_model_and_entry(t) gtk_combo_box_entry_new_with_model(t, 1) + + #define GDK_KEY_Alt_L GDK_Alt_L + #define GDK_KEY_Alt_R GDK_Alt_R + #define GDK_KEY_BackSpace GDK_BackSpace + #define GDK_KEY_Begin GDK_Begin + #define GDK_KEY_Break GDK_Break + #define GDK_KEY_Delete GDK_Delete + #define GDK_KEY_Down GDK_Down + #define GDK_KEY_End GDK_End + #define GDK_KEY_Escape GDK_Escape + #define GDK_KEY_F10 GDK_F10 + #define GDK_KEY_F11 GDK_F11 + #define GDK_KEY_F12 GDK_F12 + #define GDK_KEY_F13 GDK_F13 + #define GDK_KEY_F14 GDK_F14 + #define GDK_KEY_F15 GDK_F15 + #define GDK_KEY_F16 GDK_F16 + #define GDK_KEY_F17 GDK_F17 + #define GDK_KEY_F18 GDK_F18 + #define GDK_KEY_F19 GDK_F19 + #define GDK_KEY_F1 GDK_F1 + #define GDK_KEY_F20 GDK_F20 + #define GDK_KEY_F2 GDK_F2 + #define GDK_KEY_F3 GDK_F3 + #define GDK_KEY_F4 GDK_F4 + #define GDK_KEY_F5 GDK_F5 + #define GDK_KEY_F6 GDK_F6 + #define GDK_KEY_F7 GDK_F7 + #define GDK_KEY_F8 GDK_F8 + #define GDK_KEY_F9 GDK_F9 + #define GDK_KEY_Home GDK_Home + #define GDK_KEY_Insert GDK_Insert + #define GDK_KEY_ISO_Left_Tab GDK_ISO_Left_Tab + #define GDK_KEY_KP_0 GDK_KP_0 + #define GDK_KEY_KP_1 GDK_KP_1 + #define GDK_KEY_KP_2 GDK_KP_2 + #define GDK_KEY_KP_3 GDK_KP_3 + #define GDK_KEY_KP_4 GDK_KP_4 + #define GDK_KEY_KP_5 GDK_KP_5 + #define GDK_KEY_KP_6 GDK_KP_6 + #define GDK_KEY_KP_7 GDK_KP_7 + #define GDK_KEY_KP_8 GDK_KP_8 + #define GDK_KEY_KP_9 GDK_KP_9 + #define GDK_KEY_KP_Add GDK_KP_Add + #define GDK_KEY_KP_Begin GDK_KP_Begin + #define GDK_KEY_KP_Decimal GDK_KP_Decimal + #define GDK_KEY_KP_Delete GDK_KP_Delete + #define GDK_KEY_KP_Divide GDK_KP_Divide + #define GDK_KEY_KP_Down GDK_KP_Down + #define GDK_KEY_KP_End GDK_KP_End + #define GDK_KEY_KP_Enter GDK_KP_Enter + #define GDK_KEY_KP_Home GDK_KP_Home + #define GDK_KEY_KP_Insert GDK_KP_Insert + #define GDK_KEY_KP_Left GDK_KP_Left + #define GDK_KEY_KP_Multiply GDK_KP_Multiply + #define GDK_KEY_KP_Page_Down GDK_KP_Page_Down + #define GDK_KEY_KP_Page_Up GDK_KP_Page_Up + #define GDK_KEY_KP_Right GDK_KP_Right + #define GDK_KEY_KP_Subtract GDK_KP_Subtract + #define GDK_KEY_KP_Up GDK_KP_Up + #define GDK_KEY_Left GDK_Left + #define GDK_KEY_Meta_L GDK_Meta_L + #define GDK_KEY_Meta_R GDK_Meta_R + #define GDK_KEY_Num_Lock GDK_Num_Lock + #define GDK_KEY_Page_Down GDK_Page_Down + #define GDK_KEY_Page_Up GDK_Page_Up + #define GDK_KEY_Return GDK_Return + #define GDK_KEY_Right GDK_Right + #define GDK_KEY_Tab GDK_Tab + #define GDK_KEY_Up GDK_Up + #define GDK_KEY_greater GDK_greater + #define GDK_KEY_less GDK_less + #endif #if GTK_CHECK_VERSION(3,0,0)