--- src/imapd/imapd.c.orig	Wed Sep 18 02:48:01 1996
+++ src/imapd/imapd.c	Mon Nov 11 15:51:10 1996
@@ -44,6 +44,7 @@
 extern int errno;		/* just in case */
 #include <sys/stat.h>
 #include "misc.h"
+#include "libtrans.h"
 
 
 /* Autologout timer */
@@ -1693,7 +1694,7 @@
 
 void fetch_body_part (unsigned long i,STRINGLIST *a)
 {
-  char *s = a->text;
+  char *s = a->text,*p;
   unsigned long j;
   long k = 0;
   BODY *body;
@@ -1702,8 +1703,12 @@
   printf ("BODY[%s] ",s);	/* output attribute */
   if (body && (s = mail_fetchbody_full (stream,i,s,&j,NIL))) {
     printf ("{%lu}\015\012",j);	/* and literal string */
-    while (j -= k) k = fwrite (s += k,1,j,stdout);
+    s=strdup(s);
+    for (p=s;*p;p++) *p=TR_OUT(*p);
+    p=s;
+    while (j -= k) k = fwrite (p += k,1,j,stdout);
     changed_flags (i,f);	/* output changed flags */
+    free(s);
   }
   else fputs ("NIL",stdout);	/* can't output anything at all */
 }
@@ -1716,7 +1721,7 @@
 
 void fetch_body_part_peek (unsigned long i,STRINGLIST *a)
 {
-  char *s = a->text;
+  char *s = a->text,*p;
   unsigned long j;
   long k = 0;
   BODY *body;
@@ -1724,7 +1729,11 @@
   printf ("BODY[%s] ",s);	/* output attribute */
   if (body && (s = mail_fetchbody_full (stream,i,s,&j,FT_PEEK))) {
     printf ("{%lu}\015\012",j);	/* and literal string */
-    while (j -= k) k = fwrite (s += k,1,j,stdout);
+    s=strdup(s);
+    for (p=s;*p;p++) *p=TR_OUT(*p);
+    p=s;
+    while (j -= k) k = fwrite (p += k,1,j,stdout);
+    free(s);
   }
   else fputs ("NIL",stdout);	/* can't output anything at all */
 }
@@ -2163,21 +2172,26 @@
  * Accepts: string
  */
 
-void pstring (char *s)
+void pstring (char *sp)
 {
+  char *s,*p;
+  if (sp) s=strdup(sp); else s=NULL;
   if (s) {			/* is there a string? */
 				/* must use literal string */
     if (strpbrk (s,"\012\015\"\\")) {
+      for (p=s;*p;p++) *p=TR_OUT(*p);
       printf ("{%lu}\015\012",(unsigned long) strlen (s));
       fputs (s,stdout);		/* don't merge this with the printf() */
     }
     else {			/* may use quoted string */
       putchar ('"');		/* don't even think of merging this into a */
+      for (p=s;*p;p++) *p=TR_OUT(*p);
       fputs (s,stdout);		/*  printf().  Cretin VAXen can't do a */
       putchar ('"');		/*  printf() of godzilla strings! */
     }
   }
   else fputs ("NIL",stdout);	/* empty string */
+  free(s);
 }
 
 
--- src/ipopd/ipop3d.c.orig	Wed Sep 18 02:44:24 1996
+++ src/ipopd/ipop3d.c	Tue Nov  5 21:37:51 1996
@@ -45,6 +45,7 @@
 #include <signal.h>
 #include "misc.h"
 
+#include "libtrans.h"
 
 /* Autologout timer */
 #define TIMEOUT 60*30
@@ -456,7 +457,7 @@
   if (c == '.') putchar ('.');	/* double string-leading dot if necessary */
   while (lines && --size) {	/* copy loop */
     e = *text++;		/* get next byte */
-    putchar (c);		/* output character */
+    putchar (TR_OUT(c));	/* output character */
     if (c == '\012') {		/* end of line? */
       ret++; --lines;		/* count another line */
 				/* double leading dot as necessary */
--- src/ipopd/ipop2d.c.orig	Wed Sep 18 02:44:08 1996
+++ src/ipopd/ipop2d.c	Tue Nov  5 21:37:51 1996
@@ -43,6 +43,7 @@
 #include <errno.h>
 extern int errno;		/* just in case */
 #include "misc.h"
+#include "libtrans.h"
 
 
 /* Autologout timer */
@@ -333,6 +334,8 @@
 
 short c_retr (char *t)
 {
+  char *p;
+
   if (t) {			/* disallow argument */
     puts ("- Bogus argument given to RETR\015");
     return DONE;
@@ -340,6 +343,7 @@
   if (size) {			/* message size valid? */
     unsigned long i,j;
     t = mail_fetchheader_full (stream,msg[current],NIL,&i,NIL);
+    for (p=t;p<t+i;p++) *p=TR_OUT(*p);
     if (i > 2) {		/* only if there is something */
       i -= 2;			/* lop off last two octets */
       while (i) {		/* blat the header */
@@ -350,6 +354,7 @@
     fputs (status,stdout);	/* yes, output message */
     puts ("\015");		/* delimit header from text */
     t = mail_fetchtext_full (stream,msg[current],&i,NIL);
+    for (p=t;p<t+i;p++) *p=TR_OUT(*p);
     while (i) {			/* blat the text */
       j = fwrite (t,sizeof (char),i,stdout);
       if (i -= j) t += j;	/* advance to incomplete data */
--- src/osdep/unix/env_unix.c.orig	Tue Oct 15 01:07:22 1996
+++ src/osdep/unix/env_unix.c	Mon Oct 21 19:34:27 1996
@@ -79,6 +79,7 @@
 #include <signal.h>
 #include <sys/wait.h>
 #include "write.c"		/* include safe writing routines */
+#include "libtrans.h"
 
 /* Get all authenticators */
 
@@ -370,11 +371,25 @@
 char *mylocalhost ()
 {
   char tmp[MAILTMPLEN];
+  struct sockaddr_in sck;
+  int scksz=sizeof(sck);
   struct hostent *host_name;
+  char lang[4];
   if (!myLocalHost) {
-    gethostname(tmp,MAILTMPLEN);/* get local host name */
+/*
+    gethostname(tmp,MAILTMPLEN);
     myLocalHost = cpystr ((host_name = gethostbyname (tmp)) ?
 			  host_name->h_name : tmp);
+*/
+    if (getsockname(0,(struct sockaddr*)&sck,&scksz) < 0)
+      fatal("Cannot get local IP address");
+    host_name=gethostbyaddr((char *)&sck.sin_addr.s_addr,
+      sizeof(sck.sin_addr.s_addr),sck.sin_family);
+    myLocalHost = cpystr(host_name->h_name);
+    if (myLocalHost == NULL) fatal("Cannot resolve local host name");
+    strncpy(lang,myLocalHost,3);
+    lang[4]='\0';
+    settrtab_byname(lang);
   }
   return myLocalHost;
 }
