3 * Display version and copyright about NeoMutt
6 * Copyright (C) 1996-2007 Michael R. Elkins <me@mutt.org>
7 * Copyright (C) 1999-2007 Thomas Roessler <roessler@does-not-exist.org>
8 * Copyright (C) 2016-2017 Richard Russon <rich@flatcap.org>
11 * This program is free software: you can redistribute it and/or modify it under
12 * the terms of the GNU General Public License as published by the Free Software
13 * Foundation, either version 2 of the License, or (at your option) any later
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 * You should have received a copy of the GNU General Public License along with
22 * this program. If not, see <http://www.gnu.org/licenses/>.
26 * @page version Display version and copyright about NeoMutt
28 * Display version and copyright about NeoMutt
35 #include <sys/utsname.h>
37 #include "mutt/mutt.h"
38 #include "address/lib.h"
39 #include "mutt_curses.h"
40 #include "ncrypt/crypt_gpgme.h"
42 /* #include "protos.h" */
43 const char *mutt_make_version(void);
44 /* #include "hcache/hcache.h" */
45 const char *mutt_hcache_backend_list(void);
47 const int SCREEN_WIDTH = 80;
49 extern unsigned char cc_version[];
50 extern unsigned char cc_cflags[];
51 extern unsigned char configure_options[];
53 static const char *Copyright =
54 "Copyright (C) 1996-2016 Michael R. Elkins <me@mutt.org>\n"
55 "Copyright (C) 1996-2002 Brandon Long <blong@fiction.net>\n"
56 "Copyright (C) 1997-2009 Thomas Roessler <roessler@does-not-exist.org>\n"
57 "Copyright (C) 1998-2005 Werner Koch <wk@isil.d.shuttle.de>\n"
58 "Copyright (C) 1999-2017 Brendan Cully <brendan@kublai.com>\n"
59 "Copyright (C) 1999-2002 Tommi Komulainen <Tommi.Komulainen@iki.fi>\n"
60 "Copyright (C) 2000-2004 Edmund Grimley Evans <edmundo@rano.org>\n"
61 "Copyright (C) 2006-2009 Rocco Rutte <pdmef@gmx.net>\n"
62 "Copyright (C) 2014-2019 Kevin J. McCarthy <kevin@8t8.us>\n"
63 "Copyright (C) 2015-2019 Richard Russon <rich@flatcap.org>\n";
65 static const char *Thanks =
66 N_("Many others not mentioned here contributed code, fixes,\n"
67 "and suggestions.\n");
69 static const char *License = N_(
70 " This program is free software; you can redistribute it and/or modify\n"
71 " it under the terms of the GNU General Public License as published by\n"
72 " the Free Software Foundation; either version 2 of the License, or\n"
73 " (at your option) any later version.\n"
75 " This program is distributed in the hope that it will be useful,\n"
76 " but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
77 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
78 " GNU General Public License for more details.\n"
80 " You should have received a copy of the GNU General Public License\n"
81 " along with this program; if not, write to the Free Software\n"
82 " Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA "
83 "02110-1301, USA.\n");
85 static const char *ReachingUs =
86 N_("To learn more about NeoMutt, visit: https://neomutt.org\n"
87 "If you find a bug in NeoMutt, please raise an issue at:\n"
88 " https://github.com/neomutt/neomutt/issues\n"
89 "or send an email to: <neomutt-devel@neomutt.org>\n");
92 static const char *Notice =
93 N_("Copyright (C) 1996-2016 Michael R. Elkins and others.\n"
94 "NeoMutt comes with ABSOLUTELY NO WARRANTY; for details type 'neomutt -vv'.\n"
95 "NeoMutt is free software, and you are welcome to redistribute it\n"
96 "under certain conditions; type 'neomutt -vv' for details.\n");
100 * struct CompileOptions - List of built-in capabilities
102 struct CompileOptions
105 int enabled; // 0 Disabled, 1 Enabled, 2 Devel only
108 /* These are sorted by the display string */
110 static struct CompileOptions comp_opts_default[] = {
111 { "attach_headers_color", 1 },
112 { "compose_to_sender", 1 },
116 { "encrypt_to_self", 1 },
117 { "forgotten_attachments", 1 },
121 { "index_color", 1 },
123 { "limit_current_thread", 1 },
124 { "multiple_fcc", 1 },
130 { "quasi_delete", 1 },
132 { "reply_with_xorig", 1 },
133 { "sensible_browser", 1 },
135 { "skip_quoted", 1 },
137 { "status_color", 1 },
144 static struct CompileOptions comp_opts[] = {
185 #ifdef HAVE_GETADDRINFO
186 { "getaddrinfo", 1 },
188 { "getaddrinfo", 0 },
190 #ifdef USE_SSL_GNUTLS
195 #ifdef CRYPT_BACKEND_GPGME
226 { "locales_hack", 1 },
228 { "locales_hack", 0 },
255 #ifdef USE_SSL_OPENSSL
260 #ifdef CRYPT_BACKEND_CLASSIC_PGP
270 #ifdef CRYPT_BACKEND_CLASSIC_SMIME
280 #ifdef HAVE_START_COLOR
281 { "start_color", 1 },
283 { "start_color", 0 },
285 #ifdef SUN_ATTACHMENT
286 { "sun_attachment", 1 },
288 { "sun_attachment", 0 },
290 #ifdef HAVE_TYPEAHEAD
299 * print_compile_options - Print a list of enabled/disabled features
300 * @param co Array of compile options
301 * @param fp file to write to
303 * Two lists are generated and passed to this function:
305 * One list which just uses the configure state of each feature.
306 * One list which just uses feature which are set to on directly in NeoMutt.
308 * The output is of the form: "+enabled_feature -disabled_feature" and is
309 * wrapped to SCREEN_WIDTH characters.
311 static void print_compile_options(struct CompileOptions *co, FILE *fp)
314 bool tty = stdout ? isatty(fileno(stdout)) : false;
317 for (int i = 0; co[i].name; i++)
319 const size_t len = strlen(co[i].name) + 2; /* +/- and a space */
320 if ((used + len) > SCREEN_WIDTH)
326 const char *fmt = "?%s ";
327 switch (co[i].enabled)
331 fmt = "\033[1;31m-%s\033[0m "; // Escape, red
337 fmt = "\033[1;32m+%s\033[0m "; // Escape, green
341 case 2: // Devel only
343 fmt = "\033[1;36m!%s\033[0m "; // Escape, cyan
348 fprintf(fp, fmt, co[i].name);
354 * rstrip_in_place - Strip a trailing carriage return
355 * @param s String to be modified
356 * @retval ptr The modified string
358 * The string has its last carriage return set to NUL.
360 static char *rstrip_in_place(char *s)
365 char *p = &s[strlen(s)];
369 while ((p >= s) && ((*p == '\n') || (*p == '\r')))
375 * print_version - Print system and compile info to a file
376 * @param fp - file to print to
378 * Print information about the current system NeoMutt is running on.
379 * Also print a list of all the compile-time information.
381 void print_version(FILE *fp)
385 fprintf(fp, "%s\n", mutt_make_version());
386 fprintf(fp, "%s\n", _(Notice));
391 fprintf(fp, "System: SCO %s", uts.release);
393 fprintf(fp, "System: %s %s", uts.sysname, uts.release);
396 fprintf(fp, " (%s)", uts.machine);
398 #ifdef NCURSES_VERSION
399 fprintf(fp, "\nncurses: %s (compiled with %s.%d)", curses_version(),
400 NCURSES_VERSION, NCURSES_VERSION_PATCH);
401 #elif defined(USE_SLANG_CURSES)
402 fprintf(fp, "\nslang: %s", SLANG_VERSION_STRING);
405 #ifdef _LIBICONV_VERSION
406 fprintf(fp, "\nlibiconv: %d.%d", _LIBICONV_VERSION >> 8, _LIBICONV_VERSION & 0xff);
410 fprintf(fp, "\n%s", mutt_idna_print_version());
413 #ifdef CRYPT_BACKEND_GPGME
414 fprintf(fp, "\nGPGme: %s", mutt_gpgme_print_version());
418 const char *backends = mutt_hcache_backend_list();
419 fprintf(fp, "\nhcache backends: %s", backends);
423 fputs("\n\nCompiler:\n", fp);
424 rstrip_in_place((char *) cc_version);
425 fprintf(fp, "%s\n", (char *) cc_version);
427 rstrip_in_place((char *) configure_options);
428 fprintf(fp, "\nConfigure options: %s\n", (char *) configure_options);
430 rstrip_in_place((char *) cc_cflags);
431 fprintf(fp, "\nCompilation CFLAGS: %s\n", (char *) cc_cflags);
433 fprintf(fp, "\n%s\n", _("Default options:"));
434 print_compile_options(comp_opts_default, fp);
436 fprintf(fp, "\n%s\n", _("Compile options:"));
437 print_compile_options(comp_opts, fp);
440 fprintf(fp, "DOMAIN=\"%s\"\n", DOMAIN);
443 fprintf(fp, "ISPELL=\"%s\"\n", ISPELL);
445 fprintf(fp, "MAILPATH=\"%s\"\n", MAILPATH);
447 fprintf(fp, "MIXMASTER=\"%s\"\n", MIXMASTER);
449 fprintf(fp, "PKGDATADIR=\"%s\"\n", PKGDATADIR);
450 fprintf(fp, "SENDMAIL=\"%s\"\n", SENDMAIL);
451 fprintf(fp, "SYSCONFDIR=\"%s\"\n", SYSCONFDIR);
454 fputs(_(ReachingUs), fp);
458 * print_copyright - Print copyright message
460 * Print the authors' copyright messages, the GPL license and some contact
461 * information for the NeoMutt project.
463 void print_copyright(void)
465 puts(mutt_make_version());
473 * feature_enabled - Test if a compile-time feature is enabled
474 * @param name Compile-time symbol of the feature
475 * @retval true Feature enabled
476 * @retval false Feature not enabled, or not compiled in
478 * Many of the larger features of neomutt can be disabled at compile time.
479 * They define a symbol and use ifdef's around their code.
480 * The symbols are mirrored in "CompileOptions comp_opts[]" in this
483 * This function checks if one of these symbols is present in the code.
485 * These symbols are also seen in the output of "neomutt -v".
487 bool feature_enabled(const char *name)
491 for (int i = 0; comp_opts_default[i].name; i++)
493 if (mutt_str_strcmp(name, comp_opts_default[i].name) == 0)
498 for (int i = 0; comp_opts[i].name; i++)
500 if (mutt_str_strcmp(name, comp_opts[i].name) == 0)
502 return comp_opts[i].enabled;