git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10838 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2013-10-01 13:48:58 +00:00
parent 49550263e2
commit 09d10121a0
1 changed files with 10 additions and 2 deletions

View File

@ -845,13 +845,21 @@ void Input::label()
void Input::log()
{
if (narg != 1) error->all(FLERR,"Illegal log command");
if (narg > 2) error->all(FLERR,"Illegal log command");
int appendflag = 0;
if (narg == 2) {
if (strcmp(arg[1],"append") == 0) appendflag = 1;
else error->all(FLERR,"Illegal log command");
}
if (me == 0) {
if (logfile) fclose(logfile);
if (strcmp(arg[0],"none") == 0) logfile = NULL;
else {
logfile = fopen(arg[0],"w");
if (appendflag) logfile = fopen(arg[0],"a");
else logfile = fopen(arg[0],"w");
if (logfile == NULL) {
char str[128];
sprintf(str,"Cannot open logfile %s",arg[0]);