-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeneral.cpp
More file actions
36 lines (26 loc) · 749 Bytes
/
general.cpp
File metadata and controls
36 lines (26 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// $Id: general.cpp,v 1.5 2015-07-08 12:32:13-07 - - $
#include <cstring>
#include <libgen.h>
using namespace std;
#include "general.h"
ydc_exn::ydc_exn (const string& what): runtime_error (what) {
}
string exec::execname_; // Must be initialized from main().
int exec::status_ = EXIT_SUCCESS;
void exec::execname (const string& argv0) {
execname_ = basename (const_cast<char *>(argv0.c_str()));
cout << boolalpha;
cerr << boolalpha;
DEBUGF ('Y', "execname = " << execname_ );
}
void exec::status (int new_status) {
new_status &= 0xFF;
if (status_ < new_status) status_ = new_status;
}
ostream& note() {
return cerr << exec::execname() << ": ";
}
ostream& error() {
exec::status (EXIT_FAILURE);
return note();
}