bug fix, preserve filename case for `codemodel', `load' and `use'

reported and fixed by Emil Lambrache on the bug tracker
http://sourceforge.net/p/ngspice/bugs/241/
  "#241 case sensitivity not preserved for file names"
This commit is contained in:
rlar 2013-04-23 18:43:56 +02:00
parent caf9a9abe7
commit dc0fbe4220
1 changed files with 16 additions and 3 deletions

View File

@ -617,10 +617,23 @@ inp_readall(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile
/* loop through 'buffer' until end is reached. Then test for
premature end. If premature end is reached, spew
error and zap the line. */
if (!ciprefix("write", buffer)) { // exclude 'write' command so filename case preserved
{
char *s;
for (s = buffer; *s && (*s != '\n'); s++)
*s = (char) tolower(*s);
if ( !ciprefix("write", buffer) &&
!ciprefix("codemodel", buffer) &&
!ciprefix("use", buffer) &&
!ciprefix("load", buffer)
)
{
for (s = buffer; *s && (*s != '\n'); s++)
*s = (char) tolower(*s);
} else {
// exclude some commands to preserve filename case
for (s = buffer; *s && (*s != '\n'); s++)
;
}
if (!*s) {
// fprintf(cp_err, "Warning: premature EOF\n");
}