lib/widget/input_complete.c: minor refactoring and optimization.
[midnight-commander.git] / src / textconf.c
blob6c41d664be4a69ae08ee811174269c0490bc69e6
1 /*
2 Print features specific for this build
4 Copyright (C) 2000, 2001, 2002, 2004, 2005, 2007, 2011
5 The 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"
37 #include "src/textconf.h"
39 /*** global variables ****************************************************************************/
41 /*** file scope macro definitions ****************************************************************/
43 /*** file scope type declarations ****************************************************************/
45 /*** file scope variables ************************************************************************/
47 #ifdef ENABLE_VFS
48 static const char *const vfs_supported[] = {
49 #ifdef ENABLE_VFS_CPIO
50 "cpiofs",
51 #endif
52 #ifdef ENABLE_VFS_TAR
53 "tarfs",
54 #endif
55 #ifdef ENABLE_VFS_SFS
56 "sfs",
57 #endif
58 #ifdef ENABLE_VFS_EXTFS
59 "extfs",
60 #endif
61 #ifdef ENABLE_VFS_UNDELFS
62 "ext2undelfs",
63 #endif
64 #ifdef ENABLE_VFS_FTP
65 "ftpfs",
66 #endif
67 #ifdef ENABLE_VFS_SFTP
68 "sftpfs",
69 #endif
70 #ifdef ENABLE_VFS_FISH
71 "fish",
72 #endif
73 #ifdef ENABLE_VFS_SMB
74 "smbfs",
75 #endif /* ENABLE_VFS_SMB */
76 NULL
78 #endif /* ENABLE_VFS */
80 static const char *const features[] = {
81 #ifdef HAVE_SLANG
82 N_("Using the S-Lang library with terminfo database\n"),
83 #elif defined(USE_NCURSES)
84 N_("Using the ncurses library\n"),
85 #elif defined(USE_NCURSESW)
86 N_("Using the ncursesw library\n"),
87 #else
88 #error "Cannot compile mc without S-Lang or ncurses"
89 #endif /* !HAVE_SLANG && !USE_NCURSES */
91 #ifdef USE_INTERNAL_EDIT
92 N_("With builtin Editor\n"),
93 #endif
95 #ifdef ENABLE_SUBSHELL
96 #ifdef SUBSHELL_OPTIONAL
97 N_("With optional subshell support\n"),
98 #else
99 N_("With subshell support as default\n"),
100 #endif
101 #endif /* !ENABLE_SUBSHELL */
103 #ifdef ENABLE_BACKGROUND
104 N_("With support for background operations\n"),
105 #endif
107 #ifdef HAVE_LIBGPM
108 N_("With mouse support on xterm and Linux console\n"),
109 #else
110 N_("With mouse support on xterm\n"),
111 #endif
113 #ifdef HAVE_TEXTMODE_X11_SUPPORT
114 N_("With support for X11 events\n"),
115 #endif
117 #ifdef ENABLE_NLS
118 N_("With internationalization support\n"),
119 #endif
121 #ifdef HAVE_CHARSET
122 N_("With multiple codepages support\n"),
123 #endif
125 NULL
128 /*** file scope functions ************************************************************************/
129 /* --------------------------------------------------------------------------------------------- */
131 /* --------------------------------------------------------------------------------------------- */
132 /*** public functions ****************************************************************************/
133 /* --------------------------------------------------------------------------------------------- */
135 void
136 show_version (void)
138 size_t i;
140 printf (_("GNU Midnight Commander %s\n"), VERSION);
142 printf (_("Built with GLib %d.%d.%d\n"),
143 GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
145 for (i = 0; features[i] != NULL; i++)
146 printf ("%s", _(features[i]));
148 #ifdef ENABLE_VFS
149 printf (_("Virtual File Systems:"));
150 for (i = 0; vfs_supported[i] != NULL; i++)
151 printf ("%s %s", i == 0 ? "" : ",", _(vfs_supported[i]));
152 printf ("\n");
153 #endif /* ENABLE_VFS */
155 (void) printf (_("Data types:"));
156 #define TYPE_INFO(T) \
157 (void)printf(" %s: %d;", #T, (int) (CHAR_BIT * sizeof(T)))
158 TYPE_INFO (char);
159 TYPE_INFO (int);
160 TYPE_INFO (long);
161 TYPE_INFO (void *);
162 TYPE_INFO (size_t);
163 TYPE_INFO (off_t);
164 #undef TYPE_INFO
165 (void) printf ("\n");
168 /* --------------------------------------------------------------------------------------------- */
169 #define PRINTF_GROUP(a) \
170 (void) printf ("[%s]\n", a)
171 #define PRINTF_SECTION(a,b) \
172 (void) printf (" %-17s %s\n", a, b)
173 #define PRINTF_SECTION2(a,b) \
174 (void) printf (" %-17s %s/\n", a, b)
175 #define PRINTF(a, b, c) \
176 (void) printf ("\t%-15s %s/%s\n", a, b, c)
177 #define PRINTF2(a, b, c) \
178 (void) printf ("\t%-15s %s%s\n", a, b, c)
180 void
181 show_datadirs_extended (void)
183 (void) printf ("%s %s\n", _("Root directory:"), mc_config_get_home_dir ());
184 (void) puts ("");
186 PRINTF_GROUP (_("System data"));
188 PRINTF_SECTION (_("Config directory:"), mc_global.sysconfig_dir);
189 PRINTF_SECTION (_("Data directory:"), mc_global.share_data_dir);
191 PRINTF_SECTION (_("File extension handlers:"), EXTHELPERSDIR);
193 #if defined ENABLE_VFS_EXTFS || defined ENABLE_VFS_FISH
194 PRINTF_SECTION (_("VFS plugins and scripts:"), LIBEXECDIR);
195 #ifdef ENABLE_VFS_EXTFS
196 PRINTF2 ("extfs.d:", LIBEXECDIR, MC_EXTFS_DIR "/");
197 #endif
198 #ifdef ENABLE_VFS_FISH
199 PRINTF2 ("fish:", LIBEXECDIR, FISH_PREFIX "/");
200 #endif
201 #endif /* ENABLE_VFS_EXTFS || defiined ENABLE_VFS_FISH */
202 (void) puts ("");
204 PRINTF_GROUP (_("User data"));
206 PRINTF_SECTION2 (_("Config directory:"), mc_config_get_path ());
207 PRINTF_SECTION2 (_("Data directory:"), mc_config_get_data_path ());
208 PRINTF ("skins:", mc_config_get_data_path (), MC_SKINS_SUBDIR "/");
209 #ifdef ENABLE_VFS_EXTFS
210 PRINTF ("extfs.d:", mc_config_get_data_path (), MC_EXTFS_DIR "/");
211 #endif
212 #ifdef ENABLE_VFS_FISH
213 PRINTF ("fish:", mc_config_get_data_path (), FISH_PREFIX "/");
214 #endif
215 #ifdef USE_INTERNAL_EDIT
216 PRINTF ("mcedit macros:", mc_config_get_data_path (), MC_MACRO_FILE);
217 PRINTF ("mcedit external macros:", mc_config_get_data_path (), MC_EXTMACRO_FILE ".*");
218 #endif
219 PRINTF_SECTION2 (_("Cache directory:"), mc_config_get_cache_path ());
223 #undef PRINTF
224 #undef PRINTF_SECTION
225 #undef PRINTF_GROUP
227 /* --------------------------------------------------------------------------------------------- */
229 void
230 show_configure_options (void)
232 (void) printf ("%s\n", MC_CONFIGURE_ARGS);
235 /* --------------------------------------------------------------------------------------------- */