Fix segfault on switch to subshell in mcedit/mcview/mcdiffview.
[midnight-commander.git] / src / textconf.c
blobfbb187b121b720c7950da686b1ccfefbf84bbc9c
1 /*
2 Print features specific for this build
4 Copyright (C) 2000-2020
5 Free Software Foundation, Inc.
7 This file is part of the Midnight Commander.
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.
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.
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/>.
23 /** \file textconf.c
24 * \brief Source: prints features specific for this build
27 #include <config.h>
29 #include <limits.h>
30 #include <stdio.h>
31 #include <sys/types.h>
33 #include "lib/global.h"
34 #include "lib/fileloc.h"
35 #include "lib/mcconfig.h"
36 #include "lib/util.h" /* mc_get_profile_root() */
37 #include "lib/tty/tty.h" /* S-Lang or ncurses version */
39 #include "src/textconf.h"
41 /*** global variables ****************************************************************************/
43 /*** file scope macro definitions ****************************************************************/
45 /*** file scope type declarations ****************************************************************/
47 /*** file scope variables ************************************************************************/
49 #ifdef ENABLE_VFS
50 static const char *const vfs_supported[] = {
51 #ifdef ENABLE_VFS_CPIO
52 "cpiofs",
53 #endif
54 #ifdef ENABLE_VFS_TAR
55 "tarfs",
56 #endif
57 #ifdef ENABLE_VFS_SFS
58 "sfs",
59 #endif
60 #ifdef ENABLE_VFS_EXTFS
61 "extfs",
62 #endif
63 #ifdef ENABLE_VFS_UNDELFS
64 "ext2undelfs",
65 #endif
66 #ifdef ENABLE_VFS_FTP
67 "ftpfs",
68 #endif
69 #ifdef ENABLE_VFS_SFTP
70 "sftpfs",
71 #endif
72 #ifdef ENABLE_VFS_FISH
73 "fish",
74 #endif
75 #ifdef ENABLE_VFS_SMB
76 "smbfs",
77 #endif /* ENABLE_VFS_SMB */
78 NULL
80 #endif /* ENABLE_VFS */
82 static const char *const features[] = {
84 #ifdef USE_INTERNAL_EDIT
85 #ifdef HAVE_ASPELL
86 N_("With builtin Editor and Aspell support"),
87 #else
88 N_("With builtin Editor"),
89 #endif /* HAVE_ASPELL */
90 #endif /* USE_INTERNAL_EDIT */
92 #ifdef ENABLE_SUBSHELL
93 #ifdef SUBSHELL_OPTIONAL
94 N_("With optional subshell support"),
95 #else
96 N_("With subshell support as default"),
97 #endif
98 #endif /* !ENABLE_SUBSHELL */
100 #ifdef ENABLE_BACKGROUND
101 N_("With support for background operations"),
102 #endif
104 #ifdef HAVE_LIBGPM
105 N_("With mouse support on xterm and Linux console"),
106 #else
107 N_("With mouse support on xterm"),
108 #endif
110 #ifdef HAVE_TEXTMODE_X11_SUPPORT
111 N_("With support for X11 events"),
112 #endif
114 #ifdef ENABLE_NLS
115 N_("With internationalization support"),
116 #endif
118 #ifdef HAVE_CHARSET
119 N_("With multiple codepages support"),
120 #endif
122 #ifdef ENABLE_EXT2FS_ATTR
123 N_("With ext2fs attributes support"),
124 #endif
126 NULL
129 /*** file scope functions ************************************************************************/
130 /* --------------------------------------------------------------------------------------------- */
132 /* --------------------------------------------------------------------------------------------- */
133 /*** public functions ****************************************************************************/
134 /* --------------------------------------------------------------------------------------------- */
136 void
137 show_version (void)
139 size_t i;
141 printf (_("GNU Midnight Commander %s\n"), VERSION);
143 printf (_("Built with GLib %d.%d.%d\n"),
144 GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
146 #ifdef HAVE_SLANG
147 printf (_("Built with S-Lang %s with terminfo database\n"), SLANG_VERSION_STRING);
148 #elif defined(USE_NCURSES)
149 #ifdef NCURSES_VERSION
150 printf (_("Built with ncurses %s\n"), NCURSES_VERSION);
151 #else
152 puts (_("Built with ncurses (unknown version)"));
153 #endif /* !NCURSES_VERSION */
154 #elif defined(USE_NCURSESW)
155 #ifdef NCURSES_VERSION
156 printf (_("Built with ncursesw %s\n"), NCURSES_VERSION);
157 #else
158 puts (_("Built with ncursesw (unknown version)"));
159 #endif /* !NCURSES_VERSION */
160 #else
161 #error "Cannot compile mc without S-Lang or ncurses"
162 #endif /* !HAVE_SLANG && !USE_NCURSES */
164 for (i = 0; features[i] != NULL; i++)
165 puts (_(features[i]));
167 #ifdef ENABLE_VFS
168 puts (_("Virtual File Systems:"));
169 for (i = 0; vfs_supported[i] != NULL; i++)
170 printf ("%s %s", i == 0 ? "" : ",", _(vfs_supported[i]));
171 (void) puts ("");
172 #endif /* ENABLE_VFS */
174 (void) puts (_("Data types:"));
175 #define TYPE_INFO(T) \
176 (void)printf(" %s: %d;", #T, (int) (CHAR_BIT * sizeof(T)))
177 TYPE_INFO (char);
178 TYPE_INFO (int);
179 TYPE_INFO (long);
180 TYPE_INFO (void *);
181 TYPE_INFO (size_t);
182 TYPE_INFO (off_t);
183 #undef TYPE_INFO
184 (void) puts ("");
187 /* --------------------------------------------------------------------------------------------- */
188 #define PRINTF_GROUP(a) \
189 (void) printf ("[%s]\n", a)
190 #define PRINTF_SECTION(a,b) \
191 (void) printf (" %-17s %s\n", a, b)
192 #define PRINTF_SECTION2(a,b) \
193 (void) printf (" %-17s %s/\n", a, b)
194 #define PRINTF(a, b, c) \
195 (void) printf ("\t%-15s %s/%s\n", a, b, c)
196 #define PRINTF2(a, b, c) \
197 (void) printf ("\t%-15s %s%s\n", a, b, c)
199 void
200 show_datadirs_extended (void)
202 (void) printf ("%s %s\n", _("Home directory:"), mc_config_get_home_dir ());
203 (void) printf ("%s %s\n", _("Profile root directory:"), mc_get_profile_root ());
204 (void) puts ("");
206 PRINTF_GROUP (_("System data"));
208 PRINTF_SECTION (_("Config directory:"), mc_global.sysconfig_dir);
209 PRINTF_SECTION (_("Data directory:"), mc_global.share_data_dir);
211 PRINTF_SECTION (_("File extension handlers:"), EXTHELPERSDIR);
213 #if defined ENABLE_VFS_EXTFS || defined ENABLE_VFS_FISH
214 PRINTF_SECTION (_("VFS plugins and scripts:"), LIBEXECDIR);
215 #ifdef ENABLE_VFS_EXTFS
216 PRINTF2 ("extfs.d:", LIBEXECDIR, MC_EXTFS_DIR PATH_SEP_STR);
217 #endif
218 #ifdef ENABLE_VFS_FISH
219 PRINTF2 ("fish:", LIBEXECDIR, FISH_PREFIX PATH_SEP_STR);
220 #endif
221 #endif /* ENABLE_VFS_EXTFS || defiined ENABLE_VFS_FISH */
222 (void) puts ("");
224 PRINTF_GROUP (_("User data"));
226 PRINTF_SECTION2 (_("Config directory:"), mc_config_get_path ());
227 PRINTF_SECTION2 (_("Data directory:"), mc_config_get_data_path ());
228 PRINTF ("skins:", mc_config_get_data_path (), MC_SKINS_DIR PATH_SEP_STR);
229 #ifdef ENABLE_VFS_EXTFS
230 PRINTF ("extfs.d:", mc_config_get_data_path (), MC_EXTFS_DIR PATH_SEP_STR);
231 #endif
232 #ifdef ENABLE_VFS_FISH
233 PRINTF ("fish:", mc_config_get_data_path (), FISH_PREFIX PATH_SEP_STR);
234 #endif
235 #ifdef USE_INTERNAL_EDIT
236 PRINTF ("mcedit macros:", mc_config_get_data_path (), MC_MACRO_FILE);
237 PRINTF ("mcedit external macros:", mc_config_get_data_path (), EDIT_HOME_MACRO_FILE ".*");
238 #endif
239 PRINTF_SECTION2 (_("Cache directory:"), mc_config_get_cache_path ());
242 #undef PRINTF
243 #undef PRINTF_SECTION
244 #undef PRINTF_GROUP
246 /* --------------------------------------------------------------------------------------------- */
248 #ifdef ENABLE_CONFIGURE_ARGS
249 void
250 show_configure_options (void)
252 (void) puts (MC_CONFIGURE_ARGS);
254 #endif
256 /* --------------------------------------------------------------------------------------------- */