*** unix/Makefile.gtk.ORIG Mon Aug 13 17:05:11 2007 --- unix/Makefile.gtk Tue Aug 14 00:40:13 2007 *************** *** 95,105 **** # later on as second-level damage. # # You can define this path to point at your tools if you need to ! # TOOLPATH = /opt/gcc/bin CC = $(TOOLPATH)cc ! CFLAGS = -O2 -Wall -Werror -g -I.././ -I../charset/ -I../windows/ -I../unix/ \ -I../mac/ -I../macosx/ `gtk-config --cflags` -D _FILE_OFFSET_BITS=64 XLDFLAGS = $(LDFLAGS) `gtk-config --libs` ULDFLAGS = $(LDFLAGS) --- 95,108 ---- # later on as second-level damage. # + XFLAGS=-DDEBUG + VER=-DRELEASE="0.60 for AIX" + # You can define this path to point at your tools if you need to ! TOOLPATH = /usr/vac/bin/ CC = $(TOOLPATH)cc ! CFLAGS = -O -qcpluscmt -I.././ -I../charset/ -I../windows/ -I../unix/ \ -I../mac/ -I../macosx/ `gtk-config --cflags` -D _FILE_OFFSET_BITS=64 XLDFLAGS = $(LDFLAGS) `gtk-config --libs` ULDFLAGS = $(LDFLAGS) *************** *** 106,112 **** INSTALL=install INSTALL_PROGRAM=$(INSTALL) INSTALL_DATA=$(INSTALL) ! prefix=/usr/local exec_prefix=$(prefix) bindir=$(exec_prefix)/bin mandir=$(prefix)/man --- 109,115 ---- INSTALL=install INSTALL_PROGRAM=$(INSTALL) INSTALL_DATA=$(INSTALL) ! prefix=/opt/freeware exec_prefix=$(prefix) bindir=$(exec_prefix)/bin mandir=$(prefix)/man *************** *** 176,182 **** sbcsdat.o sercfg.o settings.o 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 xenc.o xkeysym.o xpmptcfg.o xpmpterm.o $(CC) -o $@ be_none.o cmdline.o config.o dialog.o fromucs.o gtkcfg.o \ gtkcols.o gtkdlg.o gtkwin.o ldisc.o ldiscucs.o localenc.o \ logging.o macenc.o mimeenc.o minibidi.o misc.o nocproxy.o \ --- 179,185 ---- sbcsdat.o sercfg.o settings.o 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 xenc.o xkeysym.o xpmptcfg.o xpmpterm.o xutf8.o $(CC) -o $@ be_none.o cmdline.o config.o dialog.o fromucs.o gtkcfg.o \ gtkcols.o gtkdlg.o gtkwin.o ldisc.o ldiscucs.o localenc.o \ logging.o macenc.o mimeenc.o minibidi.o misc.o nocproxy.o \ *************** *** 184,190 **** 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 xenc.o xkeysym.o xpmptcfg.o \ ! xpmpterm.o $(XLDFLAGS) putty: be_all_s.o cmdline.o config.o cproxy.o dialog.o fromucs.o gtkcfg.o \ gtkcols.o gtkdlg.o gtkwin.o ldisc.o ldiscucs.o localenc.o \ --- 187,193 ---- 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 xenc.o xkeysym.o xpmptcfg.o \ ! xpmpterm.o xutf8.o $(XLDFLAGS) -lXmu -lXt putty: be_all_s.o cmdline.o config.o cproxy.o dialog.o fromucs.o gtkcfg.o \ gtkcols.o gtkdlg.o gtkwin.o ldisc.o ldiscucs.o localenc.o \ *************** *** 198,204 **** uxmisc.o uxnet.o uxnoise.o uxprint.o uxproxy.o uxputty.o \ uxsel.o uxser.o uxsignal.o uxstore.o uxucs.o version.o \ wcwidth.o wildcard.o x11fwd.o xenc.o xkeysym.o xpmpucfg.o \ ! xpmputty.o $(CC) -o $@ be_all_s.o cmdline.o config.o cproxy.o dialog.o \ fromucs.o gtkcfg.o gtkcols.o gtkdlg.o gtkwin.o ldisc.o \ ldiscucs.o localenc.o logging.o macenc.o mimeenc.o \ --- 201,207 ---- uxmisc.o uxnet.o uxnoise.o uxprint.o uxproxy.o uxputty.o \ uxsel.o uxser.o uxsignal.o uxstore.o uxucs.o version.o \ wcwidth.o wildcard.o x11fwd.o xenc.o xkeysym.o xpmpucfg.o \ ! xpmputty.o xutf8.o $(CC) -o $@ be_all_s.o cmdline.o config.o cproxy.o dialog.o \ fromucs.o gtkcfg.o gtkcols.o gtkdlg.o gtkwin.o ldisc.o \ ldiscucs.o localenc.o logging.o macenc.o mimeenc.o \ *************** *** 211,217 **** uxagentc.o uxcfg.o uxmisc.o uxnet.o uxnoise.o uxprint.o \ uxproxy.o uxputty.o uxsel.o uxser.o uxsignal.o uxstore.o \ uxucs.o version.o wcwidth.o wildcard.o x11fwd.o xenc.o \ ! xkeysym.o xpmpucfg.o xpmputty.o $(XLDFLAGS) puttygen: cmdgen.o import.o misc.o notiming.o sshaes.o sshbn.o sshdes.o \ sshdss.o sshdssg.o sshmd5.o sshprime.o sshpubk.o sshrand.o \ --- 214,220 ---- uxagentc.o uxcfg.o uxmisc.o uxnet.o uxnoise.o uxprint.o \ uxproxy.o uxputty.o uxsel.o uxser.o uxsignal.o uxstore.o \ uxucs.o version.o wcwidth.o wildcard.o x11fwd.o xenc.o \ ! xkeysym.o xpmpucfg.o xpmputty.o xutf8.o $(XLDFLAGS) -lXmu -lXt puttygen: cmdgen.o import.o misc.o notiming.o sshaes.o sshbn.o sshdes.o \ sshdss.o sshdssg.o sshmd5.o sshprime.o sshpubk.o sshrand.o \ *************** *** 231,237 **** toucs.o tree234.o utf8.o uxcfg.o uxmisc.o uxnet.o uxprint.o \ uxproxy.o uxputty.o uxsel.o uxser.o uxsignal.o uxstore.o \ uxucs.o version.o wcwidth.o xenc.o xkeysym.o xpmpucfg.o \ ! xpmputty.o $(CC) -o $@ be_nos_s.o cmdline.o config.o dialog.o fromucs.o \ gtkcfg.o gtkcols.o gtkdlg.o gtkwin.o ldisc.o ldiscucs.o \ localenc.o logging.o macenc.o mimeenc.o minibidi.o misc.o \ --- 234,240 ---- toucs.o tree234.o utf8.o uxcfg.o uxmisc.o uxnet.o uxprint.o \ uxproxy.o uxputty.o uxsel.o uxser.o uxsignal.o uxstore.o \ uxucs.o version.o wcwidth.o xenc.o xkeysym.o xpmpucfg.o \ ! xpmputty.o xutf8.o $(CC) -o $@ be_nos_s.o cmdline.o config.o dialog.o fromucs.o \ gtkcfg.o gtkcols.o gtkdlg.o gtkwin.o ldisc.o ldiscucs.o \ localenc.o logging.o macenc.o mimeenc.o minibidi.o misc.o \ *************** *** 240,246 **** timing.o toucs.o tree234.o utf8.o uxcfg.o uxmisc.o uxnet.o \ uxprint.o uxproxy.o uxputty.o uxsel.o uxser.o uxsignal.o \ uxstore.o uxucs.o version.o wcwidth.o xenc.o xkeysym.o \ ! xpmpucfg.o xpmputty.o $(XLDFLAGS) be_all.o: ../be_all.c ../putty.h ../puttyps.h ../network.h ../misc.h \ ../windows/winstuff.h ../mac/macstuff.h ../macosx/osx.h \ --- 243,251 ---- timing.o toucs.o tree234.o utf8.o uxcfg.o uxmisc.o uxnet.o \ uxprint.o uxproxy.o uxputty.o uxsel.o uxser.o uxsignal.o \ uxstore.o uxucs.o version.o wcwidth.o xenc.o xkeysym.o \ ! xpmpucfg.o xpmputty.o xutf8.o $(XLDFLAGS) -lXmu -lXt ! xutf8.o: ./xutf8.c ./xutf8.h ! $(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) -c ./xutf8.c be_all.o: ../be_all.c ../putty.h ../puttyps.h ../network.h ../misc.h \ ../windows/winstuff.h ../mac/macstuff.h ../macosx/osx.h \ *** unix/xutf8.h.ORIG Mon Aug 13 17:20:21 2007 --- unix/xutf8.h Mon Aug 13 17:20:38 2007 *************** *** 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/xutf8.c.ORIG Mon Aug 13 17:20:23 2007 --- unix/xutf8.c Mon Aug 13 17:20:38 2007 *************** *** 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/uxpty.c.ORIG Mon Aug 13 17:30:55 2007 --- unix/uxpty.c Tue Aug 14 01:07:39 2007 *************** *** 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 *************** *** 191,196 **** --- 205,213 ---- #endif struct passwd *pw; struct timeval tv; + #ifdef _AIX + FILE *wtmp; + #endif pw = getpwuid(getuid()); memset(&utmp_entry, 0, sizeof(utmp_entry)); *************** *** 209,219 **** --- 226,243 ---- 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)); *************** *** 234,239 **** --- 258,266 ---- static void cleanup_utmp(void) { struct timeval tv; + #ifdef _AIX + FILE *wtmp; + #endif if (!pty_stamped_utmp) return; *************** *** 244,250 **** --- 271,284 ---- 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;