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

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