Manual pages: mcmcdiffmceditmcview

root/src/textconf.c

/* [previous][next][first][last][top][bottom][index][help]  */

DEFINITIONS

This source file includes following definitions.
  1. show_version
  2. show_datadirs_extended
  3. show_configure_options

   1 /*
   2    Print features specific for this build
   3 
   4    Copyright (C) 2000-2025
   5    Free Software Foundation, Inc.
   6 
   7    This file is part of the Midnight Commander.
   8 
   9    The Midnight Commander is free software: you can redistribute it
  10    and/or modify it under the terms of the GNU General Public License as
  11    published by the Free Software Foundation, either version 3 of the License,
  12    or (at your option) any later version.
  13 
  14    The Midnight Commander is distributed in the hope that it will be useful,
  15    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17    GNU General Public License for more details.
  18 
  19    You should have received a copy of the GNU General Public License
  20    along with this program.  If not, see <https://www.gnu.org/licenses/>.
  21  */
  22 
  23 /** \file textconf.c
  24  *  \brief Source: prints features specific for this build
  25  */
  26 
  27 #include <config.h>
  28 
  29 #include <limits.h>
  30 #include <stdio.h>
  31 #include <sys/types.h>
  32 #include <stdint.h>  // uintmax_t
  33 
  34 #if defined(ENABLE_VFS) && defined(ENABLE_VFS_SFTP)
  35 #include <libssh2.h>
  36 #endif
  37 
  38 #include "lib/global.h"
  39 #include "lib/fileloc.h"
  40 #include "lib/mcconfig.h"
  41 #include "lib/util.h"     // mc_get_profile_root()
  42 #include "lib/tty/tty.h"  // S-Lang or ncurses version
  43 
  44 #include "src/textconf.h"
  45 
  46 /*** global variables ****************************************************************************/
  47 
  48 /*** file scope macro definitions ****************************************************************/
  49 
  50 /*** file scope type declarations ****************************************************************/
  51 
  52 /*** forward declarations (file scope functions) *************************************************/
  53 
  54 /*** file scope variables ************************************************************************/
  55 
  56 #ifdef ENABLE_VFS
  57 static const char *const vfs_supported[] = {
  58 #ifdef ENABLE_VFS_CPIO
  59     "cpiofs",
  60 #endif
  61 #ifdef ENABLE_VFS_TAR
  62     "tarfs",
  63 #endif
  64 #ifdef ENABLE_VFS_SFS
  65     "sfs",
  66 #endif
  67 #ifdef ENABLE_VFS_EXTFS
  68     "extfs",
  69 #endif
  70 #ifdef ENABLE_VFS_FTP
  71     "ftpfs",
  72 #endif
  73 #ifdef ENABLE_VFS_SFTP
  74     "sftpfs",
  75 #endif
  76 #ifdef ENABLE_VFS_SHELL
  77     "shell",
  78 #endif
  79     NULL
  80 };
  81 #endif
  82 
  83 static const char *const features[] = {
  84 
  85 #ifdef USE_INTERNAL_EDIT
  86 #ifdef HAVE_ASPELL
  87     N_ ("With builtin editor and aspell support"),
  88 #else
  89     N_ ("With builtin editor"),
  90 #endif
  91 #endif
  92 
  93 #ifdef ENABLE_SUBSHELL
  94 #ifdef SUBSHELL_OPTIONAL
  95     N_ ("With optional subshell support"),
  96 #else
  97     N_ ("With subshell support as default"),
  98 #endif
  99 #endif
 100 
 101 #ifdef ENABLE_BACKGROUND
 102     N_ ("With support for background operations"),
 103 #endif
 104 
 105 #ifdef HAVE_LIBGPM
 106     N_ ("With mouse support on xterm and Linux console"),
 107 #else
 108     N_ ("With mouse support on xterm"),
 109 #endif
 110 
 111 #ifdef HAVE_TEXTMODE_X11_SUPPORT
 112     N_ ("With support for X11 events"),
 113 #endif
 114 
 115 #ifdef ENABLE_NLS
 116     N_ ("With internationalization support"),
 117 #endif
 118 
 119 #ifdef ENABLE_EXT2FS_ATTR
 120     N_ ("With ext2fs attributes support"),
 121 #endif
 122 
 123     NULL
 124 };
 125 
 126 /*** file scope functions ************************************************************************/
 127 /* --------------------------------------------------------------------------------------------- */
 128 
 129 /* --------------------------------------------------------------------------------------------- */
 130 /*** public functions ****************************************************************************/
 131 /* --------------------------------------------------------------------------------------------- */
 132 
 133 void
 134 show_version (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 135 {
 136     size_t i;
 137 
 138     printf ("%s %s\n", PACKAGE_NAME, mc_global.mc_version);
 139 
 140     printf (_ ("Built with GLib %d.%d.%d (using GLib %u.%u.%u)\n"), GLIB_MAJOR_VERSION,
 141             GLIB_MINOR_VERSION, GLIB_MICRO_VERSION, glib_major_version, glib_minor_version,
 142             glib_micro_version);
 143 
 144 #ifdef HAVE_SLANG
 145     printf (_ ("Built with S-Lang"));
 146 #ifdef SLANG_VERSION_STRING
 147     printf (" %s", SLANG_VERSION_STRING);
 148 #elif defined SLANG_VERSION
 149     printf (" %d", SLANG_VERSION);
 150 #endif
 151     printf (_ (" and terminfo database (using S-Lang %s)\n"), SLang_Version_String);
 152 #elif defined HAVE_NCURSES
 153     printf (_ ("Built with %s"), NCURSES_LIB_DISPLAYNAME);
 154 #ifdef NCURSES_VERSION_MAJOR
 155     printf (" %d", NCURSES_VERSION_MAJOR);
 156 #ifdef NCURSES_VERSION_MINOR
 157     printf (".%d", NCURSES_VERSION_MINOR);
 158 #endif
 159 #endif
 160 #ifdef NCURSES_VERSION_PATCH
 161     printf (".%d", NCURSES_VERSION_PATCH);
 162 #endif
 163     printf (_ (" (using %s)\n"), curses_version ());
 164 #else
 165 #error "Cannot compile mc without S-Lang or ncurses"
 166 #endif
 167 
 168 #if defined(ENABLE_VFS) && defined(ENABLE_VFS_SFTP)
 169     printf (_ ("Built with libssh2 %d.%d.%d\n"), LIBSSH2_VERSION_MAJOR, LIBSSH2_VERSION_MINOR,
 170             LIBSSH2_VERSION_PATCH);
 171 #endif
 172 
 173     for (i = 0; features[i] != NULL; i++)
 174         puts (_ (features[i]));
 175 
 176 #ifdef ENABLE_VFS
 177     puts (_ ("Virtual File Systems:"));
 178     for (i = 0; vfs_supported[i] != NULL; i++)
 179         printf ("%s %s", i == 0 ? "" : ",", _ (vfs_supported[i]));
 180     (void) puts ("");
 181 #endif
 182 
 183     (void) puts (_ ("Data types:"));
 184 #define TYPE_INFO(T) (void) printf (" %s: %d;", #T, (int) (CHAR_BIT * sizeof (T)))
 185     TYPE_INFO (char);
 186     TYPE_INFO (int);
 187     TYPE_INFO (long);
 188     TYPE_INFO (void *);
 189     TYPE_INFO (size_t);
 190     TYPE_INFO (off_t);
 191     TYPE_INFO (uintmax_t);
 192 #undef TYPE_INFO
 193     (void) puts ("");
 194 }
 195 
 196 /* --------------------------------------------------------------------------------------------- */
 197 #define PRINTF_GROUP(a)       (void) printf ("[%s]\n", a)
 198 #define PRINTF_SECTION(a, b)  (void) printf ("    %-17s %s\n", a, b)
 199 #define PRINTF_SECTION2(a, b) (void) printf ("    %-17s %s/\n", a, b)
 200 #define PRINTF(a, b, c)       (void) printf ("\t%-15s %s/%s\n", a, b, c)
 201 #define PRINTF2(a, b, c)      (void) printf ("\t%-15s %s%s\n", a, b, c)
 202 
 203 void
 204 show_datadirs_extended (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 205 {
 206     (void) printf ("%s %s\n", _ ("Home directory:"), mc_config_get_home_dir ());
 207     (void) printf ("%s %s\n", _ ("Profile root directory:"), mc_get_profile_root ());
 208     (void) puts ("");
 209 
 210     PRINTF_GROUP (_ ("System data"));
 211 
 212     PRINTF_SECTION (_ ("Config directory:"), mc_global.sysconfig_dir);
 213     PRINTF_SECTION (_ ("Data directory:"), mc_global.share_data_dir);
 214 
 215     PRINTF_SECTION (_ ("File extension handlers:"), EXTHELPERSDIR);
 216 
 217 #if defined ENABLE_VFS_EXTFS || defined ENABLE_VFS_SHELL
 218     PRINTF_SECTION (_ ("VFS plugins and scripts:"), LIBEXECDIR);
 219 #ifdef ENABLE_VFS_EXTFS
 220     PRINTF2 ("extfs.d:", LIBEXECDIR, MC_EXTFS_DIR PATH_SEP_STR);
 221 #endif
 222 #ifdef ENABLE_VFS_SHELL
 223     PRINTF2 ("shell:", LIBEXECDIR, VFS_SHELL_PREFIX PATH_SEP_STR);
 224 #endif
 225 #endif
 226     (void) puts ("");
 227 
 228     PRINTF_GROUP (_ ("User data"));
 229 
 230     PRINTF_SECTION2 (_ ("Config directory:"), mc_config_get_path ());
 231     PRINTF_SECTION2 (_ ("Data directory:"), mc_config_get_data_path ());
 232     PRINTF ("skins:", mc_config_get_data_path (), MC_SKINS_DIR PATH_SEP_STR);
 233 #ifdef ENABLE_VFS_EXTFS
 234     PRINTF ("extfs.d:", mc_config_get_data_path (), MC_EXTFS_DIR PATH_SEP_STR);
 235 #endif
 236 #ifdef ENABLE_VFS_SHELL
 237     PRINTF ("shell:", mc_config_get_data_path (), VFS_SHELL_PREFIX PATH_SEP_STR);
 238 #endif
 239 #ifdef USE_INTERNAL_EDIT
 240     PRINTF ("mcedit macros:", mc_config_get_data_path (), MC_MACRO_FILE);
 241     PRINTF ("mcedit external macros:", mc_config_get_data_path (), EDIT_HOME_MACRO_FILE ".*");
 242 #endif
 243     PRINTF_SECTION2 (_ ("Cache directory:"), mc_config_get_cache_path ());
 244 }
 245 
 246 #undef PRINTF
 247 #undef PRINTF_SECTION
 248 #undef PRINTF_GROUP
 249 
 250 /* --------------------------------------------------------------------------------------------- */
 251 
 252 #ifdef ENABLE_CONFIGURE_ARGS
 253 void
 254 show_configure_options (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 255 {
 256     (void) puts (MC_CONFIGURE_ARGS);
 257 }
 258 #endif
 259 
 260 /* --------------------------------------------------------------------------------------------- */

/* [previous][next][first][last][top][bottom][index][help]  */