summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorTakuji Tanaka <ttk@t-lab.opal.ne.jp>2019-02-17 01:40:46 +0000
committerTakuji Tanaka <ttk@t-lab.opal.ne.jp>2019-02-17 01:40:46 +0000
commit7ae2dc4098465935e9b337397aeeee0c108a1815 (patch)
tree2bb9b5dcdc5bfed4a28a0ff2c86176bc4f41d62f /Build
parent7f50dcbc43f22b77b642a09f5c9d9f0fbc176988 (diff)
mendex version 3.1 [17-Feb-2019]
git-svn-id: svn://tug.org/texlive/trunk@50038 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/mendexk/COPYRIGHT3
-rw-r--r--Build/source/texk/mendexk/ChangeLog11
-rwxr-xr-xBuild/source/texk/mendexk/configure24
-rw-r--r--Build/source/texk/mendexk/configure.ac2
-rw-r--r--Build/source/texk/mendexk/convert.c8
-rw-r--r--Build/source/texk/mendexk/fread.c16
-rw-r--r--Build/source/texk/mendexk/fwrite.c120
-rw-r--r--Build/source/texk/mendexk/kp.c4
-rw-r--r--Build/source/texk/mendexk/main.c14
9 files changed, 130 insertions, 72 deletions
diff --git a/Build/source/texk/mendexk/COPYRIGHT b/Build/source/texk/mendexk/COPYRIGHT
index 56649587b02..384c54c9aab 100644
--- a/Build/source/texk/mendexk/COPYRIGHT
+++ b/Build/source/texk/mendexk/COPYRIGHT
@@ -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
diff --git a/Build/source/texk/mendexk/ChangeLog b/Build/source/texk/mendexk/ChangeLog
index f26d2fb9246..93f6da4f95d 100644
--- a/Build/source/texk/mendexk/ChangeLog
+++ b/Build/source/texk/mendexk/ChangeLog
@@ -1,3 +1,14 @@
+2019-02-17 TANAKA Takuji <ttk@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@gmail.com>
* mendex.1, mendex.1.ja: Add fallback TeX and LaTeX logos.
diff --git a/Build/source/texk/mendexk/configure b/Build/source/texk/mendexk/configure
index 03fe300e249..885c8b90f96 100755
--- a/Build/source/texk/mendexk/configure
+++ b/Build/source/texk/mendexk/configure
@@ -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 @@ MAKEFLAGS=
# 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 @@ if test "$ac_init_help" = "long"; then
# 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 @@ fi
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 @@ fi
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 @@ cat >config.log <<_ACEOF
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 @@ fi
# Define the identity of the package.
PACKAGE='mendex--tex-live-'
- VERSION='3.0'
+ VERSION='3.1'
# Some tools Automake needs.
@@ -13460,7 +13460,7 @@ ac_config_headers="$ac_config_headers c-auto.h:c-auto.in"
-$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 @@ Usage: $0 [OPTIONS]
Report bugs to <bug-libtool@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 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# 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 @@ _ACEOF
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\\"
diff --git a/Build/source/texk/mendexk/configure.ac b/Build/source/texk/mendexk/configure.ac
index 1dd2ff618c8..419757084f9 100644
--- a/Build/source/texk/mendexk/configure.ac
+++ b/Build/source/texk/mendexk/configure.ac
@@ -6,7 +6,7 @@ dnl This file is free software; the copyright holder
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])
diff --git a/Build/source/texk/mendexk/convert.c b/Build/source/texk/mendexk/convert.c
index 24aeecd7b1f..ce0f5ba6cbb 100644
--- a/Build/source/texk/mendexk/convert.c
+++ b/Build/source/texk/mendexk/convert.c
@@ -14,6 +14,8 @@
#include "kp.h"
+#define BUFFERLEN 4096
+
struct dictionary{
char* dic[2];
};
@@ -67,7 +69,7 @@ int dicread(const char *filename)
{
int i,ecount=0;
const char *envfile;
- char buff[4096];
+ char buff[BUFFERLEN];
FILE *fp;
if (filename!=NULL) {
@@ -83,7 +85,7 @@ int dicread(const char *filename)
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 @@ static int dcomp(const void *bf1, const void *bf2)
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];
diff --git a/Build/source/texk/mendexk/fread.c b/Build/source/texk/mendexk/fread.c
index 7c624083361..2a5deb2cd91 100644
--- a/Build/source/texk/mendexk/fread.c
+++ b/Build/source/texk/mendexk/fread.c
@@ -51,7 +51,7 @@ int idxread(char *filename, int start)
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 @@ LOOP:
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 @@ LOOP:
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,15 +383,15 @@ LOOP:
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--;
}
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]);
}
}
diff --git a/Build/source/texk/mendexk/fwrite.c b/Build/source/texk/mendexk/fwrite.c
index d413b1d5a7c..2cd0f4bd491 100644
--- a/Build/source/texk/mendexk/fwrite.c
+++ b/Build/source/texk/mendexk/fwrite.c
@@ -62,11 +62,11 @@ static void fprint_euc_char(FILE *fp, const char a, const char b)
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 @@ void warn_printf(FILE *fp, const char *format, ...)
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 @@ void indwrite(char *filename, struct index *ind, int pagenum)
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 @@ void indwrite(char *filename, struct index *ind, int pagenum)
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 @@ void indwrite(char *filename, struct index *ind, int pagenum)
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 @@ static void printpage(struct index *ind, FILE *fp, int num, char *lbuff)
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,42 +373,60 @@ static void printpage(struct index *ind, FILE *fp, int num, char *lbuff)
/* 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);
}
}
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 @@ static int range_check(struct index ind, int count, char *lbuff)
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,20 +465,26 @@ static int range_check(struct index ind, int count, char *lbuff)
}
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);
}
}
}
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 int range_check(struct index ind, int count, char *lbuff)
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 @@ static void crcheck(char *lbuff, FILE *fp)
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;
}
diff --git a/Build/source/texk/mendexk/kp.c b/Build/source/texk/mendexk/kp.c
index c43453f7857..7633f8ebfc4 100644
--- a/Build/source/texk/mendexk/kp.c
+++ b/Build/source/texk/mendexk/kp.c
@@ -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;
diff --git a/Build/source/texk/mendexk/main.c b/Build/source/texk/mendexk/main.c
index 476c0eb5866..ed6d26bda73 100644
--- a/Build/source/texk/mendexk/main.c
+++ b/Build/source/texk/mendexk/main.c
@@ -19,7 +19,7 @@ char *styfile,*idxfile[256],*indfile,*dicfile,*logfile;
#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 @@ int main(int argc, char **argv)
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 @@ int main(int argc, char **argv)
}
}
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 @@ int main(int argc, char **argv)
case 0:
case 1:
if (gflg==1) {
- strcpy(atama,akasatana);
+ strncpy(atama,akasatana,2048);
}
else {
- strcpy(atama,aiueo);
+ strncpy(atama,aiueo,2048);
}
break;