Skip to content

Commit

Permalink
Merge branch 'mendex-fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
aminophen committed Jun 16, 2021
2 parents c913588 + 9254c05 commit 518774f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
19 changes: 14 additions & 5 deletions source/texk/mendexk/fwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,12 @@ void indwrite(char *filename, struct index *ind, int pagenum)
{
int i,j,hpoint=0;
char datama[2048],lbuff[BUFFERLEN];
FILE *fp;
FILE *fp=NULL;
int conv_euc_to_euc;

if (filename && kpse_out_name_ok(filename)) fp=fopen(filename,"wb");
else {
if (filename && kpse_out_name_ok(filename))
fp=fopen(filename,"wb");
if (fp == NULL) {
fp=stdout;
#ifdef WIN32
setmode(fileno(fp), _O_BINARY);
Expand Down Expand Up @@ -218,7 +219,15 @@ void indwrite(char *filename, struct index *ind, int pagenum)
if ((alphabet(ind[i-1].dic[0][0]))||(japanese(ind[i-1].dic[0]))){
fputs(group_skip,fp);
if (lethead_flag && symbol_flag) {
fprintf(fp,"%s%s%s",lethead_prefix,symbol,lethead_suffix);
if (strlen(symbol)) {
fprintf(fp,"%s%s%s",lethead_prefix,symbol,lethead_suffix);
}
else if (lethead_flag>0) {
fprintf(fp,"%s%s%s",lethead_prefix,symhead_positive,lethead_suffix);
}
else if (lethead_flag<0) {
fprintf(fp,"%s%s%s",lethead_prefix,symhead_negative,lethead_suffix);
}
}
}
}
Expand Down Expand Up @@ -309,7 +318,7 @@ void indwrite(char *filename, struct index *ind, int pagenum)
}
fputs(postamble,fp);

if (filename) fclose(fp);
if (fp!=stdout) fclose(fp);
}

/* write page block */
Expand Down
2 changes: 1 addition & 1 deletion source/texk/mendexk/pageread.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int lastpage(const char *filename)
fp=NULL;
if (fp==NULL) {
fprintf(stderr,"No log file, %s.\n",logfile);
exit(0);
exit(255);
}

while (1) {
Expand Down
2 changes: 1 addition & 1 deletion source/texk/mendexk/styfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void styread(const char *filename)
fp=NULL;
if (fp==NULL) {
fprintf(stderr,"%s does not exist.\n",filename);
exit(0);
exit(255);
}
verb_printf(efp,"Scanning style file %s.",filename);

Expand Down
9 changes: 5 additions & 4 deletions source/texk/upmendex/fwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ void indwrite(char *filename, struct index *ind, int pagenum)
char lbuff[BUFFERLEN],obuff[BUFFERLEN];
UChar datama[256],initial[INITIALLENGTH],initial_prev[INITIALLENGTH];
int chset,chset_prev;
FILE *fp;
FILE *fp=NULL;
UErrorCode perr;

if (filename && kpse_out_name_ok(filename)) fp=fopen(filename,"wb");
else {
if (filename && kpse_out_name_ok(filename))
fp=fopen(filename,"wb");
if (fp == NULL) {
fp=stdout;
#ifdef WIN32
setmode(fileno(fp), _O_BINARY);
Expand Down Expand Up @@ -402,7 +403,7 @@ void indwrite(char *filename, struct index *ind, int pagenum)
}
fputs(postamble,fp);

if (filename) fclose(fp);
if (fp!=stdout) fclose(fp);
}

/* write page block */
Expand Down
2 changes: 1 addition & 1 deletion source/texk/upmendex/pageread.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int lastpage(const char *filename)
fp=NULL;
if (fp==NULL) {
fprintf(stderr,"No log file, %s.\n",logfile);
exit(0);
exit(255);
}

while (1) {
Expand Down
2 changes: 1 addition & 1 deletion source/texk/upmendex/styfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void styread(const char *filename)
fp=NULL;
if (fp==NULL) {
fprintf(stderr,"%s does not exist.\n",filename);
exit(0);
exit(255);
}
verb_printf(efp,"Scanning style file %s.",filename);

Expand Down

0 comments on commit 518774f

Please sign in to comment.