summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2012-07-19 21:56:22 (GMT)
committerJohn Denker <jsd@av8n.com>2012-07-19 21:56:22 (GMT)
commit067dd9a68045bf775e02a47fbf663b73c6d28901 (patch)
tree1eacaebd7eb595bfcafb2c447eb1607d274a550c
parent6710e3d72bfa36de6ef0cfb0bdd9623c65ebc40f (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 ...