Corrected the "save" ("writeall") command, which after the fixes of

the last couple of days, was left in a state where it keeps appending
".mag" to the filename if "save" or "writeall" is executed more than
once in the same edit session.  Also, added ext2sim.sh and ext2spice.sh
to the CLEANS list in tcltk, and added both to .gitignore so they are
not tracked.  Removed them from git to stop the current tracking.
This commit is contained in:
Tim Edwards 2020-03-23 10:19:34 -04:00
parent c2bf9a8fb4
commit 7ec87864a6
6 changed files with 25 additions and 53 deletions

2
.gitignore vendored
View File

@ -25,3 +25,5 @@ tcltk/magic.sh
tcltk/magic.tcl
tcltk/magicdnull
tcltk/magicexec
tcltk/ext2spice.sh
tcltk/ext2sim.sh

View File

@ -1 +1 @@
8.2.200
8.2.201

View File

@ -2709,7 +2709,7 @@ DBCellWrite(cellDef, fileName)
#define NAME_SIZE 1000
char *template = ".XXXXXXX";
char *realname, *tmpname, *expandname;
char *cp1, *cp2;
char *cp1, *cp2, *dotptr;
char expandbuf[NAME_SIZE];
FILE *realf, *tmpf;
int tmpres;
@ -2738,8 +2738,16 @@ DBCellWrite(cellDef, fileName)
cellDef->cd_file = StrDup(&cellDef->cd_file, fileName);
realname = (char *) mallocMagic(strlen(fileName) + strlen(DBSuffix) + 1);
(void) sprintf(realname, "%s%s", fileName, DBSuffix);
/* The cd_file should not have the .mag suffix, but make sure */
/* it doesn't before adding one. */
if (strcmp(fileName + strlen(fileName) - 4, DBSuffix))
{
realname = (char *) mallocMagic(strlen(fileName) + strlen(DBSuffix) + 1);
(void) sprintf(realname, "%s%s", fileName, DBSuffix);
}
else
realname = StrDup((char **)NULL, fileName);
/*
* Expand the filename, removing the leading ~, if any.
@ -2927,13 +2935,21 @@ DBCellWrite(cellDef, fileName)
}
}
/* Copy expandname back to cellDef->cd_file, if the name was changed. */
/* The file extension does not get copied into cd_file. */
dotptr = strrchr(expandname, '.');
if (dotptr) *dotptr = '\0';
if (strcmp(expandname, cellDef->cd_file))
StrDup(&cellDef->cd_file, expandname);
if (dotptr) *dotptr = '.';
/* Everything worked so far. */
(void) StrDup(&cellDef->cd_file, expandname);
result = TRUE;
{
struct stat thestat;
realf = fopen(expandname,"r");
realf = fopen(expandname, "r");
if (realf == NULL)
{
cellDef->cd_flags |= CDMODIFIED;

View File

@ -9,7 +9,7 @@ SRCS = tclmagic.c
include ${MAGICDIR}/defs.mak
DFLAGS += -DMAGIC_DATE="\"`date`\""
CLEANS += magic.sh magic.tcl magicexec magicdnull
CLEANS += magic.sh magic.tcl magicexec magicdnull ext2spice.sh ext2sim.sh
TCL_FILES = \
tkcon.tcl \

View File

@ -1,23 +0,0 @@
#!/bin/sh
#
# Standalone script for ext2sim, for Tcl-based magic 8.0
#
# Parse arguments. "--" separates arguments to magic
# from arguments to ext2sim.
#
mgargs=""
esargs=""
for i in $@; do
case $i in
--) mgargs="$esargs"
esargs="" ;;
*) esargs="$esargs $i" ;;
esac
done
#
eval /usr/local/lib/magic/tcl/magicdnull -dnull -noconsole -nowrapper $mgargs <<EOF
drc off
box 0 0 0 0
ext2sim $esargs
quit -noprompt
EOF

View File

@ -1,23 +0,0 @@
#!/bin/sh
#
# Standalone script for ext2spice, for Tcl-based magic 8.0
#
# Parse arguments. "--" separates arguments to magic
# from arguments to ext2spice.
#
mgargs=""
esargs=""
for i in $@; do
case $i in
--) mgargs="$esargs"
esargs="" ;;
*) esargs="$esargs $i" ;;
esac
done
#
eval /usr/local/lib/magic/tcl/magicdnull -dnull -noconsole -nowrapper $mgargs <<EOF
drc off
box 0 0 0 0
ext2spice $esargs
quit -noprompt
EOF