tar: avoid strtoul().
[midnight-commander.git] / src / textconf.c
blob553e09999bdc662b3786c7c2df207fe0c6e09eee
1 /*
2 Print features specific for this build
4 Copyright (C) 2000-2024
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 #if defined (ENABLE_VFS) && defined(ENABLE_VFS_SFTP)
34 #include <libssh2.h>
35 #endif /* ENABLE_VFS_SFTP && ENABLE_VFS */
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 */
43 #include "src/textconf.h"
45 /*** global variables ****************************************************************************/
47 /*** file scope macro definitions ****************************************************************/
49 /*** file scope type declarations ****************************************************************/
51 /*** forward declarations (file scope functions) *************************************************/
53 /*** file scope variables ************************************************************************/
55 #ifdef ENABLE_VFS
56 static const char *const vfs_supported[] = {
57 #ifdef ENABLE_VFS_CPIO
58 "cpiofs",
59 #endif
60 #ifdef ENABLE_VFS_TAR
61 "tarfs",
62 #endif
63 #ifdef ENABLE_VFS_SFS
64 "sfs",
65 #endif
66 #ifdef ENABLE_VFS_EXTFS
67 "extfs",
68 #endif
69 #ifdef ENABLE_VFS_UNDELFS
70 "ext2undelfs",
71 #endif
72 #ifdef ENABLE_VFS_FTP
73 "ftpfs",
74 #endif
75 #ifdef ENABLE_VFS_SFTP
76 "sftpfs",
77 #endif
78 #ifdef ENABLE_VFS_SHELL
79 "shell",
80 #endif
81 NULL
83 #endif /* ENABLE_VFS */
85 static const char *const features[] = {
87 #ifdef USE_INTERNAL_EDIT
88 #ifdef HAVE_ASPELL
89 N_("With builtin editor and aspell support"),
90 #else
91 N_("With builtin editor"),
92 #endif /* HAVE_ASPELL */
93 #endif /* USE_INTERNAL_EDIT */
95 #ifdef ENABLE_SUBSHELL
96 #ifdef SUBSHELL_OPTIONAL
97 N_("With optional subshell support"),
98 #else
99 N_("With subshell support as default"),
100 #endif
101 #endif /* !ENABLE_SUBSHELL */
103 #ifdef ENABLE_BACKGROUND
104 N_("With support for background operations"),
105 #endif
107 #ifdef HAVE_LIBGPM
108 N_("With mouse support on xterm and Linux console"),
109 #else
110 N_("With mouse support on xterm"),
111 #endif
113 #ifdef HAVE_TEXTMODE_X11_SUPPORT
114 N_("With support for X11 events"),
115 #endif
117 #ifdef ENABLE_NLS
118 N_("With internationalization support"),
119 #endif
121 #ifdef HAVE_CHARSET
122 N_("With multiple codepages support"),
123 #endif
125 #ifdef ENABLE_EXT2FS_ATTR
126 N_("With ext2fs attributes support"),
127 #endif
129 NULL
132 /*** file scope functions ************************************************************************/
133 /* --------------------------------------------------------------------------------------------- */
135 /* --------------------------------------------------------------------------------------------- */
136 /*** public functions ****************************************************************************/
137 /* --------------------------------------------------------------------------------------------- */
139 void
140 show_version (void)
142 size_t i;
144 printf (_("GNU Midnight Commander %s\n"), mc_global.mc_version);
146 printf (_("Built with GLib %d.%d.%d\n"),
147 GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
149 #ifdef HAVE_SLANG
150 printf (_("Built with S-Lang %s with terminfo database\n"), SLANG_VERSION_STRING);
151 #elif defined(USE_NCURSES)
152 #ifdef NCURSES_VERSION
153 printf (_("Built with ncurses %s\n"), NCURSES_VERSION);
154 #else
155 puts (_("Built with ncurses (unknown version)"));
156 #endif /* !NCURSES_VERSION */
157 #elif defined(USE_NCURSESW)
158 #ifdef NCURSES_VERSION
159 printf (_("Built with ncursesw %s\n"), NCURSES_VERSION);
160 #else
161 puts (_("Built with ncursesw (unknown version)"));
162 #endif /* !NCURSES_VERSION */
163 #else
164 #error "Cannot compile mc without S-Lang or ncurses"
165 #endif /* !HAVE_SLANG && !USE_NCURSES */
167 #if defined (ENABLE_VFS) && defined(ENABLE_VFS_SFTP)
168 printf (_("Built with libssh2 %d.%d.%d\n"),
169 LIBSSH2_VERSION_MAJOR, LIBSSH2_VERSION_MINOR, LIBSSH2_VERSION_PATCH);
170 #endif /* ENABLE_VFS_SFTP && ENABLE_VFS */
172 for (i = 0; features[i] != NULL; i++)
173 puts (_(features[i]));
175 #ifdef ENABLE_VFS
176 puts (_("Virtual File Systems:"));
177 for (i = 0; vfs_supported[i] != NULL; i++)
178 printf ("%s %s", i == 0 ? "" : ",", _(vfs_supported[i]));
179 (void) puts ("");
180 #endif /* ENABLE_VFS */
182 (void) puts (_("Data types:"));
183 #define TYPE_INFO(T) \
184 (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 #undef TYPE_INFO
192 (void) puts ("");
195 /* --------------------------------------------------------------------------------------------- */
196 #define PRINTF_GROUP(a) \
197 (void) printf ("[%s]\n", a)
198 #define PRINTF_SECTION(a,b) \
199 (void) printf (" %-17s %s\n", a, b)
200 #define PRINTF_SECTION2(a,b) \
201 (void) printf (" %-17s %s/\n", a, b)
202 #define PRINTF(a, b, c) \
203 (void) printf ("\t%-15s %s/%s\n", a, b, c)
204 #define PRINTF2(a, b, c) \
205 (void) printf ("\t%-15s %s%s\n", a, b, c)
207 void
208 show_datadirs_extended (void)
210 (void) printf ("%s %s\n", _("Home directory:"), mc_config_get_home_dir ());
211 (void) printf ("%s %s\n", _("Profile root directory:"), mc_get_profile_root ());
212 (void) puts ("");
214 PRINTF_GROUP (_("System data"));
216 PRINTF_SECTION (_("Config directory:"), mc_global.sysconfig_dir);
217 PRINTF_SECTION (_("Data directory:"), mc_global.share_data_dir);
219 PRINTF_SECTION (_("File extension handlers:"), EXTHELPERSDIR);
221 #if defined ENABLE_VFS_EXTFS || defined ENABLE_VFS_SHELL
222 PRINTF_SECTION (_("VFS plugins and scripts:"), LIBEXECDIR);
223 #ifdef ENABLE_VFS_EXTFS
224 PRINTF2 ("extfs.d:", LIBEXECDIR, MC_EXTFS_DIR PATH_SEP_STR);
225 #endif
226 #ifdef ENABLE_VFS_SHELL
227 PRINTF2 ("shell:", LIBEXECDIR, VFS_SHELL_PREFIX PATH_SEP_STR);
228 #endif
229 #endif /* ENABLE_VFS_EXTFS || defiined ENABLE_VFS_SHELL */
230 (void) puts ("");
232 PRINTF_GROUP (_("User data"));
234 PRINTF_SECTION2 (_("Config directory:"), mc_config_get_path ());
235 PRINTF_SECTION2 (_("Data directory:"), mc_config_get_data_path ());
236 PRINTF ("skins:", mc_config_get_data_path (), MC_SKINS_DIR PATH_SEP_STR);
237 #ifdef ENABLE_VFS_EXTFS
238 PRINTF ("extfs.d:", mc_config_get_data_path (), MC_EXTFS_DIR PATH_SEP_STR);
239 #endif
240 #ifdef ENABLE_VFS_SHELL
241 PRINTF ("shell:", mc_config_get_data_path (), VFS_SHELL_PREFIX PATH_SEP_STR);
242 #endif
243 #ifdef USE_INTERNAL_EDIT
244 PRINTF ("mcedit macros:", mc_config_get_data_path (), MC_MACRO_FILE);
245 PRINTF ("mcedit external macros:", mc_config_get_data_path (), EDIT_HOME_MACRO_FILE ".*");
246 #endif
247 PRINTF_SECTION2 (_("Cache directory:"), mc_config_get_cache_path ());
250 #undef PRINTF
251 #undef PRINTF_SECTION
252 #undef PRINTF_GROUP
254 /* --------------------------------------------------------------------------------------------- */
256 #ifdef ENABLE_CONFIGURE_ARGS
257 void
258 show_configure_options (void)
260 (void) puts (MC_CONFIGURE_ARGS);
262 #endif
264 /* --------------------------------------------------------------------------------------------- */