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
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

View File

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