test/inc/test-deb359167 test/inc/test-eom-align \
test/inc/test-inc-scanout test/inc/test-msgchk \
test/inc/test-pop \
- test/install-mh/test-install-mh \
+ test/install-mh/test-install-mh test/install-mh/test-version-check \
test/locking/test-datalocking test/locking/test-spoollocking \
test/manpages/test-manpages \
test/mhbuild/test-attach \
- Support for SMTPUTF8 (RFC 6531) has been added. mhshow(1) already supported
RFC 6532, assuming all 8-bit message header field bodies are UTF-8 and use
of a UTF-8 locale.
+- Added welcome message when nmh detects that its version changed.
-----------------
OBSOLETE FEATURES
* Returns 1 if the string contains an 8-bit character, 0 if it does not.
*/
int contains8bit(const char *start, const char *end);
+
+/*
+ * Check to see if the user is running a different version of nmh
+ * than they had last run, and notify them if so. But only if
+ * they seem to be running an interactive program.
+ * Returns 1 if they are, 0 if they are not.
+ */
+int nmh_version_changed ();
*/
static const char nmh_intro1[] = \
-"Send bug reports, questions, suggestions, and patches to nmh-\n"
-"workers@nongnu.org. That mailing list is relatively quiet, so user\n"
+"Send bug reports, questions, suggestions, and patches to\n"
+"nmh-workers@nongnu.org. That mailing list is relatively quiet, so user\n"
"questions are encouraged. Users are also encouraged to subscribe, and\n"
"view the archives, at https://lists.gnu.org/mailman/listinfo/nmh-\n"
"workers .\n";
/* sbr/m_mktemp.c */
extern void remove_registered_files_atexit();
+extern char *mhdocdir;
/*
* We allocate space for messages (msgs array)
admonish("atexit", "unable to register atexit function");
}
+ /* Read context, if supposed to. */
if (read_context) {
context_read();
+
+ /* Check to see if the user is running a different version of nmh
+ than they had last run, and notify them if so. But only if
+ they seem to be running an interactive program. */
+ if (isatty (fileno (stdin)) && isatty (fileno (stdout)) &&
+ strcmp (invo_name, "ap") &&
+ strcmp (invo_name, "dp") &&
+ strcmp (invo_name, "fmtdump") &&
+ strcmp (invo_name, "install-mh") &&
+ strcmp (invo_name, "mhbuild") &&
+ strcmp (invo_name, "mhfixmsg") &&
+ strcmp (invo_name, "mhl") &&
+ strcmp (invo_name, "mhparam") &&
+ strcmp (invo_name, "mhpath") &&
+ strcmp (invo_name, "mkstemp") &&
+ strcmp (invo_name, "post") &&
+ strcmp (invo_name, "prompter") &&
+ strncmp (invo_name, "rcv", 3) &&
+ strcmp (invo_name, "slocal") &&
+ strcmp (invo_name, "viamail") &&
+ strcmp (invo_name, "whatnow") &&
+ strcmp (invo_name, "whom")) {
+
+ if (nmh_version_changed ()) {
+ fprintf (stderr, "==========================================="
+ "============================\n");
+ fprintf (stderr, "Welcome to nmh version %s\n\n", VERSION);
+ fprintf (stderr, "See the release notes in %s/NEWS .\n\n",
+ mhdocdir);
+ print_intro (stderr, 1);
+ fprintf (stderr, "\nThis message will not be repeated until "
+ "nmh is next updated.\n");
+ fprintf (stderr, "==========================================="
+ "============================\n\n\n");
+ }
+ }
+
return OK;
} else {
int status = context_foil(NULL);
}
+/*
+ * Check stored version, and if out-of-date or non-existent, notify the user
+ * and update.
+ */
+int
+nmh_version_changed () {
+ const char *const old_version = context_find("Version");
+
+ /* mhparam version includes the nmh- prefix, so be consistent with that. */
+ if (old_version == NULL || strcmp(old_version, "nmh-" VERSION) != 0) {
+ context_replace ("Version", "nmh-" VERSION);
+
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+
/* Returns copy of argument str with all characters converted to upper
case, and trimmed whitespace (see cpytrim()) . */
char *
whomproc: ${MH_INST_DIR}${bindir}/whom
#: incproc and packproc are defined in config.c but not used by any code.
EOF
- #### Suppress warnings about a new version.
- printf '%s\n' ${MH_VERSION} > ${MH_TEST_DIR}/Mail/VERSION
if test -z '@nmhetcdirinst@'; then
#### This isn't used with make distcheck, so that we can use it to
fi
folder -create +inbox > /dev/null
+ #### Suppress warnings about a new version.
+ #### mhparam version includes the nmh- prefix, so be consistent with that.
+ printf 'Version: nmh-%s\n' "${MH_VERSION}" >> "${MH_TEST_DIR}"/Mail/context
+
# create 10 basic messages
for i in 1 2 3 4 5 6 7 8 9 10;
do
--- /dev/null
+#!/bin/sh
+######################################################
+#
+# Test display of new version welcome message. This
+# doesn't really belong in install-mh.
+#
+######################################################
+
+set -e
+
+if test -z "${MH_OBJ_DIR}"; then
+ srcdir=`dirname $0`/../..
+ MH_OBJ_DIR=`cd $srcdir && pwd`; export MH_OBJ_DIR
+fi
+
+. "${MH_OBJ_DIR}/test/common.sh"
+
+setup_test
+
+require_prog script
+
+actual="$MH_TEST_DIR/test-version-check$$.actual"
+context="${MH_TEST_DIR}"/Mail/context
+
+
+start_test 'with welcome message'
+# Removing Version will trigger the welcome message.
+grep -v Version "$context" > "$context.NEW"
+mv -f "$context.NEW" "$context"
+script -c 'pick last' -q "$actual" >/dev/null
+grep 'Welcome to nmh version ' "$actual" >/dev/null
+rm "$actual"
+finish_test
+
+
+start_test 'without welcome message'
+# After running the previous test, this one should not have
+# the welcome message.
+script -c 'pick last' -q "$actual" >/dev/null
+grep 'Welcome to nmh version ' "$actual" >/dev/null && false
+rm "$actual"
+finish_test
+
+
+exit $failed
# check -all
cp "$MH" $expected
-# -all adds current folder
+# -all adds current folder and Version
echo 'Current-Folder: '`folder -f` >>$expected
+echo "Version: nmh-$MH_VERSION" >>$expected
run_prog mhparam -all >$actual
check $expected $actual 'keep first'
$MH_INST_DIR$bindir/send
$MH_INST_DIR$bindir/mhshow
$MH_INST_DIR$nmhlibexecdir/mhl
-nmh-`cat ${srcdir}/VERSION`
+nmh-$MH_VERSION
$MH_INST_DIR$bindir/whatnow
$MH_INST_DIR$bindir/whom
$nmhetcdirinst
puts ("\nPlease see the nmh(7) man page for an introduction to nmh.\n");
print_intro (stdout, FALSE);
+ /* Initialize the saved nmh version. The Path profile entry was added
+ above, that's all this needs. */
+ (void) nmh_version_changed ();
+
done (0);
return 1;
}