NeoMutt  2024-11-14-34-g5aaf0d
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
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.
 
bool print_copyright (void)
 Print copyright message.
 
bool feature_enabled (const char *name)
 Test if a compile-time feature is enabled.
 

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 388 of file version.c.

389{
390 if (!fp)
391 return false;
392
393 struct utsname uts = { 0 };
394 bool tty = isatty(fileno(fp));
395
396 const char *col_cyan = "";
397 const char *col_bold = "";
398 const char *col_end = "";
399
400 if (tty)
401 {
402 col_cyan = "\033[1;36m"; // Escape, cyan
403 col_bold = "\033[1m"; // Escape, bold
404 col_end = "\033[0m"; // Escape, end
405 }
406
407 fprintf(fp, "%s%s%s\n", col_cyan, mutt_make_version(), col_end);
408 fprintf(fp, "%s\n", _(Notice));
409
410 uname(&uts);
411
412 fprintf(fp, "%sSystem:%s ", col_bold, col_end);
413#ifdef SCO
414 fprintf(fp, "SCO %s", uts.release);
415#else
416 fprintf(fp, "%s %s", uts.sysname, uts.release);
417#endif
418
419 fprintf(fp, " (%s)", uts.machine);
420
421 fprintf(fp, "\n%sncurses:%s %s", col_bold, col_end, curses_version());
422#ifdef NCURSES_VERSION
423 fprintf(fp, " (compiled with %s.%d)", NCURSES_VERSION, NCURSES_VERSION_PATCH);
424#endif
425
426#ifdef _LIBICONV_VERSION
427 fprintf(fp, "\n%slibiconv:%s %d.%d", col_bold, col_end,
428 _LIBICONV_VERSION >> 8, _LIBICONV_VERSION & 0xff);
429#endif
430
431#ifdef HAVE_LIBIDN
432 fprintf(fp, "\n%slibidn2:%s %s", col_bold, col_end, mutt_idna_print_version());
433#endif
434
435#ifdef CRYPT_BACKEND_GPGME
436 fprintf(fp, "\n%sGPGME:%s %s", col_bold, col_end, mutt_gpgme_print_version());
437#endif
438
439#ifdef USE_SSL_OPENSSL
440#ifdef LIBRESSL_VERSION_TEXT
441 fprintf(fp, "\n%sLibreSSL:%s %s", col_bold, col_end, LIBRESSL_VERSION_TEXT);
442#endif
443#ifdef OPENSSL_VERSION_TEXT
444 fprintf(fp, "\n%sOpenSSL:%s %s", col_bold, col_end, OPENSSL_VERSION_TEXT);
445#endif
446#endif
447
448#ifdef USE_SSL_GNUTLS
449 fprintf(fp, "\n%sGnuTLS:%s %s", col_bold, col_end, GNUTLS_VERSION);
450#endif
451
452#ifdef HAVE_NOTMUCH
453 fprintf(fp, "\n%slibnotmuch:%s %d.%d.%d", col_bold, col_end, LIBNOTMUCH_MAJOR_VERSION,
454 LIBNOTMUCH_MINOR_VERSION, LIBNOTMUCH_MICRO_VERSION);
455#endif
456
457#ifdef HAVE_PCRE2
458 {
459 char version[24] = { 0 };
460 pcre2_config(PCRE2_CONFIG_VERSION, version);
461 fprintf(fp, "\n%sPCRE2:%s %s", col_bold, col_end, version);
462 }
463#endif
464
465#ifdef USE_HCACHE
466 const char *backends = store_backend_list();
467 fprintf(fp, "\n%sstorage:%s %s", col_bold, col_end, backends);
468 FREE(&backends);
469#ifdef USE_HCACHE_COMPRESSION
470 backends = compress_list();
471 fprintf(fp, "\n%scompression:%s %s", col_bold, col_end, backends);
472 FREE(&backends);
473#endif
474#endif
475
477 fprintf(fp, "\n\n%sConfigure options:%s %s\n", col_bold, col_end, (char *) configure_options);
478
479 rstrip_in_place((char *) cc_cflags);
480 fprintf(fp, "\n%sCompilation CFLAGS:%s %s\n", col_bold, col_end, (char *) cc_cflags);
481
482 fprintf(fp, "\n%s%s%s\n", col_bold, _("Compile options:"), col_end);
484
485 if (DebugOpts[0].name)
486 {
487 fprintf(fp, "\n%s%s%s\n", col_bold, _("Devel options:"), col_end);
489 }
490
491 fprintf(fp, "\n");
492#ifdef DOMAIN
493 fprintf(fp, "DOMAIN=\"%s\"\n", DOMAIN);
494#endif
495#ifdef ISPELL
496 fprintf(fp, "ISPELL=\"%s\"\n", ISPELL);
497#endif
498 fprintf(fp, "MAILPATH=\"%s\"\n", MAILPATH);
499 fprintf(fp, "PKGDATADIR=\"%s\"\n", PKGDATADIR);
500 fprintf(fp, "SENDMAIL=\"%s\"\n", SENDMAIL);
501 fprintf(fp, "SYSCONFDIR=\"%s\"\n", SYSCONFDIR);
502
503 fprintf(fp, "\n");
504 fputs(_(ReachingUs), fp);
505
506 fflush(fp);
507 return !ferror(fp);
508}
#define ISPELL
Definition: config.c:39
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:4163
const char * mutt_idna_print_version(void)
Create an IDN version string.
Definition: idna.c:272
#define FREE(x)
Definition: memory.h:55
#define _(a)
Definition: message.h:28
static void print_compile_options(const struct CompileOptions *co, FILE *fp)
Print a list of enabled/disabled features.
Definition: version.c:314
static const char * ReachingUs
CLI Version: How to reach the NeoMutt Team.
Definition: version.c:104
const char * mutt_make_version(void)
Generate the NeoMutt version string.
Definition: muttlib.c:858
static const struct CompileOptions CompOpts[]
Compile options strings for neomutt -v output.
Definition: version.c:130
unsigned char configure_options[]
static const struct CompileOptions DebugOpts[]
Debug options strings for neomutt -v output.
Definition: version.c:261
unsigned char cc_cflags[]
static char * rstrip_in_place(char *s)
Strip a trailing carriage return.
Definition: version.c:366
static const char * Notice
CLI Version: Warranty notice.
Definition: version.c:111
const char * store_backend_list(void)
Get a list of backend names.
Definition: store.c:84
+ 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 517 of file version.c.

518{
519 puts(mutt_make_version());
520 puts(Copyright);
521 puts(_(Thanks));
522 puts(_(License));
523 puts(_(ReachingUs));
524
525 fflush(stdout);
526 return !ferror(stdout);
527}
static const char * Thanks
CLI Version: Thanks.
Definition: version.c:84
static const char * License
CLI Version: License.
Definition: version.c:88
static const char * Copyright
CLI Version: Authors' copyrights.
Definition: version.c:71
+ 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 CompOpts[]" 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 544 of file version.c.

545{
546 if (!name)
547 return false;
548 for (int i = 0; CompOpts[i].name; i++)
549 {
550 if (mutt_str_equal(name, CompOpts[i].name))
551 {
552 return CompOpts[i].enabled;
553 }
554 }
555 return false;
556}
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:660
const char * name
Option name.
Definition: version.c:123
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: