| 2 |
|
patty.cpp - Programmable atom typer. |
| 3 |
|
|
| 4 |
|
Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc. |
| 5 |
< |
Some portions Copyright (C) 2001-2005 by Geoffrey R. Hutchison |
| 5 |
> |
Some portions Copyright (C) 2001-2006 by Geoffrey R. Hutchison |
| 6 |
|
|
| 7 |
|
This file is part of the Open Babel project. |
| 8 |
|
For more information, see <http://openbabel.sourceforge.net/> |
| 68 |
|
vector<string> vs; |
| 69 |
|
char buffer[BUFF_SIZE]; |
| 70 |
|
char tmp_str[BUFF_SIZE]; |
| 71 |
< |
char patty_dir[BUFF_SIZE]; |
| 71 |
> |
string patty_dir; |
| 72 |
|
OBSmartsPattern *sp; |
| 73 |
|
|
| 74 |
|
ifs.open(infile.c_str()); |
| 75 |
|
ifsP= &ifs; |
| 76 |
|
if (!ifs) |
| 77 |
|
{ |
| 78 |
< |
if (getenv("FORCE_PARAM_PATH") == NULL) |
| 78 |
> |
if (getenv("BABEL_DATADIR") == NULL) |
| 79 |
|
{ |
| 80 |
|
#ifdef HAVE_SSTREAM |
| 81 |
|
stringstream errorMsg; |
| 82 |
|
#else |
| 83 |
|
strstream errorMsg; |
| 84 |
|
#endif |
| 85 |
< |
errorMsg << "The FORCE_PARAM_PATH environment variable is not defined" << endl; |
| 85 |
> |
errorMsg << "The BABEL_DATADIR environment variable is not defined" << endl; |
| 86 |
|
errorMsg << "Please define it so the program can find " << infile << endl; |
| 87 |
|
obErrorLog.ThrowError(__func__, errorMsg.str(), obWarning); |
| 88 |
|
// exit(0); |
| 89 |
|
} |
| 90 |
|
else |
| 91 |
< |
strcpy(patty_dir,getenv("FORCE_PARAM_PATH")); |
| 92 |
< |
strcat(patty_dir,FILE_SEP_CHAR); |
| 93 |
< |
strcat(patty_dir,infile.c_str()); |
| 94 |
< |
ifs1.open(patty_dir); |
| 91 |
> |
patty_dir = getenv("BABEL_DATADIR"); |
| 92 |
> |
patty_dir += FILE_SEP_CHAR; |
| 93 |
> |
patty_dir += infile; |
| 94 |
> |
ifs1.open(patty_dir.c_str()); |
| 95 |
|
ifsP= &ifs1; |
| 96 |
|
// if (!ifs1) |
| 97 |
|
// { |
| 118 |
|
tokenize(vs,buffer," \t\n"); |
| 119 |
|
if (vs.size() >= 2) |
| 120 |
|
{ |
| 121 |
< |
strcpy(tmp_str,vs[0].c_str()); |
| 121 |
> |
strncpy(tmp_str,vs[0].c_str(), sizeof(tmp_str) - 1); |
| 122 |
> |
tmp_str[sizeof(tmp_str) - 1] = '\0'; |
| 123 |
|
sp = new OBSmartsPattern; |
| 124 |
|
sp->Init(tmp_str); |
| 125 |
|
_sp.push_back(sp); |
| 146 |
|
tokenize(vs,buffer," \t\n"); |
| 147 |
|
if (vs.size() >= 2) |
| 148 |
|
{ |
| 149 |
< |
strcpy(tmp_str,vs[0].c_str()); |
| 149 |
> |
strncpy(tmp_str,vs[0].c_str(), sizeof(tmp_str) - 1); |
| 150 |
> |
tmp_str[sizeof(tmp_str) - 1] = '\0'; |
| 151 |
|
sp = new OBSmartsPattern; |
| 152 |
|
sp->Init(tmp_str); |
| 153 |
|
_sp.push_back(sp); |