Fixed missing EOF in mbdiff

This commit is contained in:
Michiel Broek 2004-10-15 20:50:50 +00:00
parent 24da93970a
commit 503a79bc53
2 changed files with 98 additions and 103 deletions

View File

@ -12,6 +12,9 @@ v0.61.5 25-Sep-2004
In user setup, if user gets a new security level, his timelimit In user setup, if user gets a new security level, his timelimit
is updated with your permission. is updated with your permission.
mbdiff:
Added EOF character as last character in the new created list.
v0.61.4 11-Aug-2004 - 25-Sep-2004 v0.61.4 11-Aug-2004 - 25-Sep-2004

View File

@ -456,14 +456,9 @@ void Help(void)
int apply(char *nl, char *nd, char *nn) int apply(char *nl, char *nd, char *nn)
{ {
FILE *fo, *fd, *fn; FILE *fo, *fd, *fn;
unsigned char cmdbuf[BLKSIZ]; unsigned char cmdbuf[BLKSIZ], lnbuf[BLKSIZ], *p;
unsigned char lnbuf[BLKSIZ]; int i, count, ac = 0, cc = 0, dc = 0, rc = 0, firstline = 1;
int i, count;
int ac = 0, cc = 0, dc = 0;
int rc = 0;
int firstline = 1;
unsigned short theircrc = 0, mycrc = 0; unsigned short theircrc = 0, mycrc = 0;
unsigned char *p;
if ((fo = fopen(nl, "r")) == NULL) { if ((fo = fopen(nl, "r")) == NULL) {
WriteError("$Can't open %s", nl); WriteError("$Can't open %s", nl);
@ -491,13 +486,11 @@ int apply(char *nl, char *nd, char *nn)
rewind(fo); rewind(fo);
rewind(fd); rewind(fd);
while ((rc == 0) && fgets(cmdbuf, sizeof(cmdbuf)-1, fd)) while ((rc == 0) && fgets(cmdbuf, sizeof(cmdbuf)-1, fd)) {
switch (cmdbuf[0]) { switch (cmdbuf[0]) {
case ';': case ';': Striplf(cmdbuf);
Striplf(cmdbuf);
break; break;
case 'A': case 'A': count = atoi(cmdbuf+1);
count = atoi(cmdbuf+1);
ac += count; ac += count;
Striplf(cmdbuf); Striplf(cmdbuf);
for (i = 0;(i < count) && (rc == 0); i++) for (i = 0;(i < count) && (rc == 0); i++)
@ -515,16 +508,14 @@ int apply(char *nl, char *nd, char *nn)
} else } else
rc = 3; rc = 3;
break; break;
case 'D': case 'D': count = atoi(cmdbuf + 1);
count = atoi(cmdbuf + 1);
dc += count; dc += count;
Striplf(cmdbuf); Striplf(cmdbuf);
for (i = 0;(i < count) && (rc == 0); i++) for (i = 0;(i < count) && (rc == 0); i++)
if (fgets(lnbuf, sizeof(lnbuf)-1, fo) == NULL) if (fgets(lnbuf, sizeof(lnbuf)-1, fo) == NULL)
rc = 3; rc = 3;
break; break;
case 'C': case 'C': count = atoi(cmdbuf+1);
count = atoi(cmdbuf+1);
cc += count; cc += count;
Striplf(cmdbuf); Striplf(cmdbuf);
for (i = 0; (i < count) && (rc == 0); i++) for (i = 0; (i < count) && (rc == 0); i++)
@ -535,14 +526,15 @@ int apply(char *nl, char *nd, char *nn)
} else } else
rc = 3; rc = 3;
break; break;
default: default: rc = 5;
rc = 5;
break; break;
} }
} }
}
fclose(fo); fclose(fo);
fclose(fd); fclose(fd);
fputc('\012', fn);
fclose(fn); fclose(fn);
if ((rc != 0) && !do_quiet) { if ((rc != 0) && !do_quiet) {