*** ../mh-6.8-JP1/JPPatchlevel Fri Dec 18 21:47:03 1992 --- JPPatchlevel Fri Jan 29 19:07:41 1993 *************** *** 1 **** ! MH.6.8 Japanization-patch.1 --- 1 ---- ! MH.6.8 Japanization-patch.2 *** ../mh-6.8-JP1/conf/mhconfig.c Thu Dec 17 13:42:22 1992 --- conf/mhconfig.c Tue Feb 2 12:47:23 1993 *************** *** 139,144 **** --- 139,147 ---- "TMA", 0, /* trusted mail */ "TTYD", 0, "UCI", 0, + /* #ifdef JAPAN */ + "JAPAN", 0, /* Japanization patch */ + /* #endif JAPAN */ NULL, 0 }; *** ../mh-6.8-JP1/h/fmtcompile.h Wed Dec 16 01:53:20 1992 --- h/fmtcompile.h Thu Jan 28 12:17:45 1993 *************** *** 101,104 **** --- 101,109 ---- #define FT_V_MATCH 83 /* V = 1 if "str" contains literal */ #define FT_V_AMATCH 84 /* V = 1 if "str" starts with literal */ + #ifdef JAPAN + #define FT_LS_HENCODE 90 /* encoding to RFC-1342 header extension */ + #define FT_LS_HDECODE 91 /* decoding from RFC-1342 header extension */ + #endif /* JAPAN */ + #define IF_FUNCS FT_S_NULL /* start of "if" functions */ *** ../mh-6.8-JP1/h/formatsbr.h Mon Dec 21 17:33:57 1992 --- h/formatsbr.h Tue Jan 19 09:53:33 1993 *************** *** 81,89 **** struct format *fmtscan (); char *new_fs (); - - /* patch by hayashi@kuic.kyoto-u.ac.jp & takada@seraph.ntt.jp (92/12/21) */ - /* originally patch by Hiroaki KOJIMA (hkojima@etl.jp) & tetsu@kuis.kyoto-u.ac.jp */ - #ifdef JAPAN - void eucfputs (); /* for KANJI */ - #endif /* JAPAN */ --- 81,83 ---- *** ../mh-6.8-JP1/h/mh.h Wed Dec 16 01:53:21 1992 --- h/mh.h Thu Feb 4 16:57:02 1993 *************** *** 363,365 **** --- 363,385 ---- || defined(_AIX) || defined (sgi)) && !defined(UNISTD) #define UNISTD #endif + + #ifdef JAPAN + /* + * Japanization patch (patchlevel.2) + * by Toshihiro Takada + * especially thanks to + * hkojima@etl.go.jp (Hiroaki Kojima) + * UEHARA Tetsu=TaLow + * and + * Hayashi Haruhisa + */ + void ml_init (); + int ml_ismlchar (); + void ml_fputs (); + void ml_pretty_fputs (); + char *ml_conv (); + char *exthdr_encode (); + char *exthdr_decode (); + #endif /* JAPAN */ + *** ../mh-6.8-JP1/sbr/addrsbr.c Wed Dec 16 01:55:07 1992 --- sbr/addrsbr.c Mon Feb 1 17:51:26 1993 *************** *** 157,163 **** --- 157,167 ---- next address on line */ register char *nxtout = adr; /* where to put next character of `mailbox' part of address */ + #ifdef JAPAN + register unsigned char c; + #else /* JAPAN */ register char c; + #endif /* JAPAN */ register int state = NORMAL; register char *adrcopy = adrtext; /* where to put next character of address */ *** ../mh-6.8-JP1/sbr/advertise.c Wed Dec 16 01:55:08 1992 --- sbr/advertise.c Tue Feb 2 12:54:43 1993 *************** *** 35,40 **** --- 35,43 ---- *f; { int eindex = errno; + #ifdef JAPAN + char buffer[BUFSIZ]; + #else /* JAPAN */ #ifdef BSD42 char buffer[BUFSIZ], err[BUFSIZ]; *************** *** 41,49 **** --- 44,79 ---- struct iovec iob[20]; register struct iovec *iov = iob; #endif /* BSD42 */ + #endif /* JAPAN */ (void) fflush (stdout); + #ifdef JAPAN + if (invo_name && *invo_name) { + (void)sprintf(buffer, "%s: ", invo_name); + ml_fputs(buffer, stderr); + } + (void)sprintf(buffer, fmt, a, b, c, d, e, f); + ml_fputs(buffer, stderr); + if (what) { + if (*what) { + (void)sprintf(buffer, " %s: ", what); + ml_fputs(buffer, stderr); + } + if (eindex > 0 && eindex < sys_nerr) { + (void)sprintf(buffer, "%s", sys_errlist[eindex]); + ml_fputs(buffer, stderr); + } else { + (void)sprintf(buffer, "Error %d", eindex); + ml_fputs(buffer, stderr); + } + } + if (tail) { + (void)sprintf(buffer, ", %s", tail); + ml_fputs(buffer, stderr); + } + ml_fputs("\n", stderr); + #else /* JAPAN */ #ifndef BSD42 if (invo_name && *invo_name) fprintf (stderr, "%s: ", invo_name); *************** *** 99,102 **** --- 129,133 ---- iov++; (void) writev (fileno (stderr), iob, iov - iob); #endif /* BSD42 */ + #endif /* JAPAN */ } *** ../mh-6.8-JP1/sbr/fmtcompile.c Wed Dec 16 01:55:13 1992 --- sbr/fmtcompile.c Thu Jan 28 12:17:31 1993 *************** *** 124,129 **** --- 124,133 ---- "mymbox", TF_COMP, FT_LV_COMPFLAG, FT_MYMBOX, TFL_PUTN, "addtoseq", TF_STR, FT_ADDTOSEQ, 0, 0, + #ifdef JAPAN + "hencode", TF_EXPR, FT_LS_HENCODE, 0, TFL_PUTS, + "hdecode", TF_EXPR, FT_LS_HDECODE, 0, TFL_PUTS, + #endif /* JAPAN */ (char *)0, 0, 0, 0, 0 }; *************** *** 192,199 **** --- 196,216 ---- int errctx = errpos > 20 ? 20 : errpos; int i; + #ifdef JAPAN + errpos = cp - format_string + (*cp ? 1 : 0); + errctx = errpos > 20 ? 20 : errpos; usr_fstring[errpos] = '\0'; + while ((errctx < errpos) && ml_ismlchar(usr_fstring[errpos-errctx] & 0x80)) + errctx++; for (i = errpos-errctx; i < errpos; i++) + if (iscntrl((usr_fstring[i] & 0x7f))) + usr_fstring[i] = '_'; + advise(NULLCP, "\"%s\": format compile error - %s", + &usr_fstring[errpos-errctx], str); + adios (NULLCP, "%*s", errctx + 1 - (*cp ? 1 : 0), "^"); + #else /* JAPAN */ + usr_fstring[errpos] = '\0'; + for (i = errpos-errctx; i < errpos; i++) #ifdef LOCALE if (iscntrl(usr_fstring[i])) #else *************** *** 203,208 **** --- 220,226 ---- advise(NULLCP, "\"%s\": format compile error - %s", &usr_fstring[errpos-errctx], str); adios (NULLCP, "%*s", errctx+1, "^"); + #endif /* JAPAN */ } /* *** ../mh-6.8-JP1/sbr/formatsbr.c Mon Dec 21 20:04:09 1992 --- sbr/formatsbr.c Tue Feb 2 09:23:58 1993 *************** *** 70,75 **** --- 70,79 ---- formats = getcpy (format ? format : def); } + #ifdef JAPAN + (void) ml_conv(formats); + #endif /* JAPAN */ + normalize (formats); return formats; *************** *** 117,127 **** --- 121,153 ---- register char *str, *sub; { + #ifdef JAPAN + register unsigned int c1; + register unsigned int c2; + #else /* JAPAN */ register int c1; register int c2; + #endif /* JAPAN */ register char *s1; register char *s2; + #ifdef JAPAN + while (c1 = *sub) { + c1 = (isalpha(c1) && isupper(c1)) ? tolower(c1) : c1; + while ((c2 = *str++) + && c1 != ((isalpha(c2) && isupper(c2)) ? tolower(c2) : c2)) + ; + if (! c2) + return 0; + s1 = sub + 1; s2 = str; + while ((c1 = *s1++) && + ((isalpha(c1) && isupper(c1)) ? tolower(c1) : c1) + == ((isalpha(c2 = *s2++) && isupper(c2)) ? tolower(c2) : c2)) + ; + if (! c1) + return 1; + } + #else /* JAPAN */ #ifdef LOCALE while (c1 = *sub) { c1 = (isalpha(c1) && isupper(c1)) ? tolower(c1) : c1; *************** *** 148,153 **** --- 174,180 ---- return 1; } #endif + #endif /* JAPAN */ return 1; } /* */ *************** *** 283,389 **** } #endif - /* patch by hayashi@kuic.kyoto-u.ac.jp & takada@seraph.ntt.jp (92/12/21) */ - /* originally patch by Hiroaki KOJIMA (hkojima@etl.jp) & tetsu@kuis.kyoto-u.ac.jp */ #ifdef JAPAN - #define ESC '\033' - #define FALSE 0 /* for KANJI */ - #define TRUE 1 /* for KANJI */ - #undef PUTSF #undef PUTS #define PUTSF(cp, str, wid, fill) {\ ! kanji_in = FALSE;\ ! ljust = 0;\ ! if ((i = (wid)) < 0) {\ ! i = -i;\ ! ljust++;\ }\ ! if (sp = (str)) {\ ! if (ljust) {\ ! c = strlen(sp);\ ! if (c > i)\ ! sp += c - i;\ ! else {\ ! while( --i >= c && cp < ep)\ ! *cp++ = fill;\ ! i++;\ ! }\ ! } else {\ ! while ((c = *sp)\ ! && (iscntrl(c) || isspace(c))\ ! && c != ESC)\ ! sp++;\ ! }\ ! while ((c = *sp++) && --i >= 0 && cp < ep)\ ! if (isgraph(c)) {\ ! if (kanji_in)\ ! *cp++ = (c | 0x0080);\ ! else\ ! *cp++ = c;\ ! } else if (c == ESC) {\ ! if ((*sp & 0x00ff) == '$'\ ! && ((*(sp+1) & 0x00ff) == '@'\ ! || (*(sp+1) & 0x00ff) == 'B')) {\ ! kanji_in = TRUE;\ ! sp += 2;\ ! } else if ((*sp & 0x00ff) == '('\ ! && ((*(sp+1) & 0x00ff) == 'J'\ ! || (*(sp+1) & 0x00ff) == 'B')) {\ ! kanji_in = FALSE;\ ! sp += 2;\ ! } else\ ! *cp++ = c;\ ! } else {\ ! while ((c = *sp)\ ! && (iscntrl(c) || isspace(c))\ ! && c != ESC)\ ! sp++;\ ! *cp++ = ' ';\ ! }\ }\ ! if (!ljust)\ ! while( --i >= 0 && cp < ep)\ ! *cp++ = fill;\ ! } #define PUTS(cp, str) {\ ! if (sp = (str)) {\ ! while ((c = *sp & 0x00ff)\ ! && (iscntrl(c) || isspace(c))\ ! && c != ESC)\ ! sp++;\ ! while( (c = *sp++) && cp < ep)\ ! if (isgraph(c)) {\ ! if (kanji_in)\ ! *cp++ = (c | 0x0080);\ ! else\ ! *cp++ = c;\ ! } else if (c == ESC) {\ ! if ((*sp & 0x00ff) == '$'\ ! && ((*(sp+1) & 0x00ff) == '@'\ ! || (*(sp+1) & 0x00ff) == 'B')) {\ ! kanji_in = TRUE;\ ! sp += 2;\ ! } else if ((*sp & 0x00ff) == '('\ ! && ((*(sp+1) & 0x00ff) == 'J'\ ! || (*(sp+1) & 0x00ff) == 'B')) {\ ! kanji_in = FALSE;\ ! sp += 2;\ ! } else\ ! *cp++ = c;\ ! } else {\ ! while ((c = *sp & 0x00ff)\ ! && (iscntrl(c) || isspace(c))\ ! && c != ESC)\ ! sp++;\ ! *cp++ = ' ';\ ! }\ }\ ! } #endif /* JAPAN */ - /* end of patch */ static char *lmonth[] = { "January", "February","March", "April", "May", "June", "July", "August", --- 310,413 ---- } #endif #ifdef JAPAN #undef PUTSF #undef PUTS + #define ISSPACE(c1) (isspace((c1) & 0x7f)) + #define ISGRAPH(c1) ((((c1) & 0xff) == 0x1b) || (isgraph((c1) & 0x7f))) + #define ISCNTRL(c1) ((((c1) & 0xff) != 0x1b) && (iscntrl((c1) & 0x7f))) + #define ISJSPACE(c1,c2) ((((c1) & 0xff) == 0xa1) && (((c2) & 0xff) == 0xa1)) + #define ISJGRAPH(c1,c2) ((isgraph((c1) & 0x7f)) &&\ + (isgraph((c2) & 0x7f)) &&\ + (!ISJSPACE((c1), (c2)))) + + #define SKIP_SPACE(sp) {\ + while (ch = *(sp)) {\ + if (ISCNTRL(ch) || ISSPACE(ch)) {\ + (sp)++;\ + } else if (ch2 = *((sp)+1)) {\ + if (ISJSPACE(ch, ch2)) {\ + (sp) += 2;\ + } else {\ + break;\ + }\ + } else {\ + break;\ + }\ + }\ + } + #define PUTSF(cp, str, wid, fill) {\ ! ljust = 0;\ ! if ((i = (wid)) < 0) {\ ! i = -i; ljust++;\ ! }\ ! if (sp = (str)) {\ ! if (ljust) {\ ! c = strlen(sp);\ ! if (c > i)\ ! sp += c - i;\ ! else {\ ! while (--i >= c && cp < ep)\ ! *cp++ = fill;\ ! i++;\ ! }\ ! } else {\ ! SKIP_SPACE(sp);\ ! }\ ! while ((ch = *sp++) && (--i >= 0) && (cp < ep)) {\ ! if (ml_ismlchar(ch)) {\ ! if ((ch2 = *sp) && ((i-1) >= 0) && ((cp+1) < ep)) {\ ! if (ISJGRAPH(ch, ch2)) {\ ! *cp++ = ch; *cp++ = ch2; sp++; --i;\ ! } else {\ ! --sp; SKIP_SPACE(sp); *cp++ = ' ';\ ! }\ ! } else {\ ! *cp++ = ' ';\ }\ ! } else {\ ! if (ISGRAPH(ch)) {\ ! *cp++ = ch;\ ! } else {\ ! SKIP_SPACE(sp); *cp++ = ' ';\ }\ ! }\ ! }\ ! }\ ! if (!ljust)\ ! while ((--i >= 0) && (cp < ep))\ ! *cp++ = fill;\ ! } ! #define PUTS(cp, str) {\ ! if (sp = (str)) {\ ! SKIP_SPACE(sp);\ ! while ((ch = *sp++) && (cp < ep)) {\ ! if (ml_ismlchar(ch)) {\ ! if ((ch2 = *sp) && ((cp+1) < ep)) {\ ! if (ISJGRAPH(ch, ch2)) {\ ! *cp++ = ch; *cp++ = ch2; sp++;\ ! } else {\ ! --sp; SKIP_SPACE(sp); *cp++ = ' ';\ ! }\ ! } else {\ ! *cp++ = ' ';\ }\ ! } else {\ ! if (ISGRAPH(ch)) {\ ! *cp++ = ch;\ ! } else {\ ! SKIP_SPACE(sp); *cp++ = ' ';\ ! }\ ! }\ ! }\ ! }\ ! } ! #endif /* JAPAN */ static char *lmonth[] = { "January", "February","March", "April", "May", "June", "July", "August", *************** *** 452,457 **** --- 476,484 ---- register char *sp; register int i; register int c; + #ifdef JAPAN + register unsigned char ch, ch2; + #endif /* JAPAN */ register struct comp *comp; register struct tws *tws; register struct mailname *mn; *************** *** 460,469 **** char *savestr; char buffer[BUFSIZ]; - #ifdef JAPAN - int kanji_in = FALSE; - #endif /* JAPAN */ - while (cp < ep) { switch (fmt->f_type) { --- 487,492 ---- *************** *** 477,487 **** case FT_LIT: sp = fmt->f_text; #ifdef JAPAN ! while( (c = *sp++ & 0x00ff) && cp < ep) #else /* JAPAN */ while( (c = *sp++) && cp < ep) - #endif /* JAPAN */ *cp++ = c; break; case FT_LITF: sp = fmt->f_text; --- 500,511 ---- case FT_LIT: sp = fmt->f_text; #ifdef JAPAN ! while ((ch = *sp++) && cp < ep) ! *cp++ = ch; #else /* JAPAN */ while( (c = *sp++) && cp < ep) *cp++ = c; + #endif /* JAPAN */ break; case FT_LITF: sp = fmt->f_text; *************** *** 491,498 **** --- 515,527 ---- i = -i; ljust++; /* XXX should do something with this */ } + #ifdef JAPAN + while ((ch = *sp++) && --i >= 0 && cp < ep) + *cp++ = ch; + #else /* JAPAN */ while( (c = *sp++) && --i >= 0 && cp < ep) *cp++ = c; + #endif /* JAPAN */ while( --i >= 0 && cp < ep) *cp++ = fmt->f_fill; break; *************** *** 607,612 **** --- 636,656 ---- case FT_NOP: break; + #ifdef JAPAN + case FT_LS_HENCODE: + if (str) { + (void) exthdr_encode(str, buffer, 0); + str = buffer; + } + break; + case FT_LS_HDECODE: + if (str) { + (void) exthdr_decode(str, buffer); + str = buffer; + } + break; + #endif /* JAPAN */ + case FT_LS_COMP: str = fmt->f_comp->c_text; break; *************** *** 623,630 **** --- 667,678 ---- (void) strcpy(buffer, str); str = buffer; + #ifdef JAPAN + SKIP_SPACE(str); + #else /* JAPAN */ while (isspace(*str)) str++; + #endif /* JAPAN */ ljust = 0; if ((i = fmt->f_width) < 0) { i = -i; *************** *** 635,642 **** --- 683,706 ---- str[i] = '\0'; xp = str; xp += strlen(str) - 1; + #ifdef JAPAN + while ((xp > str) && (ch = *xp)) { + if (ISCNTRL(ch) || ISSPACE(ch)) { + *xp-- = '\0'; + } else if ((xp-1) > str && (ch2 = *((sp)+1))) { + if (ISJSPACE(ch, ch2)) { + *xp-- = '\0'; *xp-- = '\0'; + } else { + break; + } + } else { + break; + } + } + #else /* JAPAN */ while (xp > str && isspace(*xp)) *xp-- = '\0'; + #endif /* JAPAN */ if (ljust && i > 0 && strlen(str) > i) str += strlen(str) - i; } *************** *** 901,911 **** indent = strlen (sp); wid -= indent; #ifdef JAPAN ! while( (c = *sp++ & 0x00ff) && cp < ep) #else /* JAPAN */ while( (c = *sp++) && cp < ep) - #endif /* JAPAN */ *cp++ = c; while (len > wid) { /* try to break at a comma; failing that, break at a * space, failing that, just split the line. --- 965,976 ---- indent = strlen (sp); wid -= indent; #ifdef JAPAN ! while ((ch = *sp++) && (cp < ep)) ! *cp++ = ch; #else /* JAPAN */ while( (c = *sp++) && cp < ep) *cp++ = c; + #endif /* JAPAN */ while (len > wid) { /* try to break at a comma; failing that, break at a * space, failing that, just split the line. *************** *** 912,922 **** */ lastb = 0; sp = lp + wid; #ifdef JAPAN ! while (sp > lp && (c = *--sp & 0x00ff) != ',') { #else /* JAPAN */ while (sp > lp && (c = *--sp) != ',') { - #endif /* JAPAN */ if (! lastb && isspace(c)) lastb = sp - 1; } if (sp == lp) --- 977,988 ---- */ lastb = 0; sp = lp + wid; #ifdef JAPAN ! while (sp > lp && (ch = *--sp) != ',') { ! if (! lastb && isspace(ch)) #else /* JAPAN */ while (sp > lp && (c = *--sp) != ',') { if (! lastb && isspace(c)) + #endif /* JAPAN */ lastb = sp - 1; } if (sp == lp) *************** *** 928,934 **** --- 994,1004 ---- *cp++ = '\n'; for (i=indent; cp < ep && i > 0; i--) *cp++ = ' '; + #ifdef JAPAN + while (isspace(*lp | 0x7f)) + #else /* JAPAN */ while (isspace(*lp)) + #endif /* JAPAN */ lp++, len--; } PUTS (cp, lp); *************** *** 1007,1061 **** #endif /* JLR */ } - - - /* patch by hayashi@kuic.kyoto-u.ac.jp & takada@seraph.ntt.jp (92/12/21) */ - /* originally patch by Hiroaki KOJIMA (hkojima@etl.jp) & tetsu@kuis.kyoto-u.ac.jp */ - #ifdef JAPAN - void - eucfputs(scanlk, stream) - char *scanlk; - FILE *stream; - { - int kanji_in = 0; - - while(*scanlk) { - if (kanji_in) { - if (*scanlk & 0x80) { - if (kanji_in == 1) { - kanji_in = 2; - putc(*scanlk++ & 0x7F, stream); - } else { - if (*(scanlk+1) & 0x80) { - kanji_in = 1; - putc(*scanlk++ & 0x7F, stream); - } else { - kanji_in = 0; - fprintf(stream, "\033(J"); - scanlk++; - } - } - } else { - kanji_in = 0; - fprintf(stream, "\033(J"); - putc(*scanlk++, stream); - } - } else { - if (*scanlk & 0x80) { - if (*(scanlk+1) & 0x80) { - kanji_in = 1; - fprintf(stream, "\033$B"); - putc(*scanlk++ & 0x7F, stream); - } else { - kanji_in = 0; - putc(' ', stream); - scanlk++; - } - } else { - putc(*scanlk++, stream); - } - } - } - } - #endif /* JAPAN */ - /* end of patch */ --- 1077,1079 ---- *** ../mh-6.8-JP1/sbr/trimcpy.c Wed Dec 16 01:55:26 1992 --- sbr/trimcpy.c Mon Feb 1 16:32:19 1993 *************** *** 14,28 **** --- 14,40 ---- { register char *sp; + #ifdef JAPAN + while (isspace (*cp & 0x7f)) + #else /* JAPAN */ while (isspace (*cp)) + #endif /* JAPAN */ cp++; for (sp = cp + strlen (cp) - 1; sp >= cp; sp--) + #ifdef JAPAN + if (isspace (*sp & 0x7f)) + #else /* JAPAN */ if (isspace (*sp)) + #endif /* JAPAN */ *sp = 0; else break; for (sp = cp; *sp; sp++) + #ifdef JAPAN + if (isspace (*sp & 0x7f)) + #else /* JAPAN */ if (isspace (*sp)) + #endif /* JAPAN */ *sp = ' '; return getcpy (cp); *** ../mh-6.8-JP1/sbr/ml_codeconv.c Wed Feb 3 16:26:45 1993 --- sbr/ml_codeconv.c Wed Feb 3 13:59:17 1993 *************** *** 0 **** --- 1,420 ---- + /* ml_codeconv.c - (multilingual) code conversion */ + /* by takada@seraph.ntt.jp */ + + #ifdef JAPAN + + #include "../h/mh.h" + #include + #include + #include + + /* coding system */ + typedef int coding_system_t; + #define CS_DEFAULT 0 + #define CS_JIS7 1 + #define CS_JEUC 2 + #define CS_SJIS 3 + #define CS_NOCONV 99 + + /* coding system list */ + #define CSL_SIZE 4 + #define CSL_DISPLAY(csl) ((csl)[0]) + #define CSL_FILE(csl) ((csl)[1]) + #define CSL_PROCESS(csl) ((csl)[2]) + + /* codeset status */ + #define ASCII 0 + #define JISX0208 1 + + #define IS_JEUC(c) ((0xa1 <= (c)) && ((c) <= 0xfe)) + #define IS_SJIS1(c) (((0x81 <= (c)) && ((c) <= 0x9f)) || \ + ((0xe0 <= (c)) && ((c) <= 0xfc))) + #define IS_SJIS2(c) ((0x40 <= (c)) && ((c) <= 0xfc) && ((c) != 0x7f)) + + /* hold coding system information */ + static coding_system_t ml_coding_info[CSL_SIZE]; + + /* private functions */ + static void read_profile(); + static coding_system_t coding_to_cs(); + static coding_system_t select_coding_system(); + static void ml_fputs_sbr(); + static void jeuc_fputs(); + static void sjis_fputs(); + static void jis7_fputs(); + static void cntrl_putc(); + static void ml_conv_sbr(); + + + /* + * Initialize: holding coding system information + */ + void + ml_init() + { + read_profile(ml_coding_info); + } + + /* get coding system list from profile and environment variable */ + static void + read_profile(csl) + coding_system_t csl[]; + { + char *s, *default_coding; + + if ((default_coding = getenv("LC_CTYPE")) == NULL) + default_coding = getenv("LANG"); + + if ((s = getenv("MH_DISPLAY_CODING")) == NULL) + if ((s = m_find("display-coding")) == NULL) + s = default_coding; + CSL_DISPLAY(csl) = coding_to_cs(s); + + if ((s = getenv("MH_FILE_CODING")) == NULL) + if ((s = m_find("file-coding")) == NULL) + s = default_coding; + CSL_FILE(csl) = coding_to_cs(s); + + if ((s = getenv("MH_PROCESS_CODING")) == NULL) + if ((s = m_find("process-coding")) == NULL) + s = default_coding; + CSL_PROCESS(csl) = coding_to_cs(s); + } + + static coding_system_t + coding_to_cs(coding) + char *coding; + { + if (uleq(coding,"C") || uleq(coding,"japanese") + || uleq(coding,"ja_JP.jis7") || uleq(coding,"ja_JP.jis8") + || uleq(coding,"ja_JP.pjis") || uleq(coding,"ja_JP.jis") + || uleq(coding,"wr_WR.ct") || uleq(coding,"wr_WR.junet")) { + return(CS_JIS7); + } else if (uleq(coding,"ja_JP.ujis") || uleq(coding,"ja_JP.euc")) { + return(CS_JEUC); + } else if (uleq(coding,"ja_JP.mscode") || uleq(coding,"ja_JP.sjis")) { + return(CS_SJIS); + } else if (uleq(coding,"noconv")) { + return(CS_NOCONV); + } else { + return(CS_DEFAULT); + } + } + + static coding_system_t + select_coding_system(stream) + FILE *stream; + { + struct stat buf; + + if (fstat(fileno(stream), &buf)) adios (NULLCP, "unable to fstat stream"); + switch (buf.st_mode & S_IFMT) { + case S_IFREG: + return(CSL_FILE(ml_coding_info)); + case S_IFIFO: + case 0: /* some system returns zero-filled stat for pipe */ + return(CSL_PROCESS(ml_coding_info)); + case S_IFCHR: + default: + return(CSL_DISPLAY(ml_coding_info)); + } + } + + + /* + * + */ + int + ml_ismlchar(c) + unsigned char c; + { + return(IS_JEUC(c)); + } + + + /* + * Output: + */ + void + ml_fputs(scanlk, stream) + char *scanlk; + FILE *stream; + { + ml_fputs_sbr(scanlk, stream, 0); + } + + void + ml_pretty_fputs(scanlk, stream) + char *scanlk; + FILE *stream; + { + ml_fputs_sbr(scanlk, stream, 1); + } + + static void + ml_fputs_sbr(scanlk, stream, pretty) + char *scanlk; + FILE *stream; + int pretty; + { + switch (select_coding_system(stream)) { + case CS_NOCONV: + fputs(scanlk, stream); + break; + case CS_SJIS: + sjis_fputs(scanlk, stream, pretty); + break; + case CS_JEUC: + jeuc_fputs(scanlk, stream, pretty); + break; + case CS_JIS7: + case CS_DEFAULT: + default: + jis7_fputs(scanlk, stream, pretty); + break; + } + } + + + /* + * Output routines with code conversion + */ + static void + jeuc_fputs(scanlk, stream, pretty) + char *scanlk; + FILE *stream; + int pretty; + { + unsigned char u1, u2; + + while (u1 = *scanlk++) { + if (IS_JEUC(u1)) { + if (u2 = *scanlk++) { + if (IS_JEUC(u2)) { + putc(u1, stream); putc(u2, stream); + } else { + putc(' ', stream); + if (pretty && iscntrl(u2)) cntrl_putc(u2, stream); + else putc(u2, stream); + } + } else { + putc(u1, stream); + break; + } + } else if (pretty && iscntrl(u1)) { + cntrl_putc(u1, stream); + } else { + putc(u1, stream); + } + } + } + + #define E2S(i1, i2, o1, o2) {\ + (i1) &= ~0x80;\ + (i2) &= ~0x80;\ + (o1) = ((i1) - 0x21) / 2 + 0x81;\ + if ((o1) > 0x9f) { (o1) += (0xe0 - 0xa0); }\ + if ((i1) & 1) {\ + (o2) = (i2) + (0x40 - 0x21);\ + if ((o2) > 0x7e) (o2)++;\ + } else {\ + (o2) = (i2) + (0xfc - 0x7e);\ + }\ + } + + static void + sjis_fputs(scanlk, stream, pretty) + char *scanlk; + FILE *stream; + int pretty; + { + unsigned char u1, u2, s1, s2; + + while (u1 = *scanlk++) { + if (IS_JEUC(u1)) { + if (u2 = *scanlk++) { + if (IS_JEUC(u2)) { + E2S(u1, u2, s1, s2); + putc(s1, stream); putc(s2, stream); + } else { + putc(' ', stream); + if (pretty && iscntrl(u2)) cntrl_putc(u2, stream); + else putc(u2, stream); + } + } else { + putc(u1, stream); + break; + } + } else if (pretty && iscntrl(u1)) { + cntrl_putc(u1, stream); + } else { + putc(u1, stream); + } + } + } + + #define DSGNT_JISX0208(stream, status) {\ + fputs("\033$B", (stream)); (status) = JISX0208;}\ + + #define DSGNT_ASCII(stream, status) {\ + fputs("\033(B", (stream)); (status) = ASCII;}\ + + static void + jis7_fputs(scanlk, stream, pretty) + char *scanlk; + FILE *stream; + int pretty; + { + int kanji_pos; /* ASCII or JISX0208 */ + unsigned char u1, u2; + + kanji_pos = ASCII; + while (u1 = *scanlk++) { + if (IS_JEUC(u1)) { + if (u2 = *scanlk++) { + if (IS_JEUC(u2)) { + if (kanji_pos == ASCII) DSGNT_JISX0208(stream, kanji_pos); + putc(u1 & 0x7f, stream); putc(u2 & 0x7f, stream); + } else { + if (kanji_pos == JISX0208) DSGNT_ASCII(stream, kanji_pos); + putc(' ', stream); + if (pretty && iscntrl(u2)) cntrl_putc(u2, stream); + else putc(u2, stream); + } + } else { + if (kanji_pos == JISX0208) DSGNT_ASCII(stream, kanji_pos); + putc(u1, stream); + break; + } + } else if (pretty && iscntrl(u1)) { + if (kanji_pos == JISX0208) DSGNT_ASCII(stream, kanji_pos); + cntrl_putc(u1, stream); + } else { + if (kanji_pos == JISX0208) DSGNT_ASCII(stream, kanji_pos); + putc(u1, stream); + } + } + if (kanji_pos == JISX0208) DSGNT_ASCII(stream, kanji_pos); + } + + static void + cntrl_putc(c, stream) + char c; + FILE *stream; + { + switch (c) { + case '\b': putc('\\', stream); putc('b', stream); break; + case '\f': putc('\\', stream); putc('f', stream); break; + case '\n': putc('\\', stream); putc('n', stream); break; + case '\r': putc('\\', stream); putc('r', stream); break; + case '\t': putc('\\', stream); putc('t', stream); break; + default: putc('^', stream); putc(c ^ 0x40, stream); break; + } + } + + + /* + * Input: + */ + char * + ml_conv(s) + char *s; + { + coding_system_t coding; + + if ((s == NULL) || ((coding = CSL_FILE(ml_coding_info)) == CS_NOCONV)) + return(s); + + ml_conv_sbr(s, coding); + return(s); + } + + #define ESC '\033' + + #define E2E(i1, i2, o1, o2) { (o1) = (i1); (o2) = (i2); } + + #define I2E(i1, i2, o1, o2) { (o1) = ((i1) | 0x80); (o2) = ((i2) | 0x80); } + + #define S2E(i1, i2, o1, o2) {\ + if ((i1) >= 0xe0) { (i1) -= (0xe0 - 0xa0); }\ + if ((i2) >= 0x80) { (i2)--; }\ + if ((i2) < 0x40 + 94) {\ + (o2) = (((((i1) - 0x81) * 2) + 0x21) | 0x80);\ + (o2) = (((i2) - (0x40 - 0x21)) | 0x80);\ + } else {\ + (o2) = (((((i1) - 0x81) * 2) + 0x21 + 1) | 0x80);\ + (o2) = (((i2) - (0x9e - 0x21)) | 0x80);\ + }\ + } + + static void + ml_conv_sbr(in, cs) + char *in; + coding_system_t cs; + { + char *out = in; + int kanji_pos = ASCII; + unsigned char c1, c2, c3; + + while (c1 = *in++) { + if (c1 == ESC) { + if (c2 = *in++) { + if (c2 == '$') { + if (c3 = *in++) { + if ((c3 == '@') || (c3 == 'B')) { + kanji_pos = JISX0208; + } else { + *out++ = c1; *out++ = c2; *out++ = c3; + } + } else { + *out++ = c1; *out++ = c2; + break; + } + } else if (c2 == '(') { + if (c3 = *in++) { + if ((c3 == 'B') || (c3 == 'J') || (c3 == 'H')) { + kanji_pos = ASCII; + } else { + *out++ = c1; *out++ = c2; *out++ = c3; + } + } else { + *out++ = c1; *out++ = c2; + break; + } + } else { + *out++ = c1; *out++ = c2; + } + } else { + *out++ = c1; + break; + } + } else if ((cs == CS_SJIS) ? IS_SJIS1(c1) : IS_JEUC(c1)) { + if (c2 = *in++) { + if ((cs == CS_SJIS) ? IS_SJIS2(c2) : IS_JEUC(c2)) { + if (cs == CS_SJIS) { + S2E(c1, c2, *out++, *out++); + } else { + E2E(c1, c2, *out++, *out++); + } + } else { + *out++ = c1; *out++ = c2; + } + } else { + *out++ = c1; + break; + } + } else if (kanji_pos == JISX0208) { + if (c2 = *in++) { + I2E(c1, c2, *out++, *out++); + } else { + *out++ = c1; + break; + } + } else { + *out++ = c1; + } + } + *out = 0; + } + + #endif /* JAPAN */ *** ../mh-6.8-JP1/sbr/ml_exthdr.c Wed Feb 3 16:26:45 1993 --- sbr/ml_exthdr.c Wed Feb 3 13:59:46 1993 *************** *** 0 **** --- 1,267 ---- + /* ml_exthdr.c - supporting RFC-1342 (Non-ASCII Mail Headers) */ + /* by takada@seraph.ntt.jp */ + + #ifdef JAPAN + + #include "../h/mh.h" + #include + #include + + #define MAXWIDTH 75 + + static char b64_to_alpha[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + static unsigned char alpha_to_b64[256] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,62, 0, 0, 0,63, + 52,53,54,55, 56,57,58,59, 60,61, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, + 15,16,17,18, 19,20,21,22, 23,24,25, 0, 0, 0, 0, 0, + 0,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, + 41,42,43,44, 45,46,47,48, 49,50,51, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; + + static int ml_to_mmh(); + static int mmh_to_ml(); + static int bin_to_b64(); + static int b64_to_bin(); + + + /* + * Encode multilingual string into RFC-1342 format + */ + char * + exthdr_encode(input, output, width) + char *input, *output; + { + (void) ml_to_mmh(input, output, width); + return(output); + } + + #define ASCII 0 + #define JISX0208 1 + + #define DSGNT_JISX0208() {\ + kanji_pos = JISX0208;\ + } + + #define DSGNT_ASCII() {\ + *bp++ = '\033'; *bp++ = '('; *bp++ = 'B'; *bp = 0;\ + strcpy(op, "=?ISO-2022-JP?B?"); op += 16; width += 16;\ + x = bin_to_b64(buf, op); op += x; width += x;\ + strcpy(op, "?="); op += 2; width += 2;\ + bp = buf; *bp++ = '\033'; *bp++ = '$'; *bp++ = 'B';\ + kanji_pos = ASCII;\ + } + + static int + ml_to_mmh(ibuf, obuf, width) + char *ibuf, *obuf; + int width; + { + int kanji_pos, x; + char *ip = ibuf; + char *op = obuf; + char *bp, buf[BUFSIZ]; + unsigned char c1, c2; + + bp = buf; *bp++ = '\033'; *bp++ = '$'; *bp++ = 'B'; + kanji_pos = ASCII; + + while (c1 = *ip++) { + if (ml_ismlchar(c1)) { + if (width + ((bp-buf+2+3+2)/3)*4 + 16 + 2 >= MAXWIDTH) { + if (kanji_pos == JISX0208) { + DSGNT_ASCII(); + *op++ = '\n'; *op++ = '\t'; width = 8; + DSGNT_JISX0208(); + } else { + *op++ = '\n'; *op++ = '\t'; width = 8; + } + } + } else { + if ((width >= MAXWIDTH) && isspace(c1) && c1 != '\n') { + *op++ = '\n'; *op++ = '\t'; width = 8; + } + } + if (ml_ismlchar(c1)) { + if (c2 = *ip++) { + if (ml_ismlchar(c2)) { + if (kanji_pos == ASCII) { + DSGNT_JISX0208(); + } + *bp++ = c1 & 0x7f; *bp++ = c2 & 0x7f; + } else { + if (kanji_pos == JISX0208) { + DSGNT_ASCII(); *op++ = ' '; width++; + } + *op++ = ' '; *op++ = c2; width += 2; + } + } else { + if (kanji_pos == JISX0208) { + DSGNT_ASCII(); *op++ = ' '; width++; + } + *op++ = c1; width++; + break; + } + } else if (c1 == '\n') { + if (kanji_pos == JISX0208) { + DSGNT_ASCII(); + } + *op++ = c1; width = 0; + } else { + if (kanji_pos == JISX0208) { + DSGNT_ASCII(); *op++ = ' '; width++; + } + *op++ = c1; width++; + } + } + switch (kanji_pos) { + case JISX0208: + DSGNT_ASCII(); + *op++ = ' '; width++; + break; + case ASCII: + DSGNT_JISX0208(); + break; + } + *op = 0; + return(op - obuf); + } + + static int + bin_to_b64(in, out) + char *in, *out; + { + char *oldout = out; + char c1, c2, c3; + + while (c1 = *in++) { + *out++ = b64_to_alpha[c1 >> 2]; + c2 = *in++; + *out++ = b64_to_alpha[((c1 & 0x03) << 4) | ((c2 & 0xf0) >> 4)]; + if (c2) { + c3 = *in++; + *out++ = b64_to_alpha[((c2 & 0x0f) << 2) | ((c3 & 0xc0) >> 6)]; + if (c3) { + *out++ = b64_to_alpha[c3 & 0x3f]; + } else { + *out++ = '='; + break; + } + } else { + *out++ = '='; + *out++ = '='; + break; + } + } + *out = 0; + return(out - oldout); + } + + + /* + * Decode multilingual string from RFC-1342 format + */ + char * + exthdr_decode(input, output) + char *input, *output; + { + char *cp = input; + char *op = output; + int in, out; + + while (*cp) { + if (uprf(cp, "=?") && + ((in = stringdex("?=", cp)) >= 0) && + ((out = mmh_to_ml(cp, cp+in+1, op)) >= 0)) { + cp += in + 2; op += out; + if (!*cp) { + break; + } else if (*cp == '\n' && *(cp+1)) { + while (*++cp && isspace(*cp)) ; + } else if (isspace(*cp) && *(cp+1)) { + cp++; + } + } else { + *op++ = *cp++; + } + } + *op = NULL; + return(output); + } + + static int + mmh_to_ml(bp, ep, op) + char *bp, *ep, *op; + { + char *ip, *cp, buf[BUFSIZ]; + int result; + + ip = bp; + if ((ip > ep) || strncmp(ip, "=?", 2)) return(-1); + ip += 2; + if ((ip > ep) || ((cp = index(ip, '?')) == NULL)) return(-1); + strncpy(buf, ip, cp-ip); buf[cp-ip] = 0; + if (!uleq(buf, "iso-2022-jp") && !uleq(buf, "x-iso-2022-jp")) return(-1); + ip = cp + 1; + if ((ip > ep) || ((*ip != 'B') && (*ip != 'b'))) return(-1); + ip++; + if ((ip > ep) || (*ip != '?')) return(-1); + ip++; + if ((ip > ep) || ((cp = index(ip, '?')) == NULL)) return(-1); + strncpy(buf, ip, cp-ip); buf[cp-ip] = 0; + ip = cp + 1; + if ((ip != ep) || (*ip != '=')) return(-1); + (void) b64_to_bin(buf, op); + (void) ml_conv(op); + return(strlen(op)); + } + + static int + b64_to_bin(in, out) + char *in, *out; + { + char *oldout = out; + unsigned char c1, c2, c3, c4; + + while (c1 = *in++) { + if ((c2 = *in++) && (c3 = *in++) && (c4 = *in++)) { + if ((c1 == '=') || (c2 == '=')) { + break; + } else { + c1 = alpha_to_b64[c1]; + c2 = alpha_to_b64[c2]; + } + *out++ = (c1 << 2) | ((c2 & 0x30) >> 4); + if (c3 == '=') { + break; + } else { + c3 = alpha_to_b64[c3]; + } + *out++ = ((c2 & 0x0f) << 4) | ((c3 & 0x3c) >> 2); + if (c4 == '=') { + break; + } else { + c4 = alpha_to_b64[c4]; + } + *out++ = ((c3 & 0x03) << 6) | c4 ; + } else { + break; + } + } + *out = 0; + return(out - oldout); + } + + #endif /* JAPAN */ *** ../mh-6.8-JP1/uip/ali.c Wed Dec 16 01:55:52 1992 --- uip/ali.c Wed Jan 27 17:41:31 1993 *************** *** 74,79 **** --- 74,82 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); mts_init (invo_name); if ((cp = m_find (invo_name)) != NULL) { *** ../mh-6.8-JP1/uip/anno.c Wed Dec 16 01:55:53 1992 --- uip/anno.c Wed Jan 27 17:41:30 1993 *************** *** 63,68 **** --- 63,71 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/ap.c Mon Dec 21 17:59:53 1992 --- uip/ap.c Wed Jan 27 17:41:29 1993 *************** *** 73,78 **** --- 73,81 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); mts_init (invo_name); if ((cp = m_find (invo_name)) != NULL) { *************** *** 206,212 **** (void) fmtscan (fmt, buffer, length, dat); #ifdef JAPAN ! eucfputs (buffer, stdout); /* for KANJI */ #else /* JAPAN */ (void) fputs (buffer, stdout); #endif /* JAPAN */ --- 209,215 ---- (void) fmtscan (fmt, buffer, length, dat); #ifdef JAPAN ! ml_fputs (buffer, stdout); #else /* JAPAN */ (void) fputs (buffer, stdout); #endif /* JAPAN */ *** ../mh-6.8-JP1/uip/bbc.c Wed Dec 16 01:55:54 1992 --- uip/bbc.c Wed Jan 27 17:41:28 1993 *************** *** 191,196 **** --- 191,199 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); #ifdef BPOP mts_init (invo_name); *** ../mh-6.8-JP1/uip/bbl.c Wed Dec 16 01:55:54 1992 --- uip/bbl.c Wed Jan 27 17:41:27 1993 *************** *** 77,82 **** --- 77,85 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/burst.c Wed Dec 16 01:55:54 1992 --- uip/burst.c Wed Jan 27 17:41:26 1993 *************** *** 75,80 **** --- 75,83 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/comp.c Wed Dec 16 01:55:54 1992 --- uip/comp.c Wed Jan 27 17:41:26 1993 *************** *** 113,118 **** --- 113,121 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/conflict.c Wed Dec 16 01:55:55 1992 --- uip/conflict.c Wed Jan 27 17:41:25 1993 *************** *** 67,72 **** --- 67,75 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); m_foil (NULLCP); mts_init (invo_name); *** ../mh-6.8-JP1/uip/dist.c Wed Dec 16 01:55:55 1992 --- uip/dist.c Wed Jan 27 17:41:23 1993 *************** *** 118,123 **** --- 118,126 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/dp.c Mon Dec 21 17:59:52 1992 --- uip/dp.c Wed Jan 27 17:41:22 1993 *************** *** 67,72 **** --- 67,75 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *************** *** 156,162 **** cptr -> c_text = date; (void) fmtscan (fmt, buffer, length, dat); #ifdef JAPAN ! eucfputs (buffer, stdout); /* for KANJI */ #else /* JAPAN */ (void) fputs (buffer, stdout); #endif /* JAPAN */ --- 159,165 ---- cptr -> c_text = date; (void) fmtscan (fmt, buffer, length, dat); #ifdef JAPAN ! ml_fputs (buffer, stdout); #else /* JAPAN */ (void) fputs (buffer, stdout); #endif /* JAPAN */ *** ../mh-6.8-JP1/uip/fmtdump.c Wed Dec 16 01:55:56 1992 --- uip/fmtdump.c Thu Jan 28 12:16:58 1993 *************** *** 56,61 **** --- 56,64 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *************** *** 428,433 **** --- 431,440 ---- case FT_V_GT: return("V_GT"); case FT_V_MATCH: return("V_MATCH"); case FT_V_AMATCH: return("V_AMATCH"); + #ifdef JAPAN + case FT_LS_HENCODE: return("LS_HENCODE"); + case FT_LS_HDECODE: return("LS_HDECODE"); + #endif /* JAPAN */ default: (void)sprintf(buf, "/* ??? #%d */", t); return(buf); *************** *** 466,473 **** --- 473,484 ---- { if (s) { putc('"', stdout); + #ifdef JAPAN + ml_pretty_fputs(s, stdout); + #else /* JAPAN */ while (*s) litputc(*s++); + #endif /* JAPAN */ putc('"', stdout); } else fputs("", stdout); *** ../mh-6.8-JP1/uip/folder.c Wed Dec 16 01:55:56 1992 --- uip/folder.c Wed Jan 27 17:41:21 1993 *************** *** 114,119 **** --- 114,122 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if (argv[0][strlen (argv[0]) - 1] == 's') all++; *** ../mh-6.8-JP1/uip/forw.c Mon Dec 21 17:59:51 1992 --- uip/forw.c Wed Jan 27 17:41:20 1993 *************** *** 182,187 **** --- 182,190 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *************** *** 676,682 **** adios (NULLCP, "unable to allocate format line storage"); (void) fmtscan (fmt, line, fmtsize, dat); #ifdef JAPAN ! eucfputs (line, tmp); /* for KANJI */ #else /* JAPAN */ (void) fputs (line, tmp); #endif /* JAPAN */ --- 679,685 ---- adios (NULLCP, "unable to allocate format line storage"); (void) fmtscan (fmt, line, fmtsize, dat); #ifdef JAPAN ! ml_fputs (line, tmp); #else /* JAPAN */ (void) fputs (line, tmp); #endif /* JAPAN */ *** ../mh-6.8-JP1/uip/inc.c Mon Dec 21 17:55:13 1992 --- uip/inc.c Wed Feb 3 13:54:53 1993 *************** *** 221,226 **** --- 221,229 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); mts_init (invo_name); *************** *** 625,631 **** default: if (aud) #ifdef JAPAN ! eucfputs (scanl, aud); /* for KANJI */ #else /* JAPAN */ fputs (scanl, aud); #endif /* JAPAN */ --- 628,634 ---- default: if (aud) #ifdef JAPAN ! ml_fputs (scanl, aud); #else /* JAPAN */ fputs (scanl, aud); #endif /* JAPAN */ *************** *** 632,638 **** #ifdef MHE if (mhe) #ifdef JAPAN ! eucfputs (scanl, mhe); /* for KANJI */ #else /* JAPAN */ fputs (scanl, mhe); #endif /* JAPAN */ --- 635,641 ---- #ifdef MHE if (mhe) #ifdef JAPAN ! ml_fputs (scanl, mhe); #else /* JAPAN */ fputs (scanl, mhe); #endif /* JAPAN */ *************** *** 716,726 **** case SCNERR: if (aud) - #ifdef JAPAN - eucfputs ("inc aborted!\n", aud); /* for KANJI */ - #else /* JAPAN */ fputs ("inc aborted!\n", aud); - #endif /* JAPAN */ advise (NULLCP, "aborted!"); /* doesn't clean up locks! */ break; --- 719,725 ---- *************** *** 738,744 **** case SCNENC: if (aud) #ifdef JAPAN ! eucfputs (scanl, aud); /* for KANJI */ #else /* JAPAN */ fputs (scanl, aud); #endif /* JAPAN */ --- 737,743 ---- case SCNENC: if (aud) #ifdef JAPAN ! ml_fputs (scanl, aud); #else /* JAPAN */ fputs (scanl, aud); #endif /* JAPAN */ *************** *** 745,751 **** #ifdef MHE if (mhe) #ifdef JAPAN ! eucfputs (scanl, mhe); /* for KANJI */ #else /* JAPAN */ fputs (scanl, mhe); #endif /* JAPAN */ --- 744,750 ---- #ifdef MHE if (mhe) #ifdef JAPAN ! ml_fputs (scanl, mhe); #else /* JAPAN */ fputs (scanl, mhe); #endif /* JAPAN */ *** ../mh-6.8-JP1/uip/install-mh.c Wed Dec 16 01:55:57 1992 --- uip/install-mh.c Wed Jan 27 17:41:18 1993 *************** *** 53,58 **** --- 53,61 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); #ifdef COMPAT *** ../mh-6.8-JP1/uip/mark.c Wed Dec 16 01:55:57 1992 --- uip/mark.c Wed Jan 27 17:41:17 1993 *************** *** 73,78 **** --- 73,81 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/mhl.c Wed Dec 16 01:55:57 1992 --- uip/mhl.c Tue Jan 26 17:21:54 1993 *************** *** 13,18 **** --- 13,21 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ done (mhl (argc, argv)); } *** ../mh-6.8-JP1/uip/mhlsbr.c Wed Dec 16 01:55:58 1992 --- uip/mhlsbr.c Thu Feb 4 17:04:26 1993 *************** *** 287,292 **** --- 287,299 ---- void clear_screen (); + #ifdef JAPAN + static char mlbuf[BUFSIZ]; + static char *mlcp; + static int ml_cont_p; + static void putstr_sbr(); + #endif /* JAPAN */ + /* */ /* ARGSUSED */ *************** *** 544,549 **** --- 551,559 ---- *(ip = ignores) = NULL; while (vfgets (fp, &ap) == OK) { + #ifdef JAPAN + (void) ml_conv(ap); + #endif /* JAPAN */ bp = ap; if (*bp == ';') continue; *************** *** 742,748 **** --- 752,762 ---- /* */ static char *parse () { + #ifdef JAPAN + unsigned int c; + #else /* JAPAN */ int c; + #endif /* JAPAN */ register char *cp; static char result[NAMESZ]; *************** *** 917,922 **** --- 931,939 ---- } if (c2 == NULL) c1 -> c_flags |= EXTRA; + #ifdef JAPAN + (void) ml_conv(c1 -> c_text); + #endif /* JAPAN */ continue; case BODY: *************** *** 945,955 **** --- 962,992 ---- if ((holder.c_text = malloc (sizeof buf)) == NULL) adios (NULLCP, "unable to allocate buffer memory"); (void) strcpy (holder.c_text, buf); + #ifdef JAPAN + /* ... (-_-; */ while (state == BODY) { + char *cp, *oldhct; + cp = holder.c_text + sizeof(buf); + while (*--cp != '\n') ; + *cp = 0; + (void) ml_conv(holder.c_text); + putcomp(c1, &holder, BODYCOMP); + buf[0] = '\n'; strcpy(&(buf[1]), cp+1); + state = m_getfld(state, name, holder.c_text, + sizeof(buf) - strlen(buf), fp); + oldhct = holder.c_text; + holder.c_text = concat(buf, holder.c_text, NULLCP); + free(oldhct); + } + (void) ml_conv(holder.c_text); + putcomp(c1, &holder, BODYCOMP); + #else /* JAPAN */ + while (state == BODY) { putcomp (c1, &holder, BODYCOMP); state = m_getfld (state, name, holder.c_text, sizeof buf, fp); } + #endif /* JAPAN */ free (holder.c_text); holder.c_text = NULL; continue; *************** *** 1236,1242 **** --- 1273,1283 ---- if (!(c1 -> c_flags & HDROUTPUT) && !(c1 -> c_flags & NOCOMPONENT)) { if (c1 -> c_flags & UPPERCASE) /* uppercase component also */ for (cp = (c1 -> c_text ? c1 -> c_text : c1 -> c_name); *cp; cp++) + #ifdef JAPAN + if (islower (*cp | 0x7f)) + #else /* JAPAN */ if (islower (*cp)) + #endif /* JAPAN */ *cp = toupper (*cp); putstr (c1 -> c_text ? c1 -> c_text : c1 -> c_name); if (flag != BODYCOMP) { *************** *** 1259,1265 **** --- 1300,1310 ---- && !(c2 -> c_flags & NOCOMPONENT)) { if (c1 -> c_flags & UPPERCASE) for (cp = c2 -> c_name; *cp; cp++) + #ifdef JAPAN + if (islower (*cp | 0x7f)) + #else /* JAPAN */ if (islower (*cp)) + #endif /* JAPAN */ *cp = toupper (*cp); putstr (c2 -> c_name); putstr (": "); *************** *** 1273,1279 **** --- 1318,1328 ---- } if (c1 -> c_flags & UPPERCASE) for (cp = c2 -> c_text; *cp; cp++) + #ifdef JAPAN + if (islower (*cp | 0x7f)) + #else /* JAPAN */ if (islower (*cp)) + #endif /* JAPAN */ *cp = toupper (*cp); count = 0; *************** *** 1359,1364 **** --- 1408,1512 ---- /* */ + #ifdef JAPAN + static + putstr(string) + char *string; + { + mlcp = mlbuf; + ml_cont_p = 0; + putstr_sbr(string); + *mlcp = 0; + ml_fputs(mlbuf, stdout); + } + + static void + putstr_sbr(string) + char *string; + { + if (!column && lm > 0) + while (lm > 0) + if (lm >= 8) { + putch('\t'); lm -= 8; + } else { + putch(' '); lm--; + } + lm = 0; + while (*string) + putch(*string++); + } + + /* */ + + static + putch(ch) + char ch; + { + char buf[BUFSIZ]; + + if (llim == 0) return; + + switch (ch) { + case '\n': + if (llim > 0) llim--; + ml_cont_p = 0; + column = 0; + row++; + if (ontty != ISTTY || row != global.c_length) + break; + if (global.c_flags & BELL) *mlcp++ = '\007'; + *mlcp = 0; + ml_fputs(mlbuf, stdout); + mlcp = mlbuf; + (void) fflush(stdout); + buf[0] = 0; + (void) read (fileno (stdout), buf, sizeof buf); + if (index (buf, '\n')) { + if (global.c_flags & CLEARSCR) clear_screen (); + row = 0; + } else { + (void) putchar('\n'); + row = global.c_length / 3; + } + return; + case '\t': + ml_cont_p = 0; + column |= 07; + column++; + break; + case '\b': + ml_cont_p = 0; + column--; + break; + case '\r': + ml_cont_p = 0; + column = 0; + break; + default: + if (column == 0 && forwflg && dashflg && ch == '-') { + *mlcp++ = '-'; *mlcp++ = ' '; column += 2; + } + if (ml_ismlchar(ch)) { + ml_cont_p = ml_cont_p ? 0 : 1; + column++; + } else if ((ch & 0xff) >= ' ') { + ml_cont_p = 0; + column++; + } + break; + } + if (((column >= wid-1) && ml_cont_p) || (column >= wid)) { + putch ('\n'); + if (ovoff > 0) lm = ovoff; + putstr_sbr(ovtxt ? ovtxt : ""); + putch(ch); + return; + } + *mlcp++ = ch; + } + + #else /* JAPAN */ + static putstr (string) register char *string; { *************** *** 1443,1448 **** --- 1591,1597 ---- (void) putchar (ch); } + #endif /* JAPAN */ /* */ *** ../mh-6.8-JP1/uip/mhmail.c Wed Dec 16 01:55:58 1992 --- uip/mhmail.c Wed Jan 27 17:41:16 1993 *************** *** 68,73 **** --- 68,76 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); m_foil (NULLCP); *** ../mh-6.8-JP1/uip/mhn.c Wed Dec 16 01:55:59 1992 --- uip/mhn.c Tue Feb 2 12:47:18 1993 *************** *** 324,329 **** --- 324,332 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if (argv[1] && uprf (argv[1], "-via")) m_foil (NULLCP); *************** *** 2438,2448 **** --- 2441,2457 ---- #define CHARSET_UNKNOWN 0x00 #define CHARSET_USASCII 0x01 #define CHARSET_LATIN 0x02 + #ifdef JAPAN + #define CHARSET_ISO_2022_JP 0x03 + #endif /* JAPAN */ }; static struct k2v Charset[] = { "us-ascii", CHARSET_USASCII, "iso-8859-1", CHARSET_LATIN, + #ifdef JAPAN + "iso-2022-jp", CHARSET_ISO_2022_JP, + #endif /* JAPAN */ NULL, CHARSET_UNKNOWN /* this one must be last! */ }; *************** *** 5479,5485 **** --- 5488,5498 ---- charset = -2; else if (charset == -1) + #ifdef JAPAN + charset = CHARSET_ISO_2022_JP; + #else /* JAPAN */ charset = CHARSET_USASCII; + #endif /* JAPAN */ if ((t = (struct text *) calloc (1, sizeof *t)) == NULL) adios (NULLCP, "out of memory"); *************** *** 5492,5497 **** --- 5505,5515 ---- case CHARSET_USASCII: *ap = add ("charset=us-ascii", NULLCP); break; + #ifdef JAPAN + case CHARSET_ISO_2022_JP: + *ap = add ("charset=iso-2022-jp", NULLCP); + break; + #endif /* JAPAN */ case CHARSET_UNKNOWN: default: *************** *** 5622,5629 **** --- 5640,5654 ---- case CT_TEXT: if (ct -> c_subtype != TEXT_PLAIN || (ct -> c_ctparams + #ifdef JAPAN + && (((struct text *) ct -> c_ctparams) -> tx_charset + != CHARSET_USASCII) + && (((struct text *) ct -> c_ctparams) -> tx_charset + != CHARSET_ISO_2022_JP))) { + #else /* JAPAN */ && ((struct text *) ct -> c_ctparams) -> tx_charset != CHARSET_USASCII)) { + #endif /* JAPAN */ quoted_printable: ; fprintf (out, "%s: %s\n\n", ENCODING_FIELD, "quoted-printable"); *** ../mh-6.8-JP1/uip/mhpath.c Wed Dec 16 01:55:59 1992 --- uip/mhpath.c Wed Jan 27 17:41:13 1993 *************** *** 41,46 **** --- 41,49 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/msgchk.c Wed Dec 16 01:56:00 1992 --- uip/msgchk.c Wed Jan 27 17:41:13 1993 *************** *** 125,130 **** --- 125,133 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); mts_init (invo_name); #ifdef POP *** ../mh-6.8-JP1/uip/msh.c Wed Dec 16 01:56:00 1992 --- uip/msh.c Wed Jan 27 17:41:12 1993 *************** *** 222,227 **** --- 222,230 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); mts_init (invo_name); if ((cp = m_find (invo_name)) != NULL) { *** ../mh-6.8-JP1/uip/packf.c Wed Dec 16 01:56:01 1992 --- uip/packf.c Wed Jan 27 17:41:11 1993 *************** *** 60,65 **** --- 60,68 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/pick.c Wed Dec 16 01:56:01 1992 --- uip/pick.c Wed Jan 27 17:41:10 1993 *************** *** 102,107 **** --- 102,110 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/post.c Wed Dec 16 01:56:03 1992 --- uip/post.c Tue Feb 2 18:25:17 1993 *************** *** 149,154 **** --- 149,161 ---- #define PARTSW 34 "partno", -6, + #ifdef JAPAN + #define HENCDSW 35 + "hencode", 0, + #define NHENCDSW 36 + "nohencode", 0, + #endif /* JAPAN */ + NULL, 0 }; *************** *** 249,254 **** --- 256,264 ---- static int checksw = 0; /* whom -check */ static int linepos=0; /* putadr()'s position on the line */ static int nameoutput=0; /* putadr() has output header name */ + #ifdef JAPAN + static int hencode = 0; /* encode header in RFC-1342 style */ + #endif /* JAPAN */ static unsigned msgflags = 0; /* what we've seen */ *************** *** 360,365 **** --- 370,378 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); m_foil (NULLCP); mts_init (invo_name); *************** *** 565,570 **** --- 578,591 ---- if (!(partno = *argp++) || *partno == '-') adios (NULLCP, "missing argument to %s", argp[-2]); continue; + #ifdef JAPAN + case HENCDSW: + hencode++; + continue; + case NHENCDSW: + hencode = 0; + continue; + #endif /* JAPAN */ } if (msg) adios (NULLCP, "only one message at a time!"); *************** *** 644,650 **** --- 665,685 ---- state = m_getfld (state, name, buf, sizeof buf, in); cp = add (buf, cp); } + #ifdef JAPAN + if (hencode) { + char *ep; + if ((ep = malloc((unsigned)strlen(cp)*10)) == NULL) + adios(NULLCP, "out of memory"); + (void) ml_conv(cp); + (void) exthdr_encode(cp, ep, strlen(name)+1); + putfmt(name, ep, out); + free(ep); + } else { + putfmt(name, cp, out); + } + #else /* JAPAN */ putfmt (name, cp, out); + #endif /* JAPAN */ free (cp); if (state != FLDEOF) continue; *************** *** 943,949 **** --- 978,993 ---- #endif /* MHMTS */ if ((cp = getfullname ()) && *cp) { + #ifdef JAPAN + if (hencode) { + (void) ml_conv(cp); + (void) exthdr_encode(cp, sigbuf, 5); + } else { + (void) strcpy(sigbuf, cp); + } + #else /* JAPAN */ (void) strcpy (sigbuf, cp); + #endif /* JAPAN */ (void) sprintf (signature, "%s <%s>", sigbuf, adrsprintf (NULLCP, NULLCP)); if ((cp = getname (signature)) == NULL) adios (NULLCP, "getname () failed -- you lose extraordinarily big"); *************** *** 1352,1358 **** --- 1396,1406 ---- register char *cp; for (cp = buffer + strlen (buffer) - 1; cp >= buffer; cp--) + #ifdef JAPAN + if (!isspace (*cp & 0x7f)) + #else /* JAPAN */ if (!isspace (*cp)) + #endif /* JAPAN */ break; *++cp = NULL; if (strcmp (buffer + 2, prefix) == 0) { *** ../mh-6.8-JP1/uip/prompter.c Wed Dec 16 01:56:03 1992 --- uip/prompter.c Wed Jan 27 17:41:08 1993 *************** *** 127,132 **** --- 127,135 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/rcvdist.c Mon Dec 21 17:59:50 1992 --- uip/rcvdist.c Wed Jan 27 17:41:07 1993 *************** *** 55,60 **** --- 55,63 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); mts_init (invo_name); if ((cp = m_find (invo_name)) != NULL) { *************** *** 274,280 **** dat[3] = outputlinelen; (void) fmtscan (fmt, scanl, i, dat); #ifdef JAPAN ! eucfputs (scanl, out); /* for KANJI */ #else /* JAPAN */ fputs (scanl, out); #endif /* JAPAN */ --- 277,283 ---- dat[3] = outputlinelen; (void) fmtscan (fmt, scanl, i, dat); #ifdef JAPAN ! ml_fputs (scanl, out); #else /* JAPAN */ fputs (scanl, out); #endif /* JAPAN */ *** ../mh-6.8-JP1/uip/rcvpack.c Wed Dec 16 01:56:03 1992 --- uip/rcvpack.c Wed Jan 27 17:41:06 1993 *************** *** 45,50 **** --- 45,53 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); mts_init (invo_name); if ((cp = m_find (invo_name)) != NULL) { *** ../mh-6.8-JP1/uip/rcvstore.c Wed Dec 16 01:56:03 1992 --- uip/rcvstore.c Wed Jan 27 17:41:05 1993 *************** *** 74,79 **** --- 74,82 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); mts_init (invo_name); if ((cp = m_find (invo_name)) != NULL) { *** ../mh-6.8-JP1/uip/rcvtty.c Wed Dec 16 01:56:04 1992 --- uip/rcvtty.c Wed Jan 27 17:41:05 1993 *************** *** 91,96 **** --- 91,99 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); mts_init (invo_name); if ((cp = m_find (invo_name)) != NULL) { *** ../mh-6.8-JP1/uip/refile.c Wed Dec 16 01:56:04 1992 --- uip/refile.c Wed Jan 27 17:41:04 1993 *************** *** 90,95 **** --- 90,98 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/repl.c Wed Dec 16 01:56:04 1992 --- uip/repl.c Wed Jan 27 17:41:03 1993 *************** *** 180,185 **** --- 180,188 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/replsbr.c Mon Dec 21 17:59:49 1992 --- uip/replsbr.c Tue Feb 2 09:34:53 1993 *************** *** 206,212 **** --- 206,216 ---- register char *sp = cp; for (;;) { + #ifdef JAPAN + while (isspace(*cp & 0x7f)) + #else /* JAPAN */ while (isspace(*cp)) + #endif /* JAPAN */ cp++; if(uprf(cp, "re:")) cp += 3; *************** *** 226,232 **** dat[3] = outputlinelen; (void) fmtscan (fmt, scanl, i, dat); #ifdef JAPAN ! eucfputs (scanl, out); /* for KANJI */ #else /* JAPAN */ fputs (scanl, out); #endif /* JAPAN */ --- 230,236 ---- dat[3] = outputlinelen; (void) fmtscan (fmt, scanl, i, dat); #ifdef JAPAN ! ml_fputs (scanl, out); #else /* JAPAN */ fputs (scanl, out); #endif /* JAPAN */ *** ../mh-6.8-JP1/uip/rmail.c Wed Dec 16 01:56:04 1992 --- uip/rmail.c Wed Jan 27 17:41:02 1993 *************** *** 89,94 **** --- 89,97 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (*argv, '/'); m_foil (NULLCP); mts_init (invo_name); *** ../mh-6.8-JP1/uip/rmf.c Wed Dec 16 01:56:05 1992 --- uip/rmf.c Wed Jan 27 17:41:01 1993 *************** *** 47,52 **** --- 47,55 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/rmm.c Wed Dec 16 01:56:05 1992 --- uip/rmm.c Wed Jan 27 17:41:01 1993 *************** *** 44,49 **** --- 44,52 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/sbboards.c Wed Dec 16 01:56:05 1992 --- uip/sbboards.c Wed Jan 27 17:41:00 1993 *************** *** 129,134 **** --- 129,137 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ #ifdef MHMTS if (argc != 5) adios (EX_USAGE, NULL, "you lose really big"); *** ../mh-6.8-JP1/uip/scan.c Wed Dec 16 01:56:05 1992 --- uip/scan.c Wed Jan 27 17:40:59 1993 *************** *** 94,99 **** --- 94,103 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ + invo_name = r1bindex (argv[0], '/'); mts_init (invo_name); if ((cp = m_find (invo_name)) != NULL) { *** ../mh-6.8-JP1/uip/scansbr.c Mon Dec 21 17:59:47 1992 --- uip/scansbr.c Wed Feb 3 13:57:20 1993 *************** *** 188,197 **** do { if (uleq(name, cptr->c_name)) { if (! cptr->c_text) { ! cptr->c_text = tmpbuf; for (cp = tmpbuf + strlen (tmpbuf) - 1; cp >= tmpbuf; cp--) if (isspace (*cp)) *cp = 0; else break; --- 188,204 ---- do { if (uleq(name, cptr->c_name)) { if (! cptr->c_text) { ! #ifdef JAPAN ! (void) ml_conv(tmpbuf); ! #endif /* JAPAN */ ! cptr->c_text = tmpbuf; for (cp = tmpbuf + strlen (tmpbuf) - 1; cp >= tmpbuf; cp--) + #ifdef JAPAN + if (isspace (*cp | 0x7f)) + #else /* JAPAN */ if (isspace (*cp)) + #endif /* JAPAN */ *cp = 0; else break; *************** *** 279,284 **** --- 286,294 ---- if (bodycomp) { /* Save and restore buffer so we don't trash our dynamic pool! */ saved_c_text = bodycomp->c_text; + #ifdef JAPAN + (void) ml_conv(tmpbuf); + #endif /* JAPAN */ bodycomp->c_text = tmpbuf; } *************** *** 319,325 **** } if (noisy) #ifdef JAPAN ! eucfputs (scanl, stdout); /* for KANJI */ #else /* JAPAN */ (void) fputs (scanl, stdout); #endif /* JAPAN */ --- 329,335 ---- } if (noisy) #ifdef JAPAN ! ml_fputs (scanl, stdout); #else /* JAPAN */ (void) fputs (scanl, stdout); #endif /* JAPAN */ *** ../mh-6.8-JP1/uip/send.c Wed Dec 16 01:56:06 1992 --- uip/send.c Tue Feb 2 18:11:45 1993 *************** *** 119,124 **** --- 119,131 ---- #define SNOOPSW 35 "snoop", -5, + #ifdef JAPAN + #define HENCDSW 36 + "hencode", 0, + #define NHENCDSW 37 + "nohencode", 0, + #endif /* JAPAN */ + NULL, 0 }; *************** *** 183,188 **** --- 190,198 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *************** *** 297,302 **** --- 307,316 ---- case ENCRSW: case NENCRSW: case SNOOPSW: + #ifdef JAPAN + case HENCDSW: + case NHENCDSW: + #endif /* JAPAN */ vec[vecp++] = --cp; continue; *** ../mh-6.8-JP1/uip/sendmail.c Wed Dec 16 01:56:06 1992 --- uip/sendmail.c Wed Jan 27 17:40:57 1993 *************** *** 162,167 **** --- 162,170 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); mts_init(argv[0]); *** ../mh-6.8-JP1/uip/show.c Wed Dec 16 01:56:06 1992 --- uip/show.c Wed Jan 27 17:28:47 1993 *************** *** 87,92 **** --- 87,95 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if (uleq (invo_name, "next")) mode = NEXT; *** ../mh-6.8-JP1/uip/slocal.c Wed Dec 16 01:56:07 1992 --- uip/slocal.c Wed Jan 27 17:40:57 1993 *************** *** 213,218 **** --- 213,221 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (*argv, '/'); m_foil (NULLCP); mts_init (invo_name); *** ../mh-6.8-JP1/uip/sortm.c Wed Dec 16 01:56:07 1992 --- uip/sortm.c Wed Jan 27 17:40:56 1993 *************** *** 95,100 **** --- 95,103 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/spop.c Wed Dec 16 01:56:07 1992 --- uip/spop.c Wed Jan 27 17:40:55 1993 *************** *** 129,134 **** --- 129,137 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ #ifdef MHMTS if (argc != 5) adios (EX_USAGE, NULL, "you lose really big"); *** ../mh-6.8-JP1/uip/spost.c Wed Dec 16 01:56:07 1992 --- uip/spost.c Tue Feb 2 18:25:15 1993 *************** *** 100,105 **** --- 100,112 ---- #define ANNOSW 24 "idanno number", -6, + #ifdef JAPAN + #define HENCDSW 25 + "hencode", 0, + #define NHENCDSW 26 + "nohencode", 0, + #endif /* JAPAN */ + NULL, 0 }; *************** *** 181,186 **** --- 188,196 ---- static int pushflg = 0; /* if going to fork to sendmail */ static int aliasflg = -1; /* if going to process aliases */ static int outputlinelen=72; + #ifdef JAPAN + static int hencode = 0; /* encode header in RFC-1342 style */ + #endif /* JAPAN */ static unsigned msgflags = 0; /* what we've seen */ *************** *** 227,232 **** --- 237,245 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); mts_init (invo_name); if ((cp = m_find (invo_name)) != NULL) { *************** *** 333,338 **** --- 346,359 ---- if (!(cp = *argp++) || *cp == '-') adios (NULLCP, "missing argument to %s", argp[-2]); continue; + #ifdef JAPAN + case HENCDSW: + hencode++; + continue; + case NHENCDSW: + hencode = 0; + continue; + #endif /* JAPAN */ } if (msg) adios (NULLCP, "only one message at a time!"); *************** *** 367,374 **** --- 388,421 ---- for (compnum = 1, state = FLD;;) { switch (state = m_getfld (state, name, buf, sizeof buf, in)) { + #ifdef JAPAN case FLD: + case FLDEOF: + case FLDPLUS: + { + char *ep; compnum++; + cp = add (buf, NULLCP); + while (state == FLDPLUS) { + state = m_getfld (state, name, buf, sizeof buf, in); + cp = add (buf, cp); + } + if (hencode) { + if ((ep = malloc((unsigned)strlen(cp)*10)) == NULL) + adios (NULLCP, "out of memory"); + (void) ml_conv(cp); + (void) exthdr_encode(cp, ep, strlen(name)+1); + putfmt (name, ep, out); + free (ep); + } else { + putfmt (name, cp, out); + } + free (cp); + continue; + } + #else /* JAPAN */ + case FLD: + compnum++; putfmt (name, buf, out); continue; *************** *** 382,387 **** --- 429,435 ---- putfmt (name, cp, out); free (cp); continue; + #endif /* JAPAN */ case BODY: finish_headers (out); *************** *** 563,569 **** --- 611,626 ---- (void)strcpy( from, getusr() ); if ((cp = getfullname ()) && *cp) { + #ifdef JAPAN + if (hencode) { + (void) ml_conv(cp); + (void) exthdr_encode(cp, sigbuf, 5); + } else { + (void)strcpy (sigbuf, cp); + } + #else /* JAPAN */ (void)strcpy (sigbuf, cp); + #endif /* JAPAN */ (void)sprintf (signature, "%s <%s>", sigbuf, from); } else *** ../mh-6.8-JP1/uip/umhook.c Wed Dec 16 01:56:08 1992 --- uip/umhook.c Wed Jan 27 17:40:53 1993 *************** *** 84,89 **** --- 84,92 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); mts_init (invo_name); if ((cp = m_find (invo_name)) != NULL) { *** ../mh-6.8-JP1/uip/vmh.c Wed Dec 16 01:56:08 1992 --- uip/vmh.c Wed Jan 27 17:40:52 1993 *************** *** 207,212 **** --- 207,215 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/uip/vmhtest.c Wed Dec 16 01:56:09 1992 --- uip/vmhtest.c Wed Jan 27 17:40:51 1993 *************** *** 56,61 **** --- 56,64 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); m_foil (NULLCP); *** ../mh-6.8-JP1/uip/whatnow.c Wed Dec 16 01:56:09 1992 --- uip/whatnow.c Wed Jan 27 17:40:34 1993 *************** *** 14,18 **** --- 14,21 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ WhatNow (argc, argv); } *** ../mh-6.8-JP1/uip/whatnowsbr.c Wed Dec 16 01:56:09 1992 --- uip/whatnowsbr.c Tue Feb 2 18:18:44 1993 *************** *** 653,658 **** --- 653,665 ---- #define SNDRFSW 34 "nodraftfolder", -3, + #ifdef JAPAN + #define HENCDSW 35 + "hencode", 0, + #define NHENCDSW 36 + "nohencode", 0, + #endif /* JAPAN */ + NULL, 0 }; *************** *** 780,785 **** --- 787,796 ---- case ENCRSW: case NENCRSW: case SNOOPSW: + #ifdef JAPAN + case HENCDSW: + case NHENCDSW: + #endif /* JAPAN */ vec[vecp++] = --cp; continue; *** ../mh-6.8-JP1/uip/whom.c Wed Dec 16 01:56:10 1992 --- uip/whom.c Tue Feb 2 18:31:02 1993 *************** *** 41,46 **** --- 41,53 ---- #define SNOOPSW 10 "snoop", -5, + #ifdef JAPAN + #define HENCDSW 11 + "hencode", 0, + #define NHENCDSW 12 + "nohencode", 0, + #endif /* JAPAN */ + NULL, 0 }; *************** *** 72,77 **** --- 79,87 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *************** *** 105,110 **** --- 115,124 ---- case CHKSW: case NOCHKSW: case SNOOPSW: + #ifdef JAPAN + case HENCDSW: + case NHENCDSW: + #endif /* JAPAN */ vec[vecp++] = --cp; continue; *** ../mh-6.8-JP1/uip/wmh.c Wed Dec 16 01:56:10 1992 --- uip/wmh.c Wed Jan 27 17:40:31 1993 *************** *** 169,174 **** --- 169,177 ---- #ifdef LOCALE setlocale(LC_ALL, ""); #endif + #ifdef JAPAN + ml_init(); + #endif /* JAPAN */ invo_name = r1bindex (argv[0], '/'); if ((cp = m_find (invo_name)) != NULL) { ap = brkstring (cp = getcpy (cp), " ", "\n"); *** ../mh-6.8-JP1/zotnet/mf/mf.c Wed Dec 16 01:56:13 1992 --- zotnet/mf/mf.c Tue Feb 2 09:21:07 1993 *************** *** 58,65 **** --- 58,70 ---- if (*b == 0) return FALSE; else { + #ifdef JAPAN + char c1 = islower (*a & 0x7f) ? toupper (*a) : *a; + char c2 = islower (*b & 0x7f) ? toupper (*b) : *b; + #else /* JAPAN */ char c1 = islower (*a) ? toupper (*a) : *a; char c2 = islower (*b) ? toupper (*b) : *b; + #endif /* JAPAN */ if (c1 != c2) return FALSE; } *************** *** 153,159 **** --- 158,168 ---- return NULL; } + #ifdef JAPAN + for (cp = tp; isspace (*cp & 0x7f); cp++) + #else /* JAPAN */ for (cp = tp; isspace (*cp); cp++) + #endif /* JAPAN */ continue; if (*cp == 0) { free (vp); *************** *** 166,176 **** --- 175,193 ---- if ((wp = index (cp, ',')) == NULL) if ((wp = index (cp, ' ')) != NULL) { xp = wp; + #ifdef JAPAN + while (isspace (*xp & 0x7f)) + #else /* JAPAN */ while (isspace (*xp)) + #endif /* JAPAN */ xp++; if (*xp != 0 && isat (--xp)) { yp = xp + 4; + #ifdef JAPAN + while (isspace (*yp & 0x7f)) + #else /* JAPAN */ while (isspace (*yp)) + #endif /* JAPAN */ yp++; if (*yp != 0) if ((zp = index (yp, ' ')) != NULL) *************** *** 220,226 **** --- 237,247 ---- *cp; for (c = ' ', cp = tp; (*tp = *fp++) != 0;) + #ifdef JAPAN + if (isspace (*tp & 0x7f)) { + #else /* JAPAN */ if (isspace (*tp)) { + #endif /* JAPAN */ if (c != ' ') *tp++ = c = ' '; } *************** *** 429,435 **** --- 450,460 ---- } break; } + #ifdef JAPAN + while (isspace (*ap & 0x7f)) + #else /* JAPAN */ while (isspace (*ap)) + #endif /* JAPAN */ ap++; if (cp) (void) sprintf (adr, "%.*s", cp - ap, ap); *************** *** 801,807 **** --- 826,836 ---- gotat = isat (cp); c = *cp++; + #ifdef JAPAN + while (isspace (c & 0x7f)) + #else /* JAPAN */ while (isspace (c)) + #endif /* JAPAN */ c = *cp++; if (c == 0) { cp = NULL; *************** *** 889,895 **** --- 918,928 ---- if (c == special[i].lx_chr) return (last_lex = special[i].lx_val); + #ifdef JAPAN + if (iscntrl (c & 0x7f)) + #else /* JAPAN */ if (iscntrl (c)) + #endif /* JAPAN */ return (last_lex = LX_ERR); for (;;) { *************** *** 898,904 **** --- 931,941 ---- for (i = 0; special[i].lx_chr != 0; i++) if (c == special[i].lx_chr) goto got_atom; + #ifdef JAPAN + if (iscntrl (c & 0x7f) || isspace (c & 0x7f)) + #else /* JAPAN */ if (iscntrl (c) || isspace (c)) + #endif /* JAPAN */ break; *bp++ = c; } *** ../mh-6.8-JP1/zotnet/tws/dtime.c Mon Dec 21 20:06:12 1992 --- zotnet/tws/dtime.c Tue Feb 2 12:47:13 1993 *************** *** 71,78 **** "CST", "CDT", -6, "MST", "MDT", -7, "PST", "PDT", -8, - /* patch by takada@seraph.ntt.jp & hayashi@kuic.kyoto-u.ac.jp (92/12/21) */ - /* originally patch by tetsu@kuis.kyoto-u.ac.jp */ #ifdef JAPAN "JST", NULL, 9, #endif /* JAPAN */ --- 71,76 ---- *** ../mh-6.8-JP1/zotnet/tws/dtimep.lex Mon Dec 21 20:06:35 1992 --- zotnet/tws/dtimep.lex Tue Feb 2 12:47:10 1993 *************** *** 347,354 **** "-"?ut ZONE(0 * 60); "-"?gmt ZONE(0 * 60); "-"?jst { - /* patch by takada@seraph.ntt.jp & hayashi@kuic.kyoto-u.ac.jp (92/12/21) */ - /* originally patch by tetsu@kuis.kyoto-u.ac.jp */ #ifdef JAPAN ZONE(9 * 60); #else /* JAPAN */ --- 347,352 ---- *** ../mh-6.8-JP1/config/version.sh Mon Dec 21 17:00:47 1992 --- config/version.sh Fri Jan 29 20:20:40 1993 *************** *** 1,5 **** --- 1,9 ---- : run this script through /bin/sh : '@(#)$Id: version.sh,v 1.9 1992/01/30 22:20:41 jromine Exp jromine $' + + : patch by takada@seraph.ntt.jp and hayashi@kuic.kyoto-u.ac.jp -- 92/12/21 + : modified by the assistance of shigeya@foretune.co.jp -- 93/01/29 + case $# in 0) set "6.6";; 2) flag="$1"; shift;; *************** *** 39,47 **** rm -f version.c - : patch by takada@seraph.ntt.jp and hayashi@kuic.kyoto-u.ac.jp -- 92/12/21 echo "#ifndef JAPAN" > version.c ! : end of patch cat version ${Patch} |\ awk -F. ' --- 43,50 ---- rm -f version.c echo "#ifndef JAPAN" > version.c ! cp /dev/null version.c.tmp cat version ${Patch} |\ awk -F. ' *************** *** 52,64 **** END { local++;\ if (patch > 0) {\ printf "char *version = \"@(#)MH %s.%s.%s #%d[UCI]", \ ! major, minor, patch, local >> "version.c"; \ printf ".ds MH %s.%s.%s #%d[UCI]\n", \ major, minor, patch, local > "../doc/version.rf"; \ printf "MH %s.%s.%s #%d[UCI]\n", major, minor, patch, local ;\ } else {\ printf "char *version = \"@(#)MH %s.%s #%d[UCI] ", \ ! major, minor, local >> "version.c"; \ printf ".ds MH %s.%s #%d[UCI]\n", \ major, minor, local > "../doc/version.rf"; \ printf "MH %s.%s #%d[UCI]\n", major, minor, local ;\ --- 55,67 ---- END { local++;\ if (patch > 0) {\ printf "char *version = \"@(#)MH %s.%s.%s #%d[UCI]", \ ! major, minor, patch, local > "version.c.tmp"; \ printf ".ds MH %s.%s.%s #%d[UCI]\n", \ major, minor, patch, local > "../doc/version.rf"; \ printf "MH %s.%s.%s #%d[UCI]\n", major, minor, patch, local ;\ } else {\ printf "char *version = \"@(#)MH %s.%s #%d[UCI] ", \ ! major, minor, local > "version.c.tmp"; \ printf ".ds MH %s.%s #%d[UCI]\n", \ major, minor, local > "../doc/version.rf"; \ printf "MH %s.%s #%d[UCI]\n", major, minor, local ;\ *************** *** 65,81 **** }\ printf "%s.%s.%s.%d\n", major, minor, patch, local > "_version";\ }' && mv _version version case x${flag} in x) echo ' ('$LOCAL') of '`date`'";' >> version.c ;; x-n) echo '";' >> version.c ;; esac - : patch by takada@seraph.ntt.jp and hayashi@kuic.kyoto-u.ac.jp -- 92/12/21 echo "#else /* JAPAN */" >> version.c JPPatch="../JPPatchlevel" if [ ! -r ${JPPatch} ]; then JPPatch="" ; fi cat version ${Patch} ${JPPatch} |\ awk -F. ' BEGIN { split ("'"${1}"'", ver, ".");\ --- 68,86 ---- }\ printf "%s.%s.%s.%d\n", major, minor, patch, local > "_version";\ }' && mv _version version + cat version.c.tmp >>version.c + rm -f version.c.tmp case x${flag} in x) echo ' ('$LOCAL') of '`date`'";' >> version.c ;; x-n) echo '";' >> version.c ;; esac echo "#else /* JAPAN */" >> version.c JPPatch="../JPPatchlevel" if [ ! -r ${JPPatch} ]; then JPPatch="" ; fi + cp /dev/null version.c.tmp cat version ${Patch} ${JPPatch} |\ awk -F. ' BEGIN { split ("'"${1}"'", ver, ".");\ *************** *** 85,100 **** NR == 3 { jppatch = $(NF) } ;\ END { if (patch > 0) {\ printf "char *version = \"@(#)MH %s.%s.%s.JP%s #%d[UCI]", \ ! major, minor, patch, jppatch, local >> "version.c"; \ } else {\ printf "char *version = \"@(#)MH %s.%s.JP%s #%d[UCI] ", \ ! major, minor, jppatch, local >> "version.c"; \ }\ printf "Japanization Patchlevel %s\n", jppatch ; \ }' case x${flag} in x) echo ' ('$LOCAL') of '`date`'";' >> version.c ;; x-n) echo '";' >> version.c ;; esac echo "#endif /* JAPAN */" >> "version.c" - : end of patch --- 90,106 ---- NR == 3 { jppatch = $(NF) } ;\ END { if (patch > 0) {\ printf "char *version = \"@(#)MH %s.%s.%s.JP%s #%d[UCI]", \ ! major, minor, patch, jppatch, local >> "version.c.tmp"; \ } else {\ printf "char *version = \"@(#)MH %s.%s.JP%s #%d[UCI] ", \ ! major, minor, jppatch, local >> "version.c.tmp"; \ }\ printf "Japanization Patchlevel %s\n", jppatch ; \ }' + cat version.c.tmp >>version.c + rm -f version.c.tmp case x${flag} in x) echo ' ('$LOCAL') of '`date`'";' >> version.c ;; x-n) echo '";' >> version.c ;; esac echo "#endif /* JAPAN */" >> "version.c" *** ../mh-6.8-JP1/conf/makefiles/sbr Wed Dec 16 01:53:12 1992 --- conf/makefiles/sbr Fri Jan 29 19:03:10 1993 *************** *** 44,49 **** --- 44,52 ---- m_name.c m_readefs.c m_remsg.c m_replace.c m_scratch.c \ m_seq.c m_seqbits.c m_seqflag.c m_seqnew.c m_setcur.c \ m_setseq.c m_setvis.c m_sync.c m_tmpfil.c m_update.c \ + @BEGIN: JAPAN + ml_codeconv.c ml_exthdr.c\ + @END: JAPAN makedir.c path.c peekc.c pidwait.c pidstatus.c \ printsw.c push.c putenv.c pwd.c refile.c remdir.c r1bindex.c \ showfile.c smatch.c sprintb.c ssequal.c strindex.c trimcpy.c \ *************** *** 60,65 **** --- 63,71 ---- m_name.o m_readefs.o m_remsg.o m_replace.o m_scratch.o \ m_seq.o m_seqbits.o m_seqflag.o m_seqnew.o m_setcur.o \ m_setseq.o m_setvis.o m_sync.o m_tmpfil.o m_update.o \ + @BEGIN: JAPAN + ml_codeconv.o ml_exthdr.o\ + @END: JAPAN makedir.o path.o peekc.o pidwait.o pidstatus.o \ printsw.o push.o putenv.o pwd.o refile.o remdir.o r1bindex.o \ showfile.o smatch.o sprintb.o ssequal.o strindex.o trimcpy.o \ *************** *** 489,493 **** --- 495,503 ---- vfgets.o: vfgets.c vfgets.o: ../h/mh.h #vfgets.o: /usr/include/stdio.h + @BEGIN: JAPAN + ml_codeconv.o: ../h/mh.h + ml_exthdr.o: ../h/mh.h + @END: JAPAN # DEPENDENCIES MUST END AT END OF FILE # IF YOU PUT STUFF HERE IT WILL GO AWAY