7 /* String managing functions */
9 int is_printable (int c
);
10 int msglen (char *text
, int *lines
);
11 char *trim (char *s
, char *d
, int len
);
12 char *name_quote (const char *c
, int quote_percent
);
13 char *fake_name_quote (const char *c
, int quote_percent
);
14 char *name_trunc (const char *txt
, int trunc_len
);
15 char *size_trunc (double size
);
16 char *size_trunc_sep (double size
);
17 void size_trunc_len (char *buffer
, int len
, off_t size
, int units
);
18 int is_exe (mode_t mode
);
19 char *string_perm (mode_t mode_bits
);
20 char *strip_password (char *path
, int has_prefix
);
21 char *strip_home_and_password(char *dir
);
22 char *extension (char *);
23 char *concat_dir_and_file (const char *dir
, const char *file
);
24 char *unix_error_string (int error_num
);
25 char *skip_separators (char *s
);
26 char *skip_numbers (char *s
);
27 char *strip_ctrl_codes (char *s
);
28 char *convert_controls (char *s
);
29 void wipe_password (char *passwd
);
30 char *reverse_string (char *string
);
31 char *diff_two_paths (char *first
, char *second
);
33 char *x_basename (char *s
);
35 /* Profile managing functions */
36 int set_int (char *, char *, int);
37 int get_int (char *, char *, int);
39 char *load_file (char *filename
);
40 char *load_mc_home_file (const char *filename
, char ** allocated_filename
);
42 /* uid/gid managing */
43 void init_groups (void);
44 void destroy_groups (void);
45 int get_user_permissions (struct stat
*buf
);
47 void init_uid_gid_cache (void);
48 char *get_group (int);
49 char *get_owner (int);
51 #define MAX_I18NTIMELENGTH 14
52 #define MIN_I18NTIMELENGTH 10
53 #define STD_I18NTIMELENGTH 12
55 size_t i18n_checktimelength (void);
56 char *file_date (time_t);
58 int exist_file (char *name
);
60 /* Returns a copy of *s until a \n is found and is below top */
61 char *extract_line (char *s
, char *top
);
62 char *_icase_search (char *text
, char *data
, int *lng
);
63 #define icase_search(T,D) _icase_search((T), (D), NULL)
66 enum { match_file
, match_normal
};
67 extern int easy_patterns
;
68 char *convert_pattern (char *pattern
, int match_type
, int do_group
);
69 int regexp_match (char *pattern
, char *string
, int match_type
);
72 void open_error_pipe (void);
73 void check_error_pipe (void);
74 int close_error_pipe (int error
, char *text
);
76 /* Process spawning */
77 #define EXECUTE_INTERNAL 1
78 #define EXECUTE_AS_SHELL 4
79 int my_system (int flags
, const char *shell
, const char *command
);
80 void save_stop_handler (void);
81 extern struct sigaction startup_handler
;
84 char *tilde_expand (const char *);
86 /* Pathname canonicalization */
87 char *canonicalize_pathname (char *);
89 /* Misc Unix functions */
90 char *get_current_wd (char *buffer
, int size
);
91 int my_mkdir (char *s
, mode_t mode
);
92 int my_rmdir (char *s
);
94 /* Rotating dash routines */
95 void use_dash (int flag
); /* Disable/Enable rotate_dash routines */
96 void rotate_dash (void);
97 void remove_dash (void);
99 extern const char app_text
[];
101 /* Creating temporary files safely */
102 void init_tmpdir(void);
103 int mc_mkstemps(char **pname
, const char *prefix
, const char *suffix
);
112 int get_compression_type (int fd
);
113 char *decompress_extension (int type
);
115 int mc_doublepopen (int inhandle
, int inlen
, pid_t
*tp
, char *command
, ...);
116 int mc_doublepclose (int pipehandle
, pid_t pid
);
120 typedef struct hook
{
121 void (*hook_fn
)(void *);
126 void add_hook (Hook
**hook_list
, void (*hook_fn
)(void *), void *data
);
127 void execute_hooks (Hook
*hook_list
);
128 void delete_hook (Hook
**hook_list
, void (*hook_fn
)(void *));
129 int hook_present (Hook
*hook_list
, void (*hook_fn
)(void *));
132 # define PATH_SEP '\\'
133 # define PATH_SEP_STR "\\"
134 # define PATH_ENV_SEP ';'
135 # define TMPDIR_DEFAULT "c:\\temp"
136 # define SCRIPT_SUFFIX ".cmd"
137 # define OS_SORT_CASE_SENSITIVE_DEFAULT 0
138 # define STRCOMP stricmp
139 # define STRNCOMP strnicmp
140 # define MC_ARCH_FLAGS REG_ICASE
141 char *get_default_shell (void);
142 char *get_default_editor (void);
143 int lstat (const char* pathname
, struct stat
*buffer
);
145 # define PATH_SEP '/'
146 # define PATH_SEP_STR "/"
147 # define PATH_ENV_SEP ':'
148 # define TMPDIR_DEFAULT "/tmp"
149 # define SCRIPT_SUFFIX ""
150 # define get_default_editor() "vi"
151 # define OS_SORT_CASE_SENSITIVE_DEFAULT 1
152 # define STRCOMP strcmp
153 # define STRNCOMP strncmp
154 # define MC_ARCH_FLAGS 0
159 /* taken from regex.c: */
160 /* Jim Meyering writes:
162 "... Some ctype macros are valid only for character codes that
163 isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
164 using /bin/cc or gcc but without giving an ansi option). So, all
165 ctype uses should be through macros like ISPRINT... If
166 STDC_HEADERS is defined, then autoconf has verified that the ctype
167 macros don't need to be guarded with references to isascii. ...
168 Defining isascii to 1 should let any compiler worth its salt
169 eliminate the && through constant folding." */
171 #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
174 #define ISASCII(c) isascii(c)