- Added 'append' switches and modified gui behaviour correspondingly.

This commit is contained in:
ccremers 2006-12-14 16:28:29 +00:00
parent 8c397d984e
commit 7786e0d65f
4 changed files with 52 additions and 4 deletions

Binary file not shown.

Binary file not shown.

View File

@ -162,7 +162,7 @@ class Scyther(object):
self.cmd = "\"%s\"" % self.program
if self.xml:
self.cmd += " --dot-output --xml-output --plain"
self.cmd += " --errors=%s" % (errorfile.name)
self.cmd += " --append-errors=%s" % (errorfile.name)
self.cmd += " " + self.options
# Start the process, push input, get output
@ -171,6 +171,7 @@ class Scyther(object):
stdin.write(self.spdl)
stdin.close()
output = stdout.read()
stdout.close()
# get errors
# filter out any non-errors (say maybe only claim etc) and count
@ -184,7 +185,6 @@ class Scyther(object):
self.errorcount = len(self.errors)
# close
stdout.close()
errorfile.close()
if self.xml:

View File

@ -1298,13 +1298,61 @@ switcher (const int process, int index, int commandline)
}
}
if (detect (' ', "append-output", 1))
{
if (!process)
{
helptext (" --append-output=<FILE>",
"append output file [stdout]");
}
else
{
// Set output file name
/* try to open */
if (!freopen (arg_pointer, "a", stdout))
{
printfstderr ("Could not create output file '%s'.\n",
arg_pointer);
exit (1);
}
arg_next ();
return index;
}
}
if (detect (' ', "errors", 1))
{
if (!process)
{
if (switches.expert)
{
helptext (" --errors=<FILE>", "append errors to file [stderr]");
helptext (" --errors=<FILE>",
"write errors to file [stderr]");
}
}
else
{
// Set output file name
/* try to open */
if (!freopen (arg_pointer, "w", stderr))
{
printfstderr ("Could not create error file '%s'.\n",
arg_pointer);
exit (1);
}
arg_next ();
return index;
}
}
if (detect (' ', "append-errors", 1))
{
if (!process)
{
if (switches.expert)
{
helptext (" --append-errors=<FILE>",
"append errors to file [stderr]");
}
}
else
@ -1313,7 +1361,7 @@ switcher (const int process, int index, int commandline)
/* try to open */
if (!freopen (arg_pointer, "a", stderr))
{
printfstderr ("Could not create error file '%s'.\n",
printfstderr ("Could not create append error file '%s'.\n",
arg_pointer);
exit (1);
}