NeoMutt  2022-04-29-323-g5fcc6c
Teaching an old dog new tricks
DOXYGEN
version.h File Reference

Display version and copyright about NeoMutt. More...

#include <stdbool.h>
#include <stdio.h>
+ Include dependency graph for version.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool print_version (FILE *fp)
 Print system and compile info to a file. More...
 
bool print_copyright (void)
 Print copyright message. More...
 
bool feature_enabled (const char *name)
 Test if a compile-time feature is enabled. More...
 

Detailed Description

Display version and copyright about NeoMutt.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file version.h.

Function Documentation

◆ print_version()

bool print_version ( FILE *  fp)

Print system and compile info to a file.

Parameters
fpFile to print to
Return values
trueText displayed

Print information about the current system NeoMutt is running on. Also print a list of all the compile-time information.

Definition at line 416 of file version.c.

417{
418 if (!fp)
419 return false;
420
421 struct utsname uts;
422 bool tty = isatty(fileno(fp));
423 const char *fmt = "%s\n";
424
425 if (tty)
426 fmt = "\033[1;36m%s\033[0m\n"; // Escape, cyan
427
428 fprintf(fp, fmt, mutt_make_version());
429 fprintf(fp, "%s\n", _(Notice));
430
431 uname(&uts);
432
433#ifdef SCO
434 fprintf(fp, "System: SCO %s", uts.release);
435#else
436 fprintf(fp, "System: %s %s", uts.sysname, uts.release);
437#endif
438
439 fprintf(fp, " (%s)", uts.machine);
440
441#ifdef NCURSES_VERSION
442 fprintf(fp, "\nncurses: %s (compiled with %s.%d)", curses_version(),
443 NCURSES_VERSION, NCURSES_VERSION_PATCH);
444#else
445 fprintf(fp, "\nncurses: %s", curses_version());
446#endif
447
448#ifdef _LIBICONV_VERSION
449 fprintf(fp, "\nlibiconv: %d.%d", _LIBICONV_VERSION >> 8, _LIBICONV_VERSION & 0xff);
450#endif
451
452#ifdef HAVE_LIBIDN
453 fprintf(fp, "\n%s", mutt_idna_print_version());
454#endif
455
456#ifdef CRYPT_BACKEND_GPGME
457 fprintf(fp, "\nGPGME: %s", mutt_gpgme_print_version());
458#endif
459
460#ifdef USE_SSL_OPENSSL
461#ifdef LIBRESSL_VERSION_TEXT
462 fprintf(fp, "\nLibreSSL: %s", LIBRESSL_VERSION_TEXT);
463#endif
464#ifdef OPENSSL_VERSION_TEXT
465 fprintf(fp, "\nOpenSSL: %s", OPENSSL_VERSION_TEXT);
466#endif
467#endif
468
469#ifdef USE_SSL_GNUTLS
470 fprintf(fp, "\nGnuTLS: %s", GNUTLS_VERSION);
471#endif
472
473#ifdef HAVE_NOTMUCH
474 fprintf(fp, "\nlibnotmuch: %d.%d.%d", LIBNOTMUCH_MAJOR_VERSION,
475 LIBNOTMUCH_MINOR_VERSION, LIBNOTMUCH_MICRO_VERSION);
476#endif
477
478#ifdef HAVE_PCRE2
479 {
480 char version[24] = { 0 };
481 pcre2_config(PCRE2_CONFIG_VERSION, version);
482 fprintf(fp, "\nPCRE2: %s", version);
483 }
484#endif
485
486#ifdef USE_HCACHE
487 const char *backends = store_backend_list();
488 fprintf(fp, "\nstorage: %s", backends);
489 FREE(&backends);
490#ifdef USE_HCACHE_COMPRESSION
491 backends = compress_list();
492 fprintf(fp, "\ncompression: %s", backends);
493 FREE(&backends);
494#endif
495#endif
496
498 fprintf(fp, "\n\nConfigure options: %s\n", (char *) configure_options);
499
500 rstrip_in_place((char *) cc_cflags);
501 fprintf(fp, "\nCompilation CFLAGS: %s\n", (char *) cc_cflags);
502
503 fprintf(fp, "\n%s\n", _("Default options:"));
505
506 fprintf(fp, "\n%s\n", _("Compile options:"));
508
509 if (debug_opts[0].name)
510 {
511 fprintf(fp, "\n%s\n", _("Devel options:"));
513 }
514
515 fprintf(fp, "\n");
516#ifdef DOMAIN
517 fprintf(fp, "DOMAIN=\"%s\"\n", DOMAIN);
518#endif
519#ifdef ISPELL
520 fprintf(fp, "ISPELL=\"%s\"\n", ISPELL);
521#endif
522 fprintf(fp, "MAILPATH=\"%s\"\n", MAILPATH);
523#ifdef MIXMASTER
524 fprintf(fp, "MIXMASTER=\"%s\"\n", MIXMASTER);
525#endif
526 fprintf(fp, "PKGDATADIR=\"%s\"\n", PKGDATADIR);
527 fprintf(fp, "SENDMAIL=\"%s\"\n", SENDMAIL);
528 fprintf(fp, "SYSCONFDIR=\"%s\"\n", SYSCONFDIR);
529
530 fprintf(fp, "\n");
531 fputs(_(ReachingUs), fp);
532
533 fflush(fp);
534 return !ferror(fp);
535}
#define ISPELL
Definition: config.c:35
const char * compress_list(void)
Get a list of compression backend names.
Definition: compress.c:57
const char * mutt_gpgme_print_version(void)
Get version of GPGME.
Definition: crypt_gpgme.c:4020
const char * mutt_idna_print_version(void)
Create an IDN version string.
Definition: idna.c:314
#define FREE(x)
Definition: memory.h:43
#define _(a)
Definition: message.h:28
static void print_compile_options(struct CompileOptions *co, FILE *fp)
Print a list of enabled/disabled features.
Definition: version.c:342
static const char * ReachingUs
Definition: version.c:102
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition: muttlib.c:1470
static struct CompileOptions comp_opts_default[]
Definition: version.c:126
static struct CompileOptions debug_opts[]
Definition: version.c:295
unsigned char configure_options[]
unsigned char cc_cflags[]
static char * rstrip_in_place(char *s)
Strip a trailing carriage return.
Definition: version.c:394
static const char * Notice
Definition: version.c:108
const char * store_backend_list(void)
Get a list of backend names.
Definition: store.c:84
static struct CompileOptions comp_opts[]
Definition: version.c:160
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ print_copyright()

bool print_copyright ( void  )

Print copyright message.

Return values
trueText displayed

Print the authors' copyright messages, the GPL license and some contact information for the NeoMutt project.

Definition at line 544 of file version.c.

545{
546 puts(mutt_make_version());
547 puts(Copyright);
548 puts(_(Thanks));
549 puts(_(License));
550 puts(_(ReachingUs));
551
552 fflush(stdout);
553 return !ferror(stdout);
554}
static const char * Thanks
Definition: version.c:84
static const char * License
Definition: version.c:87
static const char * Copyright
Definition: version.c:72
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ feature_enabled()

bool feature_enabled ( const char *  name)

Test if a compile-time feature is enabled.

Parameters
nameCompile-time symbol of the feature
Return values
trueFeature enabled
falseFeature not enabled, or not compiled in

Many of the larger features of neomutt can be disabled at compile time. They define a symbol and use ifdef's around their code. The symbols are mirrored in "CompileOptions comp_opts[]" in this file.

This function checks if one of these symbols is present in the code.

These symbols are also seen in the output of "neomutt -v".

Definition at line 571 of file version.c.

572{
573 if (!name)
574 return false;
575 for (int i = 0; comp_opts_default[i].name; i++)
576 {
577 if (mutt_str_equal(name, comp_opts_default[i].name))
578 {
579 return true;
580 }
581 }
582 for (int i = 0; comp_opts[i].name; i++)
583 {
584 if (mutt_str_equal(name, comp_opts[i].name))
585 {
586 return comp_opts[i].enabled;
587 }
588 }
589 return false;
590}
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:807
const char * name
Option name.
Definition: version.c:120
int enabled
0 Disabled, 1 Enabled, 2 Devel only
Definition: version.c:121
+ Here is the call graph for this function:
+ Here is the caller graph for this function: