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

This commit is contained in:
sjplimp
2014-04-04 16:41:55 +00:00
parent ce9b5d2f3f
commit 1c640bebb6

View File

@ -51,6 +51,10 @@
#include "omp.h"
#endif
#ifdef _WIN32
#include <direct.h>
#endif
using namespace LAMMPS_NS;
#define DELTALINE 256
@ -182,7 +186,10 @@ void Input::file()
if (n == 0) {
if (label_active) error->all(FLERR,"Label wasn't found in input script");
if (me == 0) {
if (infile != stdin) fclose(infile);
if (infile != stdin) {
fclose(infile);
infile = NULL;
}
nfile--;
}
MPI_Bcast(&nfile,1,MPI_INT,0,world);
@ -231,11 +238,12 @@ void Input::file(const char *filename)
// error if another nested file still open, should not be possible
// open new filename and set infile, infiles[0], nfile
// call to file() will close filename and decrement nfile
if (me == 0) {
if (nfile > 1)
error->one(FLERR,"Invalid use of library file() function");
if (infile && infile != stdin) fclose(infile);
infile = fopen(filename,"r");
if (infile == NULL) {
char str[128];
@ -815,7 +823,7 @@ void Input::jump()
if (me == 0) {
if (strcmp(arg[0],"SELF") == 0) rewind(infile);
else {
if (infile != stdin) fclose(infile);
if (infile && infile != stdin) fclose(infile);
infile = fopen(arg[0],"r");
if (infile == NULL) {
char str[128];
@ -985,11 +993,14 @@ void Input::shell()
} else if (strcmp(arg[0],"mkdir") == 0) {
if (narg < 2) error->all(FLERR,"Illegal shell mkdir command");
#if !defined(WINDOWS) && !defined(__MINGW32__)
if (me == 0)
for (int i = 1; i < narg; i++)
for (int i = 1; i < narg; i++) {
#if defined(_WIN32)
_mkdir(arg[i]);
#else
mkdir(arg[i], S_IRWXU | S_IRGRP | S_IXGRP);
#endif
}
} else if (strcmp(arg[0],"mv") == 0) {
if (narg != 3) error->all(FLERR,"Illegal shell mv command");