summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-07-19 14:56:22 -0700
committerJohn Denker <jsd@av8n.com>2012-07-29 15:32:33 -0700
commita356f2e89ba2bc25207f2d9605a1d6bcca15d6d7 (patch)
tree8c351a7dae90d847c6fffa9a3b33f88e2223b6b6
parent8fe5ccdb4ee79b4d287b82e80004e1acc9ee4b94 (diff)
log some interesting variables
-rw-r--r--tools/hi-q.c19
-rw-r--r--tools/hi-test.c11
-rw-r--r--tools/makefile5
3 files changed, 28 insertions, 7 deletions
diff --git a/tools/hi-q.c b/tools/hi-q.c
index 6140206..2ddc448 100644
--- a/tools/hi-q.c
+++ b/tools/hi-q.c
@@ -120,11 +120,16 @@ void usage() {
// we have data coming in on fd 0.
// and envelope / control information coming in on fd 1.
+string progname;
+pid_t mypid;
+
void dump(const string var){
char* str = getenv(var.c_str());
- if (str) cerr << "hi-q: " << var
- << " is set to '" << str << "'" << endl;
- else cerr << "hi-q: " << var << " is not set." << endl;
+ cerr << progname
+ << "[" << mypid << "] "
+ << var;
+ if (str) cerr << " is set to '" << str << "'" << endl;
+ else cerr << " is not set." << endl;
}
int xclose(int arg){
@@ -149,7 +154,7 @@ public:
: mode(fail), cmd(_cmd){
setmode(_mode);
}
-
+
jobber()
: mode(fail), cmd(0)
{}
@@ -168,6 +173,10 @@ public:
};
int main(int argc, char** argv) {
+ progname = *argv;
+ mypid = getpid();
+ dump("TCPREMOTEIP");
+ dump("TCPREMOTEHOST");
int verbose(0);
int kidstatus;
@@ -534,7 +543,7 @@ int main(int argc, char** argv) {
int sts = WEXITSTATUS(kidstatus);
cerr << "hi-q says: qq program " << kidpid[nkids-1]
<< " i.e. '" << filter[nkids-1].cmd[0] << "'"
- << " returned status " << sts
+ << " returned status " << sts
<< endl;
return sts;
} else if (WIFSIGNALED(kidstatus)) {
diff --git a/tools/hi-test.c b/tools/hi-test.c
index 0c9a35f..47128a9 100644
--- a/tools/hi-test.c
+++ b/tools/hi-test.c
@@ -41,13 +41,22 @@ void exeunt(const int sts){
using namespace std;
+string progname;
+
+void dump(const string var){
+ char* str = getenv(var.c_str());
+ cerr << progname << ": " << var;
+ if (str) cerr << " is set to '" << str << "'" << endl;
+ else cerr << " is not set." << endl;
+}
+
int main(int _argc, const char** _argv){
int snooze(0);
int status(0);
int killmode(0);
int argc(_argc);
const char **argv(_argv);
- string progname(*argv); argv++; argc--;
+ progname = *argv; argv++; argc--;
while (argc) {
string arg(*argv); argv++; argc--;
diff --git a/tools/makefile b/tools/makefile
index bb91f37..04b9d21 100644
--- a/tools/makefile
+++ b/tools/makefile
@@ -6,7 +6,7 @@ CC= /usr/bin/g++ -Wall -g -I $(HOME)/lib/include
.PHONY : shipit clean list-src ALWAYS foo dirs setup imgs \
- zip wc html all hacha hevea tcprules
+ zip wc html all hacha hevea tcprules logmark
.SECONDARY : # do not remove any intermediate files
@@ -37,6 +37,9 @@ install:
/etc/tcpserver/smtp.rules :
./mk_smtp_rules $@
+logmark:
+ logger -t jsd -p mail.info =========================
+
ALWAYS:
@echo ...