X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/00d760f7506c2d5c32ab5abf9f11b3066999f08a..38c0aa73edd0e2951218a7f7f64658eb7a0eebaa:/sbr/utils.c diff --git a/sbr/utils.c b/sbr/utils.c index 839670b5..2d0acb39 100644 --- a/sbr/utils.c +++ b/sbr/utils.c @@ -417,8 +417,8 @@ void to_upper(char *s) } -int -nmh_init(const char *argv0, int read_context) { +int nmh_init(const char *argv0, bool read_context, bool check_version) +{ int status = OK; char *locale; @@ -435,25 +435,25 @@ nmh_init(const char *argv0, int read_context) { /* Read context, if supposed to. */ if (read_context) { - int allow_version_check = 1; - int check_older_version = 0; char *cp; context_read(); - if (read_context != 1 || + bool allow_version_check = true; + bool check_older_version = false; + if (!check_version || ((cp = context_find ("Welcome")) && strcasecmp (cp, "disable") == 0)) { - allow_version_check = 0; + allow_version_check = false; } else if ((cp = getenv ("MHCONTEXT")) != NULL && *cp != '\0') { /* Context file comes from $MHCONTEXT, so only print the message if the context file has an older version. If it does, or if it doesn't have a version at all, update the version. */ - check_older_version = 1; + check_older_version = true; } /* Check to see if the user is running a different (or older, if specified) version of nmh than they had run before, and notify them - if so. But only if read_context was set to a value to enable. */ + if so. */ if (allow_version_check && isatty (fileno (stdin)) && isatty (fileno (stdout)) && isatty (fileno (stderr))) { if (nmh_version_changed (check_older_version)) {