texlive[50038] Build/source/texk/mendexk: mendex version 3.1

commits+takuji at tug.org commits+takuji at tug.org
Sun Feb 17 02:40:47 CET 2019


Revision: 50038
          http://tug.org/svn/texlive?view=revision&revision=50038
Author:   takuji
Date:     2019-02-17 02:40:46 +0100 (Sun, 17 Feb 2019)
Log Message:
-----------
mendex version 3.1 [17-Feb-2019]

Modified Paths:
--------------
    trunk/Build/source/texk/mendexk/COPYRIGHT
    trunk/Build/source/texk/mendexk/ChangeLog
    trunk/Build/source/texk/mendexk/configure
    trunk/Build/source/texk/mendexk/configure.ac
    trunk/Build/source/texk/mendexk/convert.c
    trunk/Build/source/texk/mendexk/fread.c
    trunk/Build/source/texk/mendexk/fwrite.c
    trunk/Build/source/texk/mendexk/kp.c
    trunk/Build/source/texk/mendexk/main.c

Modified: trunk/Build/source/texk/mendexk/COPYRIGHT
===================================================================
--- trunk/Build/source/texk/mendexk/COPYRIGHT	2019-02-17 01:18:08 UTC (rev 50037)
+++ trunk/Build/source/texk/mendexk/COPYRIGHT	2019-02-17 01:40:46 UTC (rev 50038)
@@ -1,4 +1,5 @@
-Copyright (C) 1995 ASCII Corporation.
+Copyright (C) 2009 ASCII MEDIA WORKS
+Copyright (C) 2017-2019 Japanese TeX Development Community
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without

Modified: trunk/Build/source/texk/mendexk/ChangeLog
===================================================================
--- trunk/Build/source/texk/mendexk/ChangeLog	2019-02-17 01:18:08 UTC (rev 50037)
+++ trunk/Build/source/texk/mendexk/ChangeLog	2019-02-17 01:40:46 UTC (rev 50038)
@@ -1,3 +1,14 @@
+2019-02-17  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>
+
+	* main.c, configure.ac, configure:
+	Version 3.1 [17-Feb-2019].
+	* main.c, COPYRIGHT: Update copyright year.
+	* fread.c: Fix typo. It seems a bug.
+	* {convert,fread,fwrite,kp,main}.c:
+	Avoid compiler warnings.
+	Thanks to @ngothan for a report by covscan.
+	https://github.com/TeX-Live/texlive-source/issues/11
+
 2019-01-23  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
 
 	* mendex.1, mendex.1.ja: Add fallback TeX and LaTeX logos.

Modified: trunk/Build/source/texk/mendexk/configure
===================================================================
--- trunk/Build/source/texk/mendexk/configure	2019-02-17 01:18:08 UTC (rev 50037)
+++ trunk/Build/source/texk/mendexk/configure	2019-02-17 01:40:46 UTC (rev 50038)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for mendex (TeX Live) 3.0.
+# Generated by GNU Autoconf 2.69 for mendex (TeX Live) 3.1.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@
 # Identity of this package.
 PACKAGE_NAME='mendex (TeX Live)'
 PACKAGE_TARNAME='mendex--tex-live-'
-PACKAGE_VERSION='3.0'
-PACKAGE_STRING='mendex (TeX Live) 3.0'
+PACKAGE_VERSION='3.1'
+PACKAGE_STRING='mendex (TeX Live) 3.1'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1329,7 +1329,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures mendex (TeX Live) 3.0 to adapt to many kinds of systems.
+\`configure' configures mendex (TeX Live) 3.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1400,7 +1400,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of mendex (TeX Live) 3.0:";;
+     short | recursive ) echo "Configuration of mendex (TeX Live) 3.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1521,7 +1521,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-mendex (TeX Live) configure 3.0
+mendex (TeX Live) configure 3.1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2173,7 +2173,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by mendex (TeX Live) $as_me 3.0, which was
+It was created by mendex (TeX Live) $as_me 3.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -7860,7 +7860,7 @@
 
 # Define the identity of the package.
  PACKAGE='mendex--tex-live-'
- VERSION='3.0'
+ VERSION='3.1'
 
 
 # Some tools Automake needs.
@@ -13460,7 +13460,7 @@
 
 
 
-$as_echo "#define TL_VERSION \"TeX Live 2019\"" >>confdefs.h
+$as_echo "#define TL_VERSION \"TeX Live 2019/dev\"" >>confdefs.h
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if C99 variadic macros are supported" >&5
@@ -13912,7 +13912,7 @@
 Report bugs to <bug-libtool at gnu.org>."
 
 lt_cl_version="\
-mendex (TeX Live) config.lt 3.0
+mendex (TeX Live) config.lt 3.1
 configured by $0, generated by GNU Autoconf 2.69.
 
 Copyright (C) 2011 Free Software Foundation, Inc.
@@ -15521,7 +15521,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by mendex (TeX Live) $as_me 3.0, which was
+This file was extended by mendex (TeX Live) $as_me 3.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -15587,7 +15587,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-mendex (TeX Live) config.status 3.0
+mendex (TeX Live) config.status 3.1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

Modified: trunk/Build/source/texk/mendexk/configure.ac
===================================================================
--- trunk/Build/source/texk/mendexk/configure.ac	2019-02-17 01:18:08 UTC (rev 50037)
+++ trunk/Build/source/texk/mendexk/configure.ac	2019-02-17 01:40:46 UTC (rev 50038)
@@ -6,7 +6,7 @@
 dnl   gives unlimited permission to copy and/or distribute it,
 dnl   with or without modifications, as long as this notice is preserved.
 dnl
-AC_INIT([mendex (TeX Live)], [3.0])
+AC_INIT([mendex (TeX Live)], [3.1])
 AC_PREREQ([2.63])
 AC_CONFIG_SRCDIR([main.c])
 AC_CONFIG_AUX_DIR([../../build-aux])

Modified: trunk/Build/source/texk/mendexk/convert.c
===================================================================
--- trunk/Build/source/texk/mendexk/convert.c	2019-02-17 01:18:08 UTC (rev 50037)
+++ trunk/Build/source/texk/mendexk/convert.c	2019-02-17 01:40:46 UTC (rev 50038)
@@ -14,6 +14,8 @@
 
 #include "kp.h"
 
+#define BUFFERLEN 4096
+
 struct dictionary{
 char* dic[2];
 };
@@ -67,7 +69,7 @@
 {
 	int i,ecount=0;
 	const char *envfile;
-	char buff[4096];
+	char buff[BUFFERLEN];
 	FILE *fp;
 
 	if (filename!=NULL) {
@@ -83,7 +85,7 @@
 		verb_printf(efp,"Scanning dictionary file %s.",filename);
 
 		for (i=0;;i++) {
-			if (mfgets(buff,4095,fp)==NULL) break;
+			if (mfgets(buff,BUFFERLEN-1,fp)==NULL) break;
 			if ((buff[0]=='\r')||(buff[0]=='\n')||(buff[0]=='\0')) i--;
 		}
 		nkf_close(fp);
@@ -199,7 +201,7 @@
 int convert(char *buff1, char *buff2)
 {
 	int i=0,j=0,k,l;
-	char errbuff[4096];
+	char errbuff[BUFFERLEN];
 	int chr,wclen;
 	char buff3[3];
 

Modified: trunk/Build/source/texk/mendexk/fread.c
===================================================================
--- trunk/Build/source/texk/mendexk/fread.c	2019-02-17 01:18:08 UTC (rev 50037)
+++ trunk/Build/source/texk/mendexk/fread.c	2019-02-17 01:40:46 UTC (rev 50038)
@@ -51,7 +51,7 @@
 
 	for (i=start,n=1;;i++,n++) {
 		if (!(i%100))
-			ind=(struct index *)realloc(ind,sizeof(struct index)*(i+100));
+			ind=(struct index *)xrealloc(ind,sizeof(struct index)*(i+100));
 LOOP:
 		ind[i].lnum=n;
 		if (mfgets(buff,sizeof(buff)-1,fp)==NULL) break;
@@ -293,7 +293,7 @@
 						else tmp1=ind[i].idx[m];
 
 						if (ind[l].org[m]!=NULL) tmp2=ind[l].org[m];
-						else tmp2=ind[i].idx[m];
+						else tmp2=ind[l].idx[m];
 
 						verb_printf(efp,"\nWarning: Sort key \"%s\" is different from previous key \"%s\" for same index \"%s\" in %s, line %d.",tmp1, tmp2, ind[i].idx[m], filename,ind[i].lnum);
 						warn++;
@@ -349,11 +349,11 @@
 
 				if (k>ind[l].num) {
 					ind[l].num++;
-					if (!((ind[l].num)%16)) ind[l].p=(struct page *)realloc(ind[l].p,sizeof(struct page)*((int)((ind[l].num)/16)+1)*16);
+					if (!((ind[l].num)%16)) ind[l].p=(struct page *)xrealloc(ind[l].p,sizeof(struct page)*((int)((ind[l].num)/16)+1)*16);
 
-					ind[l].p[ind[l].num].page=xstrdup(table);	
+					ind[l].p[ind[l].num].page=xstrdup(table);
 
-					ind[l].p[ind[l].num].enc=xstrdup(estr);	
+					ind[l].p[ind[l].num].enc=xstrdup(estr);
 					chkpageattr(&ind[l].p[ind[l].num]);
 				}
 			}
@@ -383,8 +383,8 @@
 						nest++;
 					if (buff[j]==arg_close) {
 						if (nest==0) {
-							table[k]='\0';	
-							ind[i].p[0].page=xstrdup(table);	
+							table[k]='\0';
+							ind[i].p[0].page=xstrdup(table);
 							break;
 						}
 						else nest--;
@@ -391,7 +391,7 @@
 					}
 					copy_multibyte_char(buff, table, &j, &k);
 				}
-				ind[l].p[0].enc=xstrdup(estr);	
+				ind[l].p[0].enc=xstrdup(estr);
 				chkpageattr(&ind[i].p[0]);
 			}
 		}

Modified: trunk/Build/source/texk/mendexk/fwrite.c
===================================================================
--- trunk/Build/source/texk/mendexk/fwrite.c	2019-02-17 01:18:08 UTC (rev 50037)
+++ trunk/Build/source/texk/mendexk/fwrite.c	2019-02-17 01:40:46 UTC (rev 50038)
@@ -62,11 +62,11 @@
 		int chr = (unsigned char)a<<8 | (unsigned char)b;
 		chr = (chr==0xffff) ? U_REPLACEMENT_CHARACTER : JIStoUCS2(chr & 0x7f7f);
 		chr = UCStoUTF8(chr);
-		/* if (BYTE1(chr) != 0) str[k++] = BYTE1(chr); */  /* do not happen */
-		if (BYTE2(chr) != 0) str[k++] = BYTE2(chr);
-		if (BYTE3(chr) != 0) str[k++] = BYTE3(chr);
-		                     str[k++] = BYTE4(chr);
-		                     str[k++] = '\0';
+		/* if (BYTE1(chr) != 0){ str[k++] = BYTE1(chr); } */  /* do not happen */
+		if (BYTE2(chr) != 0){ str[k++] = BYTE2(chr); }
+		if (BYTE3(chr) != 0){ str[k++] = BYTE3(chr); }
+		                      str[k++] = BYTE4(chr);
+		                      str[k++] = '\0';
 		fprintf(fp,"%s",str);
 	}
 	else
@@ -97,7 +97,7 @@
     vsnprintf(print_buff, sizeof print_buff, format, argptr);
     va_end(argptr);
 
-    warn++;    
+    warn++;
     fputs(print_buff, stderr);
     if (fp!=stderr) fputs(print_buff, fp);
 }
@@ -195,13 +195,16 @@
 				break;
 
 			case 2:
-				SAPPENDF(lbuff,"%s%s",item_x1,ind[i].idx[1]);
+				SAPPENDF(lbuff,"%s",item_x1);
+				SAPPENDF(lbuff,"%s",ind[i].idx[1]);
 				SAPPENDF(lbuff,"%s",delim_1);
 				break;
 
 			case 3:
-				SAPPENDF(lbuff,"%s%s",item_x1,ind[i].idx[1]);
-				SAPPENDF(lbuff,"%s%s",item_x2,ind[i].idx[2]);
+				SAPPENDF(lbuff,"%s",item_x1);
+				SAPPENDF(lbuff,"%s",ind[i].idx[1]);
+				SAPPENDF(lbuff,"%s",item_x2);
+				SAPPENDF(lbuff,"%s",ind[i].idx[2]);
 				SAPPENDF(lbuff,"%s",delim_2);
 				break;
 
@@ -249,12 +252,16 @@
 
 			switch (ind[i].words) {
 			case 1:
-				SAPPENDF(lbuff,"%s%s%s",item_0,ind[i].idx[0],delim_0);
+				SAPPENDF(lbuff,"%s",item_0);
+				SAPPENDF(lbuff,"%s",ind[i].idx[0]);
+				SAPPENDF(lbuff,"%s",delim_0);
 				break;
 
 			case 2:
 				if (strcmp(ind[i-1].idx[0],ind[i].idx[0])!=0 || strcmp(ind[i-1].dic[0],ind[i].dic[0])!=0) {
-					SAPPENDF(lbuff,"%s%s%s",item_0,ind[i].idx[0],item_x1);
+					SAPPENDF(lbuff,"%s",item_0);
+					SAPPENDF(lbuff,"%s",ind[i].idx[0]);
+					SAPPENDF(lbuff,"%s",item_x1);
 				}
 				else {
 					if (ind[i-1].words==1) {
@@ -270,20 +277,28 @@
 
 			case 3:
 				if (strcmp(ind[i-1].idx[0],ind[i].idx[0])!=0 || strcmp(ind[i-1].dic[0],ind[i].dic[0])!=0) {
-					SAPPENDF(lbuff,"%s%s",item_0,ind[i].idx[0]);
-					SAPPENDF(lbuff,"%s%s%s",item_x1,ind[i].idx[1],item_x2);
+					SAPPENDF(lbuff,"%s",item_0);
+					SAPPENDF(lbuff,"%s",ind[i].idx[0]);
+					SAPPENDF(lbuff,"%s",item_x1);
+					SAPPENDF(lbuff,"%s",ind[i].idx[1]);
+					SAPPENDF(lbuff,"%s",item_x2);
 				}
 				else if (ind[i-1].words==1) {
-					SAPPENDF(lbuff,"%s%s%s",item_01,ind[i].idx[1],item_x2);
+					SAPPENDF(lbuff,"%s",item_01);
+					SAPPENDF(lbuff,"%s",ind[i].idx[1]);
+					SAPPENDF(lbuff,"%s",item_x2);
 				}
 				else if (strcmp(ind[i-1].idx[1],ind[i].idx[1])!=0 || strcmp(ind[i-1].dic[1],ind[i].dic[1])!=0) {
-					if (ind[i-1].words==2) SAPPENDF(lbuff,"%s%s%s",item_1,ind[i].idx[1],item_12);
-					else SAPPENDF(lbuff,"%s%s%s",item_1,ind[i].idx[1],item_x2);
+					SAPPENDF(lbuff,"%s",item_1);
+					SAPPENDF(lbuff,"%s",ind[i].idx[1]);
+					if (ind[i-1].words==2) SAPPENDF(lbuff,"%s",item_12);
+					else                   SAPPENDF(lbuff,"%s",item_x2);
 				}
 				else {
 					SAPPENDF(lbuff,"%s",item_2);
 				}
-				SAPPENDF(lbuff,"%s%s",ind[i].idx[2],delim_2);
+				SAPPENDF(lbuff,"%s",ind[i].idx[2]);
+				SAPPENDF(lbuff,"%s",delim_2);
 				break;
 
 			default:
@@ -323,16 +338,20 @@
 				SPRINTF(buff,"%s%s%s",encap_prefix,ind[num].p[j].enc,encap_infix);
 			}
 			if (strlen(suffix_3p)>0 && (pnumconv(ind[num].p[cc].page,ind[num].p[cc].attr[0])-pnumconv(ind[num].p[j].page,ind[num].p[j].attr[0]))==2) {
-				SAPPENDF(buff,"%s%s",ind[num].p[j].page,suffix_3p);
+				SAPPENDF(buff,"%s",ind[num].p[j].page);
+				SAPPENDF(buff,"%s",suffix_3p);
 			}
 			else if (strlen(suffix_mp)>0 && (pnumconv(ind[num].p[cc].page,ind[num].p[cc].attr[0])-pnumconv(ind[num].p[j].page,ind[num].p[j].attr[0]))>=2) {
-				SAPPENDF(buff,"%s%s",ind[num].p[j].page,suffix_mp);
+				SAPPENDF(buff,"%s",ind[num].p[j].page);
+				SAPPENDF(buff,"%s",suffix_mp);
 			}
 			else if (strlen(suffix_2p)>0 && (pnumconv(ind[num].p[cc].page,ind[num].p[cc].attr[0])-pnumconv(ind[num].p[j].page,ind[num].p[j].attr[0]))==1) {
-				SAPPENDF(buff,"%s%s",ind[num].p[j].page,suffix_2p);
+				SAPPENDF(buff,"%s",ind[num].p[j].page);
+				SAPPENDF(buff,"%s",suffix_2p);
 			}
 			else {
-				SAPPENDF(buff,"%s%s",ind[num].p[j].page,delim_r);
+				SAPPENDF(buff,"%s",ind[num].p[j].page);
+				SAPPENDF(buff,"%s",delim_r);
 				SAPPENDF(buff,"%s",ind[num].p[cc].page);
 			}
 			SAPPENDF(tmpbuff,"%s",buff);
@@ -354,23 +373,32 @@
 /* normal encap */
 			if (ind[num].p[j].enc[0]==range_close) {
 				SPRINTF(errbuff,"Warning: Unmatched range closing operator \'%c\',",range_close);
-				for (i=0;i<ind[num].words;i++) SAPPENDF(errbuff,"%s.",ind[num].idx[i]);
+				for (i=0;i<ind[num].words;i++) {
+					SAPPENDF(errbuff,"%s",ind[num].idx[i]);
+					SAPPENDF(errbuff,".");
+				}
 				warn_printf(efp, "%s\n", errbuff);
 				ind[num].p[j].enc++;
 			}
 			if (strlen(ind[num].p[j].enc)>0) {
-				SAPPENDF(tmpbuff,"%s%s%s",encap_prefix,ind[num].p[j].enc,encap_infix);
-				SAPPENDF(tmpbuff,"%s%s%s",ind[num].p[j].page,encap_suffix,delim_n);
+				SAPPENDF(tmpbuff,"%s",encap_prefix);
+				SAPPENDF(tmpbuff,"%s",ind[num].p[j].enc);
+				SAPPENDF(tmpbuff,"%s",encap_infix);
+				SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
+				SAPPENDF(tmpbuff,"%s",encap_suffix);
+				SAPPENDF(tmpbuff,"%s",delim_n);
 				linecheck(lbuff,tmpbuff);
 			}
 			else {
-				SAPPENDF(tmpbuff,"%s%s",ind[num].p[j].page,delim_n);
+				SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
+				SAPPENDF(tmpbuff,"%s",delim_n);
 				linecheck(lbuff,tmpbuff);
 			}
 		}
 		else {
 /* no encap */
-			SAPPENDF(tmpbuff,"%s%s",ind[num].p[j].page,delim_n);
+			SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
+			SAPPENDF(tmpbuff,"%s",delim_n);
 			linecheck(lbuff,tmpbuff);
 		}
 	}
@@ -377,19 +405,28 @@
 
 	if (ind[num].p[j].enc[0]==range_open) {
 		SPRINTF(errbuff,"Warning: Unmatched range opening operator \'%c\',",range_open);
-		for (k=0;k<ind[num].words;k++) SAPPENDF(errbuff,"%s.",ind[num].idx[k]);
+		for (k=0;k<ind[num].words;k++) {
+			SAPPENDF(errbuff,"%s",ind[num].idx[k]);
+			SAPPENDF(errbuff,".");
+		}
 		warn_printf(efp, "%s\n", errbuff);
 		ind[num].p[j].enc++;
 	}
 	else if (ind[num].p[j].enc[0]==range_close) {
 		SPRINTF(errbuff,"Warning: Unmatched range closing operator \'%c\',",range_close);
-		for (k=0;k<ind[num].words;k++) SAPPENDF(errbuff,"%s.",ind[num].idx[k]);
+		for (k=0;k<ind[num].words;k++) {
+			SAPPENDF(errbuff,"%s",ind[num].idx[k]);
+			SAPPENDF(errbuff,".");
+		}
 		warn_printf(efp, "%s\n", errbuff);
 		ind[num].p[j].enc++;
 	}
 	if (strlen(ind[num].p[j].enc)>0) {
-		SAPPENDF(tmpbuff,"%s%s%s",encap_prefix,ind[num].p[j].enc,encap_infix);
-		SAPPENDF(tmpbuff,"%s%s",ind[num].p[j].page,encap_suffix);
+		SAPPENDF(tmpbuff,"%s",encap_prefix);
+		SAPPENDF(tmpbuff,"%s",ind[num].p[j].enc);
+		SAPPENDF(tmpbuff,"%s",encap_infix);
+		SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
+		SAPPENDF(tmpbuff,"%s",encap_suffix);
 	}
 	else {
 		SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
@@ -410,7 +447,8 @@
 	for (i=count;i<ind.num+1;i++) {
 		if (ind.p[i].enc[0]==range_close) {
 			SPRINTF(errbuff,"Warning: Unmatched range closing operator \'%c\',",range_close);
-			SAPPENDF(errbuff,"%s.",ind.idx[0]);
+			SAPPENDF(errbuff,"%s",ind.idx[0]);
+			SAPPENDF(errbuff,".");
 			warn_printf(efp, "%s\n", errbuff);
 			ind.p[i].enc++;
 		}
@@ -427,13 +465,16 @@
 					}
 					else if (j!=i && ind.p[j].enc[0]==range_open) {
 						SPRINTF(errbuff,"Warning: Unmatched range opening operator \'%c\',",range_open);
-						for (k=0;k<ind.words;k++) SAPPENDF(errbuff,"%s.",ind.idx[k]);
+						for (k=0;k<ind.words;k++) {
+							SAPPENDF(errbuff,"%s",ind.idx[k]);
+							SAPPENDF(errbuff,".");
+						}
 						warn_printf(efp, "%s\n", errbuff);
 						ind.p[j].enc++;
 					}
 					if (strlen(ind.p[j].enc)>0) {
-						SPRINTF(tmpbuff,"%s%s%s",encap_prefix,ind.p[j].enc,encap_infix);
-						SAPPENDF(tmpbuff,"%s%s%s",ind.p[j].page,encap_suffix,delim_n);
+						SPRINTF(tmpbuff,"%s%s%s%s%s%s",encap_prefix,ind.p[j].enc,encap_infix
+						                              ,ind.p[j].page,encap_suffix,delim_n);
 						linecheck(lbuff,tmpbuff);
 					}
 				}
@@ -440,7 +481,10 @@
 			}
 			if (j==ind.num+1) {
 					SPRINTF(errbuff,"Warning: Unmatched range opening operator \'%c\',",range_open);
-					for (k=0;k<ind.words;k++) SAPPENDF(errbuff,"%s.",ind.idx[k]);
+					for (k=0;k<ind.words;k++) {
+						SAPPENDF(errbuff,"%s",ind.idx[k]);
+						SAPPENDF(errbuff,".");
+					}
 					warn_printf(efp, "%s\n", errbuff);
 			}
 			i=j-1;
@@ -472,7 +516,9 @@
 static void linecheck(char *lbuff, char *tmpbuff)
 {
 	if (line_length+strlen(tmpbuff)>line_max) {
-		SAPPENDF(lbuff,"\n%s%s",indent_space,tmpbuff);
+		SAPPENDF(lbuff,"\n");
+		SAPPENDF(lbuff,"%s",indent_space);
+		SAPPENDF(lbuff,"%s",tmpbuff);
 		line_length=indent_length+strlen(tmpbuff);
 		tmpbuff[0]='\0';
 	}
@@ -493,7 +539,7 @@
 			strncpy(buff,lbuff,i+1);
 			buff[i+1]='\0';
 			fputs(buff,fp);
-			strcpy(buff,&lbuff[i+1]);
+			strncpy(buff,&lbuff[i+1],BUFFERLEN-1);
 			strcpy(lbuff,buff);
 			break;
 		}

Modified: trunk/Build/source/texk/mendexk/kp.c
===================================================================
--- trunk/Build/source/texk/mendexk/kp.c	2019-02-17 01:18:08 UTC (rev 50037)
+++ trunk/Build/source/texk/mendexk/kp.c	2019-02-17 01:40:46 UTC (rev 50038)
@@ -13,10 +13,10 @@
  */
 static const char *KP_get_path(const char *var, const char *def_val)
 {
-  char avar[50];
+  char avar[264];
   const char *p;
   strcpy(avar, "${");
-  strcat(avar, var);
+  strncat(avar, var, 260);
   strcat(avar, "}");
   p = kpse_path_expand(avar);
   return (p && *p) ? p : def_val;

Modified: trunk/Build/source/texk/mendexk/main.c
===================================================================
--- trunk/Build/source/texk/mendexk/main.c	2019-02-17 01:18:08 UTC (rev 50037)
+++ trunk/Build/source/texk/mendexk/main.c	2019-02-17 01:40:46 UTC (rev 50038)
@@ -19,7 +19,7 @@
 #endif
 KpathseaSupportInfo kp_ist,kp_dict;
 
-#define VERSION "version 3.0 [15-May-2018]"
+#define VERSION "version 3.1 [17-Feb-2019]"
 
 int main(int argc, char **argv)
 {
@@ -189,7 +189,7 @@
 
 			default:
 				fprintf(stderr,"mendex - Japanese index processor, %s (%s) (%s).\n",VERSION, get_enc_string(), TL_VERSION);
-				fprintf(stderr," Copyright 2009 ASCII MEDIA WORKS.\n");
+				fprintf(stderr," Copyright 2009 ASCII MEDIA WORKS, 2017-2019 Japanese TeX Development Community\n");
 				fprintf(stderr,"usage:\n");
 				fprintf(stderr,"%% mendex [-ilqrcgfEJS"
 #ifdef WIN32
@@ -221,10 +221,8 @@
 			}
 		}
 		else {
-			cc=strlen(argv[i]);
-			if (cc<4) cc+=4;
-			else if (strcmp(&argv[i][cc-4],".idx")) cc+=4;
-			idxfile[j]=xmalloc(cc+1);
+			cc=strlen(argv[i])+6;
+			idxfile[j]=xmalloc(cc);
 			strcpy(idxfile[j++],argv[i]);
 		}
 	}
@@ -294,10 +292,10 @@
 	case 0:
 	case 1:
 		if (gflg==1) {
-			strcpy(atama,akasatana);
+			strncpy(atama,akasatana,2048);
 		}
 		else {
-			strcpy(atama,aiueo);
+			strncpy(atama,aiueo,2048);
 		}
 		break;
 



More information about the tex-live-commits mailing list