NeoMutt  2020-11-20
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

void print_version (FILE *fp)
 Print system and compile info to a file. More...
 
void 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()

void print_version ( FILE *  fp)

Print system and compile info to a file.

Parameters
fp- file to print to

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

Definition at line 424 of file version.c.

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

◆ print_copyright()

void print_copyright ( void  )

Print copyright message.

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

Definition at line 541 of file version.c.

542 {
543  puts(mutt_make_version());
544  puts(Copyright);
545  puts(_(Thanks));
546  puts(_(License));
547  puts(_(ReachingUs));
548 }
#define _(a)
Definition: message.h:28
static const char * Copyright
Definition: version.c:72
static const char * ReachingUs
Definition: version.c:104
static const char * Thanks
Definition: version.c:84
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition: muttlib.c:1460
static const char * License
Definition: version.c:88
+ 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 565 of file version.c.

566 {
567  if (!name)
568  return false;
569  for (int i = 0; comp_opts_default[i].name; i++)
570  {
571  if (mutt_str_equal(name, comp_opts_default[i].name))
572  {
573  return true;
574  }
575  }
576  for (int i = 0; comp_opts[i].name; i++)
577  {
578  if (mutt_str_equal(name, comp_opts[i].name))
579  {
580  return comp_opts[i].enabled;
581  }
582  }
583  return false;
584 }
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:871
static struct CompileOptions comp_opts[]
Definition: version.c:163
const char * name
Definition: version.c:123
static struct CompileOptions comp_opts_default[]
Definition: version.c:129
int enabled
0 Disabled, 1 Enabled, 2 Devel only
Definition: version.c:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function: