git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10838 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -845,13 +845,21 @@ void Input::label()
|
|||||||
|
|
||||||
void Input::log()
|
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 (me == 0) {
|
||||||
if (logfile) fclose(logfile);
|
if (logfile) fclose(logfile);
|
||||||
if (strcmp(arg[0],"none") == 0) logfile = NULL;
|
if (strcmp(arg[0],"none") == 0) logfile = NULL;
|
||||||
else {
|
else {
|
||||||
logfile = fopen(arg[0],"w");
|
if (appendflag) logfile = fopen(arg[0],"a");
|
||||||
|
else logfile = fopen(arg[0],"w");
|
||||||
|
|
||||||
if (logfile == NULL) {
|
if (logfile == NULL) {
|
||||||
char str[128];
|
char str[128];
|
||||||
sprintf(str,"Cannot open logfile %s",arg[0]);
|
sprintf(str,"Cannot open logfile %s",arg[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user