diff options
author | Takuji Tanaka <KXD02663@nifty.ne.jp> | 2015-08-22 23:46:15 +0000 |
---|---|---|
committer | Takuji Tanaka <KXD02663@nifty.ne.jp> | 2015-08-22 23:46:15 +0000 |
commit | 33cd848ea44cb75a693076f64008c583ae210549 (patch) | |
tree | 0c4b01a2743f18e3a576ea22399935f88547d128 /Build/source/texk/mendexk/main.c | |
parent | c156527946fa71c1f610e139263c08b926552028 (diff) |
texk/mendexk: Accept long file name for .log, .ind
git-svn-id: svn://tug.org/texlive/trunk@38182 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/mendexk/main.c')
-rw-r--r-- | Build/source/texk/mendexk/main.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Build/source/texk/mendexk/main.c b/Build/source/texk/mendexk/main.c index 5b9feca6266..3790a79b0cd 100644 --- a/Build/source/texk/mendexk/main.c +++ b/Build/source/texk/mendexk/main.c @@ -8,7 +8,7 @@ #include "kp.h" -char *styfile,*idxfile[256],indfile[256],*dicfile,logfile[256]; +char *styfile,*idxfile[256],*indfile,*dicfile,*logfile; /* default paths */ #ifndef DEFAULT_INDEXSTYLES @@ -64,7 +64,7 @@ int main(int argc, char **argv) /* check options */ - for (i=1,j=0;i<argc;i++) { + for (i=1,j=0;i<argc && j<256;i++) { if ((argv[i][0]=='-')&&(strlen(argv[i])>=2)&&chkopt) { switch (argv[i][1]) { case 'c': @@ -98,10 +98,10 @@ int main(int argc, char **argv) case 'o': if ((argv[i][2]=='\0')&&(i+1<argc)) { - strcpy(indfile,argv[++i]); + indfile=xstrdup(argv[++i]); } else { - strcpy(indfile,&argv[i][2]); + indfile=xstrdup(&argv[i][2]); } break; @@ -133,10 +133,10 @@ int main(int argc, char **argv) case 't': if ((argv[i][2]=='\0')&&(i+1<argc)) { - strcpy(logfile,argv[++i]); + logfile=xstrdup(argv[++i]); } else { - strcpy(logfile,&argv[i][2]); + logfile=xstrdup(&argv[i][2]); } break; @@ -255,7 +255,8 @@ int main(int argc, char **argv) if (styfile!=NULL) styread(styfile); - if ((indfile[0]=='\0')&&(idxcount-fsti>0)) { + if (!indfile &&(idxcount-fsti>0)) { + indfile=xmalloc(strlen(idxfile[0]+6)); for (i=strlen(idxfile[0]);i>=0;i--) { if (idxfile[0][i]=='.') { strncpy(indfile,idxfile[0],i); @@ -266,7 +267,8 @@ int main(int argc, char **argv) if (i==-1) sprintf(indfile,"%s.ind",idxfile[0]); } - if ((logfile[0] == '\0') && (idxcount-fsti > 0)) { + if (!logfile && (idxcount-fsti > 0)) { + logfile=xmalloc(strlen(idxfile[0]+6)); for (i=strlen(idxfile[0]);i>=0;i--) { if (idxfile[0][i]=='.') { strncpy(logfile,idxfile[0],i); |