One more change to add back the .mag extension when writing the

file from the contents of def->cd_file.
This commit is contained in:
Tim Edwards 2020-03-21 15:34:41 -04:00
parent 276bf1d78a
commit ae6b627df7
1 changed files with 16 additions and 20 deletions

View File

@ -2721,10 +2721,15 @@ DBCellWrite(cellDef, fileName)
/*
* Figure out the name of the file we will eventually write.
*/
if (fileName)
if (!fileName)
{
realname = (char *) mallocMagic(strlen(fileName) + strlen(DBSuffix) + 1);
(void) sprintf(realname, "%s%s", fileName, DBSuffix);
if (cellDef->cd_file)
fileName = cellDef->cd_file;
else if (cellDef->cd_name)
fileName = cellDef->cd_name;
else
return FALSE;
}
/* Bug fix: 7/17/99, Michael D. Godfrey: Forces */
/* cd_name and cd_file to ALWAYS be the same, otherwise ugly */
@ -2732,18 +2737,9 @@ DBCellWrite(cellDef, fileName)
/* filename. */
cellDef->cd_file = StrDup(&cellDef->cd_file, fileName);
}
else if (cellDef->cd_file)
{
realname = StrDup((char **) NULL, cellDef->cd_file);
}
else if (cellDef->cd_name)
{
realname = (char *) mallocMagic((unsigned) (strlen(cellDef->cd_name)
+ strlen(DBSuffix) + 1));
(void) sprintf(realname, "%s%s", cellDef->cd_name, DBSuffix);
}
else return (FALSE);
realname = (char *) mallocMagic(strlen(fileName) + strlen(DBSuffix) + 1);
(void) sprintf(realname, "%s%s", fileName, DBSuffix);
/*
* Expand the filename, removing the leading ~, if any.