23 |
|
|
24 |
|
using namespace std; |
25 |
|
|
26 |
– |
inline string sgetenv(const string& name) |
27 |
– |
{ |
28 |
– |
char* value = getenv(name.c_str()); |
29 |
– |
|
30 |
– |
return value != NULL ? value : ""; |
31 |
– |
} |
32 |
– |
|
33 |
– |
inline int ssetenv(const string& name, const string& value, bool write = true) |
34 |
– |
{ |
35 |
– |
return setenv(name.c_str(), value.c_str(), write); |
36 |
– |
} |
37 |
– |
|
38 |
– |
inline int sputenv(const string& env) |
39 |
– |
{ |
40 |
– |
istringstream input(env); |
41 |
– |
string name, value; |
42 |
– |
|
43 |
– |
getline(input, name, '='); |
44 |
– |
getline(input, value); |
45 |
– |
|
46 |
– |
return ssetenv(name, value); |
47 |
– |
} |
48 |
– |
|
49 |
– |
inline void sunsetenv(const string& name) { unsetenv(name.c_str()); } |
50 |
– |
|
26 |
|
extern string program; |
27 |
|
extern bool debug; |
28 |
|
|
29 |
+ |
#include "Environment.hpp" |
30 |
+ |
|
31 |
|
class Person; |
32 |
|
|
33 |
|
class Smersh |
34 |
|
{ |
35 |
|
private: |
36 |
+ |
static Environment env; |
37 |
|
multimap<string, string> cgi; |
38 |
< |
void parse(istream& sin); |
38 |
> |
void parse(istream& sin, Environment env); |
39 |
|
void smersh(ostream& sout); |
40 |
|
void output(ostream& sout, const vector<Person>& people); |
41 |
|
public: |
42 |
< |
Smersh(istream& sin = cin, ostream& sout = cout); |
42 |
> |
Smersh(istream& sin = cin, ostream& sout = cout, Environment env = env); |
43 |
|
~Smersh() {} |
44 |
|
}; |
45 |
|
|