Article View: comp.mail.sendmail
Article #3199Re: debugging output
From: Bob Page
Date: Thu, 16 Feb 1989 19:07
Date: Thu, 16 Feb 1989 19:07
141 lines
4218 bytes
4218 bytes
reeder@ut-emx.UUCP (William P. Reeder) wrote:
>don't you think "^P" "<@" "^Q" ">" is even worse?
Three existing solutions (that I know of), take your pick:
1. Install the IDA patches. Among the patches are routines to do this.
2. Use this script to do your debugging (this came across the net some
time ago; sorry I don't remember who provided it):
#! /bin/sh
#
# This shell script runs sendmail in address test mode and converts the
# debugging output to something more intelligible for helping debug sendmail.cf
# files.
#
# Pass the config file to use as $1
#
# Enter input of the form (same as for "sendmail -bt"):
#
# 0 address1
# 0 address2
# ...
# (eof)
#
#
/usr/lib/sendmail -bt -C$1 -d21.12 |\
grep -v -e '----- rule fails' |\
sed -e 's/-----trying rule:/R/' \
-e 's/"^P"/$*/g' \
-e 's/"^Q"/$+/g' \
-e 's/"^R"/$-/g' \
-e 's/"^S\([A-Za-z]\)"/$=\1/g' \
-e 's/"^T\([0-9]\)"/$\1/g' \
-e 's/"^U"/$#/' \
-e 's/"^V"/$\&/g' \
-e 's/"^W"/$:/g' \
-e 's/"^X"/$>/g' \
-e 's/"//g' |\
sed -e '/^R/s/[ ]//g' \
-e '/matches:/s/[ ]//g' -e 's/rulematches:/rule matches: /' \
-e '/rewritten as:/s/[ ]//g' -e 's/rewrittenas:/rewritten as: /' \
-e '/returns:/s/[ ]//g' \
-e 's/.*ruleset\([0-9]\)returns:/ruleset \1 returns: /' \
-e '/input:/s/[ ]//g' \
-e 's/.*ruleset\(.*\)input:/ruleset \1 input: /'
3. Install these changes in util.c:xputs(). You'll have to do it by
hand; I have too many changes to too many versions to be able to
produce a usable context diff. Again, I don't remember the original
author of these changes.
Change:
}
if (c < 040 || c >= 0177)
{
! (void) putchar('^');
c ^= 0100;
}
(void) putchar(c);
To:
}
if (c < 040 || c >= 0177)
{
! switch (c) {
! case MATCHZANY: /* match zero or more tokens */
! fputs("$*", stdout);
! continue;
! break;
! case MATCHANY: /* match one or more tokens */
! fputs("$+", stdout);
! continue;
! break;
! case MATCHONE: /* match exactly one token */
! fputs("$-", stdout);
! continue;
! break;
! case MATCHCLASS:/* match one token in a class */
! fputs("$=", stdout);
! continue;
! break;
! case MATCHNCLASS:/* match anything not in class */
! fputs("$~", stdout);
! continue;
! break;
! case MATCHREPL: /* replacement on RHS for above */
! fputs("$", stdout);
! continue;
! break;
! case CANONNET: /* canonical net, next token */
! fputs("$#", stdout);
! continue;
! break;
! case CANONHOST: /* canonical host, next token */
! fputs("$@", stdout);
! continue;
! break;
! case CANONUSER: /* canonical user, next N tokens */
! fputs("$:", stdout);
! continue;
! break;
! case CALLSUBR: /* call another rewriting set */
! fputs("$>", stdout);
! continue;
! break;
! case CONDIF: /* conditional if-then */
! fputs("$?", stdout);
! continue;
! break;
! case CONDELSE: /* conditional else */
! fputs("$|", stdout);
! continue;
! break;
! case CONDFI: /* conditional fi */
! fputs("$.", stdout);
! continue;
! break;
! case HOSTBEGIN: /* hostname lookup begin */
! fputs("$[", stdout);
! continue;
! break;
! case HOSTEND: /* hostname lookup end */
! fputs("$]", stdout);
! continue;
! break;
! }
! putchar('^');
c ^= 0100;
}
(void) putchar(c);
Happy sendmail debugging, if that isn't an oxymoron.
..Bob
--
Bob Page, U of Lowell CS Dept. page@swan.ulowell.edu ulowell!page
Have five nice days.
Technical Details
Message-ID:
<11751@swan.ulowell.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ulowell!pageReferences:
<10539@ut-emx.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ulowell!page From: page@swan.ulowell.edu (Bob Page) Newsgroups: comp.mail.sendmail Subject: Re: debugging output Keywords: util.c xputs() patch IDA shell script Message-ID: <11751@swan.ulowell.edu> Date: 16 Feb 89 19:07:09 GMT References: <10539@ut-emx.UUCP> Reply-To: page@swan.ulowell.edu (Bob Page) Organization: University of Lowell, Computer Science Dept. Lines: 141