*** imapd.c	Sun Jul 18 21:48:29 1993
--- imapd.c.new	Sun Jul 18 21:47:53 1993
***************
*** 109,115 ****
--- 109,119 ----
  extern DRIVER bezerkdriver,tenexdriver,imapdriver,newsdriver,nntpdriver,
    dummydriver;
  
+ #ifdef BWC
+ extern DRIVER carmeldriver, carmel2driver;
+ #endif
  
+ 
  /* Function prototypes */
  
  void main  ();
***************
*** 135,140 ****
--- 139,148 ----
  long cstring  ();
  long caddr  ();
  
+ #ifdef BWC
+ char *glyph2richtext();
+ #endif
+ 
  extern char *crypt  ();
  
  /* Main program */
***************
*** 147,152 ****
--- 155,164 ----
    char *s,*t = "OK",*u,*v;
    struct hostent *hst;
    void (*f) () = NIL;
+ #ifdef BWC
+   mail_link (&carmeldriver);
+   mail_link (&carmel2driver);
+ #endif  
    mail_link (&tenexdriver);	/* install the Tenex mail driver */
    mail_link (&bezerkdriver);	/* install the Berkeley mail driver */
    mail_link (&imapdriver);	/* install the IMAP driver */
***************
*** 164,170 ****
--- 176,186 ----
      state = SELECT;		/* enter select state */
      t = "PREAUTH";		/* pre-authorized */
    }
+ #ifdef BWC
+   printf ("* %s %s IMAP2bis Service %sBWC at %s\015\012",t,host,version,cmdbuf);
+ #else
    printf ("* %s %s IMAP2bis Service %s at %s\015\012",t,host,version,cmdbuf);
+ #endif
    fflush (stdout);		/* dump output buffer */
    signal (SIGALRM,clkint);	/* prepare for clock interrupt */
    signal (SIGUSR2,kodint);	/* prepare for Kiss Of Death */
***************
*** 782,788 ****
--- 798,817 ----
    if (body && (s = mail_fetchbody (stream,i,s,&j))) {
  				/* and literal string */
      printf ("{%d}\015\012",j);
+ #ifdef BWC_NOT_WORKING_YET
+     {
+         char *ss;
+         s[j] = '\0';
+         s = glyph2richtext(s);
+         j = strlen(s);
+         ss = rfc822_8bit(s, j, &j);
+         fs_give((void **)&s);
+         while (j -= k) k = fwrite (ss += k,1,j,stdout);
+         fs_give((void **)&ss);
+     }
+ #else    
      while (j -= k) k = fwrite (s += k,1,j,stdout);
+ #endif
      changed_flags (i,f);	/* output changed flags */
    }
    else fputs ("NIL",stdout);	/* can't output anything at all */
***************
*** 983,995 ****
--- 1012,1039 ----
      else {			/* non-multipart body type */
        pstring ((char *) body_types[body->type]);
        putchar (' ');
+ #ifdef BWC
+       if(body->type == TYPETEXT && strcmp(lcase(body->subtype), "x-bwc-glyph") == 0)
+         pstring("plain"); /* Make it plain now, richtext later when fixed */
+       else
+         pstring (body->subtype);
+ #else
        pstring (body->subtype);
+ #endif
        if (param = body->parameter) {
  	fputs (" (",stdout);
  	do {
  	  pstring (param->attribute);
  	  putchar (' ');
+ #ifdef BWC_NOT_WORKING_YET
+           if(strucmp2(param->attribute, "charset") == 0) {
+               pstring("ISO-8859-1");
+           } else {
+     	      pstring (param->value);
+           }
+ #else
  	  pstring (param->value);
+ #endif
  	  if (param = param->next) putchar (' ');
  	} while (param);
  	fputs (") ",stdout);
