From 2ea78688f2a8189cad8766df4859e2dad8d14486 Mon Sep 17 00:00:00 2001 From: John Denker Date: Sat, 14 Jul 2012 14:28:06 -0700 Subject: make 64-bit clean; add some progress messages --- tools/hi-q.c | 13 ++++++++++--- tools/skrewt.c | 9 ++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tools/hi-q.c b/tools/hi-q.c index 32b0a7b..8f0fb93 100644 --- a/tools/hi-q.c +++ b/tools/hi-q.c @@ -327,12 +327,14 @@ int main(int argc, char** argv, char const * const * env) { //xx fprintf(stderr, "slurping %d %d\n", 1, loose_end); -// All is well. +// All filters agree this is not spam. // Now it is safe to transfer the envelope information: slurp(1, loose_end); close(1); close(loose_end); +// now that the envelope information has been transfered, +// wait for the last kid in the usual way { int ii = nkids-1; @@ -342,12 +344,17 @@ fprintf(stderr, "About to wait for kid #%d (%d)\n", blurb(nkids-1, kidpid); #endif somekid = waitpid(kidpid[ii], &kidstatus, WUNTRACED); - if (WIFEXITED(kidstatus)) return WEXITSTATUS(kidstatus); + if (WIFEXITED(kidstatus)) { + int sts = WEXITSTATUS(kidstatus); + cerr << "hi-q ends with status: " << sts << endl; + return sts; + } } #ifdef testing sleep(1); #endif - return ex_syserr; // any kill, not a normal exit +// the last kid did not exit but was killed: + return ex_syserr; } diff --git a/tools/skrewt.c b/tools/skrewt.c index 117981b..da0ed64 100644 --- a/tools/skrewt.c +++ b/tools/skrewt.c @@ -84,13 +84,11 @@ string toLower(const std::string& a){ string ltrim(string foo){ - unsigned where = foo.find_first_not_of(" \t\r\n"); + size_t where = foo.find_first_not_of(" \t\r\n"); if (where == foo.npos) return foo; return foo.substr(where); } - - int main(int argc, char** argv){ if (argc > 1) { if (argv[1] == string("-h")) usage(0); @@ -129,7 +127,7 @@ int main(int argc, char** argv){ else { string headword; string rest; - unsigned int where = header.find(":"); + size_t where = header.find(":"); if (where != string::npos) { headword = header.substr(0, where); rest = ltrim(header.substr(1+where)); @@ -137,7 +135,7 @@ int main(int argc, char** argv){ headword = toLower(headword); if (headword == "content-type") { string the_type = rest; - unsigned int where = the_type.find_first_of(" \t;\n"); + size_t where = the_type.find_first_of(" \t;\n"); if (where == string::npos) { /* do nothing */ } @@ -194,5 +192,6 @@ int main(int argc, char** argv){ cerr << "skrewt rejection: no text" << endl; exit(1); } + cerr << "skrewt normal completion" << endl; return 0; } -- cgit v1.2.3