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-2022
   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 <http://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 
  33 #if defined (ENABLE_VFS) && defined(ENABLE_VFS_SFTP)
  34 #include <libssh2.h>
  35 #endif /* ENABLE_VFS_SFTP && ENABLE_VFS */
  36 
  37 #include "lib/global.h"
  38 #include "lib/fileloc.h"
  39 #include "lib/mcconfig.h"
  40 #include "lib/util.h"           /* mc_get_profile_root() */
  41 #include "lib/tty/tty.h"        /* S-Lang or ncurses version */
  42 
  43 #include "src/textconf.h"
  44 
  45 /*** global variables ****************************************************************************/
  46 
  47 /*** file scope macro definitions ****************************************************************/
  48 
  49 /*** file scope type declarations ****************************************************************/
  50 
  51 /*** file scope variables ************************************************************************/
  52 
  53 #ifdef ENABLE_VFS
  54 static const char *const vfs_supported[] = {
  55 #ifdef ENABLE_VFS_CPIO
  56     "cpiofs",
  57 #endif
  58 #ifdef ENABLE_VFS_TAR
  59     "tarfs",
  60 #endif
  61 #ifdef ENABLE_VFS_SFS
  62     "sfs",
  63 #endif
  64 #ifdef ENABLE_VFS_EXTFS
  65     "extfs",
  66 #endif
  67 #ifdef ENABLE_VFS_UNDELFS
  68     "ext2undelfs",
  69 #endif
  70 #ifdef ENABLE_VFS_FTP
  71     "ftpfs",
  72 #endif
  73 #ifdef ENABLE_VFS_SFTP
  74     "sftpfs",
  75 #endif
  76 #ifdef ENABLE_VFS_FISH
  77     "fish",
  78 #endif
  79     NULL
  80 };
  81 #endif /* ENABLE_VFS */
  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 /* HAVE_ASPELL */
  91 #endif /* USE_INTERNAL_EDIT */
  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 /* !ENABLE_SUBSHELL */
 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 HAVE_CHARSET
 120     N_("With multiple codepages support"),
 121 #endif
 122 
 123 #ifdef ENABLE_EXT2FS_ATTR
 124     N_("With ext2fs attributes support"),
 125 #endif
 126 
 127     NULL
 128 };
 129 
 130 /*** file scope functions ************************************************************************/
 131 /* --------------------------------------------------------------------------------------------- */
 132 
 133 /* --------------------------------------------------------------------------------------------- */
 134 /*** public functions ****************************************************************************/
 135 /* --------------------------------------------------------------------------------------------- */
 136 
 137 void
 138 show_version (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 139 {
 140     size_t i;
 141 
 142     printf (_("GNU Midnight Commander %s\n"), mc_global.mc_version);
 143 
 144     printf (_("Built with GLib %d.%d.%d\n"),
 145             GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
 146 
 147 #ifdef HAVE_SLANG
 148     printf (_("Built with S-Lang %s with terminfo database\n"), SLANG_VERSION_STRING);
 149 #elif defined(USE_NCURSES)
 150 #ifdef NCURSES_VERSION
 151     printf (_("Built with ncurses %s\n"), NCURSES_VERSION);
 152 #else
 153     puts (_("Built with ncurses (unknown version)"));
 154 #endif /* !NCURSES_VERSION */
 155 #elif defined(USE_NCURSESW)
 156 #ifdef NCURSES_VERSION
 157     printf (_("Built with ncursesw %s\n"), NCURSES_VERSION);
 158 #else
 159     puts (_("Built with ncursesw (unknown version)"));
 160 #endif /* !NCURSES_VERSION */
 161 #else
 162 #error "Cannot compile mc without S-Lang or ncurses"
 163 #endif /* !HAVE_SLANG && !USE_NCURSES */
 164 
 165 #if defined (ENABLE_VFS) && defined(ENABLE_VFS_SFTP)
 166     printf (_("Built with libssh2 %d.%d.%d\n"),
 167             LIBSSH2_VERSION_MAJOR, LIBSSH2_VERSION_MINOR, LIBSSH2_VERSION_PATCH);
 168 #endif /* ENABLE_VFS_SFTP && ENABLE_VFS */
 169 
 170     for (i = 0; features[i] != NULL; i++)
 171         puts (_(features[i]));
 172 
 173 #ifdef ENABLE_VFS
 174     puts (_("Virtual File Systems:"));
 175     for (i = 0; vfs_supported[i] != NULL; i++)
 176         printf ("%s %s", i == 0 ? "" : ",", _(vfs_supported[i]));
 177     (void) puts ("");
 178 #endif /* ENABLE_VFS */
 179 
 180     (void) puts (_("Data types:"));
 181 #define TYPE_INFO(T) \
 182     (void)printf(" %s: %d;", #T, (int) (CHAR_BIT * sizeof(T)))
 183     TYPE_INFO (char);
 184     TYPE_INFO (int);
 185     TYPE_INFO (long);
 186     TYPE_INFO (void *);
 187     TYPE_INFO (size_t);
 188     TYPE_INFO (off_t);
 189 #undef TYPE_INFO
 190     (void) puts ("");
 191 }
 192 
 193 /* --------------------------------------------------------------------------------------------- */
 194 #define PRINTF_GROUP(a) \
 195     (void) printf ("[%s]\n", a)
 196 #define PRINTF_SECTION(a,b) \
 197     (void) printf ("    %-17s %s\n", a, b)
 198 #define PRINTF_SECTION2(a,b) \
 199     (void) printf ("    %-17s %s/\n", a, b)
 200 #define PRINTF(a, b, c) \
 201     (void) printf ("\t%-15s %s/%s\n", a, b, c)
 202 #define PRINTF2(a, b, c) \
 203     (void) printf ("\t%-15s %s%s\n", a, b, c)
 204 
 205 void
 206 show_datadirs_extended (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 207 {
 208     (void) printf ("%s %s\n", _("Home directory:"), mc_config_get_home_dir ());
 209     (void) printf ("%s %s\n", _("Profile root directory:"), mc_get_profile_root ());
 210     (void) puts ("");
 211 
 212     PRINTF_GROUP (_("System data"));
 213 
 214     PRINTF_SECTION (_("Config directory:"), mc_global.sysconfig_dir);
 215     PRINTF_SECTION (_("Data directory:"), mc_global.share_data_dir);
 216 
 217     PRINTF_SECTION (_("File extension handlers:"), EXTHELPERSDIR);
 218 
 219 #if defined ENABLE_VFS_EXTFS || defined ENABLE_VFS_FISH
 220     PRINTF_SECTION (_("VFS plugins and scripts:"), LIBEXECDIR);
 221 #ifdef ENABLE_VFS_EXTFS
 222     PRINTF2 ("extfs.d:", LIBEXECDIR, MC_EXTFS_DIR PATH_SEP_STR);
 223 #endif
 224 #ifdef ENABLE_VFS_FISH
 225     PRINTF2 ("fish:", LIBEXECDIR, FISH_PREFIX PATH_SEP_STR);
 226 #endif
 227 #endif /* ENABLE_VFS_EXTFS || defiined ENABLE_VFS_FISH */
 228     (void) puts ("");
 229 
 230     PRINTF_GROUP (_("User data"));
 231 
 232     PRINTF_SECTION2 (_("Config directory:"), mc_config_get_path ());
 233     PRINTF_SECTION2 (_("Data directory:"), mc_config_get_data_path ());
 234     PRINTF ("skins:", mc_config_get_data_path (), MC_SKINS_DIR PATH_SEP_STR);
 235 #ifdef ENABLE_VFS_EXTFS
 236     PRINTF ("extfs.d:", mc_config_get_data_path (), MC_EXTFS_DIR PATH_SEP_STR);
 237 #endif
 238 #ifdef ENABLE_VFS_FISH
 239     PRINTF ("fish:", mc_config_get_data_path (), FISH_PREFIX PATH_SEP_STR);
 240 #endif
 241 #ifdef USE_INTERNAL_EDIT
 242     PRINTF ("mcedit macros:", mc_config_get_data_path (), MC_MACRO_FILE);
 243     PRINTF ("mcedit external macros:", mc_config_get_data_path (), EDIT_HOME_MACRO_FILE ".*");
 244 #endif
 245     PRINTF_SECTION2 (_("Cache directory:"), mc_config_get_cache_path ());
 246 }
 247 
 248 #undef PRINTF
 249 #undef PRINTF_SECTION
 250 #undef PRINTF_GROUP
 251 
 252 /* --------------------------------------------------------------------------------------------- */
 253 
 254 #ifdef ENABLE_CONFIGURE_ARGS
 255 void
 256 show_configure_options (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
 257 {
 258     (void) puts (MC_CONFIGURE_ARGS);
 259 }
 260 #endif
 261 
 262 /* --------------------------------------------------------------------------------------------- */

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