nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] draft validation, error checking


From: David Levine
Subject: Re: [Nmh-workers] draft validation, error checking
Date: Sat, 28 Apr 2012 11:45:44 -0400

Paul wrote:

> is there a way to set up a hook of some sort, either at the whatnow
> level, or deeper in send or post, which will cause forbid sending, or
> cause sending to fail, if a set of user-defined sanity checks
> don't succeed?
>
> i use a wrapper script for my editor in mh, and the script
> prints warnings regarding the draft when the editor exits.

If that script exits with non-zero status, then comp, etc.,
should not send, and terminate with a message.

> it checks for things like a missing To: header at all, or if the
> From: header looks like my home address but the To: header looks
> like a work address -- that sort of thing.  when vi exits,
> and i'm back at whatnow, i get this:
>
>     WARNING:  missing or empty 'To:' header....
>     What now?
>
> and that's great, when i'm fully caffeinated and am actually paying
> attention to what's on the screen.
>
> i'd like to elevate at least some of those warnings to fatal errors --
> i'd like to not be able to send the message until i fix the problem.
>
> how might i do that?

If I understand correctly, you're doing something like:

  comp -editor sanitychecker

where sanitycheck is of the form below.  Or do you get
to whatnow some other way?

David


#! /bin/sh

<sanity checks>

if <sanity checks succeeded>; then
  exec whatnow -editor $EDITOR "$mhdraft"
else
  echo sanity checks failed
  exit 1
fi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]