X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=bfile%2Fmfile.c;h=eccdba2295cf7060e6f25f5de414df7dad1d49ba;hb=392b67432545d96cb2f9b3264a9427582fc1934f;hp=988523111e30c1d49ffc8b8fa0f30da85475b5c8;hpb=ac2780bc12c8c2fce4c5e2bfe4c4dbb58616b8e2;p=idzebra-moved-to-github.git diff --git a/bfile/mfile.c b/bfile/mfile.c index 9885231..eccdba2 100644 --- a/bfile/mfile.c +++ b/bfile/mfile.c @@ -1,10 +1,20 @@ /* - * Copyright (C) 1994-1997, Index Data I/S + * Copyright (C) 1994-1998, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: mfile.c,v $ - * Revision 1.26 1997-10-27 14:25:38 adam + * Revision 1.29 1998-05-27 14:28:34 adam + * Fixed bug in mf_write. 'Cap off' byte written at wrong offset. + * + * Revision 1.28 1998/05/20 10:00:35 adam + * Fixed register spec so that colon isn't treated as size separator + * unless followed by [0-9+-] in order to allow DOS drive specifications. + * + * Revision 1.27 1998/02/10 11:55:07 adam + * Minor changes. + * + * Revision 1.26 1997/10/27 14:25:38 adam * Fixed memory leaks. * * Revision 1.25 1997/09/18 08:59:16 adam @@ -127,8 +137,10 @@ static int scan_areadef(MFile_area ma, const char *name, const char *ad) ad++; if (!*ad) break; - while (*ad && *ad != ':') + while (*ad) { + if (*ad == ':' && strchr ("+-0123456789", ad[1])) + break; if (i < FILENAME_MAX) dirname[i++] = *ad; ad++; @@ -499,8 +511,9 @@ int mf_write(MFile mf, int no, int offset, int num, const void *buf) mf->files[mf->cur_file].path, nblocks); if ((ps = file_position(mf, (mf->cur_file ? mf->files[mf->cur_file-1].top : 0) + - mf->files[mf->cur_file].blocks + nblocks, 0)) < 0) + mf->files[mf->cur_file].blocks + nblocks - 1, 0)) < 0) exit(1); + logf (LOG_DEBUG, "ps = %d", ps); if (write(mf->files[mf->cur_file].fd, &dummych, 1) < 1) { logf (LOG_ERRNO|LOG_FATAL, "write dummy"); @@ -552,7 +565,8 @@ int mf_write(MFile mf, int no, int offset, int num, const void *buf) towrite = num ? num : mf->blocksize; if (write(mf->files[mf->cur_file].fd, buf, towrite) < towrite) { - logf (LOG_FATAL|LOG_ERRNO, "Write failed"); + logf (LOG_FATAL|LOG_ERRNO, "Write failed for file %s part %d", + mf->name, mf->cur_file); exit(1); } return 0;