textconf.c 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*
  2. Print features specific for this build
  3. Copyright (C) 2000, 2001, 2002, 2004, 2005, 2007, 2011
  4. The Free Software Foundation, Inc.
  5. This file is part of the Midnight Commander.
  6. The Midnight Commander is free software: you can redistribute it
  7. and/or modify it under the terms of the GNU General Public License as
  8. published by the Free Software Foundation, either version 3 of the License,
  9. or (at your option) any later version.
  10. The Midnight Commander is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /** \file textconf.c
  18. * \brief Source: prints features specific for this build
  19. */
  20. #include <config.h>
  21. #include <limits.h>
  22. #include <stdio.h>
  23. #include <sys/types.h>
  24. #include "lib/global.h"
  25. #include "lib/fileloc.h"
  26. #include "lib/mcconfig.h"
  27. #include "src/textconf.h"
  28. /*** global variables ****************************************************************************/
  29. /*** file scope macro definitions ****************************************************************/
  30. /*** file scope type declarations ****************************************************************/
  31. /*** file scope variables ************************************************************************/
  32. #ifdef ENABLE_VFS
  33. static const char *const vfs_supported[] = {
  34. #ifdef ENABLE_VFS_CPIO
  35. "cpiofs",
  36. #endif
  37. #ifdef ENABLE_VFS_TAR
  38. "tarfs",
  39. #endif
  40. #ifdef ENABLE_VFS_SFS
  41. "sfs",
  42. #endif
  43. #ifdef ENABLE_VFS_EXTFS
  44. "extfs",
  45. #endif
  46. #ifdef ENABLE_VFS_UNDELFS
  47. "ext2undelfs",
  48. #endif
  49. #ifdef ENABLE_VFS_FTP
  50. "ftpfs",
  51. #endif
  52. #ifdef ENABLE_VFS_FISH
  53. "fish",
  54. #endif
  55. #ifdef ENABLE_VFS_SMB
  56. "smbfs",
  57. #endif /* ENABLE_VFS_SMB */
  58. NULL
  59. };
  60. #endif /* ENABLE_VFS */
  61. static const char *const features[] = {
  62. #ifdef HAVE_SLANG
  63. N_("Using the S-Lang library with terminfo database\n"),
  64. #elif defined(USE_NCURSES)
  65. N_("Using the ncurses library\n"),
  66. #elif defined(USE_NCURSESW)
  67. N_("Using the ncursesw library\n"),
  68. #else
  69. #error "Cannot compile mc without S-Lang or ncurses"
  70. #endif /* !HAVE_SLANG && !USE_NCURSES */
  71. #ifdef USE_INTERNAL_EDIT
  72. N_("With builtin Editor\n"),
  73. #endif
  74. #ifdef HAVE_SUBSHELL_SUPPORT
  75. #ifdef SUBSHELL_OPTIONAL
  76. N_("With optional subshell support\n"),
  77. #else
  78. N_("With subshell support as default\n"),
  79. #endif
  80. #endif /* !HAVE_SUBSHELL_SUPPORT */
  81. #ifdef ENABLE_BACKGROUND
  82. N_("With support for background operations\n"),
  83. #endif
  84. #ifdef HAVE_LIBGPM
  85. N_("With mouse support on xterm and Linux console\n"),
  86. #else
  87. N_("With mouse support on xterm\n"),
  88. #endif
  89. #ifdef HAVE_TEXTMODE_X11_SUPPORT
  90. N_("With support for X11 events\n"),
  91. #endif
  92. #ifdef ENABLE_NLS
  93. N_("With internationalization support\n"),
  94. #endif
  95. #ifdef HAVE_CHARSET
  96. N_("With multiple codepages support\n"),
  97. #endif
  98. NULL
  99. };
  100. /*** file scope functions ************************************************************************/
  101. /* --------------------------------------------------------------------------------------------- */
  102. /* --------------------------------------------------------------------------------------------- */
  103. /*** public functions ****************************************************************************/
  104. /* --------------------------------------------------------------------------------------------- */
  105. void
  106. show_version (void)
  107. {
  108. size_t i;
  109. printf (_("GNU Midnight Commander %s\n"), VERSION);
  110. printf (_("Built with GLib %d.%d.%d\n"),
  111. GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
  112. for (i = 0; features[i] != NULL; i++)
  113. printf ("%s", _(features[i]));
  114. #ifdef ENABLE_VFS
  115. printf (_("Virtual File Systems:"));
  116. for (i = 0; vfs_supported[i] != NULL; i++)
  117. printf ("%s %s", i == 0 ? "" : ",", _(vfs_supported[i]));
  118. printf ("\n");
  119. #endif /* ENABLE_VFS */
  120. (void) printf (_("Data types:"));
  121. #define TYPE_INFO(T) \
  122. (void)printf(" %s: %d;", #T, (int) (CHAR_BIT * sizeof(T)))
  123. TYPE_INFO (char);
  124. TYPE_INFO (int);
  125. TYPE_INFO (long);
  126. TYPE_INFO (void *);
  127. TYPE_INFO (size_t);
  128. TYPE_INFO (off_t);
  129. #undef TYPE_INFO
  130. (void) printf ("\n");
  131. }
  132. /* --------------------------------------------------------------------------------------------- */
  133. #define PRINTF_GROUP(a) \
  134. (void) printf ("[%s]\n", a)
  135. #define PRINTF_SECTION(a,b) \
  136. (void) printf (" %-17s %s\n", a, b)
  137. #define PRINTF_SECTION2(a,b) \
  138. (void) printf (" %-17s %s/\n", a, b)
  139. #define PRINTF(a, b, c) \
  140. (void) printf ("\t%-15s %s/%s\n", a, b, c)
  141. #define PRINTF2(a, b, c) \
  142. (void) printf ("\t%-15s %s%s\n", a, b, c)
  143. void
  144. show_datadirs_extended (void)
  145. {
  146. (void) printf ("%s %s\n", _("Root directory:"), mc_config_get_home_dir ());
  147. (void) puts ("");
  148. PRINTF_GROUP (_("System data"));
  149. PRINTF_SECTION (_("Config directory:"), mc_global.sysconfig_dir);
  150. PRINTF_SECTION (_("Data directory:"), mc_global.share_data_dir);
  151. #if defined ENABLE_VFS_EXTFS || defined ENABLE_VFS_FISH
  152. PRINTF_SECTION (_("VFS plugins and scripts:"), LIBEXECDIR);
  153. #ifdef ENABLE_VFS_EXTFS
  154. PRINTF2 ("extfs.d:", LIBEXECDIR, MC_EXTFS_DIR "/");
  155. #endif
  156. #ifdef ENABLE_VFS_FISH
  157. PRINTF2 ("fish:", LIBEXECDIR, FISH_PREFIX "/");
  158. #endif
  159. #endif /* ENABLE_VFS_EXTFS || defiined ENABLE_VFS_FISH */
  160. (void) puts ("");
  161. PRINTF_GROUP (_("User data"));
  162. PRINTF_SECTION2 (_("Config directory:"), mc_config_get_path ());
  163. PRINTF_SECTION2 (_("Data directory:"), mc_config_get_data_path ());
  164. PRINTF ("skins:", mc_config_get_data_path (), MC_SKINS_SUBDIR "/");
  165. #ifdef ENABLE_VFS_EXTFS
  166. PRINTF ("extfs.d:", mc_config_get_data_path (), MC_EXTFS_DIR "/");
  167. #endif
  168. #ifdef ENABLE_VFS_FISH
  169. PRINTF ("fish:", mc_config_get_data_path (), FISH_PREFIX "/");
  170. #endif
  171. PRINTF_SECTION2 (_("Cache directory:"), mc_config_get_cache_path ());
  172. }
  173. #undef PRINTF
  174. #undef PRINTF_SECTION
  175. #undef PRINTF_GROUP
  176. /* --------------------------------------------------------------------------------------------- */
  177. void
  178. show_configure_options (void)
  179. {
  180. (void) printf ("%s\n", MC_CONFIGURE_ARGS);
  181. }
  182. /* --------------------------------------------------------------------------------------------- */