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_UNDELFS
  71     "ext2undelfs",
  72 #endif
  73 #ifdef ENABLE_VFS_FTP
  74     "ftpfs",
  75 #endif
  76 #ifdef ENABLE_VFS_SFTP
  77     "sftpfs",
  78 #endif
  79 #ifdef ENABLE_VFS_SHELL
  80     "shell",
  81 #endif
  82     NULL
  83 };
  84 #endif
  85 
  86 static const char *const features[] = {
  87 
  88 #ifdef USE_INTERNAL_EDIT
  89 #ifdef HAVE_ASPELL
  90     N_ ("With builtin editor and aspell support"),
  91 #else
  92     N_ ("With builtin editor"),
  93 #endif
  94 #endif
  95 
  96 #ifdef ENABLE_SUBSHELL
  97 #ifdef SUBSHELL_OPTIONAL
  98     N_ ("With optional subshell support"),
  99 #else
 100     N_ ("With subshell support as default"),
 101 #endif
 102 #endif
 103 
 104 #ifdef ENABLE_BACKGROUND
 105     N_ ("With support for background operations"),
 106 #endif
 107 
 108 #ifdef HAVE_LIBGPM
 109     N_ ("With mouse support on xterm and Linux console"),
 110 #else
 111     N_ ("With mouse support on xterm"),
 112 #endif
 113 
 114 #ifdef HAVE_TEXTMODE_X11_SUPPORT
 115     N_ ("With support for X11 events"),
 116 #endif
 117 
 118 #ifdef ENABLE_NLS
 119     N_ ("With internationalization support"),
 120 #endif
 121 
 122 #ifdef ENABLE_EXT2FS_ATTR
 123     N_ ("With ext2fs attributes support"),
 124 #endif
 125 
 126     NULL
 127 };
 128 
 129 /*** file scope functions ************************************************************************/
 130 /* --------------------------------------------------------------------------------------------- */
 131 
 132 /* --------------------------------------------------------------------------------------------- */
 133 /*** public functions ****************************************************************************/
 134 /* --------------------------------------------------------------------------------------------- */
 135 
 136 void
 137 show_version (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 138 {
 139     size_t i;
 140 
 141     printf (PACKAGE_NAME " %s\n", mc_global.mc_version);
 142 
 143     printf (_ ("Built with GLib %d.%d.%d (using GLib %u.%u.%u)\n"), GLIB_MAJOR_VERSION,
 144             GLIB_MINOR_VERSION, GLIB_MICRO_VERSION, glib_major_version, glib_minor_version,
 145             glib_micro_version);
 146 
 147 #ifdef HAVE_SLANG
 148     printf (_ ("Built with S-Lang"));
 149 #ifdef SLANG_VERSION_STRING
 150     printf (" %s", SLANG_VERSION_STRING);
 151 #elif defined SLANG_VERSION
 152     printf (" %d", SLANG_VERSION);
 153 #endif
 154     printf (_ (" and terminfo database (using S-Lang %s)\n"), SLang_Version_String);
 155 #elif defined HAVE_NCURSES
 156     printf (_ ("Built with %s"), NCURSES_LIB_DISPLAYNAME);
 157 #ifdef NCURSES_VERSION_MAJOR
 158     printf (" %d", NCURSES_VERSION_MAJOR);
 159 #ifdef NCURSES_VERSION_MINOR
 160     printf (".%d", NCURSES_VERSION_MINOR);
 161 #endif
 162 #endif
 163 #ifdef NCURSES_VERSION_PATCH
 164     printf (".%d", NCURSES_VERSION_PATCH);
 165 #endif
 166     printf (_ (" (using %s)\n"), curses_version ());
 167 #else
 168 #error "Cannot compile mc without S-Lang or ncurses"
 169 #endif
 170 
 171 #if defined(ENABLE_VFS) && defined(ENABLE_VFS_SFTP)
 172     printf (_ ("Built with libssh2 %d.%d.%d\n"), LIBSSH2_VERSION_MAJOR, LIBSSH2_VERSION_MINOR,
 173             LIBSSH2_VERSION_PATCH);
 174 #endif
 175 
 176     for (i = 0; features[i] != NULL; i++)
 177         puts (_ (features[i]));
 178 
 179 #ifdef ENABLE_VFS
 180     puts (_ ("Virtual File Systems:"));
 181     for (i = 0; vfs_supported[i] != NULL; i++)
 182         printf ("%s %s", i == 0 ? "" : ",", _ (vfs_supported[i]));
 183     (void) puts ("");
 184 #endif
 185 
 186     (void) puts (_ ("Data types:"));
 187 #define TYPE_INFO(T) (void) printf (" %s: %d;", #T, (int) (CHAR_BIT * sizeof (T)))
 188     TYPE_INFO (char);
 189     TYPE_INFO (int);
 190     TYPE_INFO (long);
 191     TYPE_INFO (void *);
 192     TYPE_INFO (size_t);
 193     TYPE_INFO (off_t);
 194     TYPE_INFO (uintmax_t);
 195 #undef TYPE_INFO
 196     (void) puts ("");
 197 }
 198 
 199 /* --------------------------------------------------------------------------------------------- */
 200 #define PRINTF_GROUP(a)       (void) printf ("[%s]\n", a)
 201 #define PRINTF_SECTION(a, b)  (void) printf ("    %-17s %s\n", a, b)
 202 #define PRINTF_SECTION2(a, b) (void) printf ("    %-17s %s/\n", a, b)
 203 #define PRINTF(a, b, c)       (void) printf ("\t%-15s %s/%s\n", a, b, c)
 204 #define PRINTF2(a, b, c)      (void) printf ("\t%-15s %s%s\n", a, b, c)
 205 
 206 void
 207 show_datadirs_extended (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 208 {
 209     (void) printf ("%s %s\n", _ ("Home directory:"), mc_config_get_home_dir ());
 210     (void) printf ("%s %s\n", _ ("Profile root directory:"), mc_get_profile_root ());
 211     (void) puts ("");
 212 
 213     PRINTF_GROUP (_ ("System data"));
 214 
 215     PRINTF_SECTION (_ ("Config directory:"), mc_global.sysconfig_dir);
 216     PRINTF_SECTION (_ ("Data directory:"), mc_global.share_data_dir);
 217 
 218     PRINTF_SECTION (_ ("File extension handlers:"), EXTHELPERSDIR);
 219 
 220 #if defined ENABLE_VFS_EXTFS || defined ENABLE_VFS_SHELL
 221     PRINTF_SECTION (_ ("VFS plugins and scripts:"), LIBEXECDIR);
 222 #ifdef ENABLE_VFS_EXTFS
 223     PRINTF2 ("extfs.d:", LIBEXECDIR, MC_EXTFS_DIR PATH_SEP_STR);
 224 #endif
 225 #ifdef ENABLE_VFS_SHELL
 226     PRINTF2 ("shell:", LIBEXECDIR, VFS_SHELL_PREFIX PATH_SEP_STR);
 227 #endif
 228 #endif
 229     (void) puts ("");
 230 
 231     PRINTF_GROUP (_ ("User data"));
 232 
 233     PRINTF_SECTION2 (_ ("Config directory:"), mc_config_get_path ());
 234     PRINTF_SECTION2 (_ ("Data directory:"), mc_config_get_data_path ());
 235     PRINTF ("skins:", mc_config_get_data_path (), MC_SKINS_DIR PATH_SEP_STR);
 236 #ifdef ENABLE_VFS_EXTFS
 237     PRINTF ("extfs.d:", mc_config_get_data_path (), MC_EXTFS_DIR PATH_SEP_STR);
 238 #endif
 239 #ifdef ENABLE_VFS_SHELL
 240     PRINTF ("shell:", mc_config_get_data_path (), VFS_SHELL_PREFIX PATH_SEP_STR);
 241 #endif
 242 #ifdef USE_INTERNAL_EDIT
 243     PRINTF ("mcedit macros:", mc_config_get_data_path (), MC_MACRO_FILE);
 244     PRINTF ("mcedit external macros:", mc_config_get_data_path (), EDIT_HOME_MACRO_FILE ".*");
 245 #endif
 246     PRINTF_SECTION2 (_ ("Cache directory:"), mc_config_get_cache_path ());
 247 }
 248 
 249 #undef PRINTF
 250 #undef PRINTF_SECTION
 251 #undef PRINTF_GROUP
 252 
 253 /* --------------------------------------------------------------------------------------------- */
 254 
 255 #ifdef ENABLE_CONFIGURE_ARGS
 256 void
 257 show_configure_options (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 258 {
 259     (void) puts (MC_CONFIGURE_ARGS);
 260 }
 261 #endif
 262 
 263 /* --------------------------------------------------------------------------------------------- */

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