*** int64.h.ORIG Thu Jun 23 11:30:21 2005 --- int64.h Wed Jun 22 13:38:42 2005 *************** *** 7,19 **** typedef struct { unsigned long hi, lo; ! } uint64, int64; ! uint64 uint64_div10(uint64 x, int *remainder); ! void uint64_decimal(uint64 x, char *buffer); ! uint64 uint64_make(unsigned long hi, unsigned long lo); ! uint64 uint64_add(uint64 x, uint64 y); ! uint64 uint64_add32(uint64 x, unsigned long y); ! int uint64_compare(uint64 x, uint64 y); #endif --- 7,19 ---- typedef struct { unsigned long hi, lo; ! } putty_uint64, putty_int64; ! putty_uint64 uint64_div10(putty_uint64 x, int *remainder); ! void uint64_decimal(putty_uint64 x, char *buffer); ! putty_uint64 uint64_make(unsigned long hi, unsigned long lo); ! putty_uint64 uint64_add(putty_uint64 x, putty_uint64 y); ! putty_uint64 uint64_add32(putty_uint64 x, unsigned long y); ! int uint64_compare(putty_uint64 x, putty_uint64 y); #endif *** sftp.h.ORIG Thu Jun 23 11:30:39 2005 --- sftp.h Wed Jun 22 13:45:55 2005 *************** *** 74,80 **** struct fxp_attrs { unsigned long flags; ! uint64 size; unsigned long uid; unsigned long gid; unsigned long permissions; --- 74,80 ---- struct fxp_attrs { unsigned long flags; ! putty_uint64 size; unsigned long uid; unsigned long gid; unsigned long permissions; *************** *** 182,188 **** * Read from a file. */ struct sftp_request *fxp_read_send(struct fxp_handle *handle, ! uint64 offset, int len); int fxp_read_recv(struct sftp_packet *pktin, struct sftp_request *req, char *buffer, int len); --- 182,188 ---- * Read from a file. */ struct sftp_request *fxp_read_send(struct fxp_handle *handle, ! putty_uint64 offset, int len); int fxp_read_recv(struct sftp_packet *pktin, struct sftp_request *req, char *buffer, int len); *************** *** 190,196 **** * Write to a file. Returns 0 on error, 1 on OK. */ struct sftp_request *fxp_write_send(struct fxp_handle *handle, ! char *buffer, uint64 offset, int len); int fxp_write_recv(struct sftp_packet *pktin, struct sftp_request *req); /* --- 190,196 ---- * Write to a file. Returns 0 on error, 1 on OK. */ struct sftp_request *fxp_write_send(struct fxp_handle *handle, ! char *buffer, putty_uint64 offset, int len); int fxp_write_recv(struct sftp_packet *pktin, struct sftp_request *req); /* *************** *** 233,244 **** struct fxp_xfer; ! struct fxp_xfer *xfer_download_init(struct fxp_handle *fh, uint64 offset); void xfer_download_queue(struct fxp_xfer *xfer); int xfer_download_gotpkt(struct fxp_xfer *xfer, struct sftp_packet *pktin); int xfer_download_data(struct fxp_xfer *xfer, void **buf, int *len); ! struct fxp_xfer *xfer_upload_init(struct fxp_handle *fh, uint64 offset); int xfer_upload_ready(struct fxp_xfer *xfer); void xfer_upload_data(struct fxp_xfer *xfer, char *buffer, int len); int xfer_upload_gotpkt(struct fxp_xfer *xfer, struct sftp_packet *pktin); --- 233,244 ---- struct fxp_xfer; ! struct fxp_xfer *xfer_download_init(struct fxp_handle *fh, putty_uint64 offset); void xfer_download_queue(struct fxp_xfer *xfer); int xfer_download_gotpkt(struct fxp_xfer *xfer, struct sftp_packet *pktin); int xfer_download_data(struct fxp_xfer *xfer, void **buf, int *len); ! struct fxp_xfer *xfer_upload_init(struct fxp_handle *fh, putty_uint64 offset); int xfer_upload_ready(struct fxp_xfer *xfer); void xfer_upload_data(struct fxp_xfer *xfer, char *buffer, int len); int xfer_upload_gotpkt(struct fxp_xfer *xfer, struct sftp_packet *pktin); *** ssh.h.ORIG Thu Jun 23 11:30:46 2005 --- ssh.h Wed Jun 22 13:39:23 2005 *************** *** 124,130 **** unsigned char *output); typedef struct { ! uint64 h[8]; unsigned char block[128]; int blkused; uint32 len[4]; --- 124,130 ---- unsigned char *output); typedef struct { ! putty_uint64 h[8]; unsigned char block[128]; int blkused; uint32 len[4]; *** int64.c.ORIG Thu Jun 23 11:30:26 2005 --- int64.c Wed Jun 22 13:45:19 2005 *************** *** 9,17 **** #include "int64.h" ! uint64 uint64_div10(uint64 x, int *remainder) { ! uint64 y; int rem, r2; y.hi = x.hi / 10; y.lo = x.lo / 10; --- 9,17 ---- #include "int64.h" ! putty_uint64 uint64_div10(putty_uint64 x, int *remainder) { ! putty_uint64 y; int rem, r2; y.hi = x.hi / 10; y.lo = x.lo / 10; *************** *** 30,36 **** return y; } ! void uint64_decimal(uint64 x, char *buffer) { char buf[20]; int start = 20; --- 30,36 ---- return y; } ! void uint64_decimal(putty_uint64 x, char *buffer) { char buf[20]; int start = 20; *************** *** 46,60 **** buffer[sizeof(buf) - start] = '\0'; } ! uint64 uint64_make(unsigned long hi, unsigned long lo) { ! uint64 y; y.hi = hi; y.lo = lo; return y; } ! uint64 uint64_add(uint64 x, uint64 y) { x.lo += y.lo; x.hi += y.hi + (x.lo < y.lo ? 1 : 0); --- 46,60 ---- buffer[sizeof(buf) - start] = '\0'; } ! putty_uint64 uint64_make(unsigned long hi, unsigned long lo) { ! putty_uint64 y; y.hi = hi; y.lo = lo; return y; } ! putty_uint64 uint64_add(putty_uint64 x, putty_uint64 y) { x.lo += y.lo; x.hi += y.hi + (x.lo < y.lo ? 1 : 0); *************** *** 61,75 **** return x; } ! uint64 uint64_add32(uint64 x, unsigned long y) { ! uint64 yy; yy.hi = 0; yy.lo = y; return uint64_add(x, yy); } ! int uint64_compare(uint64 x, uint64 y) { if (x.hi != y.hi) return x.hi < y.hi ? -1 : +1; --- 61,75 ---- return x; } ! putty_uint64 uint64_add32(putty_uint64 x, unsigned long y) { ! putty_uint64 yy; yy.hi = 0; yy.lo = y; return uint64_add(x, yy); } ! int uint64_compare(putty_uint64 x, putty_uint64 y) { if (x.hi != y.hi) return x.hi < y.hi ? -1 : +1; *** misc.c.ORIG Thu Jun 23 11:31:02 2005 --- misc.c Thu Jun 23 10:52:23 2005 *************** *** 393,398 **** --- 393,405 ---- { void *p; + #ifdef _AIX + if (n <= 0) { + p = NULL; + return p; + } + #endif + if (n > INT_MAX / size) { p = NULL; } else { *** pscp.c.ORIG Thu Jun 23 11:31:34 2005 --- pscp.c Wed Jun 22 13:48:43 2005 *************** *** 749,755 **** static int scp_has_times; static struct fxp_handle *scp_sftp_filehandle; static struct fxp_xfer *scp_sftp_xfer; ! static uint64 scp_sftp_fileoffset; void scp_source_setup(char *target, int shouldbedir) { --- 749,755 ---- static int scp_has_times; static struct fxp_handle *scp_sftp_filehandle; static struct fxp_xfer *scp_sftp_xfer; ! static putty_uint64 scp_sftp_fileoffset; void scp_source_setup(char *target, int shouldbedir) { *** psftp.c.ORIG Thu Jun 23 11:31:41 2005 --- psftp.c Wed Jun 22 13:49:38 2005 *************** *** 203,209 **** struct sftp_packet *pktin; struct sftp_request *req, *rreq; struct fxp_xfer *xfer; ! uint64 offset; FILE *fp; int ret, shown_err = FALSE; --- 203,209 ---- struct sftp_packet *pktin; struct sftp_request *req, *rreq; struct fxp_xfer *xfer; ! putty_uint64 offset; FILE *fp; int ret, shown_err = FALSE; *************** *** 477,483 **** struct fxp_xfer *xfer; struct sftp_packet *pktin; struct sftp_request *req, *rreq; ! uint64 offset; FILE *fp; int ret, err, eof; --- 477,483 ---- struct fxp_xfer *xfer; struct sftp_packet *pktin; struct sftp_request *req, *rreq; ! putty_uint64 offset; FILE *fp; int ret, err, eof; *** sftp.c.ORIG Thu Jun 23 11:31:49 2005 --- sftp.c Wed Jun 22 13:41:27 2005 *************** *** 81,87 **** PUT_32BIT(x, value); sftp_pkt_adddata(pkt, x, 4); } ! static void sftp_pkt_adduint64(struct sftp_packet *pkt, uint64 value) { unsigned char x[8]; PUT_32BIT(x, value.hi); --- 81,87 ---- PUT_32BIT(x, value); sftp_pkt_adddata(pkt, x, 4); } ! static void sftp_pkt_adduint64(struct sftp_packet *pkt, putty_uint64 value) { unsigned char x[8]; PUT_32BIT(x, value.hi); *************** *** 906,912 **** * error indicator. It might even depend on the SFTP server.) */ struct sftp_request *fxp_read_send(struct fxp_handle *handle, ! uint64 offset, int len) { struct sftp_request *req = sftp_alloc_request(); struct sftp_packet *pktout; --- 906,912 ---- * error indicator. It might even depend on the SFTP server.) */ struct sftp_request *fxp_read_send(struct fxp_handle *handle, ! putty_uint64 offset, int len) { struct sftp_request *req = sftp_alloc_request(); struct sftp_packet *pktout; *************** *** 1038,1044 **** * Write to a file. Returns 0 on error, 1 on OK. */ struct sftp_request *fxp_write_send(struct fxp_handle *handle, ! char *buffer, uint64 offset, int len) { struct sftp_request *req = sftp_alloc_request(); struct sftp_packet *pktout; --- 1038,1044 ---- * Write to a file. Returns 0 on error, 1 on OK. */ struct sftp_request *fxp_write_send(struct fxp_handle *handle, ! char *buffer, putty_uint64 offset, int len) { struct sftp_request *req = sftp_alloc_request(); struct sftp_packet *pktout; *************** *** 1122,1139 **** struct req { char *buffer; int len, retlen, complete; ! uint64 offset; struct req *next, *prev; }; struct fxp_xfer { ! uint64 offset, furthestdata, filesize; int req_totalsize, req_maxsize, eof, err; struct fxp_handle *fh; struct req *head, *tail; }; ! static struct fxp_xfer *xfer_init(struct fxp_handle *fh, uint64 offset) { struct fxp_xfer *xfer = snew(struct fxp_xfer); --- 1122,1139 ---- struct req { char *buffer; int len, retlen, complete; ! putty_uint64 offset; struct req *next, *prev; }; struct fxp_xfer { ! putty_uint64 offset, furthestdata, filesize; int req_totalsize, req_maxsize, eof, err; struct fxp_handle *fh; struct req *head, *tail; }; ! static struct fxp_xfer *xfer_init(struct fxp_handle *fh, putty_uint64 offset) { struct fxp_xfer *xfer = snew(struct fxp_xfer); *************** *** 1195,1201 **** } } ! struct fxp_xfer *xfer_download_init(struct fxp_handle *fh, uint64 offset) { struct fxp_xfer *xfer = xfer_init(fh, offset); --- 1195,1201 ---- } } ! struct fxp_xfer *xfer_download_init(struct fxp_handle *fh, putty_uint64 offset) { struct fxp_xfer *xfer = xfer_init(fh, offset); *************** *** 1256,1262 **** } if (rr->retlen < rr->len) { ! uint64 filesize = uint64_add32(rr->offset, (rr->retlen < 0 ? 0 : rr->retlen)); #ifdef DEBUG_DOWNLOAD { char buf[40]; --- 1256,1262 ---- } if (rr->retlen < rr->len) { ! putty_uint64 filesize = uint64_add32(rr->offset, (rr->retlen < 0 ? 0 : rr->retlen)); #ifdef DEBUG_DOWNLOAD { char buf[40]; *************** *** 1328,1334 **** return 0; } ! struct fxp_xfer *xfer_upload_init(struct fxp_handle *fh, uint64 offset) { struct fxp_xfer *xfer = xfer_init(fh, offset); --- 1328,1334 ---- return 0; } ! struct fxp_xfer *xfer_upload_init(struct fxp_handle *fh, putty_uint64 offset) { struct fxp_xfer *xfer = xfer_init(fh, offset); *** sshsh512.c.ORIG Thu Jun 23 11:32:01 2005 --- sshsh512.c Wed Jun 22 13:43:21 2005 *************** *** 46,52 **** shrL(t,x,6), xor(r,r,t) ) static void SHA512_Core_Init(SHA512_State *s) { ! static const uint64 iv[] = { INIT(0x6a09e667, 0xf3bcc908), INIT(0xbb67ae85, 0x84caa73b), INIT(0x3c6ef372, 0xfe94f82b), --- 46,52 ---- shrL(t,x,6), xor(r,r,t) ) static void SHA512_Core_Init(SHA512_State *s) { ! static const putty_uint64 iv[] = { INIT(0x6a09e667, 0xf3bcc908), INIT(0xbb67ae85, 0x84caa73b), INIT(0x3c6ef372, 0xfe94f82b), *************** *** 61,70 **** s->h[i] = iv[i]; } ! static void SHA512_Block(SHA512_State *s, uint64 *block) { ! uint64 w[80]; ! uint64 a,b,c,d,e,f,g,h; ! static const uint64 k[] = { INIT(0x428a2f98, 0xd728ae22), INIT(0x71374491, 0x23ef65cd), INIT(0xb5c0fbcf, 0xec4d3b2f), INIT(0xe9b5dba5, 0x8189dbbc), INIT(0x3956c25b, 0xf348b538), INIT(0x59f111f1, 0xb605d019), --- 61,70 ---- s->h[i] = iv[i]; } ! static void SHA512_Block(SHA512_State *s, putty_uint64 *block) { ! putty_uint64 w[80]; ! putty_uint64 a,b,c,d,e,f,g,h; ! static const putty_uint64 k[] = { INIT(0x428a2f98, 0xd728ae22), INIT(0x71374491, 0x23ef65cd), INIT(0xb5c0fbcf, 0xec4d3b2f), INIT(0xe9b5dba5, 0x8189dbbc), INIT(0x3956c25b, 0xf348b538), INIT(0x59f111f1, 0xb605d019), *************** *** 113,119 **** w[t] = block[t]; for (t = 16; t < 80; t++) { ! uint64 p, q, r, tmp; smallsigma1(p, tmp, w[t-2]); smallsigma0(q, tmp, w[t-15]); add(r, p, q); --- 113,119 ---- w[t] = block[t]; for (t = 16; t < 80; t++) { ! putty_uint64 p, q, r, tmp; smallsigma1(p, tmp, w[t-2]); smallsigma0(q, tmp, w[t-15]); add(r, p, q); *************** *** 125,131 **** e = s->h[4]; f = s->h[5]; g = s->h[6]; h = s->h[7]; for (t = 0; t < 80; t+=8) { ! uint64 tmp, p, q, r; #define ROUND(j,a,b,c,d,e,f,g,h) \ bigsigma1(p, tmp, e); \ --- 125,131 ---- e = s->h[4]; f = s->h[5]; g = s->h[6]; h = s->h[7]; for (t = 0; t < 80; t+=8) { ! putty_uint64 tmp, p, q, r; #define ROUND(j,a,b,c,d,e,f,g,h) \ bigsigma1(p, tmp, e); \ *************** *** 152,158 **** } { ! uint64 tmp; #define UPDATE(state, local) ( tmp = state, add(state, tmp, local) ) UPDATE(s->h[0], a); UPDATE(s->h[1], b); UPDATE(s->h[2], c); UPDATE(s->h[3], d); --- 152,158 ---- } { ! putty_uint64 tmp; #define UPDATE(state, local) ( tmp = state, add(state, tmp, local) ) UPDATE(s->h[0], a); UPDATE(s->h[1], b); UPDATE(s->h[2], c); UPDATE(s->h[3], d); *************** *** 177,183 **** void SHA512_Bytes(SHA512_State *s, const void *p, int len) { unsigned char *q = (unsigned char *)p; ! uint64 wordblock[16]; uint32 lenw = len; int i; --- 177,183 ---- void SHA512_Bytes(SHA512_State *s, const void *p, int len) { unsigned char *q = (unsigned char *)p; ! putty_uint64 wordblock[16]; uint32 lenw = len; int i; *** unix/gtkwin.c.ORIG Thu Jun 23 11:38:20 2005 --- unix/gtkwin.c Thu Jun 23 09:35:38 2005 *************** *** 24,29 **** --- 24,33 ---- #include #include + #ifdef _AIX + #include "xutf8.h" + #endif + #define PUTTY_DO_GLOBALS /* actually _define_ globals */ #include "putty.h" *** unix/uxpty.c.ORIG Thu Jun 23 11:38:31 2005 --- unix/uxpty.c Wed Jun 22 13:54:46 2005 *************** *** 2,10 **** --- 2,21 ---- * 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 + #define BSD_PTYS + #endif #include #include *** unix/Makefile.gtk.ORIG Thu Jun 23 11:38:44 2005 --- unix/Makefile.gtk Fri Dec 30 16:32:32 2005 *************** *** 78,88 **** # 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` XLDFLAGS = `gtk-config --libs` ULDFLAGS =# --- 78,91 ---- # later on as second-level damage. # + XFLAGS=-DDEBUG + VER=-DRELEASE=0.58 + # 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` XLDFLAGS = `gtk-config --libs` ULDFLAGS =# *************** *** 89,95 **** INSTALL=install INSTALL_PROGRAM=$(INSTALL) INSTALL_DATA=$(INSTALL) ! prefix=/usr/local exec_prefix=$(prefix) bindir=$(exec_prefix)/bin mandir=$(prefix)/man --- 92,98 ---- INSTALL=install INSTALL_PROGRAM=$(INSTALL) INSTALL_DATA=$(INSTALL) ! prefix=/opt/freeware exec_prefix=$(prefix) bindir=$(exec_prefix)/bin mandir=$(prefix)/man *************** *** 156,162 **** sbcs.o sbcsdat.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 $(CC) $(XLDFLAGS) -o $@ be_none.o cmdline.o config.o dialog.o \ fromucs.o gtkcfg.o gtkcols.o gtkdlg.o gtkpanel.o gtkwin.o \ ldisc.o ldiscucs.o localenc.o logging.o macenc.o mimeenc.o \ --- 159,165 ---- sbcs.o sbcsdat.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 xutf8.o $(CC) $(XLDFLAGS) -o $@ be_none.o cmdline.o config.o dialog.o \ fromucs.o gtkcfg.o gtkcols.o gtkdlg.o gtkpanel.o gtkwin.o \ ldisc.o ldiscucs.o localenc.o logging.o macenc.o mimeenc.o \ *************** *** 164,170 **** 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 putty: be_all.o cmdline.o config.o cproxy.o dialog.o fromucs.o gtkcfg.o \ gtkcols.o gtkdlg.o gtkpanel.o gtkwin.o ldisc.o ldiscucs.o \ --- 167,173 ---- 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 xutf8.o -lXmu -lXt putty: be_all.o cmdline.o config.o cproxy.o dialog.o fromucs.o gtkcfg.o \ gtkcols.o gtkdlg.o gtkpanel.o gtkwin.o ldisc.o ldiscucs.o \ *************** *** 177,183 **** ux_x11.o uxagentc.o uxcfg.o uxmisc.o uxnet.o uxnoise.o \ uxprint.o uxproxy.o uxputty.o uxsel.o uxsignal.o uxstore.o \ uxucs.o version.o wcwidth.o wildcard.o x11fwd.o xenc.o \ ! xkeysym.o $(CC) $(XLDFLAGS) -o $@ be_all.o cmdline.o config.o cproxy.o \ dialog.o fromucs.o gtkcfg.o gtkcols.o gtkdlg.o gtkpanel.o \ gtkwin.o ldisc.o ldiscucs.o localenc.o logging.o macenc.o \ --- 180,186 ---- ux_x11.o uxagentc.o uxcfg.o uxmisc.o uxnet.o uxnoise.o \ uxprint.o uxproxy.o uxputty.o uxsel.o uxsignal.o uxstore.o \ uxucs.o version.o wcwidth.o wildcard.o x11fwd.o xenc.o \ ! xkeysym.o xutf8.o $(CC) $(XLDFLAGS) -o $@ be_all.o cmdline.o config.o cproxy.o \ dialog.o fromucs.o gtkcfg.o gtkcols.o gtkdlg.o gtkpanel.o \ gtkwin.o ldisc.o ldiscucs.o localenc.o logging.o macenc.o \ *************** *** 189,195 **** timing.o toucs.o tree234.o utf8.o ux_x11.o uxagentc.o \ uxcfg.o uxmisc.o uxnet.o uxnoise.o uxprint.o uxproxy.o \ uxputty.o uxsel.o uxsignal.o uxstore.o uxucs.o version.o \ ! wcwidth.o wildcard.o x11fwd.o xenc.o xkeysym.o 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 \ --- 192,199 ---- timing.o toucs.o tree234.o utf8.o ux_x11.o uxagentc.o \ uxcfg.o uxmisc.o uxnet.o uxnoise.o uxprint.o uxproxy.o \ uxputty.o uxsel.o uxsignal.o uxstore.o uxucs.o version.o \ ! wcwidth.o wildcard.o x11fwd.o xenc.o xkeysym.o \ ! xutf8.o -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 \ *************** *** 199,205 **** sshbn.o sshdes.o sshdss.o sshdssg.o sshmd5.o sshprime.o \ sshpubk.o sshrand.o sshrsa.o sshrsag.o sshsh512.o sshsha.o \ time.o tree234.o uxcons.o uxgen.o uxmisc.o uxnoise.o \ ! uxstore.o version.o puttytel: be_nossh.o cmdline.o config.o dialog.o fromucs.o gtkcfg.o \ gtkcols.o gtkdlg.o gtkpanel.o gtkwin.o ldisc.o ldiscucs.o \ --- 203,209 ---- sshbn.o sshdes.o sshdss.o sshdssg.o sshmd5.o sshprime.o \ sshpubk.o sshrand.o sshrsa.o sshrsag.o sshsh512.o sshsha.o \ time.o tree234.o uxcons.o uxgen.o uxmisc.o uxnoise.o \ ! uxstore.o version.o puttytel: be_nossh.o cmdline.o config.o dialog.o fromucs.o gtkcfg.o \ gtkcols.o gtkdlg.o gtkpanel.o gtkwin.o ldisc.o ldiscucs.o \ *************** *** 208,214 **** settings.o slookup.o telnet.o terminal.o time.o timing.o \ toucs.o tree234.o utf8.o uxcfg.o uxmisc.o uxnet.o uxprint.o \ uxproxy.o uxputty.o uxsel.o uxsignal.o uxstore.o uxucs.o \ ! version.o wcwidth.o xenc.o xkeysym.o $(CC) $(XLDFLAGS) -o $@ be_nossh.o cmdline.o config.o dialog.o \ fromucs.o gtkcfg.o gtkcols.o gtkdlg.o gtkpanel.o gtkwin.o \ ldisc.o ldiscucs.o localenc.o logging.o macenc.o mimeenc.o \ --- 212,218 ---- settings.o slookup.o telnet.o terminal.o time.o timing.o \ toucs.o tree234.o utf8.o uxcfg.o uxmisc.o uxnet.o uxprint.o \ uxproxy.o uxputty.o uxsel.o uxsignal.o uxstore.o uxucs.o \ ! version.o wcwidth.o xenc.o xkeysym.o xutf8.o $(CC) $(XLDFLAGS) -o $@ be_nossh.o cmdline.o config.o dialog.o \ fromucs.o gtkcfg.o gtkcols.o gtkdlg.o gtkpanel.o gtkwin.o \ ldisc.o ldiscucs.o localenc.o logging.o macenc.o mimeenc.o \ *************** *** 216,223 **** sbcs.o sbcsdat.o settings.o slookup.o telnet.o terminal.o \ time.o timing.o toucs.o tree234.o utf8.o uxcfg.o uxmisc.o \ uxnet.o uxprint.o uxproxy.o uxputty.o uxsel.o uxsignal.o \ ! uxstore.o uxucs.o version.o wcwidth.o xenc.o xkeysym.o be_all.o: ../be_all.c ../putty.h ../puttyps.h ../network.h ../misc.h \ ../windows/winstuff.h ../mac/macstuff.h ../macosx/osx.h \ ../unix/unix.h ../puttymem.h ../tree234.h \ --- 220,230 ---- sbcs.o sbcsdat.o settings.o slookup.o telnet.o terminal.o \ time.o timing.o toucs.o tree234.o utf8.o uxcfg.o uxmisc.o \ uxnet.o uxprint.o uxproxy.o uxputty.o uxsel.o uxsignal.o \ ! uxstore.o uxucs.o version.o wcwidth.o xenc.o xkeysym.o \ ! xutf8.o -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/unix.h ../puttymem.h ../tree234.h \ *** unix/xutf8.h.ORIG Fri Dec 30 16:29:07 2005 --- unix/xutf8.h Thu Dec 30 22:57:27 2004 *************** *** 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 Fri Dec 30 16:29:08 2005 --- unix/xutf8.c Thu Dec 30 23:19:30 2004 *************** *** 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; + } +