root/lib/global.h

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

INCLUDED FROM


   1 /** \file global.h
   2  *  \brief Header: %global definitions for compatibility
   3  *
   4  *  This file should be included after all system includes and before all local includes.
   5  */
   6 
   7 #ifndef MC_GLOBAL_H
   8 #define MC_GLOBAL_H
   9 
  10 #if defined(HAVE_STRING_H)
  11 #include <string.h>
  12    /* An ANSI string.h and pre-ANSI memory.h might conflict */
  13 #elif defined(HAVE_MEMORY_H)
  14 #include <memory.h>
  15 #else
  16 #include <strings.h>
  17     /* memory and strings.h conflict on other systems */
  18 #endif /* !STDC_HEADERS & !HAVE_STRING_H */
  19 
  20 #ifdef HAVE_SYS_PARAM_H
  21 #include <sys/param.h>
  22 #endif
  23 
  24 /* for O_* macros */
  25 #include <fcntl.h>
  26 
  27 /* for sig_atomic_t */
  28 #include <signal.h>
  29 
  30 #ifdef HAVE_FUNC_ATTRIBUTE_FALLTHROUGH
  31 #define MC_FALLTHROUGH __attribute__((fallthrough))
  32 #else
  33 #define MC_FALLTHROUGH
  34 #endif
  35 
  36 /*** typedefs(not structures) and defined constants **********************************************/
  37 
  38 /* The O_BINARY definition was taken from gettext */
  39 #if !defined O_BINARY && defined _O_BINARY
  40   /* For MSC-compatible compilers.  */
  41 #define O_BINARY _O_BINARY
  42 #endif
  43 #ifdef __BEOS__
  44   /* BeOS 5 has O_BINARY, but is has no effect.  */
  45 #undef O_BINARY
  46 #endif
  47 /* On reasonable systems, binary I/O is the default.  */
  48 #ifndef O_BINARY
  49 #define O_BINARY 0
  50 #endif
  51 
  52 /* Replacement for O_NONBLOCK */
  53 #ifndef O_NONBLOCK
  54 #ifdef O_NDELAY                 /* SYSV */
  55 #define O_NONBLOCK O_NDELAY
  56 #else /* BSD */
  57 #define O_NONBLOCK FNDELAY
  58 #endif /* !O_NDELAY */
  59 #endif /* !O_NONBLOCK */
  60 
  61 #if defined(__QNX__) && !defined(__QNXNTO__)
  62 /* exec*() from <process.h> */
  63 #include <unix.h>
  64 #endif
  65 
  66 #include <glib.h>
  67 #include "glibcompat.h"
  68 
  69 /* For SMB VFS only */
  70 #ifndef __GNUC__
  71 #define __attribute__(x)
  72 #endif
  73 
  74 /* Solaris9 doesn't have PRIXMAX */
  75 #ifndef PRIXMAX
  76 #define PRIXMAX PRIxMAX
  77 #endif
  78 
  79 #ifdef ENABLE_NLS
  80 #include <libintl.h>
  81 #define _(String) gettext (String)
  82 #ifdef gettext_noop
  83 #define N_(String) gettext_noop (String)
  84 #else
  85 #define N_(String) (String)
  86 #endif
  87 #else /* Stubs that do something close enough.  */
  88 #define textdomain(String) 1
  89 #define gettext(String) (String)
  90 #define ngettext(String1,String2,Num) (((Num) == 1) ? (String1) : (String2))
  91 #define dgettext(Domain,Message) (Message)
  92 #define dcgettext(Domain,Message,Type) (Message)
  93 #define bindtextdomain(Domain,Directory) 1
  94 #define _(String) (String)
  95 #define N_(String) (String)
  96 #endif /* !ENABLE_NLS */
  97 
  98 #include "fs.h"
  99 #include "shell.h"
 100 #include "mcconfig.h"
 101 
 102 #ifdef USE_MAINTAINER_MODE
 103 #include "lib/logging.h"
 104 #endif
 105 
 106 /* Just for keeping Your's brains from invention a proper size of the buffer :-) */
 107 #define BUF_10K 10240L
 108 #define BUF_8K  8192L
 109 #define BUF_4K  4096L
 110 #define BUF_1K  1024L
 111 
 112 #define BUF_LARGE  BUF_1K
 113 #define BUF_MEDIUM 512
 114 #define BUF_SMALL 128
 115 #define BUF_TINY 64
 116 
 117 /* ESC_CHAR is defined in /usr/include/langinfo.h in some systems */
 118 #ifdef ESC_CHAR
 119 #undef ESC_CHAR
 120 #endif
 121 /* AIX compiler doesn't understand '\e' */
 122 #define ESC_CHAR '\033'
 123 #define ESC_STR  "\033"
 124 
 125 /* OS specific defines */
 126 #define PATH_SEP '/'
 127 #define PATH_SEP_STR "/"
 128 #define IS_PATH_SEP(c) ((c) == PATH_SEP)
 129 #define PATH_ENV_SEP ':'
 130 #define TMPDIR_DEFAULT "/tmp"
 131 #define SCRIPT_SUFFIX ""
 132 #define get_default_editor() "vi"
 133 #define OS_SORT_CASE_SENSITIVE_DEFAULT TRUE
 134 #define UTF8_CHAR_LEN 6
 135 
 136 /* struct stat members */
 137 #ifdef __APPLE__
 138 #define st_atim st_atimespec
 139 #define st_ctim st_ctimespec
 140 #define st_mtim st_mtimespec
 141 #endif
 142 
 143 /* Used to distinguish between a normal MC termination and */
 144 /* one caused by typing 'exit' or 'logout' in the subshell */
 145 #define SUBSHELL_EXIT 128
 146 
 147 #define MC_ERROR g_quark_from_static_string (PACKAGE)
 148 
 149 #define DEFAULT_CHARSET "ASCII"
 150 
 151 #include "lib/timer.h"          /* mc_timer_t */
 152 
 153 /*** enums ***************************************************************************************/
 154 
 155 /* run mode and params */
 156 typedef enum
 157 {
 158     MC_RUN_FULL = 0,
 159     MC_RUN_EDITOR,
 160     MC_RUN_VIEWER,
 161     MC_RUN_DIFFVIEWER
 162 } mc_run_mode_t;
 163 
 164 /*** structures declarations (and typedefs of structures)*****************************************/
 165 
 166 typedef struct
 167 {
 168     mc_run_mode_t mc_run_mode;
 169     /* global timer */
 170     mc_timer_t *timer;
 171     /* Used so that widgets know if they are being destroyed or shut down */
 172     gboolean midnight_shutdown;
 173 
 174     /* sysconfig_dir: Area for default settings from maintainers of distributuves
 175        default is /etc/mc or may be defined by MC_DATADIR */
 176     char *sysconfig_dir;
 177     /* share_data_dir: Area for default settings from developers */
 178     char *share_data_dir;
 179 
 180     mc_config_t *main_config;
 181     mc_config_t *panels_config;
 182 
 183 #ifdef HAVE_CHARSET
 184     /* Numbers of (file I/O) and (input/display) codepages. -1 if not selected */
 185     int source_codepage;
 186     int display_codepage;
 187 #else
 188     /* If true, allow characters in the range 160-255 */
 189     gboolean eight_bit_clean;
 190     /*
 191      * If true, also allow characters in the range 128-159.
 192      * This is reported to break on many terminals (xterm, qansi-m).
 193      */
 194     gboolean full_eight_bits;
 195 #endif                          /* !HAVE_CHARSET */
 196     /*
 197      * If utf-8 terminal utf8_display = TRUE
 198      * Display bits set UTF-8
 199      */
 200     gboolean utf8_display;
 201 
 202     /* Set if the nice message (hint) bar is visible */
 203     int message_visible;
 204     /* Set if the nice and useful keybar is visible */
 205     int keybar_visible;
 206 
 207 #ifdef ENABLE_BACKGROUND
 208     /* If true, this is a background process */
 209     gboolean we_are_background;
 210 #endif                          /* ENABLE_BACKGROUND */
 211 
 212     struct
 213     {
 214         /* Asks for confirmation before clean up of history */
 215         gboolean confirm_history_cleanup;
 216 
 217         /* Set if you want the possible completions dialog for the first time */
 218         gboolean show_all_if_ambiguous;
 219 
 220         /* Ugly hack in order to distinguish between left and right panel in menubar */
 221         /* Set if the command is being run from the "Right" menu */
 222         gboolean is_right;      /* If the selected menu was the right */
 223     } widget;
 224 
 225     /* The user's shell */
 226     mc_shell_t *shell;
 227 
 228     struct
 229     {
 230         /* Use the specified skin */
 231         char *skin;
 232 
 233         char *setup_color_string;
 234         char *term_color_string;
 235         char *color_terminal_string;
 236         /* colors specified on the command line: they override any other setting */
 237         char *command_line_colors;
 238 
 239 #ifndef LINUX_CONS_SAVER_C
 240         /* Used only in mc, not in cons.saver */
 241         char console_flag;
 242 #endif                          /* !LINUX_CONS_SAVER_C */
 243         /* If using a subshell for evaluating commands this is true */
 244         gboolean use_subshell;
 245 
 246 #ifdef ENABLE_SUBSHELL
 247         /* File descriptors of the pseudoterminal used by the subshell */
 248         int subshell_pty;
 249 #endif                          /* !ENABLE_SUBSHELL */
 250 
 251         /* This flag is set by xterm detection routine in function main() */
 252         /* It is used by function toggle_subshell() */
 253         gboolean xterm_flag;
 254 
 255         /* disable x11 support */
 256         gboolean disable_x11;
 257 
 258         /* For slow terminals */
 259         /* If true lines are shown by spaces */
 260         gboolean slow_terminal;
 261 
 262         /* Set to force black and white display at program startup */
 263         gboolean disable_colors;
 264 
 265         /* If true use +, -, | for line drawing */
 266         gboolean ugly_line_drawing;
 267 
 268         /* Tries to use old highlight mouse tracking */
 269         gboolean old_mouse;
 270 
 271         /* If true, use + and \ keys normally and select/unselect do if M-+ / M-\.
 272            and M-- and keypad + / - */
 273         gboolean alternate_plus_minus;
 274     } tty;
 275 
 276     struct
 277     {
 278         /* Set when cd symlink following is desirable (bash mode) */
 279         gboolean cd_symlinks;
 280 
 281         /* Preallocate space before file copying */
 282         gboolean preallocate_space;
 283 
 284     } vfs;
 285 } mc_global_t;
 286 
 287 /*** global variables defined in .c file *********************************************************/
 288 
 289 extern mc_global_t mc_global;
 290 
 291 /*** declarations of public functions ************************************************************/
 292 
 293 /*** inline functions ****************************************************************************/
 294 #endif

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