7 /* String managing functions */
9 #if defined(SCO_FLAVOR) && defined(__GNUC__)
10 extern char*g_strdup (const char*);
13 int is_printable (int c
);
14 int msglen (char *text
, int *lines
);
15 char *trim (char *s
, char *d
, int len
);
16 char *name_quote (const char *c
, int quote_percent
);
17 char *fake_name_quote (const char *c
, int quote_percent
);
18 char *name_trunc (char *txt
, int trunc_len
);
19 char *size_trunc (long int size
);
20 char *size_trunc_sep (long int size
);
21 int is_exe (mode_t mode
);
22 char *string_perm (mode_t mode_bits
);
23 char *strip_password (char *path
, int has_prefix
);
24 char *strip_home_and_password(char *dir
);
25 char *extension (char *);
26 char *split_extension (char *, int pad
);
27 char *concat_dir_and_file (const char *dir
, const char *file
);
28 char *unix_error_string (int error_num
);
29 char *skip_separators (char *s
);
30 char *skip_numbers (char *s
);
31 char *strip_ctrl_codes (char *s
);
32 char *convert_controls (char *s
);
33 void wipe_password (char *passwd
);
34 char *reverse_string (char *string
);
35 char *resolve_symlinks (char *path
);
36 char *diff_two_paths (char *first
, char *second
);
37 int set_nonblocking (int fd
);
39 char *x_basename (char *s
);
41 extern int align_extensions
;
44 char *mad_strconcat (const char *first
, ...);
45 char *mad_strdup_printf (const char *format
, ...);
46 char *mad_strdup_vprintf (const char *format
, va_list args
);
48 #define g_strconcat mad_strconcat
49 #define g_strdup_printf mad_strdup_printf
50 #define g_strdup_vprintf mad_strdup_vprintf
53 /* Profile managing functions */
54 int set_int (char *, char *, int);
55 int get_int (char *, char *, int);
57 char *load_file (char *filename
);
61 # define S_ISLNK(x) (((x) & S_IFLNK) == S_IFLNK)
66 # define S_ISSOCK(x) (((x) & S_IFSOCK) == S_IFSOCK)
68 # define S_ISSOCK(x) 0
72 /* uid/gid managing */
73 typedef struct user_in_groups
{
74 struct user_in_groups
*next
;
78 void init_groups (void);
79 void delete_groups (void);
80 int get_user_rights (struct stat
*buf
);
82 void init_uid_gid_cache (void);
83 char *get_group (int);
84 char *get_owner (int);
86 char *file_date (time_t);
87 char *file_date_pck (time_t);
88 int exist_file (char *name
);
90 /* Returns a copy of *s until a \n is found and is below top */
91 char *extract_line (char *s
, char *top
);
92 char *_icase_search (char *text
, char *data
, int *lng
);
93 #define icase_search(T,D) _icase_search((T), (D), NULL)
96 enum { match_file
, match_normal
};
97 extern int easy_patterns
;
98 char *convert_pattern (char *pattern
, int match_type
, int do_group
);
99 int regexp_match (char *pattern
, char *string
, int match_type
);
102 void open_error_pipe (void);
103 void check_error_pipe (void);
104 void close_error_pipe (int error
, char *text
);
106 /* Process spawning */
107 void my_putenv (char*, char*);
108 #define EXECUTE_INTERNAL 1
109 #define EXECUTE_TEMPFILE 2
110 #define EXECUTE_AS_SHELL 4
111 #define EXECUTE_SETUID 8
112 #define EXECUTE_WAIT 16
113 int my_system (int flags
, const char *shell
, const char *command
);
114 int my_system_get_child_pid (int flags
, const char *shell
, const char *command
, pid_t
*pid
);
115 void save_stop_handler (void);
116 extern struct sigaction startup_handler
;
118 /* Tilde expansion */
119 char *tilde_expand (char *);
121 /* Pathname canonicalization */
122 char *canonicalize_pathname (char *);
124 /* Misc Unix functions */
125 long blocks2kilos (int blocks
, int bsize
);
126 char *get_current_wd (char *buffer
, int size
);
127 int my_mkdir (char *s
, mode_t mode
);
128 int my_rmdir (char *s
);
130 /* Filesystem status */
142 void init_my_statfs (void);
143 void my_statfs (struct my_statfs
*myfs_stats
, char *path
);
145 /* Rotating dash routines */
146 void use_dash (int flag
); /* Disable/Enable rotate_dash routines */
147 void rotate_dash (void);
148 void remove_dash (void);
150 extern char app_text
[];
158 long int is_gunzipable (int fd
, int *type
);
159 char *decompress_command (int type
);
160 char *decompress_extension (int type
);
161 void decompress_command_and_arg (int type
, char **cmd
, char **flags
);
163 int mc_doublepopen (int inhandle
, int inlen
, pid_t
*tp
, char *command
, ...);
164 int mc_doublepclose (int pipehandle
, pid_t pid
);
168 typedef struct hook
{
169 void (*hook_fn
)(void *);
174 void add_hook (Hook
**hook_list
, void (*hook_fn
)(void *), void *data
);
175 void execute_hooks (Hook
*hook_list
);
176 void delete_hook (Hook
**hook_list
, void (*hook_fn
)(void *));
177 int hook_present (Hook
*hook_list
, void (*hook_fn
)(void *));
179 /* message stubs: used by those routines that may output something during the panel_operate process */
180 void message_1s (int flags
, char *title
, char *str1
);
181 void message_2s (int flags
, char *title
, char *str1
, char *str2
);
182 void message_3s (int flags
, char *title
, char *str1
, char *str2
, const char *str3
);
183 void message_1s1d (int flags
, char *title
, char *str
, int d
);
184 void tell_parent (int msg
);
185 int max_open_files (void);
188 # define PATH_SEP '\\'
189 # define PATH_SEP_STR "\\"
190 # define PATH_ENV_SEP ';'
191 # define OS_SORT_CASE_SENSITIVE_DEFAULT 0
192 # define STRCOMP stricmp
193 # define STRNCOMP strnicmp
194 # define MC_ARCH_FLAGS REG_ICASE
195 char *get_default_shell (void);
196 char *get_default_editor (void);
197 int lstat (const char* pathname
, struct stat
*buffer
);
199 # define PATH_SEP '/'
200 # define PATH_SEP_STR "/"
201 # define PATH_ENV_SEP ':'
202 # define get_default_editor() "vi"
203 # define OS_SORT_CASE_SENSITIVE_DEFAULT 1
204 # define STRCOMP strcmp
205 # define STRNCOMP strncmp
206 # define MC_ARCH_FLAGS 0
211 /* taken from regex.c: */
212 /* Jim Meyering writes:
214 "... Some ctype macros are valid only for character codes that
215 isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
216 using /bin/cc or gcc but without giving an ansi option). So, all
217 ctype uses should be through macros like ISPRINT... If
218 STDC_HEADERS is defined, then autoconf has verified that the ctype
219 macros don't need to be guarded with references to isascii. ...
220 Defining isascii to 1 should let any compiler worth its salt
221 eliminate the && through constant folding." */
223 #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
226 #define ISASCII(c) isascii(c)