1 |
// Smersh |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#ifndef _Smersh_hpp_ |
8 |
#define _Smersh_hpp_ |
9 |
|
10 |
#include <iostream> |
11 |
#include <string> |
12 |
#include <sstream> |
13 |
#include <vector> |
14 |
#include <map> |
15 |
#include <algorithm> |
16 |
#include <cctype> |
17 |
|
18 |
using namespace std; |
19 |
|
20 |
#include <menes-ext/casts.hpp> |
21 |
|
22 |
inline string sgetenv(const string& name) |
23 |
{ |
24 |
char* value = getenv(name.c_str()); |
25 |
|
26 |
return value != NULL ? value : ""; |
27 |
} |
28 |
|
29 |
inline int sputenv(const string& env) |
30 |
{ |
31 |
istringstream input(env); |
32 |
string name, value; |
33 |
|
34 |
getline(input, name, '='); |
35 |
getline(input, value); |
36 |
|
37 |
return setenv(name.c_str(), value.c_str(), true); |
38 |
} |
39 |
|
40 |
inline void sunsetenv(const string& name) { unsetenv(name.c_str()); } |
41 |
|
42 |
class Person; |
43 |
|
44 |
class Smersh |
45 |
{ |
46 |
private: |
47 |
multimap<string, string> cgi; |
48 |
void parse(istream& sin); |
49 |
void smersh(ostream& sout); |
50 |
void output(ostream& sout, const vector<Person>& people); |
51 |
public: |
52 |
Smersh(istream& sin = cin, ostream& sout = cout); |
53 |
~Smersh() {} |
54 |
}; |
55 |
|
56 |
#endif // _Smersh_hpp_ |