mirror of
https://github.com/adamyg/mcwin32.git
synced 2025-04-18 01:17:37 +03:00
build-232 (#119)
# upgrades/bug-fixes * documentation enhancements * mcstart, file-extension utility (#124) * MSTerminal maximize disabled (#122) * obey NODRIVES group policy (#121) * getmntinfo, networked/mapped drive (#120) * script enhancements, MC_XDG_OPEN as "start" (#119) * non-ascii group name handling (#118) * mandoc / mchelp integration (#116) * stat/seek64 (#35) and (#89) * unzip vfs (#88) * mc-wrapper's (#69) * ESC timeout, -1 enables an infinite wait (#36)
This commit is contained in:
parent
b7b7a86767
commit
cd8c3be0e0
129
README.md
129
README.md
@ -9,12 +9,12 @@
|
||||
|
||||
Windows XP+/32 bit native port of GNU Midnight Commander, based on the [4.8.33](https://midnight-commander.org/wiki/NEWS-4.8.33) release.
|
||||
|
||||
Supports both the recent Windows 10 plus the prior legacy console, 16 and 256 colour modes are available within either.
|
||||
Supports recent Windows 10/11 distributions, both MsTerminal and legacy console, 16 and 256 colour modes are available within all.
|
||||
|
||||
Midnight Commander (also known as mc) is a free cross-platform orthodox file manager and a clone of Norton Commander.
|
||||
|
||||
Features include the ability work with common archive formats as if they were simply another directory, and to function as an SFTP/FTP client.
|
||||
Midnight Commander also includes an builtin editor/viewer, features include syntax highlighting for many languages, macros, code snippets,
|
||||
Midnight Commander also includes an built-in editor/viewer, features include syntax highlighting for many languages, macros, code snippets,
|
||||
simple integration with external tools, automatic indentation, mouse support, clipboard and the ability to work in both ASCII and hex modes.
|
||||
|
||||
Midnight Commander supports accessing remote filesystems through several methods, including SSH’s Secure File Transfer Protocol, SFTP.
|
||||
@ -38,6 +38,7 @@ Internal editor.
|
||||
|
||||

|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
Recent distributions are now bundled with an installer, the following shall prompt and then check for available upgrades.
|
||||
@ -57,18 +58,136 @@ To utilise *Files transferred over Shell protocol* **(FISH)** over SSH, an ssh c
|
||||
|
||||
Finally the internal editor has built-in spell enabled. To utilise aspell is required, you can optionally install [Win32-Aspell](https://github.com/adamyg/aspell-win32).
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
The primary way to learn about midnight-commander is to use the context-sensitive online help available via **F1**.
|
||||
|
||||

|
||||
|
||||
Comprehensive manual pages serve as the main source of official documentation. These pages cover topics such as "mc," "mcdiff," "mcedit," and "mcview," which can be accessed through the **mchelp** utility. This utility presents relevant information on each topic using the internal viewer of _Midnight Commander_.
|
||||
|
||||
```
|
||||
mchelp mc
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Run-time profile
|
||||
|
||||
The location of run-time configuration elements will differ across installations, and this can be checked using the ```--datadir-info``` option. Additionally, these elements are influenced by the MC_DATADIR environment variable. Further details can be found in __mchelp mc__.
|
||||
|
||||
|
||||
```
|
||||
$ mc --datadir-info
|
||||
|
||||
Home directory: C:\Users\user
|
||||
Profile root directory: C:\Users\user
|
||||
Temporary directory: C:/Users/user/AppData/Local/Temp/mc-user/mc-user
|
||||
|
||||
[System data]
|
||||
Config directory: C:/Program Files (x86)/Midnight Commander/etc/
|
||||
Data directory: C:/Program Files (x86)/Midnight Commander/share/
|
||||
File extension handlers: C:/Program Files (x86)/Midnight Commander/plugin/
|
||||
VFS plugins and scripts: C:/Program Files (x86)/Midnight Commander/plugin/
|
||||
extfs.d: C:/Program Files (x86)/Midnight Commander/plugin/extfs.d/
|
||||
shell: C:/Program Files (x86)/Midnight Commander/plugin/shell/
|
||||
magic: C:/Program Files (x86)/Midnight Commander/etc/magic
|
||||
|
||||
[User data]
|
||||
Config directory: C:/Users/user/AppData/Roaming/Midnight Commander/
|
||||
Data directory: C:/Users/user/AppData/Local/Midnight Commander/
|
||||
skins: C:/Users/user/AppData/Local/Midnight Commander/skins/
|
||||
extfs.d: C:/Users/user/AppData/Local/Midnight Commander/extfs.d/
|
||||
shell: C:/Users/user/AppData/Local/Midnight Commander/shell/
|
||||
mcedit macros: C:/Users/user/AppData/Local/Midnight Commander/mc.macros
|
||||
mcedit external macros: C:/Users/user/AppData/Local/Midnight Commander/mcedit/macros.d/macro.*
|
||||
mcedit global-menu: n/a
|
||||
mcedit local-menu: n/a
|
||||
mcedit home-menu: C:/Users/user/AppData/Roaming/Midnight Commander/mcedit/menu
|
||||
Cache directory: C:/Users/user/AppData/Local/Microsoft/Windows/INetCache/Midnight Commander/
|
||||
```
|
||||
|
||||
### Extensions
|
||||
|
||||
Midnight Commander is fully extendable, allowing operations bound to file extensions.
|
||||
|
||||
Double-clicking on a file will try to execute the command if it is an executable program; and if the extension file has a program specified for the file's extension, the specified program is executed. See [EXTENSIONS](mcwin32/doc/EXTENSIONS.md) for a number of suitable examples.
|
||||
|
||||
|
||||
## Distributions
|
||||
|
||||
Latest builds:
|
||||
### Binaries and installers
|
||||
|
||||
Midnight Commander:
|
||||
|
||||
* https://github.com/adamyg/mcwin32/releases
|
||||
* https://sourceforge.net/projects/mcwin32
|
||||
* https://sourceforge.net/projects/mcwin32 (Mirror)
|
||||
|
||||
Aspell:
|
||||
|
||||
* https://github.com/adamyg/aspell-win32/releases
|
||||
|
||||
Source:
|
||||
|
||||
### Source
|
||||
|
||||
* https://github.com/adamyg/mcwin32
|
||||
|
||||
The project can be built from source, the method dependent on the target host.
|
||||
See [INSTALL](mcwin32/doc/INSTALL.md) for details, plus working examples are visible within the GitHub workflows.
|
||||
|
||||
https://github.com/adamyg/mcwin32f/blob/master/.github/workflows/build.yml
|
||||
|
||||
For actively supported tool-chains, configuration profiles are available.
|
||||
|
||||
```
|
||||
cd mcwin32
|
||||
.\support\vc2019config
|
||||
```
|
||||
|
||||
The following build profile and options shall be available.
|
||||
|
||||
```
|
||||
-
|
||||
- Configuration:
|
||||
-
|
||||
- PackageName: Midnight Commander WIN32
|
||||
- Version: 4.8.33
|
||||
-
|
||||
- ToolChain: Visual Studio 2019
|
||||
- Compiler: cl / cl
|
||||
- CFLAGS: -nologo -MD$(RTSUFFIX) -fp:precise
|
||||
- CXXFLAGS: -nologo -MD$(RTSUFFIX) -EHsc -fp:precise -Zc:offsetof-
|
||||
- Release: -O2 -GL -Gy -DNDEBUG
|
||||
- Debug: -Zi -RTC1 -Od
|
||||
- LDFLAGS: -nologo -MD$(RTSUFFIX)
|
||||
-
|
||||
-
|
||||
- Virtual File Systems: cpio, extfs, shell, ftp, sfs, sftp, tar (see: config.h)
|
||||
- Screen library: console
|
||||
- Mouse support: native
|
||||
- Subshell support: n/a
|
||||
- Background operations: n/a
|
||||
- Internal editor: yes
|
||||
- Diff viewer: yes
|
||||
-
|
||||
|
||||
Review the options above for accuracy.
|
||||
|
||||
Execute to build:
|
||||
|
||||
"make release" - build software.
|
||||
|
||||
To generate an installer:
|
||||
|
||||
"make release package" - build installer.
|
||||
|
||||
Optionally after installation:
|
||||
|
||||
"make release clean" - remove build tree.
|
||||
|
||||
```
|
||||
|
||||
## Status:
|
||||
|
||||
Please feel free to raise tickets on **GitHub** when issues are encountered.
|
||||
|
@ -22,7 +22,7 @@ typedef struct
|
||||
/* File name */
|
||||
GString *fname;
|
||||
/* File attributes */
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
/* Key used for comparing names */
|
||||
char *name_sort_key;
|
||||
/* Key used for comparing extensions */
|
||||
|
@ -201,7 +201,7 @@ int
|
||||
lock_file (const vfs_path_t *fname_vpath)
|
||||
{
|
||||
char *lockfname = NULL, *newlock, *msg;
|
||||
struct stat statbuf;
|
||||
mc_stat_t statbuf;
|
||||
lock_s *lockinfo;
|
||||
gboolean is_local;
|
||||
gboolean symlink_ok = FALSE;
|
||||
@ -293,7 +293,7 @@ unlock_file (const vfs_path_t *fname_vpath)
|
||||
lockfname = lock_build_symlink_name (fname_vpath);
|
||||
if (lockfname != NULL)
|
||||
{
|
||||
struct stat statbuf;
|
||||
mc_stat_t statbuf;
|
||||
|
||||
/* Check if lock exists */
|
||||
if (lstat (lockfname, &statbuf) != -1)
|
||||
|
@ -107,7 +107,7 @@ mc_config_t *
|
||||
mc_config_init (const gchar *ini_path, gboolean read_only)
|
||||
{
|
||||
mc_config_t *mc_config;
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
|
||||
mc_config = g_try_malloc0 (sizeof (mc_config_t));
|
||||
if (mc_config == NULL)
|
||||
|
@ -116,7 +116,7 @@ resolve_symlinks (const vfs_path_t *vpath)
|
||||
{
|
||||
char *p, *p2;
|
||||
char *buf, *buf2, *q, *r, c;
|
||||
struct stat mybuf;
|
||||
mc_stat_t mybuf;
|
||||
|
||||
if (vpath->relative)
|
||||
return NULL;
|
||||
@ -1361,7 +1361,7 @@ Q_ (const char *s)
|
||||
gboolean
|
||||
mc_util_make_backup_if_possible (const char *file_name, const char *backup_suffix)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
mc_stat_t stat_buf;
|
||||
char *backup_path;
|
||||
gboolean ret;
|
||||
|
||||
|
@ -196,7 +196,7 @@ char *load_mc_home_file (const char *from, const char *filename, char **allocate
|
||||
/* uid/gid managing */
|
||||
void init_groups (void);
|
||||
void destroy_groups (void);
|
||||
int get_user_permissions (struct stat *buf);
|
||||
int get_user_permissions (mc_stat_t *buf);
|
||||
|
||||
void init_uid_gid_cache (void);
|
||||
const char *get_group (gid_t gid);
|
||||
|
@ -1238,7 +1238,7 @@ mc_realpath (const char *path, char *resolved_path)
|
||||
*/
|
||||
|
||||
int
|
||||
get_user_permissions (struct stat *st)
|
||||
get_user_permissions (mc_stat_t *st)
|
||||
{
|
||||
static gboolean initialized = FALSE;
|
||||
static gid_t *groups;
|
||||
|
@ -507,7 +507,7 @@ vfs_s_chdir (const vfs_path_t *vpath)
|
||||
/* --------------------------- stat and friends ---------------------------- */
|
||||
|
||||
static int
|
||||
vfs_s_internal_stat (const vfs_path_t *vpath, struct stat *buf, int flag)
|
||||
vfs_s_internal_stat (const vfs_path_t *vpath, mc_stat_t *buf, int flag)
|
||||
{
|
||||
struct vfs_s_inode *ino;
|
||||
|
||||
@ -611,18 +611,18 @@ vfs_s_write (void *fh, const char *buffer, size_t count)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static off_t
|
||||
vfs_s_lseek (void *fh, off_t offset, int whence)
|
||||
static mc_off_t
|
||||
vfs_s_lseek (void *fh, mc_off_t offset, int whence)
|
||||
{
|
||||
vfs_file_handler_t *file = VFS_FILE_HANDLER (fh);
|
||||
off_t size = file->ino->st.st_size;
|
||||
mc_off_t size = file->ino->st.st_size;
|
||||
|
||||
if (file->linear == LS_LINEAR_OPEN)
|
||||
vfs_die ("cannot lseek() after linear_read!");
|
||||
|
||||
if (file->handle != -1)
|
||||
{ /* If we have local file opened, we want to work with it */
|
||||
off_t retval;
|
||||
mc_off_t retval;
|
||||
|
||||
retval = lseek (file->handle, offset, whence);
|
||||
if (retval == -1)
|
||||
@ -704,7 +704,7 @@ vfs_s_close (void *fh)
|
||||
|
||||
static void
|
||||
vfs_s_print_stats (const char *fs_name, const char *action,
|
||||
const char *file_name, off_t have, off_t need)
|
||||
const char *file_name, mc_off_t have, mc_off_t need)
|
||||
{
|
||||
if (need != 0)
|
||||
vfs_print_message (_("%s: %s: %s %3d%% (%lld) bytes transferred"), fs_name, action,
|
||||
@ -878,7 +878,7 @@ vfs_s_dir_uptodate (struct vfs_class *me, struct vfs_s_inode *ino)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
struct vfs_s_inode *
|
||||
vfs_s_new_inode (struct vfs_class *me, struct vfs_s_super *super, struct stat *initstat)
|
||||
vfs_s_new_inode (struct vfs_class *me, struct vfs_s_super *super, mc_stat_t *initstat)
|
||||
{
|
||||
struct vfs_s_inode *ino;
|
||||
|
||||
@ -1000,10 +1000,10 @@ vfs_s_entry_compare (const void *a, const void *b)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
struct stat *
|
||||
mc_stat_t *
|
||||
vfs_s_default_stat (struct vfs_class *me, mode_t mode)
|
||||
{
|
||||
static struct stat st;
|
||||
static mc_stat_t st;
|
||||
mode_t myumask;
|
||||
|
||||
(void) me;
|
||||
@ -1041,7 +1041,7 @@ vfs_s_default_stat (struct vfs_class *me, mode_t mode)
|
||||
*/
|
||||
|
||||
void
|
||||
vfs_adjust_stat (struct stat *s)
|
||||
vfs_adjust_stat (mc_stat_t *s)
|
||||
{
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
|
||||
if (s->st_size == 0)
|
||||
@ -1073,7 +1073,7 @@ vfs_s_generate_entry (struct vfs_class *me, const char *name, struct vfs_s_inode
|
||||
mode_t mode)
|
||||
{
|
||||
struct vfs_s_inode *inode;
|
||||
struct stat *st;
|
||||
mc_stat_t *st;
|
||||
|
||||
st = vfs_s_default_stat (me, mode);
|
||||
inode = vfs_s_new_inode (me, parent->super, st);
|
||||
@ -1396,7 +1396,7 @@ vfs_s_open (const vfs_path_t *vpath, int flags, mode_t mode)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
vfs_s_stat (const vfs_path_t *vpath, struct stat *buf)
|
||||
vfs_s_stat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
return vfs_s_internal_stat (vpath, buf, FL_FOLLOW);
|
||||
}
|
||||
@ -1404,7 +1404,7 @@ vfs_s_stat (const vfs_path_t *vpath, struct stat *buf)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
vfs_s_lstat (const vfs_path_t *vpath, struct stat *buf)
|
||||
vfs_s_lstat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
return vfs_s_internal_stat (vpath, buf, FL_NONE);
|
||||
}
|
||||
@ -1412,7 +1412,7 @@ vfs_s_lstat (const vfs_path_t *vpath, struct stat *buf)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
vfs_s_fstat (void *fh, struct stat *buf)
|
||||
vfs_s_fstat (void *fh, mc_stat_t *buf)
|
||||
{
|
||||
*buf = VFS_FILE_HANDLER (fh)->ino->st;
|
||||
return 0;
|
||||
@ -1424,11 +1424,11 @@ int
|
||||
vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino)
|
||||
{
|
||||
/* If you want reget, you'll have to open file with O_LINEAR */
|
||||
off_t total = 0;
|
||||
mc_off_t total = 0;
|
||||
char buffer[BUF_8K];
|
||||
int handle;
|
||||
ssize_t n;
|
||||
off_t stat_size = ino->st.st_size;
|
||||
mc_off_t stat_size = ino->st.st_size;
|
||||
vfs_file_handler_t *fh = NULL;
|
||||
vfs_path_t *tmp_vpath;
|
||||
struct vfs_s_subclass *s = VFS_SUBCLASS (me);
|
||||
|
@ -108,8 +108,13 @@ extern struct vfs_dirent *mc_readdir_result;
|
||||
#define MKDIR w32_mkdir
|
||||
#define LINK w32_link
|
||||
#define UNLINK w32_unlink
|
||||
#if defined(_LARGEFILE64_SOURCE)
|
||||
#define STAT w32_stat64
|
||||
#define LSTAT w32_lstat64
|
||||
#else
|
||||
#define STAT w32_stat
|
||||
#define LSTAT w32_lstat
|
||||
#endif
|
||||
#define WRITE w32_write
|
||||
#define READ w32_read
|
||||
|
||||
@ -130,7 +135,7 @@ mc_def_getlocalcopy (const vfs_path_t * filename_vpath)
|
||||
int fdin = -1, fdout = -1;
|
||||
ssize_t i;
|
||||
char buffer[BUF_1K * 8];
|
||||
struct stat mystat;
|
||||
mc_stat_t mystat;
|
||||
|
||||
fdin = mc_open (filename_vpath, O_RDONLY | O_LINEAR);
|
||||
if (fdin == -1)
|
||||
@ -356,7 +361,7 @@ rettype mc_##name inarg \
|
||||
|
||||
MC_HANDLEOP (ssize_t, read, (int handle, void *buf, size_t count), (fsinfo, buf, count))
|
||||
MC_HANDLEOP (ssize_t, write, (int handle, const void *buf, size_t count), (fsinfo, buf, count))
|
||||
MC_HANDLEOP (int, fstat, (int handle, struct stat *buf), (fsinfo, buf))
|
||||
MC_HANDLEOP (int, fstat, (int handle, mc_stat_t *buf), (fsinfo, buf))
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
@ -576,7 +581,7 @@ mc_closedir (DIR * dirp)
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
#define MC_STATOP(name) \
|
||||
int mc_##name (const vfs_path_t *vpath, struct stat *buf) \
|
||||
int mc_##name (const vfs_path_t *vpath, mc_stat_t *buf) \
|
||||
{ \
|
||||
int result = -1; \
|
||||
struct vfs_class *me; \
|
||||
@ -738,12 +743,12 @@ mc_chdir (const vfs_path_t * vpath)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
off_t
|
||||
mc_lseek (int fd, off_t offset, int whence)
|
||||
mc_off_t
|
||||
mc_lseek (int fd, mc_off_t offset, int whence)
|
||||
{
|
||||
struct vfs_class *vfs;
|
||||
void *fsinfo = NULL;
|
||||
off_t result;
|
||||
mc_off_t result;
|
||||
|
||||
if (fd == -1)
|
||||
return (-1);
|
||||
@ -752,7 +757,7 @@ mc_lseek (int fd, off_t offset, int whence)
|
||||
if (vfs == NULL)
|
||||
return (-1);
|
||||
|
||||
result = vfs->lseek ? vfs->lseek (fsinfo, offset, whence) : -1;
|
||||
result = vfs->lseek ? (vfs->lseek) (fsinfo, offset, whence) : -1;
|
||||
if (result == -1)
|
||||
errno = vfs->lseek ? vfs_ferrno (vfs) : ENOTSUP;
|
||||
return result;
|
||||
@ -819,7 +824,7 @@ mc_tmpdir (void)
|
||||
static const char *tmpdir = NULL;
|
||||
const char *sys_tmp;
|
||||
struct passwd *pwd;
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
const char *error = NULL;
|
||||
|
||||
/* Check if already correctly initialized */
|
||||
|
@ -679,7 +679,7 @@ vfs_parse_ls_lga_get_final_spaces (void)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
vfs_parse_ls_lga (const char *p, struct stat *s, char **filename, char **linkname,
|
||||
vfs_parse_ls_lga (const char *p, mc_stat_t *s, char **filename, char **linkname,
|
||||
size_t *num_spaces)
|
||||
{
|
||||
int idx, idx2, num_cols;
|
||||
@ -793,7 +793,7 @@ vfs_parse_ls_lga (const char *p, struct stat *s, char **filename, char **linknam
|
||||
if (!is_num (idx2))
|
||||
goto error;
|
||||
|
||||
s->st_size = (off_t) g_ascii_strtoll (columns[idx2], NULL, 10);
|
||||
s->st_size = (mc_off_t) g_ascii_strtoll (columns[idx2], NULL, 10);
|
||||
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
||||
s->st_rdev = 0;
|
||||
#endif
|
||||
|
@ -68,7 +68,7 @@ extern GPtrArray *vfs__classes_list;
|
||||
static gboolean
|
||||
path_magic (const char *path)
|
||||
{
|
||||
struct stat buf;
|
||||
mc_stat_t buf;
|
||||
|
||||
return (stat (path, &buf) != 0);
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ vfs_get_timespecs_from_timesbuf (mc_timesbuf_t *times, mc_timespec_t *atime, mc_
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
vfs_get_timesbuf_from_stat (const struct stat *s, mc_timesbuf_t *times)
|
||||
vfs_get_timesbuf_from_stat (const mc_stat_t *s, mc_timesbuf_t *times)
|
||||
{
|
||||
#ifdef HAVE_UTIMENSAT
|
||||
#ifdef HAVE_STRUCT_STAT_ST_MTIM
|
||||
@ -447,7 +447,7 @@ vfs_get_timesbuf_from_stat (const struct stat *s, mc_timesbuf_t *times)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
vfs_copy_stat_times (const struct stat *src, struct stat *dst)
|
||||
vfs_copy_stat_times (const mc_stat_t *src, mc_stat_t *dst)
|
||||
{
|
||||
dst->st_atime = src->st_atime;
|
||||
dst->st_mtime = src->st_mtime;
|
||||
@ -471,9 +471,9 @@ vfs_copy_stat_times (const struct stat *src, struct stat *dst)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
vfs_zero_stat_times (struct stat *s)
|
||||
vfs_zero_stat_times (mc_stat_t *s)
|
||||
{
|
||||
const struct stat empty = { 0 };
|
||||
const mc_stat_t empty = { 0 };
|
||||
|
||||
vfs_copy_stat_times (&empty, s);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ gboolean vfs_parse_filemode (const char *s, size_t *ret_skipped, mode_t * ret_mo
|
||||
gboolean vfs_parse_raw_filemode (const char *s, size_t *ret_skipped, mode_t * ret_mode);
|
||||
|
||||
void vfs_parse_ls_lga_init (void);
|
||||
gboolean vfs_parse_ls_lga (const char *p, struct stat *s, char **filename, char **linkname,
|
||||
gboolean vfs_parse_ls_lga (const char *p, mc_stat_t *s, char **filename, char **linkname,
|
||||
size_t *filename_pos);
|
||||
size_t vfs_parse_ls_lga_get_final_spaces (void);
|
||||
gboolean vfs_parse_month (const char *str, struct tm *tim);
|
||||
@ -63,9 +63,9 @@ int vfs_parse_filedate (int idx, time_t * t);
|
||||
int vfs_utime (const char *path, mc_timesbuf_t *times);
|
||||
void vfs_get_timespecs_from_timesbuf (mc_timesbuf_t *times, mc_timespec_t *atime,
|
||||
mc_timespec_t *mtime);
|
||||
void vfs_get_timesbuf_from_stat (const struct stat *s, mc_timesbuf_t *times);
|
||||
void vfs_copy_stat_times (const struct stat *src, struct stat *dst);
|
||||
void vfs_zero_stat_times (struct stat *s);
|
||||
void vfs_get_timesbuf_from_stat (const mc_stat_t *s, mc_timesbuf_t *times);
|
||||
void vfs_copy_stat_times (const mc_stat_t *src, mc_stat_t *dst);
|
||||
void vfs_zero_stat_times (mc_stat_t *s);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
||||
|
@ -224,7 +224,7 @@ vfs_get_openfile (int handle)
|
||||
static gboolean
|
||||
vfs_test_current_dir (const vfs_path_t *vpath)
|
||||
{
|
||||
struct stat my_stat, my_stat2;
|
||||
mc_stat_t my_stat, my_stat2;
|
||||
|
||||
return (mc_global.vfs.cd_symlinks && mc_stat (vpath, &my_stat) == 0
|
||||
&& mc_stat (vfs_get_raw_current_dir (), &my_stat2) == 0
|
||||
@ -717,7 +717,7 @@ vfs_get_cwd (void)
|
||||
*/
|
||||
|
||||
int
|
||||
vfs_preallocate (int dest_vfs_fd, off_t src_fsize, off_t dest_fsize)
|
||||
vfs_preallocate (int dest_vfs_fd, mc_off_t src_fsize, mc_off_t dest_fsize)
|
||||
{
|
||||
#ifndef HAVE_POSIX_FALLOCATE
|
||||
(void) dest_vfs_fd;
|
||||
|
@ -169,9 +169,9 @@ typedef struct vfs_class
|
||||
struct vfs_dirent *(*readdir) (void *vfs_info);
|
||||
int (*closedir) (void *vfs_info);
|
||||
|
||||
int (*stat) (const vfs_path_t * vpath, struct stat * buf);
|
||||
int (*lstat) (const vfs_path_t * vpath, struct stat * buf);
|
||||
int (*fstat) (void *vfs_info, struct stat * buf);
|
||||
int (*stat) (const vfs_path_t * vpath, mc_stat_t * buf);
|
||||
int (*lstat) (const vfs_path_t * vpath, mc_stat_t * buf);
|
||||
int (*fstat) (void *vfs_info, mc_stat_t * buf);
|
||||
|
||||
int (*chmod) (const vfs_path_t * vpath, mode_t mode);
|
||||
int (*chown) (const vfs_path_t * vpath, uid_t owner, gid_t group);
|
||||
@ -188,7 +188,7 @@ typedef struct vfs_class
|
||||
int (*rename) (const vfs_path_t * vpath1, const vfs_path_t * vpath2);
|
||||
int (*chdir) (const vfs_path_t * vpath);
|
||||
int (*ferrno) (struct vfs_class * me);
|
||||
off_t (*lseek) (void *vfs_info, off_t offset, int whence);
|
||||
mc_off_t (*lseek) (void *vfs_info, mc_off_t offset, int whence);
|
||||
int (*mknod) (const vfs_path_t * vpath, mode_t mode, dev_t dev);
|
||||
|
||||
vfsid (*getid) (const vfs_path_t * vpath);
|
||||
@ -238,11 +238,11 @@ void vfs_init_class (struct vfs_class *vclass, const char *name, vfs_flags_t fla
|
||||
const char *prefix);
|
||||
|
||||
void *vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode);
|
||||
int vfs_s_stat (const vfs_path_t * vpath, struct stat *buf);
|
||||
int vfs_s_lstat (const vfs_path_t * vpath, struct stat *buf);
|
||||
int vfs_s_fstat (void *fh, struct stat *buf);
|
||||
int vfs_s_stat (const vfs_path_t * vpath, mc_stat_t *buf);
|
||||
int vfs_s_lstat (const vfs_path_t * vpath, mc_stat_t *buf);
|
||||
int vfs_s_fstat (void *fh, mc_stat_t *buf);
|
||||
|
||||
void vfs_adjust_stat (struct stat *s);
|
||||
void vfs_adjust_stat (mc_stat_t *s);
|
||||
|
||||
vfsid vfs_getid (const vfs_path_t * vpath);
|
||||
|
||||
@ -302,7 +302,7 @@ void vfs_free_handle (int handle);
|
||||
void vfs_setup_cwd (void);
|
||||
char *vfs_get_cwd (void);
|
||||
|
||||
int vfs_preallocate (int dest_desc, off_t src_fsize, off_t dest_fsize);
|
||||
int vfs_preallocate (int dest_desc, mc_off_t src_fsize, mc_off_t dest_fsize);
|
||||
|
||||
int vfs_clone_file (int dest_vfs_fd, int src_vfs_fd);
|
||||
|
||||
@ -314,17 +314,17 @@ ssize_t mc_write (int handle, const void *buffer, size_t count);
|
||||
int mc_utime (const vfs_path_t * vpath, mc_timesbuf_t * times);
|
||||
int mc_readlink (const vfs_path_t * vpath, char *buf, size_t bufsiz);
|
||||
int mc_close (int handle);
|
||||
off_t mc_lseek (int fd, off_t offset, int whence);
|
||||
mc_off_t mc_lseek (int fd, mc_off_t offset, int whence);
|
||||
DIR *mc_opendir (const vfs_path_t * vpath);
|
||||
struct vfs_dirent *mc_readdir (DIR * dirp);
|
||||
int mc_closedir (DIR * dir);
|
||||
MC_MOCKABLE int mc_stat (const vfs_path_t * vpath, struct stat *buf);
|
||||
MC_MOCKABLE int mc_stat (const vfs_path_t * vpath, mc_stat_t *buf);
|
||||
int mc_mknod (const vfs_path_t * vpath, mode_t mode, dev_t dev);
|
||||
int mc_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2);
|
||||
int mc_mkdir (const vfs_path_t * vpath, mode_t mode);
|
||||
int mc_rmdir (const vfs_path_t * vpath);
|
||||
int mc_fstat (int fd, struct stat *buf);
|
||||
MC_MOCKABLE int mc_lstat (const vfs_path_t * vpath, struct stat *buf);
|
||||
int mc_fstat (int fd, mc_stat_t * buf);
|
||||
MC_MOCKABLE int mc_lstat (const vfs_path_t * vpath, mc_stat_t *buf);
|
||||
int mc_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2);
|
||||
int mc_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2);
|
||||
int mc_chmod (const vfs_path_t * vpath, mode_t mode);
|
||||
|
@ -93,11 +93,11 @@ struct vfs_s_inode
|
||||
use only for directories because they
|
||||
cannot be hardlinked */
|
||||
GQueue *subdir; /* If this is a directory, its entry. List of vfs_s_entry */
|
||||
struct stat st; /* Parameters of this inode */
|
||||
mc_stat_t st; /* Parameters of this inode */
|
||||
char *linkname; /* Symlink's contents */
|
||||
char *localname; /* Filename of local file, if we have one */
|
||||
gint64 timestamp; /* Subclass specific */
|
||||
off_t data_offset; /* Subclass specific */
|
||||
mc_off_t data_offset; /* Subclass specific */
|
||||
void *user_data; /* Subclass specific */
|
||||
};
|
||||
|
||||
@ -105,7 +105,7 @@ struct vfs_s_inode
|
||||
typedef struct
|
||||
{
|
||||
struct vfs_s_inode *ino;
|
||||
off_t pos; /* This is for module's use */
|
||||
mc_off_t pos; /* This is for module's use */
|
||||
int handle; /* This is for module's use, but if != -1, will be mc_close()d */
|
||||
gboolean changed; /* Did this file change? */
|
||||
vfs_linear_state_t linear; /* Is that file open with O_LINEAR? */
|
||||
@ -148,7 +148,7 @@ struct vfs_s_subclass
|
||||
gboolean (*dir_uptodate) (struct vfs_class * me, struct vfs_s_inode * ino);
|
||||
int (*file_store) (struct vfs_class * me, vfs_file_handler_t * fh, char *path, char *localname);
|
||||
|
||||
int (*linear_start) (struct vfs_class * me, vfs_file_handler_t * fh, off_t from);
|
||||
int (*linear_start) (struct vfs_class * me, vfs_file_handler_t * fh, mc_off_t from);
|
||||
ssize_t (*linear_read) (struct vfs_class * me, vfs_file_handler_t * fh, void *buf, size_t len);
|
||||
void (*linear_close) (struct vfs_class * me, vfs_file_handler_t * fh);
|
||||
/* *INDENT-ON* */
|
||||
@ -160,7 +160,7 @@ struct vfs_s_subclass
|
||||
|
||||
/* entries and inodes */
|
||||
struct vfs_s_inode *vfs_s_new_inode (struct vfs_class *me,
|
||||
struct vfs_s_super *super, struct stat *initstat);
|
||||
struct vfs_s_super *super, mc_stat_t *initstat);
|
||||
void vfs_s_free_inode (struct vfs_class *me, struct vfs_s_inode *ino);
|
||||
|
||||
struct vfs_s_entry *vfs_s_new_entry (struct vfs_class *me, const char *name,
|
||||
@ -168,7 +168,7 @@ struct vfs_s_entry *vfs_s_new_entry (struct vfs_class *me, const char *name,
|
||||
void vfs_s_free_entry (struct vfs_class *me, struct vfs_s_entry *ent);
|
||||
void vfs_s_insert_entry (struct vfs_class *me, struct vfs_s_inode *dir, struct vfs_s_entry *ent);
|
||||
int vfs_s_entry_compare (const void *a, const void *b);
|
||||
struct stat *vfs_s_default_stat (struct vfs_class *me, mode_t mode);
|
||||
mc_stat_t *vfs_s_default_stat (struct vfs_class *me, mode_t mode);
|
||||
|
||||
struct vfs_s_entry *vfs_s_generate_entry (struct vfs_class *me, const char *name,
|
||||
struct vfs_s_inode *parent, mode_t mode);
|
||||
|
@ -228,7 +228,7 @@ filename_completion_function (const char *text, int state, input_complete_t flag
|
||||
isexec = FALSE;
|
||||
|
||||
{
|
||||
struct stat tempstat;
|
||||
mc_stat_t tempstat;
|
||||
vfs_path_t *tmp_vpath;
|
||||
|
||||
tmp_vpath = vfs_path_build_filename (dirname, entry->d_name, (char *) NULL);
|
||||
|
@ -553,7 +553,7 @@ parse_mcedit_arguments (int argc, char **argv)
|
||||
{
|
||||
char *fname;
|
||||
vfs_path_t *tmp_vpath, *fname_vpath;
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
|
||||
fname = g_strndup (tmp, p - 1 - tmp);
|
||||
tmp_vpath = vfs_path_from_str (tmp);
|
||||
|
@ -163,7 +163,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
unsigned char action = 0, console_flag = 3;
|
||||
int console_fd, vcsa_fd, console_minor, buffer_size;
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
uid_t uid, euid;
|
||||
char *buffer, *tty_name, console_name[16], vcsa_name[16];
|
||||
const char *p, *q;
|
||||
|
@ -3627,7 +3627,7 @@ dview_diff_cmd (const void *f0, const void *f1)
|
||||
/* run from command line */
|
||||
const char *p0 = (const char *) f0;
|
||||
const char *p1 = (const char *) f1;
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
|
||||
file0 = vfs_path_from_str (p0);
|
||||
if (mc_stat (file0, &st) == 0)
|
||||
@ -3677,7 +3677,7 @@ dview_diff_cmd (const void *f0, const void *f1)
|
||||
if (file0 != NULL && file1 != NULL)
|
||||
{
|
||||
int use_copy0, use_copy1;
|
||||
struct stat st0, st1;
|
||||
mc_stat_t st0, st1;
|
||||
vfs_path_t *real_file0, *real_file1;
|
||||
|
||||
GET_FILE_AND_STAMP (0);
|
||||
|
@ -294,7 +294,7 @@ edit_insert_stream (WEdit *edit, FILE *f)
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
check_file_access (WEdit *edit, const vfs_path_t *filename_vpath, struct stat *st)
|
||||
check_file_access (WEdit *edit, const vfs_path_t *filename_vpath, mc_stat_t *st)
|
||||
{
|
||||
static uintmax_t threshold = UINTMAX_MAX;
|
||||
int file;
|
||||
@ -1796,7 +1796,7 @@ edit_user_menu (WEdit *edit, const char *menu_file, int selected_entry)
|
||||
gboolean mark;
|
||||
off_t curs;
|
||||
off_t start_mark, end_mark;
|
||||
struct stat status;
|
||||
mc_stat_t status;
|
||||
vfs_path_t *block_file_vpath;
|
||||
|
||||
block_file = mc_config_get_full_path (EDIT_HOME_BLOCK_FILE);
|
||||
|
@ -138,7 +138,7 @@ edit_save_file (WEdit *edit, const vfs_path_t *filename_vpath)
|
||||
vfs_path_t *savename_vpath = NULL;
|
||||
const char *start_filename;
|
||||
const vfs_path_element_t *vpath_element;
|
||||
struct stat sb;
|
||||
mc_stat_t sb;
|
||||
|
||||
vpath_element = vfs_path_get_by_index (filename_vpath, 0);
|
||||
if (vpath_element == NULL)
|
||||
@ -954,7 +954,7 @@ edit_save_as_cmd (WEdit *edit)
|
||||
if (!vfs_path_equal (edit->filename_vpath, exp_vpath))
|
||||
{
|
||||
int file;
|
||||
struct stat sb;
|
||||
mc_stat_t sb;
|
||||
|
||||
if (mc_stat (exp_vpath, &sb) == 0 && !S_ISREG (sb.st_mode))
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ struct WEdit
|
||||
unsigned long redo_stack_bottom;
|
||||
unsigned int redo_stack_reset:1; /* If 1, need clear redo stack */
|
||||
|
||||
struct stat stat1; /* Result of mc_fstat() on the file */
|
||||
mc_stat_t stat1; /* Result of mc_fstat() on the file */
|
||||
unsigned long attrs; /* Result of mc_fgetflags() on the file */
|
||||
gboolean attrs_ok; /* mc_fgetflags() == 0 */
|
||||
|
||||
|
@ -181,7 +181,7 @@ static gboolean
|
||||
execute_prepare_with_vfs_arg (const vfs_path_t *filename_vpath, vfs_path_t **localcopy_vpath,
|
||||
time_t *mtime)
|
||||
{
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
|
||||
/* Simplest case, this file is local */
|
||||
if ((filename_vpath == NULL && vfs_file_is_local (vfs_get_raw_current_dir ()))
|
||||
@ -213,7 +213,7 @@ execute_cleanup_with_vfs_arg (const vfs_path_t *filename_vpath, vfs_path_t **loc
|
||||
{
|
||||
if (*localcopy_vpath != NULL)
|
||||
{
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
|
||||
/*
|
||||
* filename can be an entry on panel, it can be changed by executing
|
||||
|
@ -102,7 +102,7 @@ static int x_toggle;
|
||||
static char ch_flags[11];
|
||||
static const char ch_perm[] = "rwx";
|
||||
static mode_t ch_cmode;
|
||||
static struct stat sf_stat;
|
||||
static mc_stat_t sf_stat;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** file scope functions ************************************************************************/
|
||||
@ -931,7 +931,7 @@ do_advanced_chown (WPanel *panel, const vfs_path_t *p, mode_t m, uid_t u, gid_t
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
apply_advanced_chowns (WPanel *panel, vfs_path_t *vpath, struct stat *sf)
|
||||
apply_advanced_chowns (WPanel *panel, vfs_path_t *vpath, mc_stat_t *sf)
|
||||
{
|
||||
gid_t a_gid = sf->st_gid;
|
||||
uid_t a_uid = sf->st_uid;
|
||||
|
@ -300,7 +300,7 @@ chmod_callback (Widget *w, Widget *sender, widget_msg_t msg, int parm, void *dat
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static WDialog *
|
||||
chmod_dlg_create (WPanel *panel, const char *fname, const struct stat *sf_stat)
|
||||
chmod_dlg_create (WPanel *panel, const char *fname, const mc_stat_t *sf_stat)
|
||||
{
|
||||
gboolean single_set;
|
||||
WDialog *ch_dlg;
|
||||
@ -457,7 +457,7 @@ try_chmod (const vfs_path_t *p, mode_t m)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
do_chmod (WPanel *panel, const vfs_path_t *p, struct stat *sf)
|
||||
do_chmod (WPanel *panel, const vfs_path_t *p, mc_stat_t *sf)
|
||||
{
|
||||
gboolean ret;
|
||||
|
||||
@ -474,7 +474,7 @@ do_chmod (WPanel *panel, const vfs_path_t *p, struct stat *sf)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
apply_mask (WPanel *panel, vfs_path_t *vpath, struct stat *sf)
|
||||
apply_mask (WPanel *panel, vfs_path_t *vpath, mc_stat_t *sf)
|
||||
{
|
||||
gboolean ok;
|
||||
|
||||
@ -529,7 +529,7 @@ chmod_cmd (WPanel *panel)
|
||||
{ /* do while any files remaining */
|
||||
vfs_path_t *vpath;
|
||||
WDialog *ch_dlg;
|
||||
struct stat sf_stat;
|
||||
mc_stat_t sf_stat;
|
||||
const GString *fname;
|
||||
int i, result;
|
||||
|
||||
|
@ -353,7 +353,7 @@ apply_chowns (WPanel *panel, vfs_path_t *vpath, uid_t u, gid_t g)
|
||||
do
|
||||
{
|
||||
const GString *fname;
|
||||
struct stat sf;
|
||||
mc_stat_t sf;
|
||||
|
||||
fname = panel_find_marked_file (panel, ¤t_file);
|
||||
vpath = vfs_path_from_str (fname->str);
|
||||
@ -395,7 +395,7 @@ chown_cmd (WPanel *panel)
|
||||
{ /* do while any files remaining */
|
||||
vfs_path_t *vpath;
|
||||
WDialog *ch_dlg;
|
||||
struct stat sf_stat;
|
||||
mc_stat_t sf_stat;
|
||||
const GString *fname;
|
||||
int result;
|
||||
char buffer[BUF_TINY];
|
||||
|
@ -149,7 +149,7 @@ clean_sort_keys (dir_list *list, int start, int count)
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
handle_dirent (struct vfs_dirent *dp, const file_filter_t *filter, struct stat *buf1,
|
||||
handle_dirent (struct vfs_dirent *dp, const file_filter_t *filter, mc_stat_t *buf1,
|
||||
gboolean *link_to_dir, gboolean *stale_link)
|
||||
{
|
||||
vfs_path_t *vpath;
|
||||
@ -196,7 +196,7 @@ handle_dirent (struct vfs_dirent *dp, const file_filter_t *filter, struct stat *
|
||||
/** get info about ".." */
|
||||
|
||||
static gboolean
|
||||
dir_get_dotdot_stat (const vfs_path_t *vpath, struct stat *st)
|
||||
dir_get_dotdot_stat (const vfs_path_t *vpath, mc_stat_t *st)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
|
||||
@ -296,7 +296,7 @@ dir_list_grow (dir_list *list, int delta)
|
||||
*/
|
||||
|
||||
gboolean
|
||||
dir_list_append (dir_list *list, const char *fname, const struct stat *st,
|
||||
dir_list_append (dir_list *list, const char *fname, const mc_stat_t *st,
|
||||
gboolean link_to_dir, gboolean stale_link)
|
||||
{
|
||||
file_entry_t *fentry;
|
||||
@ -593,7 +593,7 @@ dir_list_init (dir_list *list)
|
||||
/* Return values: FALSE = don't add, TRUE = add to the list */
|
||||
|
||||
gboolean
|
||||
handle_path (const char *path, struct stat *buf1, gboolean *link_to_dir, gboolean *stale_link)
|
||||
handle_path (const char *path, mc_stat_t *buf1, gboolean *link_to_dir, gboolean *stale_link)
|
||||
{
|
||||
vfs_path_t *vpath;
|
||||
|
||||
@ -615,7 +615,7 @@ handle_path (const char *path, struct stat *buf1, gboolean *link_to_dir, gboolea
|
||||
*stale_link = FALSE;
|
||||
if (S_ISLNK (buf1->st_mode))
|
||||
{
|
||||
struct stat buf2;
|
||||
mc_stat_t buf2;
|
||||
|
||||
if (mc_stat (vpath, &buf2) == 0)
|
||||
*link_to_dir = S_ISDIR (buf2.st_mode) != 0;
|
||||
@ -636,7 +636,7 @@ dir_list_load (dir_list *list, const vfs_path_t *vpath, GCompareFunc sort,
|
||||
{
|
||||
DIR *dirp;
|
||||
struct vfs_dirent *dp;
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
file_entry_t *fentry;
|
||||
const char *vpath_str;
|
||||
gboolean ret = TRUE;
|
||||
@ -692,7 +692,7 @@ dir_list_load (dir_list *list, const vfs_path_t *vpath, GCompareFunc sort,
|
||||
gboolean
|
||||
if_link_is_exe (const vfs_path_t *full_name_vpath, const file_entry_t *file)
|
||||
{
|
||||
struct stat b;
|
||||
mc_stat_t b;
|
||||
|
||||
if (S_ISLNK (file->st.st_mode) && mc_stat (full_name_vpath, &b) == 0)
|
||||
return is_exe (b.st_mode);
|
||||
@ -710,7 +710,7 @@ dir_list_reload (dir_list *list, const vfs_path_t *vpath, GCompareFunc sort,
|
||||
DIR *dirp;
|
||||
struct vfs_dirent *dp;
|
||||
int i;
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
int marked_cnt;
|
||||
GHashTable *marked_files;
|
||||
const char *tmp_path;
|
||||
|
@ -75,7 +75,7 @@ typedef struct
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
gboolean dir_list_grow (dir_list * list, int delta);
|
||||
gboolean dir_list_append (dir_list * list, const char *fname, const struct stat *st,
|
||||
gboolean dir_list_append (dir_list * list, const char *fname, const mc_stat_t *st,
|
||||
gboolean link_to_dir, gboolean stale_link);
|
||||
|
||||
gboolean dir_list_load (dir_list * list, const vfs_path_t * vpath, GCompareFunc sort,
|
||||
@ -86,7 +86,7 @@ void dir_list_sort (dir_list * list, GCompareFunc sort, const dir_sort_options_t
|
||||
gboolean dir_list_init (dir_list * list);
|
||||
void dir_list_clean (dir_list * list);
|
||||
void dir_list_free_list (dir_list * list);
|
||||
gboolean handle_path (const char *path, struct stat *buf1, gboolean * link_to_dir,
|
||||
gboolean handle_path (const char *path, mc_stat_t *buf1, gboolean * link_to_dir,
|
||||
gboolean * stale_link);
|
||||
|
||||
/* Sorting functions */
|
||||
|
@ -142,7 +142,7 @@ exec_cleanup_file_name (const vfs_path_t *filename_vpath, gboolean has_changed)
|
||||
|
||||
if (has_changed)
|
||||
{
|
||||
struct stat mystat;
|
||||
mc_stat_t mystat;
|
||||
|
||||
mc_stat (localfilecopy_vpath, &mystat);
|
||||
has_changed = localmtime != mystat.st_mtime;
|
||||
@ -162,7 +162,7 @@ exec_get_file_name (const vfs_path_t *filename_vpath)
|
||||
|
||||
if (localfilecopy_vpath == NULL)
|
||||
{
|
||||
struct stat mystat;
|
||||
mc_stat_t mystat;
|
||||
localfilecopy_vpath = mc_getlocalcopy (filename_vpath);
|
||||
if (localfilecopy_vpath == NULL)
|
||||
return NULL;
|
||||
@ -1021,7 +1021,7 @@ regex_command_for (void *target, const vfs_path_t *filename_vpath, const char *a
|
||||
gboolean found = FALSE;
|
||||
gboolean error_flag = FALSE;
|
||||
int ret = 0;
|
||||
struct stat mystat;
|
||||
mc_stat_t mystat;
|
||||
int view_at_line_number = 0;
|
||||
#ifdef USE_FILE_CMD
|
||||
gboolean have_type = FALSE; /* Flag used by regex_check_type() */
|
||||
|
@ -333,7 +333,7 @@ free_linklist (GSList *lp)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static const link_t *
|
||||
is_in_linklist (const GSList *lp, const vfs_path_t *vpath, const struct stat *sb)
|
||||
is_in_linklist (const GSList *lp, const vfs_path_t *vpath, const mc_stat_t *sb)
|
||||
{
|
||||
const struct vfs_class *class;
|
||||
ino_t ino = sb->st_ino;
|
||||
@ -361,7 +361,7 @@ is_in_linklist (const GSList *lp, const vfs_path_t *vpath, const struct stat *sb
|
||||
*/
|
||||
|
||||
static hardlink_status_t
|
||||
check_hardlinks (file_op_context_t *ctx, const vfs_path_t *src_vpath, const struct stat *src_stat,
|
||||
check_hardlinks (file_op_context_t *ctx, const vfs_path_t *src_vpath, const mc_stat_t *src_stat,
|
||||
const vfs_path_t *dst_vpath, gboolean *ignore_all)
|
||||
{
|
||||
link_t *lnk;
|
||||
@ -377,7 +377,7 @@ check_hardlinks (file_op_context_t *ctx, const vfs_path_t *src_vpath, const stru
|
||||
if (lnk != NULL)
|
||||
{
|
||||
int stat_result;
|
||||
struct stat link_stat;
|
||||
mc_stat_t link_stat;
|
||||
|
||||
stat_result = mc_stat (lnk->src_vpath, &link_stat);
|
||||
|
||||
@ -507,7 +507,7 @@ make_symlink (file_op_context_t *ctx, const vfs_path_t *src_vpath, const vfs_pat
|
||||
char link_target[MC_MAXPATHLEN];
|
||||
int len;
|
||||
FileProgressStatus return_status;
|
||||
struct stat dst_stat;
|
||||
mc_stat_t dst_stat;
|
||||
gboolean dst_is_symlink;
|
||||
vfs_path_t *link_target_vpath = NULL;
|
||||
|
||||
@ -644,7 +644,7 @@ do_compute_dir_size (const vfs_path_t *dirname_vpath, dirsize_status_msg_t *dsm,
|
||||
|
||||
status_msg_t *sm = STATUS_MSG (dsm);
|
||||
int res;
|
||||
struct stat s;
|
||||
mc_stat_t s;
|
||||
DIR *dir;
|
||||
struct vfs_dirent *dirent;
|
||||
FileProgressStatus ret = FILE_CONT;
|
||||
@ -716,7 +716,7 @@ panel_compute_totals (const WPanel *panel, dirsize_status_msg_t *sm, size_t *ret
|
||||
for (i = 0; i < panel->dir.len; i++)
|
||||
{
|
||||
const file_entry_t *fe = &panel->dir.list[i];
|
||||
const struct stat *s;
|
||||
const mc_stat_t *s;
|
||||
|
||||
if (fe->f.marked == 0)
|
||||
continue;
|
||||
@ -750,7 +750,7 @@ panel_compute_totals (const WPanel *panel, dirsize_status_msg_t *sm, size_t *ret
|
||||
/** Initialize variables for progress bars */
|
||||
static FileProgressStatus
|
||||
panel_operate_init_totals (const WPanel *panel, const vfs_path_t *source,
|
||||
const struct stat *source_stat, file_op_context_t *ctx,
|
||||
const mc_stat_t *source_stat, file_op_context_t *ctx,
|
||||
gboolean compute_totals, filegui_dialog_type_t dialog_type)
|
||||
{
|
||||
FileProgressStatus status;
|
||||
@ -778,7 +778,7 @@ panel_operate_init_totals (const WPanel *panel, const vfs_path_t *source,
|
||||
ctx->follow_links);
|
||||
else if (S_ISDIR (source_stat->st_mode)
|
||||
|| (ctx->follow_links
|
||||
&& file_is_symlink_to_dir (source, (struct stat *) source_stat, &stale_link)
|
||||
&& file_is_symlink_to_dir (source, (mc_stat_t *) source_stat, &stale_link)
|
||||
&& !stale_link))
|
||||
{
|
||||
size_t dir_count = 0;
|
||||
@ -819,7 +819,7 @@ panel_operate_init_totals (const WPanel *panel, const vfs_path_t *source,
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
progress_update_one (gboolean success, file_op_context_t *ctx, off_t add)
|
||||
progress_update_one (gboolean success, file_op_context_t *ctx, mc_off_t add)
|
||||
{
|
||||
gint64 tv_current;
|
||||
static gint64 tv_start = -1;
|
||||
@ -925,8 +925,8 @@ warn_same_file (file_op_context_t *ctx, const char *fmt, const char *a, const ch
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
check_same_file (file_op_context_t *ctx, const char *a, const struct stat *ast, const char *b,
|
||||
const struct stat *bst, FileProgressStatus *status)
|
||||
check_same_file (file_op_context_t *ctx, const char *a, const mc_stat_t *ast, const char *b,
|
||||
const mc_stat_t *bst, FileProgressStatus *status)
|
||||
{
|
||||
if (ast->st_dev != bst->st_dev || ast->st_ino != bst->st_ino)
|
||||
return FALSE;
|
||||
@ -1082,23 +1082,23 @@ query_recursive (file_op_context_t *ctx, const char *s)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static FileProgressStatus
|
||||
query_replace (file_op_context_t *ctx, const char *src, struct stat *src_stat, const char *dst,
|
||||
struct stat *dst_stat)
|
||||
query_replace (file_op_context_t *ctx, const char *src, mc_stat_t *src_stat, const char *dst,
|
||||
mc_stat_t *dst_stat)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
union
|
||||
{
|
||||
void *p;
|
||||
FileProgressStatus (*f) (file_op_context_t *, enum OperationMode, const char *,
|
||||
struct stat *, const char *, struct stat *);
|
||||
mc_stat_t *, const char *, mc_stat_t *);
|
||||
} pntr;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
pntr.f = file_progress_real_query_replace;
|
||||
|
||||
if (mc_global.we_are_background)
|
||||
return parent_call (pntr.p, ctx, 4, strlen (src), src, sizeof (struct stat), src_stat,
|
||||
strlen (dst), dst, sizeof (struct stat), dst_stat);
|
||||
return parent_call (pntr.p, ctx, 4, strlen (src), src, sizeof (mc_stat_t), src_stat,
|
||||
strlen (dst), dst, sizeof (mc_stat_t), dst_stat);
|
||||
else
|
||||
return file_progress_real_query_replace (ctx, Foreground, src, src_stat, dst, dst_stat);
|
||||
}
|
||||
@ -1123,8 +1123,8 @@ query_recursive (file_op_context_t *ctx, const char *s)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static FileProgressStatus
|
||||
query_replace (file_op_context_t *ctx, const char *src, struct stat *src_stat, const char *dst,
|
||||
struct stat *dst_stat)
|
||||
query_replace (file_op_context_t *ctx, const char *src, mc_stat_t *src_stat, const char *dst,
|
||||
mc_stat_t *dst_stat)
|
||||
{
|
||||
return file_progress_real_query_replace (ctx, Foreground, src, src_stat, dst, dst_stat);
|
||||
}
|
||||
@ -1154,8 +1154,8 @@ files_error (file_op_context_t *ctx, const char *format, const char *file1, cons
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
calc_copy_file_progress (file_op_context_t *ctx, gint64 tv_current, off_t file_part,
|
||||
off_t file_size)
|
||||
calc_copy_file_progress (file_op_context_t *ctx, gint64 tv_current, mc_off_t file_part,
|
||||
mc_off_t file_size)
|
||||
{
|
||||
double dt;
|
||||
|
||||
@ -1226,7 +1226,7 @@ try_remove_file (file_op_context_t *ctx, const vfs_path_t *vpath, FileProgressSt
|
||||
static FileProgressStatus
|
||||
move_file_file (const WPanel *panel, file_op_context_t *ctx, const char *s, const char *d)
|
||||
{
|
||||
struct stat src_stat, dst_stat;
|
||||
mc_stat_t src_stat, dst_stat;
|
||||
FileProgressStatus return_status = FILE_CONT;
|
||||
gboolean copy_done = FALSE;
|
||||
gboolean old_ask_overwrite;
|
||||
@ -1396,7 +1396,7 @@ move_file_file (const WPanel *panel, file_op_context_t *ctx, const char *s, cons
|
||||
static FileProgressStatus
|
||||
erase_file (file_op_context_t *ctx, const vfs_path_t *vpath)
|
||||
{
|
||||
struct stat buf;
|
||||
mc_stat_t buf;
|
||||
FileProgressStatus return_status;
|
||||
|
||||
/* check buttons if deleting info was changed */
|
||||
@ -1468,7 +1468,7 @@ recursive_erase (file_op_context_t *ctx, const vfs_path_t *vpath)
|
||||
while ((next = mc_readdir (reading)) && return_status != FILE_ABORT)
|
||||
{
|
||||
vfs_path_t *tmp_vpath;
|
||||
struct stat buf;
|
||||
mc_stat_t buf;
|
||||
|
||||
if (DIR_IS_DOT (next->d_name) || DIR_IS_DOTDOT (next->d_name))
|
||||
continue;
|
||||
@ -1631,7 +1631,7 @@ erase_dir_after_copy (file_op_context_t *ctx, const vfs_path_t *vpath, FileProgr
|
||||
static FileProgressStatus
|
||||
do_move_dir_dir (const WPanel *panel, file_op_context_t *ctx, const char *s, const char *d)
|
||||
{
|
||||
struct stat src_stat, dst_stat;
|
||||
mc_stat_t src_stat, dst_stat;
|
||||
FileProgressStatus return_status = FILE_CONT;
|
||||
gboolean move_over = FALSE;
|
||||
gboolean dstat_ok;
|
||||
@ -1821,7 +1821,7 @@ panel_get_file (const WPanel *panel)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static const char *
|
||||
check_single_entry (const WPanel *panel, gboolean force_single, struct stat *src_stat)
|
||||
check_single_entry (const WPanel *panel, gboolean force_single, mc_stat_t *src_stat)
|
||||
{
|
||||
const char *source;
|
||||
gboolean ok;
|
||||
@ -1883,7 +1883,7 @@ check_single_entry (const WPanel *panel, gboolean force_single, struct stat *src
|
||||
|
||||
static char *
|
||||
panel_operate_generate_prompt (const WPanel *panel, FileOperation operation,
|
||||
const struct stat *src_stat)
|
||||
const mc_stat_t *src_stat)
|
||||
{
|
||||
char *sp;
|
||||
char *format_string;
|
||||
@ -1964,7 +1964,7 @@ panel_operate_generate_prompt (const WPanel *panel, FileOperation operation,
|
||||
|
||||
static char *
|
||||
do_confirm_copy_move (const WPanel *panel, gboolean force_single, const char *source,
|
||||
struct stat *src_stat, file_op_context_t *ctx, gboolean *do_bg)
|
||||
mc_stat_t *src_stat, file_op_context_t *ctx, gboolean *do_bg)
|
||||
{
|
||||
const char *tmp_dest_dir;
|
||||
char *dest_dir;
|
||||
@ -2018,7 +2018,7 @@ do_confirm_copy_move (const WPanel *panel, gboolean force_single, const char *so
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
do_confirm_erase (const WPanel *panel, const char *source, struct stat *src_stat)
|
||||
do_confirm_erase (const WPanel *panel, const char *source, mc_stat_t *src_stat)
|
||||
{
|
||||
int i;
|
||||
char *format;
|
||||
@ -2054,7 +2054,7 @@ do_confirm_erase (const WPanel *panel, const char *source, struct stat *src_stat
|
||||
|
||||
static FileProgressStatus
|
||||
operate_single_file (const WPanel *panel, file_op_context_t *ctx, const char *src,
|
||||
struct stat *src_stat, const char *dest, filegui_dialog_type_t dialog_type)
|
||||
mc_stat_t *src_stat, const char *dest, filegui_dialog_type_t dialog_type)
|
||||
{
|
||||
FileProgressStatus value;
|
||||
vfs_path_t *src_vpath;
|
||||
@ -2156,7 +2156,7 @@ operate_single_file (const WPanel *panel, file_op_context_t *ctx, const char *sr
|
||||
|
||||
static FileProgressStatus
|
||||
operate_one_file (const WPanel *panel, file_op_context_t *ctx, const char *src,
|
||||
struct stat *src_stat, const char *dest)
|
||||
mc_stat_t *src_stat, const char *dest)
|
||||
{
|
||||
FileProgressStatus value = FILE_CONT;
|
||||
vfs_path_t *src_vpath;
|
||||
@ -2266,9 +2266,9 @@ attrs_ignore_error (const int e)
|
||||
* @return TRUE if file symlink to directory, ELSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
file_is_symlink_to_dir (const vfs_path_t *vpath, struct stat *st, gboolean *stale_link)
|
||||
file_is_symlink_to_dir (const vfs_path_t *vpath, mc_stat_t *st, gboolean *stale_link)
|
||||
{
|
||||
struct stat st2;
|
||||
mc_stat_t st2;
|
||||
gboolean stale = FALSE;
|
||||
gboolean res = FALSE;
|
||||
|
||||
@ -2282,7 +2282,7 @@ file_is_symlink_to_dir (const vfs_path_t *vpath, struct stat *st, gboolean *stal
|
||||
|
||||
if (S_ISLNK (st->st_mode))
|
||||
{
|
||||
struct stat st3;
|
||||
mc_stat_t st3;
|
||||
|
||||
stale = (mc_stat (vpath, &st3) != 0);
|
||||
|
||||
@ -2307,12 +2307,12 @@ copy_file_file (file_op_context_t *ctx, const char *src_path, const char *dst_pa
|
||||
|
||||
int src_desc, dest_desc = -1;
|
||||
mode_t src_mode = 0; /* The mode of the source file */
|
||||
struct stat src_stat, dst_stat;
|
||||
mc_stat_t src_stat, dst_stat;
|
||||
mc_timesbuf_t times;
|
||||
unsigned long attrs = 0;
|
||||
gboolean attrs_ok = ctx->preserve;
|
||||
gboolean dst_exists = FALSE, appending = FALSE;
|
||||
off_t file_size = -1;
|
||||
mc_off_t file_size = -1;
|
||||
FileProgressStatus return_status, temp_status;
|
||||
dest_status_t dst_status = DEST_NONE;
|
||||
int open_flags;
|
||||
@ -2734,7 +2734,7 @@ copy_file_file (file_op_context_t *ctx, const char *src_path, const char *dst_pa
|
||||
|
||||
if (return_status == FILE_CONT)
|
||||
{
|
||||
off_t file_part = 0;
|
||||
mc_off_t file_part = 0;
|
||||
gint64 tv_last_update = ctx->transfer_start;
|
||||
gint64 tv_last_input = 0;
|
||||
gboolean is_first_time = TRUE;
|
||||
@ -3036,7 +3036,7 @@ copy_dir_dir (file_op_context_t *ctx, const char *s, const char *d, gboolean top
|
||||
gboolean move_over, gboolean do_delete, GSList *parent_dirs)
|
||||
{
|
||||
struct vfs_dirent *next;
|
||||
struct stat dst_stat, src_stat;
|
||||
mc_stat_t dst_stat, src_stat;
|
||||
unsigned long attrs = 0;
|
||||
gboolean attrs_ok = ctx->preserve;
|
||||
DIR *reading;
|
||||
@ -3535,7 +3535,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||
char *dest = NULL;
|
||||
vfs_path_t *dest_vpath = NULL;
|
||||
vfs_path_t *save_cwd = NULL, *save_dest = NULL;
|
||||
struct stat src_stat;
|
||||
mc_stat_t src_stat;
|
||||
gboolean ret_val = TRUE;
|
||||
int i;
|
||||
FileProgressStatus value;
|
||||
@ -3674,7 +3674,7 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
|
||||
while (operation != OP_DELETE)
|
||||
{
|
||||
int dst_result;
|
||||
struct stat dst_stat;
|
||||
mc_stat_t dst_stat;
|
||||
|
||||
dst_result = mc_stat (dest_vpath, &dst_stat);
|
||||
|
||||
|
@ -39,7 +39,7 @@ struct dirsize_status_msg_t
|
||||
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
gboolean file_is_symlink_to_dir (const vfs_path_t * path, struct stat *st, gboolean * stale_link);
|
||||
gboolean file_is_symlink_to_dir (const vfs_path_t * path, mc_stat_t *st, gboolean * stale_link);
|
||||
|
||||
FileProgressStatus copy_file_file (file_op_context_t * ctx, const char *src_path,
|
||||
const char *dst_path);
|
||||
|
@ -230,7 +230,7 @@ typedef struct
|
||||
replace_action_t replace_result;
|
||||
gboolean dont_overwrite_with_zero;
|
||||
|
||||
struct stat *src_stat, *dst_stat;
|
||||
mc_stat_t *src_stat, *dst_stat;
|
||||
} file_progress_ui_t;
|
||||
|
||||
/*** forward declarations (file scope functions) *************************************************/
|
||||
@ -1046,7 +1046,7 @@ file_progress_ui_destroy (file_op_context_t *ctx)
|
||||
*/
|
||||
|
||||
void
|
||||
file_progress_show (file_op_context_t *ctx, off_t done, off_t total,
|
||||
file_progress_show (file_op_context_t *ctx, mc_off_t done, mc_off_t total,
|
||||
const char *stalled_msg, gboolean force_update)
|
||||
{
|
||||
file_progress_ui_t *ui;
|
||||
@ -1275,8 +1275,8 @@ file_progress_show_deleting (file_op_context_t *ctx, const vfs_path_t *vpath, si
|
||||
|
||||
FileProgressStatus
|
||||
file_progress_real_query_replace (file_op_context_t *ctx, enum OperationMode mode,
|
||||
const char *src, struct stat *src_stat,
|
||||
const char *dst, struct stat *dst_stat)
|
||||
const char *src, mc_stat_t *src_stat,
|
||||
const char *dst, mc_stat_t *dst_stat)
|
||||
{
|
||||
file_progress_ui_t *ui;
|
||||
FileProgressStatus replace_with_zero;
|
||||
@ -1418,7 +1418,7 @@ file_mask_dialog (file_op_context_t *ctx, gboolean only_one, const char *format,
|
||||
char *source_mask = NULL;
|
||||
char *orig_mask;
|
||||
int val;
|
||||
struct stat buf;
|
||||
mc_stat_t buf;
|
||||
|
||||
#if defined(WIN32) //WIN32, quick
|
||||
#ifdef ENABLE_BACKGROUND
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
/*** typedefs(not structures) and defined constants **********************************************/
|
||||
|
||||
typedef int (*mc_stat_fn) (const vfs_path_t * vpath, struct stat * buf);
|
||||
typedef int (*mc_stat_fn) (const vfs_path_t * vpath, mc_stat_t * buf);
|
||||
|
||||
/*** enums ***************************************************************************************/
|
||||
|
||||
@ -101,7 +101,7 @@ typedef struct
|
||||
gboolean erase_at_end;
|
||||
|
||||
/* Whether to do a reget */
|
||||
off_t do_reget;
|
||||
mc_off_t do_reget;
|
||||
/* Controls appending to files */
|
||||
gboolean do_append;
|
||||
|
||||
@ -172,7 +172,7 @@ char *file_mask_dialog (file_op_context_t * ctx, gboolean only_one, const char *
|
||||
|
||||
FileProgressStatus file_progress_check_buttons (file_op_context_t * ctx);
|
||||
|
||||
void file_progress_show (file_op_context_t * ctx, off_t done, off_t total,
|
||||
void file_progress_show (file_op_context_t * ctx, mc_off_t done, mc_off_t total,
|
||||
const char *stalled_msg, gboolean force_update);
|
||||
void file_progress_show_count (file_op_context_t * ctx);
|
||||
void file_progress_show_total (file_op_context_t * ctx, uintmax_t copied_bytes, gint64 tv_current,
|
||||
@ -185,8 +185,8 @@ gboolean file_progress_show_deleting (file_op_context_t * ctx, const vfs_path_t
|
||||
/* The following functions are implemented separately by each port */
|
||||
FileProgressStatus file_progress_real_query_replace (file_op_context_t * ctx,
|
||||
enum OperationMode mode, const char *src,
|
||||
struct stat *src_stat, const char *dst,
|
||||
struct stat *dst_stat);
|
||||
mc_stat_t *src_stat, const char *dst,
|
||||
mc_stat_t *dst_stat);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
||||
|
@ -163,7 +163,7 @@ static gint64 last_refresh;
|
||||
static gboolean resuming;
|
||||
static int last_line;
|
||||
static int last_pos;
|
||||
static off_t last_off;
|
||||
static mc_off_t last_off;
|
||||
static int last_i;
|
||||
|
||||
static size_t ignore_count = 0;
|
||||
@ -1015,7 +1015,7 @@ check_find_events (WDialog *h)
|
||||
static gboolean
|
||||
search_content (WDialog *h, const char *directory, const char *filename)
|
||||
{
|
||||
struct stat s;
|
||||
mc_stat_t s;
|
||||
char buffer[BUF_4K] = ""; /* raw input buffer */
|
||||
int file_fd = -1;
|
||||
gboolean ret_val = FALSE;
|
||||
@ -1052,7 +1052,7 @@ search_content (WDialog *h, const char *directory, const char *filename)
|
||||
int line = 1;
|
||||
int pos = 0;
|
||||
int n_read = 0;
|
||||
off_t off = 0; /* file_fd's offset corresponding to strbuf[0] */
|
||||
mc_off_t off = 0; /* file_fd's offset corresponding to strbuf[0] */
|
||||
gboolean found = FALSE;
|
||||
char *strbuf = NULL; /* buffer for fetched string */
|
||||
int strbuf_size = 0;
|
||||
@ -1277,7 +1277,7 @@ do_search (WDialog *h)
|
||||
static DIR *dirp = NULL;
|
||||
static char *directory = NULL;
|
||||
static gboolean pop_start_dir = TRUE;
|
||||
struct stat tmp_stat;
|
||||
mc_stat_t tmp_stat;
|
||||
gsize bytes_found;
|
||||
unsigned short count;
|
||||
|
||||
@ -1816,7 +1816,7 @@ do_find (WPanel *panel, const char *start_dir, ssize_t start_dir_len, const char
|
||||
|
||||
if (return_value == B_PANELIZE && *filename != NULL)
|
||||
{
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
GList *entry;
|
||||
dir_list *list = &panel->dir;
|
||||
char *name = NULL;
|
||||
|
@ -1481,7 +1481,7 @@ static void
|
||||
load_hotlist (void)
|
||||
{
|
||||
gboolean remove_old_list = FALSE;
|
||||
struct stat stat_buf;
|
||||
mc_stat_t stat_buf;
|
||||
|
||||
if (hotlist_state.loaded)
|
||||
{
|
||||
@ -1702,7 +1702,7 @@ gboolean
|
||||
save_hotlist (void)
|
||||
{
|
||||
gboolean saved = FALSE;
|
||||
struct stat stat_buf;
|
||||
mc_stat_t stat_buf;
|
||||
|
||||
if (!hotlist_state.readonly && hotlist_state.modified && hotlist_file_name != NULL)
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ info_show_info (WInfo *info)
|
||||
static int i18n_adjust = 0;
|
||||
static const char *file_label;
|
||||
GString *buff;
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
char rp_cwd[PATH_MAX];
|
||||
const char *p_rp_cwd;
|
||||
|
||||
|
@ -82,7 +82,7 @@ enum { IO_BUFSIZE = 256 * 1024 };
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static inline size_t
|
||||
io_blksize (struct stat sb)
|
||||
io_blksize (mc_stat_t sb)
|
||||
{
|
||||
size_t blksize = ST_BLKSIZE (sb);
|
||||
|
||||
|
@ -835,7 +835,7 @@ read_file_system_list (void)
|
||||
while ((d = readdir (dirp)) != NULL)
|
||||
{
|
||||
char *name;
|
||||
struct stat statbuf;
|
||||
mc_stat_t statbuf;
|
||||
|
||||
if (DIR_IS_DOT (d->d_name))
|
||||
continue;
|
||||
|
@ -3164,7 +3164,7 @@ chdir_to_readlink (WPanel *panel)
|
||||
vfs_path_t *new_dir_vpath;
|
||||
char buffer[MC_MAXPATHLEN];
|
||||
int i;
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
vfs_path_t *panel_fname_vpath;
|
||||
gboolean ok;
|
||||
WPanel *cpanel;
|
||||
@ -4729,7 +4729,7 @@ panel_sized_with_dir_new (const char *panel_name, const WRect *r, const vfs_path
|
||||
void
|
||||
panel_reload (WPanel *panel)
|
||||
{
|
||||
struct stat current_stat;
|
||||
mc_stat_t current_stat;
|
||||
vfs_path_t *cwd_vpath;
|
||||
|
||||
if (panels_options.fast_reload && stat (vfs_path_as_str (panel->cwd_vpath), ¤t_stat) == 0
|
||||
|
@ -96,7 +96,7 @@ typedef struct
|
||||
#endif
|
||||
|
||||
dir_list dir; /* Directory contents */
|
||||
struct stat dir_stat; /* Stat of current dir: used by execute () */
|
||||
mc_stat_t dir_stat; /* Stat of current dir: used by execute () */
|
||||
|
||||
vfs_path_t *cwd_vpath; /* Current Working Directory */
|
||||
vfs_path_t *lwd_vpath; /* Last Working Directory */
|
||||
|
@ -362,7 +362,7 @@ do_external_panelize (const char *command)
|
||||
{
|
||||
char *name;
|
||||
gboolean link_to_dir, stale_link;
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
|
||||
/* handle a \n-separated file list */
|
||||
|
||||
|
@ -755,7 +755,7 @@ tree_move (WTree *tree, const char *default_dest)
|
||||
if (dest != NULL && *dest != '\0')
|
||||
{
|
||||
vfs_path_t *dest_vpath;
|
||||
struct stat buf;
|
||||
mc_stat_t buf;
|
||||
|
||||
dest_vpath = vfs_path_from_str (dest);
|
||||
|
||||
|
@ -812,7 +812,7 @@ tree_store_start_check (const vfs_path_t *vpath)
|
||||
current = tree_store_whereis (vpath);
|
||||
if (current == NULL)
|
||||
{
|
||||
struct stat s;
|
||||
mc_stat_t s;
|
||||
|
||||
if (mc_stat (vpath, &s) == -1 || !S_ISDIR (s.st_mode))
|
||||
return NULL;
|
||||
@ -900,7 +900,7 @@ tree_entry *
|
||||
tree_store_rescan (const vfs_path_t *vpath)
|
||||
{
|
||||
DIR *dirp;
|
||||
struct stat buf;
|
||||
mc_stat_t buf;
|
||||
tree_entry *entry;
|
||||
|
||||
if (should_skip_directory (vpath))
|
||||
|
@ -199,6 +199,8 @@ show_version (void)
|
||||
TYPE_INFO (void *);
|
||||
TYPE_INFO (size_t);
|
||||
TYPE_INFO (off_t);
|
||||
TYPE_INFO (mc_off_t);
|
||||
TYPE_INFO (time_t);
|
||||
TYPE_INFO (uintmax_t);
|
||||
#undef TYPE_INFO
|
||||
(void) puts ("");
|
||||
|
@ -312,7 +312,7 @@ test_condition (const Widget *edit_widget, char *p, gboolean *condition)
|
||||
break;
|
||||
case 'x': /* executable */
|
||||
{
|
||||
struct stat status;
|
||||
mc_stat_t status;
|
||||
|
||||
p = extract_arg (p, arg, sizeof (arg));
|
||||
*condition = stat (arg, &status) == 0 && is_exe (status.st_mode);
|
||||
@ -627,7 +627,7 @@ execute_menu_command (const Widget *edit_widget, const char *commands, gboolean
|
||||
static gboolean
|
||||
menu_file_own (char *path)
|
||||
{
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
|
||||
if (stat (path, &st) == 0 && (st.st_uid == 0 || (st.st_uid == geteuid ()) != 0)
|
||||
&& ((st.st_mode & (S_IWGRP | S_IWOTH)) == 0))
|
||||
|
@ -134,7 +134,7 @@ typedef struct
|
||||
struct vfs_s_super base; /* base class */
|
||||
|
||||
int fd;
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
int type; /* Type of the archive */
|
||||
GSList *deferred; /* List of inodes for which another entries may appear */
|
||||
} cpio_super_t;
|
||||
@ -151,7 +151,7 @@ static ssize_t cpio_read_crc_head (struct vfs_class *me, struct vfs_s_super *sup
|
||||
static struct vfs_s_subclass cpio_subclass;
|
||||
static struct vfs_class *vfs_cpiofs_ops = VFS_CLASS (&cpio_subclass);
|
||||
|
||||
static off_t cpio_position;
|
||||
static mc_off_t cpio_position;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/*** file scope functions ************************************************************************/
|
||||
@ -372,7 +372,7 @@ cpio_find_head (struct vfs_class *me, struct vfs_s_super *super)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
cpio_create_entry (struct vfs_class *me, struct vfs_s_super *super, struct stat *st, char *name)
|
||||
cpio_create_entry (struct vfs_class *me, struct vfs_s_super *super, mc_stat_t *st, char *name)
|
||||
{
|
||||
cpio_super_t *arch = CPIO_SUPER (super);
|
||||
struct vfs_s_inode *inode = NULL;
|
||||
@ -551,7 +551,7 @@ cpio_read_bin_head (struct vfs_class *me, struct vfs_s_super *super)
|
||||
cpio_super_t *arch = CPIO_SUPER (super);
|
||||
ssize_t len;
|
||||
char *name;
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
|
||||
len = mc_read (arch->fd, (char *) &u.buf, HEAD_LENGTH);
|
||||
if (len < HEAD_LENGTH)
|
||||
@ -596,7 +596,7 @@ cpio_read_bin_head (struct vfs_class *me, struct vfs_s_super *super)
|
||||
#ifdef HAVE_STRUCT_STAT_ST_RDEV
|
||||
st.st_rdev = u.buf.c_rdev;
|
||||
#endif
|
||||
st.st_size = ((off_t) u.buf.c_filesizes[0] << 16) | u.buf.c_filesizes[1];
|
||||
st.st_size = ((mc_off_t) u.buf.c_filesizes[0] << 16) | u.buf.c_filesizes[1];
|
||||
|
||||
vfs_zero_stat_times (&st);
|
||||
|
||||
@ -618,7 +618,7 @@ cpio_read_oldc_head (struct vfs_class *me, struct vfs_s_super *super)
|
||||
struct new_cpio_header hd;
|
||||
union
|
||||
{
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
char buf[HEAD_LENGTH + 1];
|
||||
} u;
|
||||
ssize_t len;
|
||||
@ -689,7 +689,7 @@ cpio_read_crc_head (struct vfs_class *me, struct vfs_s_super *super)
|
||||
struct new_cpio_header hd;
|
||||
union
|
||||
{
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
char buf[HEAD_LENGTH + 1];
|
||||
} u;
|
||||
ssize_t len;
|
||||
@ -804,7 +804,7 @@ cpio_open_archive (struct vfs_s_super *super, const vfs_path_t *vpath,
|
||||
static void *
|
||||
cpio_super_check (const vfs_path_t *vpath)
|
||||
{
|
||||
static struct stat sb;
|
||||
static mc_stat_t sb;
|
||||
int stat_result;
|
||||
|
||||
stat_result = mc_stat (vpath, &sb);
|
||||
@ -817,7 +817,7 @@ static int
|
||||
cpio_super_same (const vfs_path_element_t *vpath_element, struct vfs_s_super *parc,
|
||||
const vfs_path_t *vpath, void *cookie)
|
||||
{
|
||||
struct stat *archive_stat = cookie; /* stat of main archive */
|
||||
mc_stat_t *archive_stat = cookie; /* stat of main archive */
|
||||
|
||||
(void) vpath_element;
|
||||
|
||||
@ -846,7 +846,7 @@ cpio_read (void *fh, char *buffer, size_t count)
|
||||
vfs_file_handler_t *file = VFS_FILE_HANDLER (fh);
|
||||
struct vfs_class *me = VFS_FILE_HANDLER_SUPER (fh)->me;
|
||||
int fd = CPIO_SUPER (VFS_FILE_HANDLER_SUPER (fh))->fd;
|
||||
off_t begin = file->ino->data_offset;
|
||||
mc_off_t begin = file->ino->data_offset;
|
||||
ssize_t res;
|
||||
|
||||
if (mc_lseek (fd, begin + file->pos, SEEK_SET) != begin + file->pos)
|
||||
|
@ -84,7 +84,7 @@ struct extfs_super_t
|
||||
|
||||
int fstype;
|
||||
char *local_name;
|
||||
struct stat local_stat;
|
||||
mc_stat_t local_stat;
|
||||
dev_t rdev;
|
||||
};
|
||||
|
||||
@ -195,7 +195,7 @@ extfs_generate_entry (struct extfs_super_t *archive, const char *name, struct vf
|
||||
mode_t mode)
|
||||
{
|
||||
struct vfs_class *me = VFS_SUPER (archive)->me;
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
mode_t myumask;
|
||||
struct vfs_s_inode *inode;
|
||||
struct vfs_s_entry *entry;
|
||||
@ -356,7 +356,7 @@ extfs_free_archive (struct vfs_class *me, struct vfs_s_super *psup)
|
||||
|
||||
if (archive->local_name != NULL)
|
||||
{
|
||||
struct stat my;
|
||||
mc_stat_t my;
|
||||
vfs_path_t *local_name_vpath, *name_vpath;
|
||||
|
||||
local_name_vpath = vfs_path_from_str (archive->local_name);
|
||||
@ -396,7 +396,7 @@ static int
|
||||
extfs_add_file (struct extfs_super_t *archive, const char *file_name)
|
||||
{
|
||||
struct vfs_s_super *super = VFS_SUPER (archive);
|
||||
struct stat hstat;
|
||||
mc_stat_t hstat;
|
||||
char *current_file_name = NULL, *current_link_name = NULL;
|
||||
int ret = 0;
|
||||
|
||||
@ -466,7 +466,7 @@ extfs_add_file (struct extfs_super_t *archive, const char *file_name)
|
||||
}
|
||||
else
|
||||
{
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
|
||||
memset (&st, 0, sizeof (st));
|
||||
st.st_ino = super->ino_usage++;
|
||||
@ -516,7 +516,7 @@ extfs_open_archive (int fstype, const char *name, struct extfs_super_t **pparc,
|
||||
mc_pipe_t *result = NULL;
|
||||
mode_t mode;
|
||||
char *cmd = NULL;
|
||||
struct stat mystat;
|
||||
mc_stat_t mystat;
|
||||
struct extfs_super_t *current_archive;
|
||||
struct vfs_s_entry *root_entry;
|
||||
char *tmp = NULL;
|
||||
@ -1167,7 +1167,7 @@ extfs_close (void *fh)
|
||||
/* Commit the file if it has changed */
|
||||
if (file->changed)
|
||||
{
|
||||
struct stat file_status;
|
||||
mc_stat_t file_status;
|
||||
|
||||
if (extfs_cmd
|
||||
(" copyin ", EXTFS_SUPER (VFS_FILE_HANDLER_SUPER (fh)), file->ino->ent,
|
||||
@ -1259,7 +1259,7 @@ extfs_closedir (void *data)
|
||||
|
||||
|
||||
static void
|
||||
extfs_stat_move (struct stat *buf, const struct vfs_s_inode *inode)
|
||||
extfs_stat_move (mc_stat_t *buf, const struct vfs_s_inode *inode)
|
||||
{
|
||||
const time_t atime = inode->st.st_atime;
|
||||
const time_t mtime = inode->st.st_mtime;
|
||||
@ -1282,7 +1282,7 @@ extfs_stat_move (struct stat *buf, const struct vfs_s_inode *inode)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
extfs_internal_stat (const vfs_path_t *vpath, struct stat *buf, gboolean resolve)
|
||||
extfs_internal_stat (const vfs_path_t *vpath, mc_stat_t *buf, gboolean resolve)
|
||||
{
|
||||
struct extfs_super_t *archive;
|
||||
const char *q;
|
||||
@ -1310,7 +1310,7 @@ extfs_internal_stat (const vfs_path_t *vpath, struct stat *buf, gboolean resolve
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
extfs_stat (const vfs_path_t *vpath, struct stat *buf)
|
||||
extfs_stat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
return extfs_internal_stat (vpath, buf, TRUE);
|
||||
}
|
||||
@ -1318,7 +1318,7 @@ extfs_stat (const vfs_path_t *vpath, struct stat *buf)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
extfs_lstat (const vfs_path_t *vpath, struct stat *buf)
|
||||
extfs_lstat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
return extfs_internal_stat (vpath, buf, FALSE);
|
||||
}
|
||||
@ -1326,7 +1326,7 @@ extfs_lstat (const vfs_path_t *vpath, struct stat *buf)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
extfs_fstat (void *fh, struct stat *buf)
|
||||
extfs_fstat (void *fh, mc_stat_t *buf)
|
||||
{
|
||||
vfs_file_handler_t *file = VFS_FILE_HANDLER (fh);
|
||||
|
||||
@ -1512,8 +1512,8 @@ extfs_chdir (const vfs_path_t *vpath)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static off_t
|
||||
extfs_lseek (void *fh, off_t offset, int whence)
|
||||
static mc_off_t
|
||||
extfs_lseek (void *fh, mc_off_t offset, int whence)
|
||||
{
|
||||
vfs_file_handler_t *file = VFS_FILE_HANDLER (fh);
|
||||
|
||||
@ -1627,7 +1627,7 @@ extfs_get_plugins (const char *where, gboolean silent)
|
||||
while ((filename = g_dir_read_name (dir)) != NULL)
|
||||
{
|
||||
char fullname[MC_MAXPATHLEN];
|
||||
struct stat s;
|
||||
mc_stat_t s;
|
||||
|
||||
g_snprintf (fullname, sizeof (fullname), "%s" PATH_SEP_STR "%s", dirname, filename);
|
||||
|
||||
|
@ -265,7 +265,7 @@ static const char *netrcp;
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
ftpfs_set_blksize (struct stat *s)
|
||||
ftpfs_set_blksize (mc_stat_t *s)
|
||||
{
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
/* redefine block size */
|
||||
@ -275,10 +275,10 @@ ftpfs_set_blksize (struct stat *s)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static struct stat *
|
||||
static mc_stat_t *
|
||||
ftpfs_default_stat (struct vfs_class *me)
|
||||
{
|
||||
struct stat *s;
|
||||
mc_stat_t *s;
|
||||
|
||||
s = vfs_s_default_stat (me, S_IFDIR | 0755);
|
||||
ftpfs_set_blksize (s);
|
||||
@ -1677,7 +1677,7 @@ resolve_symlink_with_ls_options (struct vfs_class *me, struct vfs_s_super *super
|
||||
char buffer[2048] = "", *filename;
|
||||
int sock;
|
||||
FILE *fp;
|
||||
struct stat s;
|
||||
mc_stat_t s;
|
||||
struct linklist *flist;
|
||||
struct direntry *fe;
|
||||
int switch_method = 0;
|
||||
@ -1752,7 +1752,7 @@ resolve_symlink_with_ls_options (struct vfs_class *me, struct vfs_s_super *super
|
||||
goto done;
|
||||
}
|
||||
|
||||
fe->l_stat = g_try_new (struct stat, 1);
|
||||
fe->l_stat = g_try_new (mc_stat_t, 1);
|
||||
if (fe->l_stat == NULL)
|
||||
goto done;
|
||||
|
||||
@ -1933,14 +1933,14 @@ ftpfs_file_store (struct vfs_class *me, vfs_file_handler_t *fh, char *name, char
|
||||
ftp_file_handler_t *ftp = FTP_FILE_HANDLER (fh);
|
||||
|
||||
int h, sock;
|
||||
off_t n_stored = 0;
|
||||
mc_off_t n_stored = 0;
|
||||
#ifdef HAVE_STRUCT_LINGER_L_LINGER
|
||||
struct linger li;
|
||||
#else
|
||||
int flag_one = 1;
|
||||
#endif
|
||||
char lc_buffer[BUF_8K];
|
||||
struct stat s;
|
||||
mc_stat_t s;
|
||||
char *w_buf;
|
||||
|
||||
h = open (localname, O_RDONLY);
|
||||
@ -2034,7 +2034,7 @@ ftpfs_file_store (struct vfs_class *me, vfs_file_handler_t *fh, char *name, char
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
ftpfs_linear_start (struct vfs_class *me, vfs_file_handler_t *fh, off_t offset)
|
||||
ftpfs_linear_start (struct vfs_class *me, vfs_file_handler_t *fh, mc_off_t offset)
|
||||
{
|
||||
char *name;
|
||||
|
||||
@ -2157,7 +2157,7 @@ ftpfs_send_command (const vfs_path_t *vpath, const char *cmd, int flags)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
ftpfs_stat (const vfs_path_t *vpath, struct stat *buf)
|
||||
ftpfs_stat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -2169,7 +2169,7 @@ ftpfs_stat (const vfs_path_t *vpath, struct stat *buf)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
ftpfs_lstat (const vfs_path_t *vpath, struct stat *buf)
|
||||
ftpfs_lstat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -2181,7 +2181,7 @@ ftpfs_lstat (const vfs_path_t *vpath, struct stat *buf)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
ftpfs_fstat (void *vfs_info, struct stat *buf)
|
||||
ftpfs_fstat (void *vfs_info, mc_stat_t *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -2501,7 +2501,7 @@ ftpfs_netrc_next (void)
|
||||
static gboolean
|
||||
ftpfs_netrc_bad_mode (const char *netrcname)
|
||||
{
|
||||
struct stat mystat;
|
||||
mc_stat_t mystat;
|
||||
|
||||
if (stat (netrcname, &mystat) >= 0 && (mystat.st_mode & 077) != 0)
|
||||
{
|
||||
|
@ -56,7 +56,7 @@
|
||||
|
||||
#define number_of_parsers 7
|
||||
|
||||
#define NO_SIZE ((off_t) (-1L))
|
||||
#define NO_SIZE ((mc_off_t) (-1L))
|
||||
#define NO_DATE ((time_t) (-1L))
|
||||
|
||||
#define FIRST_TOKEN strtok (line, " \t")
|
||||
@ -76,24 +76,24 @@ typedef enum
|
||||
NORMAL
|
||||
} filetype;
|
||||
|
||||
typedef gboolean (*ftpfs_line_parser) (char *line, struct stat * s, char **filename,
|
||||
typedef gboolean (*ftpfs_line_parser) (char *line, mc_stat_t * s, char **filename,
|
||||
char **linkname, int *err);
|
||||
|
||||
/*** forward declarations (file scope functions) *************************************************/
|
||||
|
||||
static gboolean ftpfs_parse_long_list_UNIX (char *line, struct stat *s, char **filename,
|
||||
static gboolean ftpfs_parse_long_list_UNIX (char *line, mc_stat_t *s, char **filename,
|
||||
char **linkname, int *err);
|
||||
static gboolean ftpfs_parse_long_list_NT (char *line, struct stat *s, char **filename,
|
||||
static gboolean ftpfs_parse_long_list_NT (char *line, mc_stat_t *s, char **filename,
|
||||
char **linkname, int *err);
|
||||
static gboolean ftpfs_parse_long_list_EPLF (char *line, struct stat *s, char **filename,
|
||||
static gboolean ftpfs_parse_long_list_EPLF (char *line, mc_stat_t *s, char **filename,
|
||||
char **linkname, int *err);
|
||||
static gboolean ftpfs_parse_long_list_MLSD (char *line, struct stat *s, char **filename,
|
||||
static gboolean ftpfs_parse_long_list_MLSD (char *line, mc_stat_t *s, char **filename,
|
||||
char **linkname, int *err);
|
||||
static gboolean ftpfs_parse_long_list_AS400 (char *line, struct stat *s, char **filename,
|
||||
static gboolean ftpfs_parse_long_list_AS400 (char *line, mc_stat_t *s, char **filename,
|
||||
char **linkname, int *err);
|
||||
static gboolean ftpfs_parse_long_list_OS2 (char *line, struct stat *s, char **filename,
|
||||
static gboolean ftpfs_parse_long_list_OS2 (char *line, mc_stat_t *s, char **filename,
|
||||
char **linkname, int *err);
|
||||
static gboolean ftpfs_parse_long_list_MacWebStar (char *line, struct stat *s, char **filename,
|
||||
static gboolean ftpfs_parse_long_list_MacWebStar (char *line, mc_stat_t *s, char **filename,
|
||||
char **linkname, int *err);
|
||||
|
||||
/*** file scope variables ************************************************************************/
|
||||
@ -274,7 +274,7 @@ ftpfs_convert_date (const char *s)
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
parse_ls_line (char *line, struct stat *s, char **filename, char **linkname)
|
||||
parse_ls_line (char *line, mc_stat_t *s, char **filename, char **linkname)
|
||||
{
|
||||
char *next = NULL;
|
||||
char *t;
|
||||
@ -327,7 +327,7 @@ parse_ls_line (char *line, struct stat *s, char **filename, char **linkname)
|
||||
s->st_gid = ftpfs_get_gid (group_or_size);
|
||||
|
||||
if (sscanf (t, "%lld%n", &size, &n) == 1 && t[n] == '\0')
|
||||
s->st_size = (off_t) size;
|
||||
s->st_size = (mc_off_t) size;
|
||||
t = NEXT_TOKEN_R;
|
||||
if (t == NULL)
|
||||
return FALSE;
|
||||
@ -339,7 +339,7 @@ parse_ls_line (char *line, struct stat *s, char **filename, char **linkname)
|
||||
int n;
|
||||
|
||||
if (sscanf (group_or_size, "%lld%n", &size, &n) == 1 && group_or_size[n] == '\0')
|
||||
s->st_size = (off_t) size;
|
||||
s->st_size = (mc_off_t) size;
|
||||
}
|
||||
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
@ -416,7 +416,7 @@ parse_ls_line (char *line, struct stat *s, char **filename, char **linkname)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
ftpfs_parse_long_list_UNIX (char *line, struct stat *s, char **filename, char **linkname, int *err)
|
||||
ftpfs_parse_long_list_UNIX (char *line, mc_stat_t *s, char **filename, char **linkname, int *err)
|
||||
{
|
||||
int tmp;
|
||||
gboolean ret;
|
||||
@ -447,7 +447,7 @@ ftpfs_parse_long_list_UNIX (char *line, struct stat *s, char **filename, char **
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
ftpfs_parse_long_list_NT (char *line, struct stat *s, char **filename, char **linkname, int *err)
|
||||
ftpfs_parse_long_list_NT (char *line, mc_stat_t *s, char **filename, char **linkname, int *err)
|
||||
{
|
||||
char *t;
|
||||
int month, day, year, hour, minute;
|
||||
@ -503,7 +503,7 @@ ftpfs_parse_long_list_NT (char *line, struct stat *s, char **filename, char **li
|
||||
s->st_mode = S_IFREG;
|
||||
if (sscanf (t, "%lld", &size) != 1)
|
||||
ERR2;
|
||||
s->st_size = (off_t) size;
|
||||
s->st_size = (mc_off_t) size;
|
||||
}
|
||||
|
||||
t = strtok (NULL, "");
|
||||
@ -539,13 +539,13 @@ ftpfs_parse_long_list_NT (char *line, struct stat *s, char **filename, char **li
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
ftpfs_parse_long_list_EPLF (char *line, struct stat *s, char **filename, char **linkname, int *err)
|
||||
ftpfs_parse_long_list_EPLF (char *line, mc_stat_t *s, char **filename, char **linkname, int *err)
|
||||
{
|
||||
size_t len;
|
||||
const char *b;
|
||||
const char *name = NULL;
|
||||
size_t name_len = 0;
|
||||
off_t size = NO_SIZE;
|
||||
mc_off_t size = NO_SIZE;
|
||||
time_t date = NO_DATE;
|
||||
long date_l;
|
||||
long long size_ll;
|
||||
@ -651,10 +651,10 @@ ftpfs_parse_long_list_EPLF (char *line, struct stat *s, char **filename, char **
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
ftpfs_parse_long_list_MLSD (char *line, struct stat *s, char **filename, char **linkname, int *err)
|
||||
ftpfs_parse_long_list_MLSD (char *line, mc_stat_t *s, char **filename, char **linkname, int *err)
|
||||
{
|
||||
const char *name = NULL;
|
||||
off_t size = NO_SIZE;
|
||||
mc_off_t size = NO_SIZE;
|
||||
time_t date = NO_DATE;
|
||||
const char *owner = NULL;
|
||||
const char *group = NULL;
|
||||
@ -816,7 +816,7 @@ ftpfs_parse_long_list_MLSD (char *line, struct stat *s, char **filename, char **
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
ftpfs_parse_long_list_AS400 (char *line, struct stat *s, char **filename, char **linkname, int *err)
|
||||
ftpfs_parse_long_list_AS400 (char *line, mc_stat_t *s, char **filename, char **linkname, int *err)
|
||||
{
|
||||
char *t;
|
||||
char *user;
|
||||
@ -903,7 +903,7 @@ ftpfs_parse_long_list_AS400 (char *line, struct stat *s, char **filename, char *
|
||||
|
||||
*filename = g_strdup (t);
|
||||
s->st_mode = type;
|
||||
s->st_size = (off_t) size;
|
||||
s->st_size = (mc_off_t) size;
|
||||
s->st_mtime = mtime;
|
||||
/* Use resulting time value */
|
||||
s->st_atime = s->st_ctime = s->st_mtime;
|
||||
@ -920,7 +920,7 @@ ftpfs_parse_long_list_AS400 (char *line, struct stat *s, char **filename, char *
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
ftpfs_parse_long_list_OS2 (char *line, struct stat *s, char **filename, char **linkname, int *err)
|
||||
ftpfs_parse_long_list_OS2 (char *line, mc_stat_t *s, char **filename, char **linkname, int *err)
|
||||
{
|
||||
char *t;
|
||||
long long size;
|
||||
@ -933,7 +933,7 @@ ftpfs_parse_long_list_OS2 (char *line, struct stat *s, char **filename, char **l
|
||||
|
||||
if (sscanf (t, "%lld", &size) != 1)
|
||||
ERR2;
|
||||
s->st_size = (off_t) size;
|
||||
s->st_size = (mc_off_t) size;
|
||||
|
||||
t = NEXT_TOKEN;
|
||||
if (t == NULL)
|
||||
@ -988,7 +988,7 @@ ftpfs_parse_long_list_OS2 (char *line, struct stat *s, char **filename, char **l
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static gboolean
|
||||
ftpfs_parse_long_list_MacWebStar (char *line, struct stat *s, char **filename,
|
||||
ftpfs_parse_long_list_MacWebStar (char *line, mc_stat_t *s, char **filename,
|
||||
char **linkname, int *err)
|
||||
{
|
||||
char *t;
|
||||
@ -1031,7 +1031,7 @@ ftpfs_parse_long_list_MacWebStar (char *line, struct stat *s, char **filename,
|
||||
ERR2;
|
||||
|
||||
if (sscanf (t, "%lld", &size) == 1)
|
||||
s->st_size = (off_t) size;
|
||||
s->st_size = (mc_off_t) size;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -142,7 +142,7 @@ local_closedir (void *data)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
local_stat (const vfs_path_t *vpath, struct stat *buf)
|
||||
local_stat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
const char *path;
|
||||
|
||||
@ -153,7 +153,7 @@ local_stat (const vfs_path_t *vpath, struct stat *buf)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
local_lstat (const vfs_path_t *vpath, struct stat *buf)
|
||||
local_lstat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
const char *path;
|
||||
|
||||
@ -441,7 +441,7 @@ local_errno (struct vfs_class *me)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
local_fstat (void *data, struct stat *buf)
|
||||
local_fstat (void *data, mc_stat_t *buf)
|
||||
{
|
||||
int fd = *(int *) data;
|
||||
|
||||
@ -450,8 +450,8 @@ local_fstat (void *data, struct stat *buf)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
off_t
|
||||
local_lseek (void *data, off_t offset, int whence)
|
||||
mc_off_t
|
||||
local_lseek (void *data, mc_off_t offset, int whence)
|
||||
{
|
||||
int fd = *(int *) data;
|
||||
|
||||
|
@ -24,9 +24,9 @@ extern void vfs_init_localfs (void);
|
||||
* published here. */
|
||||
extern int local_close (void *data);
|
||||
extern ssize_t local_read (void *data, char *buffer, size_t count);
|
||||
extern int local_fstat (void *data, struct stat *buf);
|
||||
extern int local_fstat (void *data, mc_stat_t *buf);
|
||||
extern int local_errno (struct vfs_class *me);
|
||||
extern off_t local_lseek (void *data, off_t offset, int whence);
|
||||
extern mc_off_t local_lseek (void *data, mc_off_t offset, int whence);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
#endif
|
||||
|
@ -314,7 +314,7 @@ sfs_open (const vfs_path_t *vpath /*struct vfs_class *me, const char *path */ ,
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
sfs_stat (const vfs_path_t *vpath, struct stat *buf)
|
||||
sfs_stat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
return stat (sfs_redirect (vpath), buf);
|
||||
}
|
||||
@ -322,7 +322,7 @@ sfs_stat (const vfs_path_t *vpath, struct stat *buf)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
sfs_lstat (const vfs_path_t *vpath, struct stat *buf)
|
||||
sfs_lstat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
#ifndef HAVE_STATLSTAT
|
||||
return lstat (sfs_redirect (vpath), buf);
|
||||
|
@ -189,15 +189,15 @@ sftpfs_open_file (vfs_file_handler_t *fh, int flags, mode_t mode, GError **mcerr
|
||||
if (do_append)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
struct stat file_info = {0};
|
||||
mc_stat_t file_info = {0};
|
||||
#else
|
||||
struct stat file_info = {
|
||||
mc_stat_t file_info = {
|
||||
.st_dev = 0
|
||||
};
|
||||
#endif
|
||||
/* In case of
|
||||
|
||||
struct stat file_info = { 0 };
|
||||
mc_stat_t file_info = { 0 };
|
||||
|
||||
gcc < 4.7 [1] generates the following:
|
||||
|
||||
@ -224,7 +224,7 @@ sftpfs_open_file (vfs_file_handler_t *fh, int flags, mode_t mode, GError **mcerr
|
||||
*/
|
||||
|
||||
int
|
||||
sftpfs_fstat (void *data, struct stat *buf, GError **mcerror)
|
||||
sftpfs_fstat (void *data, mc_stat_t *buf, GError **mcerror)
|
||||
{
|
||||
int res;
|
||||
LIBSSH2_SFTP_ATTRIBUTES attrs;
|
||||
@ -301,7 +301,7 @@ sftpfs_read_file (vfs_file_handler_t *fh, char *buffer, size_t count, GError **m
|
||||
}
|
||||
while (rc == LIBSSH2_ERROR_EAGAIN);
|
||||
|
||||
fh->pos = (off_t) libssh2_sftp_tell64 (file->handle);
|
||||
fh->pos = (mc_off_t) libssh2_sftp_tell64 (file->handle);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -328,7 +328,7 @@ sftpfs_write_file (vfs_file_handler_t *fh, const char *buffer, size_t count, GEr
|
||||
|
||||
mc_return_val_if_error (mcerror, -1);
|
||||
|
||||
fh->pos = (off_t) libssh2_sftp_tell64 (file->handle);
|
||||
fh->pos = (mc_off_t) libssh2_sftp_tell64 (file->handle);
|
||||
|
||||
do
|
||||
{
|
||||
@ -383,8 +383,8 @@ sftpfs_close_file (vfs_file_handler_t *fh, GError **mcerror)
|
||||
* @return 0 on success, negative value otherwise
|
||||
*/
|
||||
|
||||
off_t
|
||||
sftpfs_lseek (vfs_file_handler_t *fh, off_t offset, int whence, GError **mcerror)
|
||||
mc_off_t
|
||||
sftpfs_lseek (vfs_file_handler_t *fh, mc_off_t offset, int whence, GError **mcerror)
|
||||
{
|
||||
sftpfs_file_handler_t *file = SFTP_FILE_HANDLER (fh);
|
||||
|
||||
@ -420,7 +420,7 @@ sftpfs_lseek (vfs_file_handler_t *fh, off_t offset, int whence, GError **mcerror
|
||||
}
|
||||
|
||||
libssh2_sftp_seek64 (file->handle, fh->pos);
|
||||
fh->pos = (off_t) libssh2_sftp_tell64 (file->handle);
|
||||
fh->pos = (mc_off_t) libssh2_sftp_tell64 (file->handle);
|
||||
|
||||
return fh->pos;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ GString *sftpfs_filename_buffer = NULL;
|
||||
/* Adjust block size and number of blocks */
|
||||
|
||||
static void
|
||||
sftpfs_blksize (struct stat *s)
|
||||
sftpfs_blksize (mc_stat_t *s)
|
||||
{
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
s->st_blksize = LIBSSH2_CHANNEL_WINDOW_DEFAULT; /* FIXME */
|
||||
@ -250,7 +250,7 @@ sftpfs_op_init (sftpfs_super_t **super, const vfs_path_element_t **path_element,
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
sftpfs_attr_to_stat (const LIBSSH2_SFTP_ATTRIBUTES *attrs, struct stat *s)
|
||||
sftpfs_attr_to_stat (const LIBSSH2_SFTP_ATTRIBUTES *attrs, mc_stat_t *s)
|
||||
{
|
||||
if ((attrs->flags & LIBSSH2_SFTP_ATTR_UIDGID) != 0)
|
||||
{
|
||||
@ -287,7 +287,7 @@ sftpfs_attr_to_stat (const LIBSSH2_SFTP_ATTRIBUTES *attrs, struct stat *s)
|
||||
*/
|
||||
|
||||
int
|
||||
sftpfs_lstat (const vfs_path_t *vpath, struct stat *buf, GError **mcerror)
|
||||
sftpfs_lstat (const vfs_path_t *vpath, mc_stat_t *buf, GError **mcerror)
|
||||
{
|
||||
sftpfs_super_t *super = NULL;
|
||||
const vfs_path_element_t *path_element = NULL;
|
||||
@ -315,7 +315,7 @@ sftpfs_lstat (const vfs_path_t *vpath, struct stat *buf, GError **mcerror)
|
||||
*/
|
||||
|
||||
int
|
||||
sftpfs_stat (const vfs_path_t *vpath, struct stat *buf, GError **mcerror)
|
||||
sftpfs_stat (const vfs_path_t *vpath, mc_stat_t *buf, GError **mcerror)
|
||||
{
|
||||
sftpfs_super_t *super = NULL;
|
||||
const vfs_path_element_t *path_element = NULL;
|
||||
|
@ -78,9 +78,9 @@ const GString *sftpfs_fix_filename (const char *file_name);
|
||||
gboolean sftpfs_op_init (sftpfs_super_t ** super, const vfs_path_element_t ** path_element,
|
||||
const vfs_path_t * vpath, GError ** mcerror);
|
||||
|
||||
void sftpfs_attr_to_stat (const LIBSSH2_SFTP_ATTRIBUTES * attrs, struct stat *s);
|
||||
int sftpfs_lstat (const vfs_path_t * vpath, struct stat *buf, GError ** mcerror);
|
||||
int sftpfs_stat (const vfs_path_t * vpath, struct stat *buf, GError ** mcerror);
|
||||
void sftpfs_attr_to_stat (const LIBSSH2_SFTP_ATTRIBUTES * attrs, mc_stat_t *s);
|
||||
int sftpfs_lstat (const vfs_path_t * vpath, mc_stat_t *buf, GError ** mcerror);
|
||||
int sftpfs_stat (const vfs_path_t * vpath, mc_stat_t *buf, GError ** mcerror);
|
||||
int sftpfs_readlink (const vfs_path_t * vpath, char *buf, size_t size, GError ** mcerror);
|
||||
int sftpfs_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2, GError ** mcerror);
|
||||
int sftpfs_utime (const vfs_path_t * vpath, time_t atime, time_t mtime, GError ** mcerror);
|
||||
@ -106,8 +106,8 @@ ssize_t sftpfs_read_file (vfs_file_handler_t * fh, char *buffer, size_t count, G
|
||||
ssize_t sftpfs_write_file (vfs_file_handler_t * fh, const char *buffer, size_t count,
|
||||
GError ** mcerror);
|
||||
int sftpfs_close_file (vfs_file_handler_t * fh, GError ** mcerror);
|
||||
int sftpfs_fstat (void *data, struct stat *buf, GError ** mcerror);
|
||||
off_t sftpfs_lseek (vfs_file_handler_t * fh, off_t offset, int whence, GError ** mcerror);
|
||||
int sftpfs_fstat (void *data, mc_stat_t *buf, GError ** mcerror);
|
||||
mc_off_t sftpfs_lseek (vfs_file_handler_t * fh, mc_off_t offset, int whence, GError ** mcerror);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
||||
|
@ -251,7 +251,7 @@ sftpfs_cb_closedir (void *data)
|
||||
*/
|
||||
|
||||
static int
|
||||
sftpfs_cb_lstat (const vfs_path_t *vpath, struct stat *buf)
|
||||
sftpfs_cb_lstat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
int rc;
|
||||
GError *mcerror = NULL;
|
||||
@ -271,7 +271,7 @@ sftpfs_cb_lstat (const vfs_path_t *vpath, struct stat *buf)
|
||||
*/
|
||||
|
||||
static int
|
||||
sftpfs_cb_stat (const vfs_path_t *vpath, struct stat *buf)
|
||||
sftpfs_cb_stat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
int rc;
|
||||
GError *mcerror = NULL;
|
||||
@ -291,7 +291,7 @@ sftpfs_cb_stat (const vfs_path_t *vpath, struct stat *buf)
|
||||
*/
|
||||
|
||||
static int
|
||||
sftpfs_cb_fstat (void *data, struct stat *buf)
|
||||
sftpfs_cb_fstat (void *data, mc_stat_t *buf)
|
||||
{
|
||||
int rc;
|
||||
GError *mcerror = NULL;
|
||||
@ -573,10 +573,10 @@ sftpfs_cb_rmdir (const vfs_path_t *vpath)
|
||||
* @return 0 if success, negative value otherwise
|
||||
*/
|
||||
|
||||
static off_t
|
||||
sftpfs_cb_lseek (void *data, off_t offset, int whence)
|
||||
static mc_off_t
|
||||
sftpfs_cb_lseek (void *data, mc_off_t offset, int whence)
|
||||
{
|
||||
off_t ret_offset;
|
||||
mc_off_t ret_offset;
|
||||
vfs_file_handler_t *fh = VFS_FILE_HANDLER (data);
|
||||
GError *mcerror = NULL;
|
||||
|
||||
|
@ -166,8 +166,8 @@ typedef struct
|
||||
{
|
||||
vfs_file_handler_t base; /* base class */
|
||||
|
||||
off_t got;
|
||||
off_t total;
|
||||
mc_off_t got;
|
||||
mc_off_t total;
|
||||
gboolean append;
|
||||
} shell_file_handler_t;
|
||||
|
||||
@ -185,7 +185,7 @@ static struct vfs_class *vfs_shell_ops = VFS_CLASS (&shell_subclass);
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static void
|
||||
shell_set_blksize (struct stat *s)
|
||||
shell_set_blksize (mc_stat_t *s)
|
||||
{
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||
/* redefine block size */
|
||||
@ -195,10 +195,10 @@ shell_set_blksize (struct stat *s)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static struct stat *
|
||||
static mc_stat_t *
|
||||
shell_default_stat (struct vfs_class *me)
|
||||
{
|
||||
struct stat *s;
|
||||
mc_stat_t *s;
|
||||
|
||||
s = vfs_s_default_stat (me, S_IFDIR | 0755);
|
||||
shell_set_blksize (s);
|
||||
@ -918,7 +918,7 @@ shell_parse_ls (char *buffer, struct vfs_s_entry *ent)
|
||||
}
|
||||
|
||||
case 'S':
|
||||
ST.st_size = (off_t) g_ascii_strtoll (buffer, NULL, 10);
|
||||
ST.st_size = (mc_off_t) g_ascii_strtoll (buffer, NULL, 10);
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
@ -1079,9 +1079,9 @@ shell_file_store (struct vfs_class *me, vfs_file_handler_t *fh, char *name, char
|
||||
struct vfs_s_super *super = VFS_FILE_HANDLER_SUPER (fh);
|
||||
shell_super_t *shell_super = SHELL_SUPER (super);
|
||||
int code;
|
||||
off_t total = 0;
|
||||
mc_off_t total = 0;
|
||||
char buffer[BUF_8K];
|
||||
struct stat s;
|
||||
mc_stat_t s;
|
||||
int h;
|
||||
char *quoted_name;
|
||||
|
||||
@ -1185,7 +1185,7 @@ shell_file_store (struct vfs_class *me, vfs_file_handler_t *fh, char *name, char
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
shell_linear_start (struct vfs_class *me, vfs_file_handler_t *fh, off_t offset)
|
||||
shell_linear_start (struct vfs_class *me, vfs_file_handler_t *fh, mc_off_t offset)
|
||||
{
|
||||
shell_file_handler_t *shell = SHELL_FILE_HANDLER (fh);
|
||||
struct vfs_s_super *super = VFS_FILE_HANDLER_SUPER (fh);
|
||||
@ -1218,9 +1218,9 @@ shell_linear_start (struct vfs_class *me, vfs_file_handler_t *fh, off_t offset)
|
||||
shell->got = 0;
|
||||
errno = 0;
|
||||
#if SIZEOF_OFF_T == SIZEOF_LONG
|
||||
shell->total = (off_t) strtol (reply_str, NULL, 10);
|
||||
shell->total = (mc_off_t) strtol (reply_str, NULL, 10);
|
||||
#else
|
||||
shell->total = (off_t) g_ascii_strtoll (reply_str, NULL, 10);
|
||||
shell->total = (mc_off_t) g_ascii_strtoll (reply_str, NULL, 10);
|
||||
#endif
|
||||
if (errno != 0)
|
||||
ERRNOR (E_REMOTE, 0);
|
||||
@ -1241,7 +1241,7 @@ shell_linear_abort (struct vfs_class *me, vfs_file_handler_t *fh)
|
||||
|
||||
do
|
||||
{
|
||||
n = MIN ((off_t) sizeof (buffer), (shell->total - shell->got));
|
||||
n = MIN ((mc_off_t) sizeof (buffer), (shell->total - shell->got));
|
||||
if (n != 0)
|
||||
{
|
||||
n = read (SHELL_SUPER (super)->sockr, buffer, n);
|
||||
@ -1433,7 +1433,7 @@ shell_symlink (const vfs_path_t *vpath1, const vfs_path_t *vpath2)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
shell_stat (const vfs_path_t *vpath, struct stat *buf)
|
||||
shell_stat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -1445,7 +1445,7 @@ shell_stat (const vfs_path_t *vpath, struct stat *buf)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
shell_lstat (const vfs_path_t *vpath, struct stat *buf)
|
||||
shell_lstat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -1457,7 +1457,7 @@ shell_lstat (const vfs_path_t *vpath, struct stat *buf)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
shell_fstat (void *vfs_info, struct stat *buf)
|
||||
shell_fstat (void *vfs_info, mc_stat_t *buf)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -346,7 +346,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef SMB_OFF_T
|
||||
#define SMB_OFF_T off_t
|
||||
#define SMB_OFF_T mc_off_t
|
||||
#endif
|
||||
|
||||
#define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8)
|
||||
@ -373,7 +373,7 @@
|
||||
*/
|
||||
|
||||
#ifndef SMB_STRUCT_STAT
|
||||
#define SMB_STRUCT_STAT struct stat
|
||||
#define SMB_STRUCT_STAT mc_stat_t
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -100,7 +100,7 @@ typedef struct
|
||||
{
|
||||
struct cli_state *cli;
|
||||
int fnum;
|
||||
off_t nread;
|
||||
mc_off_t nread;
|
||||
uint16 attr;
|
||||
} smbfs_handle;
|
||||
|
||||
@ -108,7 +108,7 @@ typedef struct dir_entry
|
||||
{
|
||||
char *text;
|
||||
struct dir_entry *next;
|
||||
struct stat my_stat;
|
||||
mc_stat_t my_stat;
|
||||
int merrno;
|
||||
} dir_entry;
|
||||
|
||||
@ -1431,7 +1431,7 @@ smbfs_opendir (const vfs_path_t * vpath)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
smbfs_fake_server_stat (const char *server_url, const char *path, struct stat *buf)
|
||||
smbfs_fake_server_stat (const char *server_url, const char *path, mc_stat_t *buf)
|
||||
{
|
||||
dir_entry *dentry;
|
||||
const char *p;
|
||||
@ -1457,7 +1457,7 @@ smbfs_fake_server_stat (const char *server_url, const char *path, struct stat *b
|
||||
{
|
||||
DEBUG (4, ("smbfs_fake_server_stat: %s:%4o\n",
|
||||
dentry->text, (unsigned int) dentry->my_stat.st_mode));
|
||||
memcpy (buf, &dentry->my_stat, sizeof (struct stat));
|
||||
memcpy (buf, &dentry->my_stat, sizeof (mc_stat_t));
|
||||
return 0;
|
||||
}
|
||||
dentry = dentry->next;
|
||||
@ -1470,7 +1470,7 @@ smbfs_fake_server_stat (const char *server_url, const char *path, struct stat *b
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
smbfs_fake_share_stat (const char *server_url, const char *path, struct stat *buf)
|
||||
smbfs_fake_share_stat (const char *server_url, const char *path, mc_stat_t *buf)
|
||||
{
|
||||
dir_entry *dentry;
|
||||
if (strlen (path) < strlen (server_url))
|
||||
@ -1518,7 +1518,7 @@ smbfs_fake_share_stat (const char *server_url, const char *path, struct stat *bu
|
||||
{
|
||||
DEBUG (6, ("smbfs_fake_share_stat: %s:%4o\n",
|
||||
dentry->text, (unsigned int) dentry->my_stat.st_mode));
|
||||
memcpy (buf, &dentry->my_stat, sizeof (struct stat));
|
||||
memcpy (buf, &dentry->my_stat, sizeof (mc_stat_t));
|
||||
return 0;
|
||||
}
|
||||
dentry = dentry->next;
|
||||
@ -1531,7 +1531,7 @@ smbfs_fake_share_stat (const char *server_url, const char *path, struct stat *bu
|
||||
/* stat a single file */
|
||||
|
||||
static int
|
||||
smbfs_get_remote_stat (smbfs_connection * sc, const char *path, struct stat *buf)
|
||||
smbfs_get_remote_stat (smbfs_connection * sc, const char *path, mc_stat_t *buf)
|
||||
{
|
||||
uint16 attribute = aDIR | aSYSTEM | aHIDDEN;
|
||||
char *mypath;
|
||||
@ -1557,7 +1557,7 @@ smbfs_get_remote_stat (smbfs_connection * sc, const char *path, struct stat *buf
|
||||
return -1; /* cli_list returns number of files */
|
||||
}
|
||||
|
||||
memcpy (buf, &single_entry->my_stat, sizeof (struct stat));
|
||||
memcpy (buf, &single_entry->my_stat, sizeof (mc_stat_t));
|
||||
|
||||
/* don't free here, use for smbfs_fstat() */
|
||||
/* g_free(single_entry->text);
|
||||
@ -1569,14 +1569,14 @@ smbfs_get_remote_stat (smbfs_connection * sc, const char *path, struct stat *buf
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
smbfs_search_dir_entry (dir_entry * dentry, const char *text, struct stat *buf)
|
||||
smbfs_search_dir_entry (dir_entry * dentry, const char *text, mc_stat_t *buf)
|
||||
{
|
||||
while (dentry)
|
||||
{
|
||||
if (strcmp (text, dentry->text) == 0)
|
||||
{
|
||||
memcpy (buf, &dentry->my_stat, sizeof (struct stat));
|
||||
memcpy (&single_entry->my_stat, &dentry->my_stat, sizeof (struct stat));
|
||||
memcpy (buf, &dentry->my_stat, sizeof (mc_stat_t));
|
||||
memcpy (&single_entry->my_stat, &dentry->my_stat, sizeof (mc_stat_t));
|
||||
return 0;
|
||||
}
|
||||
dentry = dentry->next;
|
||||
@ -1587,7 +1587,7 @@ smbfs_search_dir_entry (dir_entry * dentry, const char *text, struct stat *buf)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
smbfs_get_stat_info (smbfs_connection * sc, const char *path, struct stat *buf)
|
||||
smbfs_get_stat_info (smbfs_connection * sc, const char *path, mc_stat_t *buf)
|
||||
{
|
||||
char *p;
|
||||
#if 0
|
||||
@ -1625,9 +1625,9 @@ smbfs_get_stat_info (smbfs_connection * sc, const char *path, struct stat *buf)
|
||||
mydir = p + 1; /* advance util last '/' */
|
||||
if (strcmp (mydir, mypath) == 0)
|
||||
{ /* fake a stat for ".." */
|
||||
memset (buf, 0, sizeof (struct stat));
|
||||
memset (buf, 0, sizeof (mc_stat_t));
|
||||
buf->st_mode = (S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH) & myumask;
|
||||
memcpy (&single_entry->my_stat, buf, sizeof (struct stat));
|
||||
memcpy (&single_entry->my_stat, buf, sizeof (mc_stat_t));
|
||||
g_free (mdp);
|
||||
DEBUG (1, (" PARENT:found in %s\n", current_info->dirname));
|
||||
return 0;
|
||||
@ -1647,9 +1647,9 @@ smbfs_get_stat_info (smbfs_connection * sc, const char *path, struct stat *buf)
|
||||
}
|
||||
if (strcmp (mypath, dnp) == 0)
|
||||
{
|
||||
memset (buf, 0, sizeof (struct stat));
|
||||
memset (buf, 0, sizeof (mc_stat_t));
|
||||
buf->st_mode = (S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH) & myumask;
|
||||
memcpy (&single_entry->my_stat, buf, sizeof (struct stat));
|
||||
memcpy (&single_entry->my_stat, buf, sizeof (mc_stat_t));
|
||||
DEBUG (1, (" CURRENT:found in %s\n", current_info->dirname));
|
||||
return 0;
|
||||
}
|
||||
@ -1727,7 +1727,7 @@ smbfs_loaddir_by_name (const vfs_path_t * vpath)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
smbfs_stat (const vfs_path_t * vpath, struct stat *buf)
|
||||
smbfs_stat (const vfs_path_t * vpath, mc_stat_t *buf)
|
||||
{
|
||||
smbfs_connection *sc;
|
||||
pstring server_url;
|
||||
@ -1798,7 +1798,7 @@ smbfs_stat (const vfs_path_t * vpath, struct stat *buf)
|
||||
{
|
||||
/* make server name appear as directory */
|
||||
DEBUG (1, ("smbfs_stat: showing server as directory\n"));
|
||||
memset (buf, 0, sizeof (struct stat));
|
||||
memset (buf, 0, sizeof (mc_stat_t));
|
||||
buf->st_mode = (S_IFDIR | S_IRUSR | S_IRGRP | S_IROTH) & myumask;
|
||||
g_free (service);
|
||||
return 0;
|
||||
@ -1836,8 +1836,8 @@ smbfs_stat (const vfs_path_t * vpath, struct stat *buf)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static off_t
|
||||
smbfs_lseek (void *data, off_t offset, int whence)
|
||||
static mc_off_t
|
||||
smbfs_lseek (void *data, mc_off_t offset, int whence)
|
||||
{
|
||||
smbfs_handle *info = (smbfs_handle *) data;
|
||||
size_t size;
|
||||
@ -2192,7 +2192,7 @@ smbfs_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
smbfs_fstat (void *data, struct stat *buf)
|
||||
smbfs_fstat (void *data, mc_stat_t *buf)
|
||||
{
|
||||
smbfs_handle *remote_handle = (smbfs_handle *) data;
|
||||
|
||||
@ -2200,7 +2200,7 @@ smbfs_fstat (void *data, struct stat *buf)
|
||||
|
||||
/* use left over from previous smbfs_get_remote_stat, if available */
|
||||
if (single_entry)
|
||||
memcpy (buf, &single_entry->my_stat, sizeof (struct stat));
|
||||
memcpy (buf, &single_entry->my_stat, sizeof (mc_stat_t));
|
||||
else
|
||||
{ /* single_entry not set up: bug */
|
||||
my_errno = EFAULT;
|
||||
|
@ -155,12 +155,12 @@ tar_flush_archive (tar_super_t *archive)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static off_t
|
||||
tar_seek_archive (tar_super_t *archive, off_t size)
|
||||
static mc_off_t
|
||||
tar_seek_archive (tar_super_t *archive, mc_off_t size)
|
||||
{
|
||||
off_t start, offset;
|
||||
off_t nrec, nblk;
|
||||
off_t skipped;
|
||||
mc_off_t start, offset;
|
||||
mc_off_t nrec, nblk;
|
||||
mc_off_t skipped;
|
||||
|
||||
/* If low level I/O is already at EOF, do not try to seek further. */
|
||||
if (record_end < archive->record_start + blocking_factor)
|
||||
@ -567,12 +567,12 @@ tar_from_header (const char *where0, size_t digs, char const *type, intmax_t min
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
off_t
|
||||
mc_off_t
|
||||
off_from_header (const char *p, size_t s)
|
||||
{
|
||||
/* Negative offsets are not allowed in tar files, so invoke
|
||||
from_header with minimum value 0, not TYPE_MINIMUM (off_t). */
|
||||
return tar_from_header (p, s, "off_t", 0, TYPE_MAXIMUM (off_t), FALSE);
|
||||
from_header with minimum value 0, not TYPE_MINIMUM (mc_off_t). */
|
||||
return tar_from_header (p, s, "off_t", 0, TYPE_MAXIMUM (mc_off_t), FALSE);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -628,7 +628,7 @@ tar_set_next_block_after (union block *block)
|
||||
/**
|
||||
* Compute and return the block ordinal at current_block.
|
||||
*/
|
||||
off_t
|
||||
mc_off_t
|
||||
tar_current_block_ordinal (const tar_super_t *archive)
|
||||
{
|
||||
return record_start_block + (current_block - archive->record_start);
|
||||
@ -640,10 +640,10 @@ tar_current_block_ordinal (const tar_super_t *archive)
|
||||
* Skip over @size bytes of data in blocks in the archive.
|
||||
*/
|
||||
gboolean
|
||||
tar_skip_file (tar_super_t *archive, off_t size)
|
||||
tar_skip_file (tar_super_t *archive, mc_off_t size)
|
||||
{
|
||||
union block *x;
|
||||
off_t nblk;
|
||||
mc_off_t nblk;
|
||||
|
||||
nblk = tar_seek_archive (archive, size);
|
||||
if (nblk >= 0)
|
||||
|
@ -205,9 +205,9 @@ union block
|
||||
/* Information about a sparse file */
|
||||
struct sp_array
|
||||
{
|
||||
off_t offset; /* chunk offset in file */
|
||||
off_t numbytes; /* length of chunk */
|
||||
off_t arch_offset; /* chunk offset in archive */
|
||||
mc_off_t offset; /* chunk offset in file */
|
||||
mc_off_t numbytes; /* length of chunk */
|
||||
mc_off_t arch_offset; /* chunk offset in archive */
|
||||
};
|
||||
|
||||
enum dump_status
|
||||
@ -234,7 +234,7 @@ typedef struct
|
||||
struct vfs_s_super base; /* base class */
|
||||
|
||||
int fd;
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
enum archive_format type; /**< type of the archive */
|
||||
union block *record_start; /**< start of record of archive */
|
||||
} tar_super_t;
|
||||
@ -254,7 +254,7 @@ struct tar_stat_info
|
||||
char *uname; /**< user name of owner */
|
||||
char *gname; /**< group name of owner */
|
||||
#endif
|
||||
struct stat stat; /**< regular filesystem stat */
|
||||
mc_stat_t stat; /**< regular filesystem stat */
|
||||
|
||||
/* stat() doesn't always have access, data modification, and status
|
||||
change times in a convenient form, so store them separately. */
|
||||
@ -262,7 +262,7 @@ struct tar_stat_info
|
||||
struct timespec mtime;
|
||||
struct timespec ctime;
|
||||
|
||||
off_t archive_file_size; /**< size of file as stored in the archive.
|
||||
mc_off_t archive_file_size; /**< size of file as stored in the archive.
|
||||
Equals stat.st_size for non-sparse files */
|
||||
gboolean is_sparse; /**< is the file sparse */
|
||||
|
||||
@ -271,7 +271,7 @@ struct tar_stat_info
|
||||
intmax_t sparse_minor;
|
||||
GArray *sparse_map; /**< array of struct sp_array */
|
||||
|
||||
off_t real_size; /**< real size of sparse file */
|
||||
mc_off_t real_size; /**< real size of sparse file */
|
||||
gboolean real_size_set; /**< TRUE when GNU.sparse.realsize is set in archived file */
|
||||
|
||||
gboolean sparse_name_done; /**< TRUE if 'GNU.sparse.name' header was processed pax header parsing.
|
||||
@ -293,7 +293,7 @@ extern const idx_t record_size;
|
||||
|
||||
extern union block *record_end; /* last+1 block of archive record */
|
||||
extern union block *current_block; /* current block of archive */
|
||||
extern off_t record_start_block; /* block ordinal at record_start */
|
||||
extern mc_off_t record_start_block; /* block ordinal at record_start */
|
||||
|
||||
extern union block *current_header;
|
||||
|
||||
@ -313,11 +313,11 @@ intmax_t stoint (const char *arg, char **arglim, gboolean *overflow, intmax_t mi
|
||||
uintmax_t maxval);
|
||||
intmax_t tar_from_header (const char *where0, size_t digs, char const *type, intmax_t minval,
|
||||
uintmax_t maxval, gboolean octal_only);
|
||||
off_t off_from_header (const char *p, size_t s);
|
||||
mc_off_t off_from_header (const char *p, size_t s);
|
||||
union block *tar_find_next_block (tar_super_t * archive);
|
||||
gboolean tar_set_next_block_after (union block *block);
|
||||
off_t tar_current_block_ordinal (const tar_super_t * archive);
|
||||
gboolean tar_skip_file (tar_super_t * archive, off_t size);
|
||||
mc_off_t tar_current_block_ordinal (const tar_super_t * archive);
|
||||
gboolean tar_skip_file (tar_super_t * archive, mc_off_t size);
|
||||
|
||||
/* tar-sparse.c */
|
||||
gboolean tar_sparse_member_p (tar_super_t * archive, struct tar_stat_info *st);
|
||||
@ -327,7 +327,7 @@ enum dump_status tar_sparse_skip_file (tar_super_t * archive, struct tar_stat_in
|
||||
/* tar-xheader.c */
|
||||
gboolean tar_xheader_decode (struct tar_stat_info *st);
|
||||
gboolean tar_xheader_read (tar_super_t * archive, struct xheader *xhdr, union block *header,
|
||||
off_t size);
|
||||
mc_off_t size);
|
||||
gboolean tar_xheader_decode_global (struct xheader *xhdr);
|
||||
void tar_xheader_destroy (struct xheader *xhdr);
|
||||
|
||||
|
@ -121,8 +121,8 @@ struct tar_sparse_optab
|
||||
struct tar_sparse_file
|
||||
{
|
||||
int fd; /**< File descriptor */
|
||||
off_t dumped_size; /**< Number of bytes actually written to the archive */
|
||||
struct tar_stat_info *stat_info; /**< Information about the file */
|
||||
mc_off_t dumped_size; /**< Number of bytes actually written to the archive */
|
||||
struct tar_stat_info *stat_info; /**< Information about the file */
|
||||
struct tar_sparse_optab const *optab;
|
||||
void *closure; /**< Any additional data optab calls might reqiure */
|
||||
};
|
||||
@ -387,7 +387,7 @@ oldgnu_add_sparse (struct tar_sparse_file *file, struct sparse *s)
|
||||
{
|
||||
struct sp_array sp;
|
||||
#if !defined(WIN32) //WIN32: stdckdint.h
|
||||
off_t size;
|
||||
mc_off_t size;
|
||||
#endif
|
||||
|
||||
if (s->numbytes[0] == '\0')
|
||||
@ -429,7 +429,7 @@ oldgnu_fixup_header (struct tar_sparse_file *file)
|
||||
{
|
||||
/* NOTE! st_size was initialized from the header which actually contains archived size.
|
||||
The following fixes it */
|
||||
off_t realsize;
|
||||
mc_off_t realsize;
|
||||
|
||||
realsize = OFF_FROM_HEADER (current_header->oldgnu_header.realsize);
|
||||
file->stat_info->archive_file_size = file->stat_info->stat.st_size;
|
||||
@ -494,7 +494,7 @@ star_fixup_header (struct tar_sparse_file *file)
|
||||
{
|
||||
/* NOTE! st_size was initialized from the header which actually contains archived size.
|
||||
The following fixes it */
|
||||
off_t realsize;
|
||||
mc_off_t realsize;
|
||||
|
||||
realsize = OFF_FROM_HEADER (current_header->star_in_header.realsize);
|
||||
file->stat_info->archive_file_size = file->stat_info->stat.st_size;
|
||||
@ -571,7 +571,7 @@ pax_decode_header (tar_super_t *archive, struct tar_sparse_file *file)
|
||||
char *p;
|
||||
size_t sparse_map_len;
|
||||
size_t i;
|
||||
off_t start;
|
||||
mc_off_t start;
|
||||
|
||||
start = tar_current_block_ordinal (archive);
|
||||
tar_set_next_block_after (current_header);
|
||||
@ -600,11 +600,11 @@ pax_decode_header (tar_super_t *archive, struct tar_sparse_file *file)
|
||||
{
|
||||
struct sp_array sp;
|
||||
#if !defined(WIN32) //WIN32: stdckdint.h
|
||||
off_t size;
|
||||
mc_off_t size;
|
||||
#endif
|
||||
|
||||
COPY_BUF (archive, blk, nbuf, p);
|
||||
if (!decode_num (&u, nbuf, TYPE_MAXIMUM (off_t)))
|
||||
if (!decode_num (&u, nbuf, TYPE_MAXIMUM (mc_off_t)))
|
||||
{
|
||||
/* malformed sparse archive member */
|
||||
return FALSE;
|
||||
@ -616,7 +616,7 @@ pax_decode_header (tar_super_t *archive, struct tar_sparse_file *file)
|
||||
if (!decode_num(&u, nbuf, TYPE_MAXIMUM(size_t)) || INT_ADD_OVERFLOW(sp.offset, u)
|
||||
|| (uintmax_t)file->stat_info->stat.st_size < sp.offset + u)
|
||||
#else
|
||||
if (!decode_num (&u, nbuf, TYPE_MAXIMUM (off_t)) || ckd_add (&size, sp.offset, u)
|
||||
if (!decode_num (&u, nbuf, TYPE_MAXIMUM (mc_off_t)) || ckd_add (&size, sp.offset, u)
|
||||
|| file->stat_info->stat.st_size < size)
|
||||
#endif
|
||||
{
|
||||
|
@ -602,7 +602,7 @@ size_decoder (struct tar_stat_info *st, const char *keyword, const char *arg, si
|
||||
|
||||
(void) size;
|
||||
|
||||
if (!decode_num (&u, arg, TYPE_MAXIMUM (off_t), keyword))
|
||||
if (!decode_num (&u, arg, TYPE_MAXIMUM (mc_off_t), keyword))
|
||||
return FALSE;
|
||||
|
||||
st->stat.st_size = u;
|
||||
@ -813,7 +813,7 @@ sparse_size_decoder (struct tar_stat_info *st, const char *keyword, const char *
|
||||
|
||||
(void) size;
|
||||
|
||||
if (!decode_num (&u, arg, TYPE_MAXIMUM (off_t), keyword))
|
||||
if (!decode_num (&u, arg, TYPE_MAXIMUM (mc_off_t), keyword))
|
||||
return FALSE;
|
||||
|
||||
st->real_size_set = TRUE;
|
||||
@ -852,7 +852,7 @@ sparse_offset_decoder (struct tar_stat_info *st, const char *keyword, const char
|
||||
|
||||
(void) size;
|
||||
|
||||
if (!decode_num (&u, arg, TYPE_MAXIMUM (off_t), keyword))
|
||||
if (!decode_num (&u, arg, TYPE_MAXIMUM (mc_off_t), keyword))
|
||||
return FALSE;
|
||||
|
||||
s = &g_array_index (st->sparse_map, struct sp_array, st->sparse_map->len - 1);
|
||||
@ -896,11 +896,11 @@ sparse_map_decoder (struct tar_stat_info *st, const char *keyword, const char *a
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
off_t u;
|
||||
mc_off_t u;
|
||||
char *delim = NULL;
|
||||
gboolean overflow = FALSE;
|
||||
|
||||
u = stoint (arg, &delim, &overflow, 0, TYPE_MAXIMUM (off_t));
|
||||
u = stoint (arg, &delim, &overflow, 0, TYPE_MAXIMUM (mc_off_t));
|
||||
|
||||
if (delim == arg)
|
||||
{
|
||||
@ -994,7 +994,7 @@ tar_xheader_decode (struct tar_stat_info *st)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
tar_xheader_read (tar_super_t *archive, struct xheader *xhdr, union block *p, off_t size)
|
||||
tar_xheader_read (tar_super_t *archive, struct xheader *xhdr, union block *p, mc_off_t size)
|
||||
{
|
||||
size_t j = 0;
|
||||
size_t size_plus_1;
|
||||
|
@ -65,7 +65,7 @@ const idx_t record_size = DEFAULT_BLOCKING * BLOCKSIZE;
|
||||
/* As we open one archive at a time, it is safe to have these static */
|
||||
union block *record_end; /* last+1 block of archive record */
|
||||
union block *current_block; /* current block of archive */
|
||||
off_t record_start_block; /* block ordinal at record_start */
|
||||
mc_off_t record_start_block; /* block ordinal at record_start */
|
||||
|
||||
union block *current_header;
|
||||
|
||||
@ -251,7 +251,7 @@ uid_from_header (const char *p, size_t s)
|
||||
static void
|
||||
tar_calc_sparse_offsets (struct vfs_s_inode *inode)
|
||||
{
|
||||
off_t begin = inode->data_offset;
|
||||
mc_off_t begin = inode->data_offset;
|
||||
GArray *sm = (GArray *) inode->user_data;
|
||||
size_t i;
|
||||
|
||||
@ -643,7 +643,7 @@ tar_read_header (struct vfs_class *me, struct vfs_s_super *archive)
|
||||
size_t name_size = current_stat_info.stat.st_size;
|
||||
size_t n;
|
||||
#endif
|
||||
off_t size;
|
||||
mc_off_t size;
|
||||
union block *header_copy;
|
||||
char *bp;
|
||||
size_t written;
|
||||
@ -656,7 +656,7 @@ tar_read_header (struct vfs_class *me, struct vfs_s_super *archive)
|
||||
size = name_size + BLOCKSIZE;
|
||||
if (n != 0)
|
||||
size += BLOCKSIZE - n;
|
||||
if ((off_t)name_size != current_stat_info.stat.st_size || size < (off_t)name_size)
|
||||
if ((mc_off_t)name_size != current_stat_info.stat.st_size || size < (mc_off_t)name_size)
|
||||
#else
|
||||
if (ckd_add (&size, current_stat_info.stat.st_size, 2 * BLOCKSIZE - 1))
|
||||
#endif
|
||||
@ -698,7 +698,7 @@ tar_read_header (struct vfs_class *me, struct vfs_s_super *archive)
|
||||
}
|
||||
|
||||
written = tar_available_space_after (data_block);
|
||||
if ((off_t) written > size)
|
||||
if ((mc_off_t) written > size)
|
||||
written = (size_t) size;
|
||||
|
||||
memcpy (bp, data_block->buffer, written);
|
||||
@ -1060,7 +1060,7 @@ tar_open_archive (struct vfs_s_super *archive, const vfs_path_t *vpath,
|
||||
static void *
|
||||
tar_super_check (const vfs_path_t *vpath)
|
||||
{
|
||||
static struct stat stat_buf;
|
||||
static mc_stat_t stat_buf;
|
||||
int stat_result;
|
||||
|
||||
stat_result = mc_stat (vpath, &stat_buf);
|
||||
@ -1074,7 +1074,7 @@ static int
|
||||
tar_super_same (const vfs_path_element_t *vpath_element, struct vfs_s_super *parc,
|
||||
const vfs_path_t *vpath, void *cookie)
|
||||
{
|
||||
struct stat *archive_stat = cookie; /* stat of main archive */
|
||||
mc_stat_t *archive_stat = cookie; /* stat of main archive */
|
||||
|
||||
(void) vpath_element;
|
||||
|
||||
@ -1112,7 +1112,7 @@ tar_super_same (const vfs_path_element_t *vpath_element, struct vfs_s_super *par
|
||||
*/
|
||||
|
||||
static ssize_t
|
||||
tar_get_sparse_chunk_idx (const GArray *sparse_map, off_t offset)
|
||||
tar_get_sparse_chunk_idx (const GArray *sparse_map, mc_off_t offset)
|
||||
{
|
||||
size_t k;
|
||||
|
||||
@ -1144,7 +1144,7 @@ tar_read_sparse (vfs_file_handler_t *fh, char *buffer, size_t count)
|
||||
const GArray *sm = (const GArray *) fh->ino->user_data;
|
||||
ssize_t chunk_idx;
|
||||
const struct sp_array *chunk;
|
||||
off_t remain;
|
||||
mc_off_t remain;
|
||||
ssize_t res;
|
||||
|
||||
chunk_idx = tar_get_sparse_chunk_idx (sm, fh->pos);
|
||||
@ -1152,7 +1152,7 @@ tar_read_sparse (vfs_file_handler_t *fh, char *buffer, size_t count)
|
||||
{
|
||||
/* we are in the chunk -- read data until chunk end */
|
||||
chunk = &g_array_index (sm, struct sp_array, chunk_idx - 1);
|
||||
remain = MIN ((off_t) count, chunk->offset + chunk->numbytes - fh->pos);
|
||||
remain = MIN ((mc_off_t) count, chunk->offset + chunk->numbytes - fh->pos);
|
||||
res = mc_read (fd, buffer, (size_t) remain);
|
||||
}
|
||||
else
|
||||
@ -1160,7 +1160,7 @@ tar_read_sparse (vfs_file_handler_t *fh, char *buffer, size_t count)
|
||||
if (chunk_idx == 0)
|
||||
{
|
||||
/* we are in the hole after last chunk -- return zeros until file end */
|
||||
remain = MIN ((off_t) count, fh->ino->st.st_size - fh->pos);
|
||||
remain = MIN ((mc_off_t) count, fh->ino->st.st_size - fh->pos);
|
||||
/* FIXME: can remain be negative? */
|
||||
remain = MAX (remain, 0);
|
||||
}
|
||||
@ -1168,7 +1168,7 @@ tar_read_sparse (vfs_file_handler_t *fh, char *buffer, size_t count)
|
||||
{
|
||||
/* we are in the hole -- return zeros until next chunk start */
|
||||
chunk = &g_array_index (sm, struct sp_array, -chunk_idx - 1);
|
||||
remain = MIN ((off_t) count, chunk->offset - fh->pos);
|
||||
remain = MIN ((mc_off_t) count, chunk->offset - fh->pos);
|
||||
}
|
||||
|
||||
memset (buffer, 0, (size_t) remain);
|
||||
@ -1180,15 +1180,15 @@ tar_read_sparse (vfs_file_handler_t *fh, char *buffer, size_t count)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static off_t
|
||||
tar_lseek_sparse (vfs_file_handler_t *fh, off_t offset)
|
||||
static mc_off_t
|
||||
tar_lseek_sparse (vfs_file_handler_t *fh, mc_off_t offset)
|
||||
{
|
||||
off_t saved_offset = offset;
|
||||
mc_off_t saved_offset = offset;
|
||||
int fd = TAR_SUPER (fh->ino->super)->fd;
|
||||
const GArray *sm = (const GArray *) fh->ino->user_data;
|
||||
ssize_t chunk_idx;
|
||||
const struct sp_array *chunk;
|
||||
off_t res;
|
||||
mc_off_t res;
|
||||
|
||||
chunk_idx = tar_get_sparse_chunk_idx (sm, offset);
|
||||
if (chunk_idx > 0)
|
||||
@ -1241,7 +1241,7 @@ tar_read (void *fh, char *buffer, size_t count)
|
||||
struct vfs_class *me = VFS_FILE_HANDLER_SUPER (fh)->me;
|
||||
vfs_file_handler_t *file = VFS_FILE_HANDLER (fh);
|
||||
int fd = TAR_SUPER (VFS_FILE_HANDLER_SUPER (fh))->fd;
|
||||
off_t begin = file->pos;
|
||||
mc_off_t begin = file->pos;
|
||||
ssize_t res;
|
||||
|
||||
if (file->ino->user_data != NULL)
|
||||
@ -1258,7 +1258,7 @@ tar_read (void *fh, char *buffer, size_t count)
|
||||
if (mc_lseek (fd, begin, SEEK_SET) != begin)
|
||||
ERRNOR (EIO, -1);
|
||||
|
||||
count = (size_t) MIN ((off_t) count, file->ino->st.st_size - file->pos);
|
||||
count = (size_t) MIN ((mc_off_t) count, file->ino->st.st_size - file->pos);
|
||||
res = mc_read (fd, buffer, count);
|
||||
}
|
||||
|
||||
|
@ -622,7 +622,7 @@ undelfs_getindex (char *path)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
undelfs_stat_int (int inode_index, struct stat *buf)
|
||||
undelfs_stat_int (int inode_index, mc_stat_t *buf)
|
||||
{
|
||||
buf->st_dev = 0;
|
||||
buf->st_ino = delarray[inode_index].ino;
|
||||
@ -643,7 +643,7 @@ undelfs_stat_int (int inode_index, struct stat *buf)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
undelfs_lstat (const vfs_path_t *vpath, struct stat *buf)
|
||||
undelfs_lstat (const vfs_path_t *vpath, mc_stat_t *buf)
|
||||
{
|
||||
int inode_index;
|
||||
char *file, *f = NULL;
|
||||
@ -688,7 +688,7 @@ undelfs_lstat (const vfs_path_t *vpath, struct stat *buf)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
static int
|
||||
undelfs_fstat (void *vfs_info, struct stat *buf)
|
||||
undelfs_fstat (void *vfs_info, mc_stat_t *buf)
|
||||
{
|
||||
undelfs_file *p = vfs_info;
|
||||
|
||||
|
@ -125,7 +125,7 @@ mcview_update_filesize (WView *view)
|
||||
{
|
||||
if (view->datasource == DS_FILE)
|
||||
{
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
if (mc_fstat (view->ds_file_fd, &st) != -1)
|
||||
view->ds_file_filesize = st.st_size;
|
||||
}
|
||||
@ -367,7 +367,7 @@ mcview_close_datasource (WView *view)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
mcview_set_datasource_file (WView *view, int fd, const struct stat *st)
|
||||
mcview_set_datasource_file (WView *view, int fd, const mc_stat_t *st)
|
||||
{
|
||||
view->datasource = DS_FILE;
|
||||
view->ds_file_fd = fd;
|
||||
|
@ -251,7 +251,7 @@ gboolean mcview_get_byte_none (WView * view, off_t byte_index, int *retval);
|
||||
void mcview_set_byte (WView * view, off_t offset, byte b);
|
||||
void mcview_file_load_data (WView * view, off_t byte_index);
|
||||
void mcview_close_datasource (WView * view);
|
||||
void mcview_set_datasource_file (WView * view, int fd, const struct stat *st);
|
||||
void mcview_set_datasource_file (WView * view, int fd, const mc_stat_t *st);
|
||||
gboolean mcview_load_command_output (WView * view, const char *command);
|
||||
void mcview_set_datasource_vfs_pipe (WView * view, int fd);
|
||||
void mcview_set_datasource_string (WView * view, const char *s);
|
||||
|
@ -331,7 +331,7 @@ mcview_load (WView *view, const char *command, const char *file, int start_line,
|
||||
{
|
||||
int fd;
|
||||
char tmp[BUF_MEDIUM];
|
||||
struct stat st;
|
||||
mc_stat_t st;
|
||||
|
||||
/* Open the file */
|
||||
vpath = vfs_path_from_str (file);
|
||||
|
@ -1 +1 @@
|
||||
231
|
||||
232
|
||||
|
@ -1,3 +1,14 @@
|
||||
Mon Apr 7 14:34:02 2025 adamy
|
||||
|
||||
* build-232
|
||||
|
||||
o obey NODRIVES group policy (#121)
|
||||
o getmntinfo, networked/mapped drive (#120)
|
||||
o non-ascii group name handling (#118)
|
||||
o mandoc integration and mchelp (#116)
|
||||
o stat/seek64 (#35) and (#89)
|
||||
o unzip vfs (#88)
|
||||
|
||||
Wed Mar 19 16:03:57 2025 adamy
|
||||
|
||||
* build-231
|
||||
@ -12,6 +23,7 @@ Wed Mar 19 16:03:57 2025 adamy
|
||||
|
||||
* upgrades/bugfixes
|
||||
|
||||
o vio: wide-character handling (#115)
|
||||
o wputenv() cross tool-chain usage (#113)
|
||||
o pcre2 10.45 (#106)
|
||||
o appupdater (#102)
|
||||
|
@ -7,8 +7,7 @@
|
||||
#
|
||||
# The Midnight Commander is free software: you can redistribute it
|
||||
# and/or modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the License,
|
||||
# or (at your option) any later version.
|
||||
# published by the Free Software Foundation, version 3 of the License.
|
||||
#
|
||||
# The Midnight Commander is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@ -181,6 +180,7 @@ D_OBJ= $(ROOT)/obj@TOOLCHAINEXT@/$(BUILD_TYPE)
|
||||
LW= $(D_LIB)/$(LP)
|
||||
|
||||
D_ETC= $(D_BIN)/etc
|
||||
D_LIBEXEC= $(D_BIN)/libexec
|
||||
D_PLUGIN= $(D_BIN)/plugin
|
||||
D_SHARE= $(D_BIN)/share
|
||||
D_DOC= $(D_BIN)/doc
|
||||
@ -221,7 +221,7 @@ XFLAGS=
|
||||
CFLAGS= @CFLAGS@
|
||||
CWARN= @CWARN@
|
||||
ifeq ("gcc","@CC@")
|
||||
CWARN+= -Wno-sign-compare -Wno-missing-prototypes
|
||||
CWARN+= -Wno-sign-compare -Wno-missing-prototypes -Wno-type-limits
|
||||
CWARN+= -Wno-unused-variable -Wno-unused-parameter -Wno-unused-parameter -Wno-unused-function -Wno-unused-label
|
||||
CWARN+= -Wno-missing-field-initializers -Wno-implicit-fallthrough
|
||||
endif
|
||||
@ -586,9 +586,13 @@ PO_SRC= $(MCSOURCE)/po
|
||||
|
||||
WIN32_ETC_SRC= ./win32_etc
|
||||
WIN32_PLUGIN_SRC= ./win32_plugin
|
||||
WIN32_SKINS_SRC= ./win32_skins
|
||||
WIN32_WRAPPER_SRC= ./win32_wrapper
|
||||
WIN32_SKINS_SRC= ./win32_skins
|
||||
WIN32_DOC_SRC= ./doc
|
||||
|
||||
Unique= $(if $(1),$(strip $(word 1,$(1)) $(call Unique,$(filter-out $(word 1,$(1)),$(1)))))
|
||||
Reverse= $(if $(1),$(call Reverse,$(wordlist 2,$(words $(1)),$(1)))) $(firstword $(1))
|
||||
|
||||
CFG_ETC=\
|
||||
$(D_ETC)/filehighlight.ini \
|
||||
$(D_ETC)/mc.ext.ini \
|
||||
@ -633,6 +637,19 @@ CFG_SHARE_SYNTAX:= $(addprefix $(D_SHARE)/syntax/, \
|
||||
CFG_SHARE_MACROS_D:= $(addprefix $(D_SHARE)/macros.d/, \
|
||||
$(filter-out CVS, $(notdir $(wildcard $(MACROSDATA_SRC)/*sh))))
|
||||
|
||||
CFG_SHARE_MANDIRS:= $(subst $(MAN_SRC)/,,$(filter-out %/CVS/, $(call Unique, $(dir $(wildcard $(MAN_SRC)/*/)))))
|
||||
CFG_SHARE_MAN:= $(addprefix $(D_SHARE)/man/, \
|
||||
$(subst .in,,$(notdir $(wildcard $(MAN_SRC)/*.in)))) \
|
||||
$(foreach dir, $(CFG_SHARE_MANDIRS), $(addprefix $(D_SHARE)/man/$(dir), \
|
||||
$(subst .in,,$(notdir $(wildcard $(MAN_SRC)/$(dir)/*.in))))) \
|
||||
$(addprefix $(D_SHARE)/man/, \
|
||||
$(subst .in,,$(notdir $(wildcard ./support/*.1.in)))) \
|
||||
$(addprefix $(D_SHARE)/man/, \
|
||||
$(notdir $(wildcard ./mandoc/*.man)))
|
||||
|
||||
##$(info CFG_SHARE_MANDIRS=$(CFG_SHARE_MANDIRS))
|
||||
##$(info CFG_SHARE_MAN=$(CFG_SHARE_MAN))
|
||||
|
||||
CFG_WIN32_SKINS:= $(filter-out CVS, $(notdir $(wildcard $(WIN32_SKINS_SRC)/*.ini)))
|
||||
|
||||
CFG_PLUGIN:= $(addprefix $(D_PLUGIN)/, \
|
||||
@ -647,6 +664,9 @@ CFG_PLUGIN_SHELL:= $(addprefix $(D_PLUGIN)/shell/, \
|
||||
CFG_WIN32_PLUGIN:= $(filter-out CVS extfs.d, $(notdir $(wildcard $(WIN32_PLUGIN_SRC)/*)))
|
||||
CFG_WIN32_PLUGIN_EXTFS_D:=$(filter-out CVS, $(notdir $(wildcard $(WIN32_PLUGIN_SRC)/extfs.d/*.in)))
|
||||
|
||||
CFG_LIBEXEC= $(addprefix $(D_LIBEXEC)/, \
|
||||
$(subst .in,,$(filter-out CVS, $(notdir $(wildcard $(WIN32_WRAPPER_SRC)/*.in)))))
|
||||
|
||||
CFG_DOC=\
|
||||
$(D_DOC)/FAQ \
|
||||
$(D_DOC)/COPYING \
|
||||
@ -680,9 +700,11 @@ CONFIGURATION=\
|
||||
$(CFG_SHARE_SKINS) \
|
||||
$(CFG_SHARE_SYNTAX) \
|
||||
$(CFG_SHARE_MACROS_D) \
|
||||
$(CFG_SHARE_MAN) \
|
||||
$(CFG_PLUGIN) \
|
||||
$(CFG_PLUGIN_EXTFS_D) \
|
||||
$(CFG_PLUGIN_SHELL) \
|
||||
$(CFG_LIBEXEC) \
|
||||
$(CFG_DOC)
|
||||
|
||||
|
||||
@ -694,7 +716,9 @@ TARGETS=\
|
||||
$(D_BIN)/mcedit$(E) \
|
||||
$(D_BIN)/mcdiff$(E) \
|
||||
$(D_BIN)/mcview$(E) \
|
||||
$(D_BIN)/mchelp$(E) \
|
||||
$(D_BIN)/mcbsddiff$(E) \
|
||||
$(D_BIN)/mcmandoc$(E) \
|
||||
$(D_BIN)/kbtest$(E) \
|
||||
$(D_BIN)/coninfo$(E) \
|
||||
$(D_BIN)/man2hlp.pl
|
||||
@ -773,13 +797,15 @@ DIRECTORIES:=\
|
||||
$(D_PLUGIN)/.created \
|
||||
$(D_PLUGIN)/extfs.d/.created \
|
||||
$(D_PLUGIN)/shell/.created \
|
||||
$(D_LIBEXEC)/.created \
|
||||
$(D_SHARE)/.created \
|
||||
$(D_SHARE)/help/.created \
|
||||
$(D_SHARE)/hints/.created \
|
||||
$(D_SHARE)/man/.created \
|
||||
$(foreach dir, $(CFG_SHARE_MANDIRS), $(D_SHARE)/man/$(dir)/.created) \
|
||||
$(D_SHARE)/skins/.created \
|
||||
$(D_SHARE)/syntax/.created \
|
||||
$(D_SHARE)/macros.d/.created
|
||||
$(D_SHARE)/macros.d/.created \
|
||||
|
||||
|
||||
#########################################################################################
|
||||
@ -925,6 +951,7 @@ clean:
|
||||
$(MAKE) -C libw32 clean
|
||||
$(MAKE) -C apps clean
|
||||
$(MAKE) -C diff clean
|
||||
$(MAKE) -C mandoc clean
|
||||
$(MAKE) -C src/kbtest clean
|
||||
$(MAKE) -C src/coninfo clean
|
||||
$(MAKE) -C autoupdater clean
|
||||
@ -947,12 +974,15 @@ $(D_BIN)/mc$(E): MAPFILE=$(basename $@).map
|
||||
$(D_BIN)/mc$(E): $(MC_OBJS) $(MC_RES) $(LDLIBRARIES)
|
||||
$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) @LDMAPFILE@
|
||||
|
||||
$(D_BIN)/mcdiff$(E) $(D_BIN)/mcedit$(E) $(D_BIN)/mcview$(E):
|
||||
$(D_BIN)/mcdiff$(E) $(D_BIN)/mcedit$(E) $(D_BIN)/mcview$(E) $(D_BIN)/mchelp$(E):
|
||||
$(MAKE) -C apps
|
||||
|
||||
$(D_BIN)/mcbsddiff$(E):
|
||||
$(MAKE) -C diff
|
||||
|
||||
$(D_BIN)/mcmandoc$(E):
|
||||
$(MAKE) -C mandoc
|
||||
|
||||
$(D_BIN)/kbtest$(E):
|
||||
$(MAKE) -C src/kbtest
|
||||
|
||||
@ -1054,9 +1084,7 @@ $(D_ETC)/magic.mgc: libmagic/magic.mgc
|
||||
|
||||
# .. plugin
|
||||
$(D_PLUGIN)/% : $(EXTD_SRC)/%
|
||||
@echo importing $@ ..
|
||||
@$(CP) $^ $@
|
||||
@$(BUSYBOX) dos2unix $@
|
||||
@$(PERL) ./support/sedin.pl -u --script $^ $@
|
||||
|
||||
$(D_PLUGIN)/% : $(EXTD_SRC)/%.in
|
||||
@$(PERL) ./support/sedin.pl -u $^ $@
|
||||
@ -1076,6 +1104,12 @@ $(D_PLUGIN)/shell/% : $(SHELL_SRC)/%
|
||||
@$(CP) $^ $@
|
||||
@$(BUSYBOX) dos2unix $@
|
||||
|
||||
# .. libexec
|
||||
$(D_LIBEXEC)/% : $(WIN32_WRAPPER_SRC)/%.in
|
||||
@echo importing $@ ..
|
||||
@$(CP) $^ $@
|
||||
@$(BUSYBOX) unix2dos $@
|
||||
|
||||
# .. share
|
||||
$(D_SHARE)/mc.charsets : $(MISC_SRC)/mc.charsets.in
|
||||
@echo importing $@ ..
|
||||
@ -1130,6 +1164,20 @@ $(D_SHARE)/macros.d/% : $(MACROSDATA_SRC)/%
|
||||
@$(CP) $^ $@
|
||||
@$(BUSYBOX) dos2unix $@
|
||||
|
||||
# .. share/man
|
||||
$(D_SHARE)/man/% : $(MAN_SRC)/%.in
|
||||
@$(PERL) ./support/sedin.pl --man --version="$(PKG_VERSION)" --iswin64="@ISWIN64@" -u $^ $@
|
||||
@$(D_BIN)/mcmandoc -K utf-8 -T utf8 $@ > $@.man
|
||||
|
||||
$(D_SHARE)/man/% : ./mandoc/%
|
||||
@echo importing $@ ..
|
||||
@$(CP) $^ $@
|
||||
|
||||
$(D_SHARE)/man/% : ./support/%.in
|
||||
@echo importing $@ ..
|
||||
@$(CP) $^ $@
|
||||
@$(D_BIN)/mcmandoc -K utf-8 -T utf8 $@ > $@.man
|
||||
|
||||
# .. docs
|
||||
$(D_DOC)/AUTHORS : $(MCSOURCE)/AUTHORS
|
||||
@echo importing $@ ..
|
||||
@ -1228,7 +1276,7 @@ $(D_OBJRT)/%$(O) : $(MCSOURCE)/src/%.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(D_OBJMC)/%$(O) : $(MCSOURCE)/src/file/%.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $<)
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(D_OBJFM)/%$(O) : $(MCSOURCE)/src/filemanager/%.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- mode: mak; indent-tabs-mode: t; tab-width: 8 -*-
|
||||
# $Id: Makefile.in,v 1.2 2025/02/13 17:53:33 cvsuser Exp $
|
||||
# $Id: Makefile.in,v 1.5 2025/04/12 18:01:04 cvsuser Exp $
|
||||
# mcdiff/mcedit/mcdiff, application shims
|
||||
#
|
||||
#
|
||||
@ -134,6 +134,8 @@ MCSHIMSRC= .
|
||||
MCDIFFTSK= $(D_BIN)/mcdiff$(E)
|
||||
MCEDITTSK= $(D_BIN)/mcedit$(E)
|
||||
MCVIEWTSK= $(D_BIN)/mcview$(E)
|
||||
MCHELPTSK= $(D_BIN)/mchelp$(E)
|
||||
MCSTARTTSK= $(D_BIN)/mcstart$(E)
|
||||
|
||||
VPATH+= $(MCSHIMSRC)
|
||||
LIBCSOURCES=\
|
||||
@ -148,11 +150,22 @@ EDITCSOURCES=\
|
||||
VIEWCSOURCES=\
|
||||
mcdiff.c
|
||||
|
||||
HELPCPPSOURCES=\
|
||||
mchelp.cpp \
|
||||
getopt.cpp
|
||||
|
||||
STARTCPPSOURCES=\
|
||||
mcstart.cpp \
|
||||
getopt.cpp
|
||||
|
||||
LIBOBJS= $(addprefix $(D_OBJ)/,$(subst .c,$(O),$(LIBCSOURCES)))
|
||||
|
||||
MCDIFFOBJS= $(addprefix $(D_OBJ)/,$(subst .c,$(O),$(DIFFCSOURCES)))
|
||||
MCEDITOBJS= $(addprefix $(D_OBJ)/,$(subst .c,$(O),$(EDITCSOURCES)))
|
||||
MCVIEWOBJS= $(addprefix $(D_OBJ)/,$(subst .c,$(O),$(VIEWCSOURCES)))
|
||||
MCHELPOBJS= $(addprefix $(D_OBJ)/,$(subst .cpp,$(O),$(HELPCPPSOURCES)))
|
||||
MCSTARTOBJS= $(addprefix $(D_OBJ)/,$(subst .cpp,$(O),$(STARTCPPSOURCES)))
|
||||
|
||||
|
||||
ifeq (mingw,$(findstring mingw,"@TOOLCHAIN@"))
|
||||
MCDIFFOBJS+= $(D_OBJ)/mcdiff_res.o
|
||||
@ -172,10 +185,22 @@ else
|
||||
MCVIEWOBJS+= $(D_OBJ)/mcview.res
|
||||
endif
|
||||
|
||||
ifeq (mingw,$(findstring mingw,"@TOOLCHAIN@"))
|
||||
MCHELPOBJS+= $(D_OBJ)/mchelp_res.o
|
||||
else
|
||||
MCHELPOBJS+= $(D_OBJ)/mchelp.res
|
||||
endif
|
||||
|
||||
ifeq (mingw,$(findstring mingw,"@TOOLCHAIN@"))
|
||||
MCSTARTOBJS+= $(D_OBJ)/mcstart_res.o
|
||||
else
|
||||
MCSTARTOBJS+= $(D_OBJ)/mchelp.res
|
||||
endif
|
||||
|
||||
OBJS= $(LIBOBJS) $(TSKOBJS)
|
||||
LIBS= $(MCSHIMLIB)
|
||||
DLLS=
|
||||
TSKS= $(MCDIFFTSK) $(MCEDITTSK) $(MCVIEWTSK)
|
||||
TSKS= $(MCDIFFTSK) $(MCEDITTSK) $(MCVIEWTSK) $(MCHELPTSK) $(MCSTARTTSK)
|
||||
INSTALLED=
|
||||
GENERATED=
|
||||
|
||||
@ -196,7 +221,7 @@ $(MCSHIMLIB): $(D_OBJ)/.created $(LIBOBJS)
|
||||
$(AR) $(ARFLAGS) $@ $(LIBOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
$(MCDIFFTSK) $(MCEDITTSK) $(MCVIEWTSK): $(MCSHIMLIB)
|
||||
$(MCDIFFTSK) $(MCEDITTSK) $(MCVIEWTSK) $(MCHELPTSK): $(MCSHIMLIB)
|
||||
|
||||
$(MCDIFFTSK): MAPFILE=$(basename $@).map
|
||||
$(MCDIFFTSK): $(D_OBJ)/.created $(MCDIFFOBJS)
|
||||
@ -210,6 +235,17 @@ $(MCVIEWTSK): MAPFILE=$(basename $@).map
|
||||
$(MCVIEWTSK): $(D_OBJ)/.created $(MCVIEWOBJS)
|
||||
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $(MCVIEWOBJS) $(MCSHIMLIB) $(LDLIBS) -MAP:$(MAPFILE)
|
||||
|
||||
$(MCHELPTSK): MAPFILE=$(basename $@).map
|
||||
$(MCHELPTSK): $(D_OBJ)/.created $(MCHELPOBJS)
|
||||
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $(MCHELPOBJS) $(MCSHIMLIB) $(LDLIBS) -MAP:$(MAPFILE)
|
||||
|
||||
$(MCSTARTTSK): MAPFILE=$(basename $@).map
|
||||
ifeq (mingw,$(findstring mingw,"@TOOLCHAIN@"))
|
||||
$(MCSTARTTSK): LDFLAGS += -municode
|
||||
endif
|
||||
$(MCSTARTTSK): $(D_OBJ)/.created $(MCSTARTOBJS)
|
||||
$(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) -o $@ $(MCSTARTOBJS) $(MCSHIMLIB) $(LDLIBS) -MAP:$(MAPFILE)
|
||||
|
||||
%/.created:
|
||||
-@mkdir $(@D)
|
||||
@echo "do not delete, managed directory" > $@
|
||||
@ -221,7 +257,7 @@ clean:
|
||||
-@$(RM) $(LIBOBJS) $(QUIETOUT)
|
||||
|
||||
$(D_OBJ)/%$(O): %.cpp
|
||||
$(CC) $(CXXFLAGS) -o $@ -c $<
|
||||
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||
|
||||
$(D_OBJ)/%$(O): %.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
136
mcwin32/apps/getopt.cpp
Normal file
136
mcwin32/apps/getopt.cpp
Normal file
@ -0,0 +1,136 @@
|
||||
// $Id: getopt.cpp,v 1.3 2025/04/12 18:01:04 cvsuser Exp $
|
||||
//
|
||||
// getopt() implementation
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
#if defined(__WATCOMC__)
|
||||
#pragma disable_message(391) /* assignment found in boolean expression */
|
||||
#endif
|
||||
|
||||
namespace Updater {
|
||||
|
||||
int optind = 1, /* index into parent argv vector */
|
||||
optopt; /* character checked for validity */
|
||||
const char *optarg; /* argument associated with option */
|
||||
const wchar_t *woptarg; /* argument associated with option */
|
||||
|
||||
|
||||
#define OPTBADCH (int)'?'
|
||||
|
||||
int
|
||||
Getopt(int nargc, char **nargv, const char *ostr)
|
||||
{
|
||||
#define OPTEMSG ""
|
||||
#define OPTERR(__s) \
|
||||
fputs(*nargv, stderr); fputs(__s, stderr); fputc(optopt, stderr); fputc('\n', stderr); \
|
||||
return(OPTBADCH);
|
||||
|
||||
static const char *place = OPTEMSG; /* option letter processing */
|
||||
const char *oli; /* option letter list index */
|
||||
|
||||
if (!*place) { /* update scanning pointer */
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-' || !*++place) {
|
||||
return(EOF);
|
||||
}
|
||||
|
||||
if (*place == '-') { /* found "--" */
|
||||
++optind;
|
||||
return EOF;
|
||||
}
|
||||
}
|
||||
/* option letter okay? */
|
||||
if ((optopt = (int)*place++) == (int)':' ||
|
||||
NULL == (oli = strchr(ostr,optopt))) {
|
||||
if (!*place) ++optind;
|
||||
OPTERR(": illegal option -- ");
|
||||
}
|
||||
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
optarg = NULL;
|
||||
if (!*place) ++optind;
|
||||
|
||||
} else { /* need an argument */
|
||||
if (*place) {
|
||||
optarg = place; /* no white space */
|
||||
|
||||
} else if (nargc <= ++optind) { /* no arg */
|
||||
place = OPTEMSG;
|
||||
OPTERR(": option requires an argument -- ");
|
||||
|
||||
} else {
|
||||
optarg = nargv[optind]; /* white space */
|
||||
}
|
||||
|
||||
place = OPTEMSG;
|
||||
++optind;
|
||||
}
|
||||
|
||||
#undef OPTEMSG
|
||||
#undef OPTERR
|
||||
|
||||
return(optopt); /* dump back option letter */
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
Getopt(int nargc, wchar_t **nargv, const char *ostr)
|
||||
{
|
||||
#define LOPTEMSG L""
|
||||
#define LOPTERR(__s) \
|
||||
fputws(*nargv, stderr); fputws(__s, stderr); fputwc(optopt, stderr); fputwc('\n', stderr); \
|
||||
return (OPTBADCH);
|
||||
|
||||
static const wchar_t *place = LOPTEMSG; /* option letter processing */
|
||||
const char *oli; /* option letter list index */
|
||||
|
||||
if (!*place) { /* update scanning pointer */
|
||||
if (optind >= nargc || *(place = nargv[optind]) != '-' || !*++place) {
|
||||
return(EOF);
|
||||
}
|
||||
|
||||
if (*place == '-') { /* found "--" */
|
||||
++optind;
|
||||
return EOF;
|
||||
}
|
||||
}
|
||||
/* option letter okay? */
|
||||
if ((optopt = (int)*place++) == (int)':' ||
|
||||
NULL == (oli = strchr(ostr,optopt))) {
|
||||
if (!*place) ++optind;
|
||||
LOPTERR(L": illegal option -- ");
|
||||
}
|
||||
|
||||
if (*++oli != ':') { /* don't need argument */
|
||||
woptarg = NULL;
|
||||
if (!*place) ++optind;
|
||||
|
||||
} else { /* need an argument */
|
||||
if (*place) {
|
||||
woptarg = place; /* no white space */
|
||||
|
||||
} else if (nargc <= ++optind) { /* no arg */
|
||||
place = LOPTEMSG;
|
||||
LOPTERR(L": option requires an argument -- ");
|
||||
|
||||
} else {
|
||||
woptarg = nargv[optind]; /* white space */
|
||||
}
|
||||
|
||||
place = LOPTEMSG;
|
||||
++optind;
|
||||
}
|
||||
|
||||
#undef LOPTEMSG
|
||||
#undef LOPTERR
|
||||
|
||||
return(optopt); /* dump back option letter */
|
||||
}
|
||||
|
||||
} // namespace Updater
|
||||
|
24
mcwin32/apps/getopt.h
Normal file
24
mcwin32/apps/getopt.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef MCGETOPT_H_INCLUDED
|
||||
#define MCGETOPT_H_INCLUDED
|
||||
// $Id: getopt.h,v 1.2 2025/04/12 18:01:04 cvsuser Exp $
|
||||
//
|
||||
// getopt() implementation
|
||||
//
|
||||
|
||||
#include <wchar.h>
|
||||
|
||||
namespace Updater {
|
||||
|
||||
extern int optind, /* index into parent argv vector */
|
||||
optopt; /* character checked for validity */
|
||||
extern const char *optarg; /* argument associated with option */
|
||||
extern const wchar_t *woptarg; /* argument associated with option */
|
||||
|
||||
extern int Getopt(int nargc, char **nargv, const char *ostr);
|
||||
extern int Getopt(int nargc, wchar_t **nargv, const char *ostr);
|
||||
|
||||
|
||||
} //namespace Updater
|
||||
|
||||
#endif /*MCGETOPT_H_INCLUDED*/
|
||||
|
169
mcwin32/apps/mchelp.cpp
Normal file
169
mcwin32/apps/mchelp.cpp
Normal file
@ -0,0 +1,169 @@
|
||||
/*
|
||||
* mchelp application.
|
||||
*
|
||||
* Copyright (c) 2024 - 2025, Adam Young.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This file is part of WIN32 Midnight Commander.
|
||||
*
|
||||
* The applications are free software: you can redistribute it
|
||||
* and/or modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation, version 3.
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, and must be distributed with the license document above.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, and must include the license document above in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* This project is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* License for more details.
|
||||
* ==end==
|
||||
*/
|
||||
|
||||
#include "shim.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
#ifndef _countof
|
||||
#define _countof(__type) (sizeof(__type)/sizeof(__type[0]))
|
||||
#endif
|
||||
|
||||
static wchar_t *Cmdline(const char *topic, unsigned section);
|
||||
static void Usage();
|
||||
|
||||
static const char PROGNAME[] = {"mchelp"};
|
||||
static const wchar_t WMCVIEW[] = {L"mcview"};
|
||||
|
||||
static const char MANPATH[] = {"share\\man\\"};
|
||||
static const wchar_t WMANPATH[] = {L"share\\man\\"};
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
unsigned section = 1;
|
||||
int ch;
|
||||
|
||||
while (-1 != (ch = Updater::Getopt(argc, argv, "s:h"))) {
|
||||
switch (ch) {
|
||||
case 's': /* section */
|
||||
section = static_cast<unsigned>(strtoul(Updater::optarg, NULL, 10));
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
Usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
argv += Updater::optind;
|
||||
if ((argc -= Updater::optind) < 1) {
|
||||
std::cerr << "\n" <<
|
||||
PROGNAME << ": expected a topic" << std::endl;
|
||||
Usage();
|
||||
|
||||
} else if (argc > 1) {
|
||||
std::cerr << "\n" <<
|
||||
PROGNAME << ": unexpected arguments '" << argv[1] << "' ..." << std::endl;
|
||||
Usage();
|
||||
|
||||
} else {
|
||||
ApplicationShimCmd(WMCVIEW, L"mc.exe", Cmdline(argv[0], section));
|
||||
}
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
static wchar_t *
|
||||
Cmdline(const char *topic, unsigned section)
|
||||
{
|
||||
char suffix[32];
|
||||
_snprintf(suffix, _countof(suffix), ".%u.man", section);
|
||||
|
||||
const size_t total_len = (_countof(WMCVIEW) + MAX_PATH) + 32 + strlen(topic) + strlen(suffix);
|
||||
wchar_t *buf = static_cast<wchar_t *>(calloc(total_len, sizeof(wchar_t)));
|
||||
size_t aptlen, len;
|
||||
|
||||
aptlen = swprintf(buf, total_len, L"%s \"", WMCVIEW);
|
||||
|
||||
if ((len = GetModuleFileNameW(NULL, buf + aptlen, MAX_PATH)) > 0) {
|
||||
wchar_t *cp;
|
||||
|
||||
len += aptlen;
|
||||
|
||||
for (cp = buf + len; (cp > (buf + aptlen)) && (*cp != '\\'); cp--)
|
||||
--len; // remove application-name
|
||||
|
||||
if ('\\' == *cp) ++cp;
|
||||
|
||||
cp += swprintf(cp, total_len - len, WMANPATH);
|
||||
for (const char *cursor = topic; *cursor; ++cursor) {
|
||||
*cp++ = *cursor;
|
||||
}
|
||||
for (const char *cursor = suffix; *cursor; ++cursor) {
|
||||
*cp++ = *cursor;
|
||||
}
|
||||
|
||||
*cp++ = '"';
|
||||
*cp = '\0';
|
||||
|
||||
for (; (cp > (buf + aptlen)); cp--)
|
||||
if (*cp == '\\') *cp = '/'; // path conversion
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Usage()
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
size_t len;
|
||||
|
||||
std::cerr <<
|
||||
"\nusage: " << PROGNAME << " -s [section] topic\n";
|
||||
|
||||
if ((len = GetModuleFileNameA(NULL, path, MAX_PATH)) > 0) {
|
||||
char *cp;
|
||||
|
||||
for (cp = path + len; (cp > path) && (*cp != '\\'); cp--)
|
||||
--len; // remove application-name
|
||||
|
||||
if ('\\' == *cp) { // expand
|
||||
WIN32_FIND_DATAA ffd = {0};
|
||||
HANDLE h = INVALID_HANDLE_VALUE;
|
||||
|
||||
_snprintf(cp, _countof(path) - len, "\\%s\\*.man", MANPATH);
|
||||
|
||||
if ((h = FindFirstFileA(path, &ffd)) != INVALID_HANDLE_VALUE) {
|
||||
std::cerr <<
|
||||
"\ntopics:\n ";
|
||||
|
||||
do {
|
||||
if (0 == (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
|
||||
ffd.cFileName[strlen(ffd.cFileName) - 4] = 0;
|
||||
std::cerr << ' ' << ffd.cFileName;
|
||||
}
|
||||
} while (FindNextFileA(h, &ffd));
|
||||
|
||||
FindClose(h);
|
||||
|
||||
std::cerr << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::cerr << std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
//end
|
23
mcwin32/apps/mchelp.rc
Normal file
23
mcwin32/apps/mchelp.rc
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* windows resource file
|
||||
*
|
||||
* This file is part of the Midnight Commander.
|
||||
*
|
||||
* The Midnight Commander is free software: you can redistribute it
|
||||
* and/or modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the License,
|
||||
* or (at your option) any later version.
|
||||
*
|
||||
* The Midnight Commander is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define APPNAME "mchelp"
|
||||
#include "shim.rc"
|
||||
|
||||
//end
|
317
mcwin32/apps/mcstart.cpp
Normal file
317
mcwin32/apps/mcstart.cpp
Normal file
@ -0,0 +1,317 @@
|
||||
/*
|
||||
* mcstart application.
|
||||
*
|
||||
* Copyright (c) 2024 - 2025, Adam Young.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This file is part of WIN32 Midnight Commander.
|
||||
*
|
||||
* The applications are free software: you can redistribute it
|
||||
* and/or modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation, version 3.
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, and must be distributed with the license document above.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, and must include the license document above in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* This project is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* License for more details.
|
||||
* ==end==
|
||||
*/
|
||||
|
||||
#include "shim.h"
|
||||
|
||||
#include <shlwapi.h>
|
||||
#include <Shellapi.h>
|
||||
#include <ObjBase.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include "getopt.h"
|
||||
#include "..\buildinfo.h"
|
||||
|
||||
#ifndef _countof /*MSVC _countof()*/
|
||||
#define _countof(__type) (sizeof(__type)/sizeof(__type[0]))
|
||||
#endif
|
||||
#if defined(__GNUC__) /*BOOST_GCC_VERSION equiv*/
|
||||
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
#endif
|
||||
|
||||
#define __L(__t) L##__t
|
||||
#define _L(__t) __L(__t)
|
||||
#define PROGNAME _L("mcstart")
|
||||
|
||||
#define EV_SUCCESS 0 // Success.
|
||||
#define EV_SYNTAX 1 // Error in command line syntax.
|
||||
#define EV_NOT_FOUND 2 // One of the files passed on the command line did not exist.
|
||||
#define EV_NOTOOL 3 // A required tool could not be found.
|
||||
#define EV_FAILURE 4 // The action failed.
|
||||
|
||||
typedef BOOL (WINAPI *ShellExecuteExW_t)(SHELLEXECUTEINFOW *);
|
||||
|
||||
static void Usage();
|
||||
static const wchar_t *ExitvalueString(int rc);
|
||||
|
||||
static int StartAssociation(const wchar_t *cmd);
|
||||
static int ShellAssociation(const wchar_t *cmd);
|
||||
|
||||
static BOOL overbose = 0;
|
||||
static BOOL owait = 0;
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
extern "C"
|
||||
#endif
|
||||
int wmain(int argc, wchar_t *argv[])
|
||||
{
|
||||
BOOL ocmd = 0;
|
||||
int ch;
|
||||
|
||||
while (-1 != (ch = Updater::Getopt(argc, argv, "CWvVh"))) {
|
||||
switch (ch) {
|
||||
case 'C': // command
|
||||
ocmd = 1;
|
||||
break;
|
||||
case 'W': // wait
|
||||
owait = 1;
|
||||
break;
|
||||
case 'v': // verbose
|
||||
overbose = 1;
|
||||
break;
|
||||
case 'V': // version
|
||||
fputws(PROGNAME _L(" ") _L(VERSION) _L(".") _L(BUILD_NUMBER) _L(" (") _L(BUILD_DATE) _L(")\n"), stderr);
|
||||
return EV_FAILURE;
|
||||
case 'h':
|
||||
default:
|
||||
Usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
argv += Updater::optind;
|
||||
if ((argc -= Updater::optind) < 1) {
|
||||
fwprintf(stderr, L"\n%ls: expected a target\n", PROGNAME);
|
||||
Usage();
|
||||
|
||||
} else if (argc > 1) {
|
||||
fwprintf(stderr, L"\n%ls: unexpected arguments '%ls' ...", PROGNAME, argv[1]);
|
||||
Usage();
|
||||
|
||||
} else {
|
||||
const wchar_t *argv0 = argv[0];
|
||||
|
||||
if ((argv0[0] == '-' || argv0[0] == '/') &&
|
||||
(0 == wcscmp(argv0+1, L"?") || 0 == wcscmp(argv0+1, L"help"))) {
|
||||
Usage();
|
||||
|
||||
} else {
|
||||
int rc;
|
||||
|
||||
if (ocmd) {
|
||||
rc = StartAssociation(argv0);
|
||||
} else {
|
||||
rc = ShellAssociation(argv0);
|
||||
}
|
||||
|
||||
if (overbose) fwprintf(stdout, L"result=%d (%ls)\n", rc, ExitvalueString(rc));
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
//NOTREACHED
|
||||
return EV_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Usage()
|
||||
{
|
||||
const static wchar_t *usage[] = {
|
||||
L"",
|
||||
L"Usage: " PROGNAME L" [options] file|url",
|
||||
L"",
|
||||
L"Options:",
|
||||
L" -C Execute using cmd start, otherwise shell execute (default).",
|
||||
L" -W Wait for the child to exit.",
|
||||
L" -V Version/build information.",
|
||||
L" -v Verbose output.",
|
||||
L" -h Command line usage.",
|
||||
L"",
|
||||
L"Description:",
|
||||
L" mcstart opens a file or URL in the user's preferred application. If a URL is",
|
||||
L" provided the URL will be opened in the user's preferred web browser. If a file",
|
||||
L" is provided the file will be opened in the preferred application for files of",
|
||||
L" that type. mcstart supports any file with an assigned file-association.",
|
||||
L" See ASSOC command for details.",
|
||||
L"",
|
||||
L"Exit Codes:",
|
||||
L" An exit code of 0 indicates success while a non-zero exit code indicates",
|
||||
L" failure. The following failure codes can be returned:",
|
||||
L"",
|
||||
L" 1 - Error in command line syntax, or help.",
|
||||
L" 2 - One of the files passed on the command line did not exist.",
|
||||
L" 3 - A required tool could not be found.",
|
||||
L" 4 - The action failed. ",
|
||||
L""
|
||||
};
|
||||
for (unsigned i = 0; i != _countof(usage); ++i) {
|
||||
fwprintf(stderr, L" %ls\n", usage[i]);
|
||||
}
|
||||
exit(EV_SYNTAX);
|
||||
}
|
||||
|
||||
|
||||
static const wchar_t *
|
||||
ExitvalueString(int rc)
|
||||
{
|
||||
switch (rc)
|
||||
{
|
||||
case EV_SUCCESS: return L"success";
|
||||
case EV_SYNTAX: return L"command line syntax";
|
||||
case EV_NOT_FOUND: return L"file not found";
|
||||
case EV_NOTOOL: return L"no tool available";
|
||||
case EV_FAILURE: return L"failure";
|
||||
}
|
||||
return L"undefined";
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
StartAssociation(const wchar_t *argv0)
|
||||
{
|
||||
// START ["title"]
|
||||
// [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
|
||||
// [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
|
||||
// /NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/WAIT] [/B]
|
||||
// [command/program] [parameters]
|
||||
//
|
||||
JOBOBJECT_EXTENDED_LIMIT_INFORMATION joli = {0};
|
||||
PROCESS_INFORMATION pi = {0};
|
||||
|
||||
const wchar_t *comspec = _wgetenv(L"ComSpec");
|
||||
if (NULL == comspec || !*comspec) comspec = L"cmd";
|
||||
wchar_t cmd[1024];
|
||||
|
||||
swprintf(cmd, _countof(cmd), L"%ls /C start %ls", comspec, argv0);
|
||||
if (overbose) fwprintf(stdout, L"CMD: %ls, %ls\n", comspec, cmd);
|
||||
|
||||
if (! ShimCreateChild(&pi, L"start", comspec, cmd)) {
|
||||
int rc = EV_FAILURE;
|
||||
if (! PathFileExistsW(argv0)) {
|
||||
if (overbose) fwprintf(stderr, L"\n%ls: <%ls> not found\n", PROGNAME, argv0);
|
||||
rc = EV_NOT_FOUND;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
ResumeThread(pi.hThread);
|
||||
CloseHandle(pi.hThread);
|
||||
|
||||
if (owait && pi.hProcess) {
|
||||
DWORD dwExitCode = 0;
|
||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
GetExitCodeProcess(pi.hProcess, &dwExitCode);
|
||||
CloseHandle(pi.hProcess);
|
||||
if (overbose) fwprintf(stderr, L"\n%ls: rc=%u\n", PROGNAME, (unsigned)dwExitCode);
|
||||
}
|
||||
|
||||
CloseHandle(pi.hProcess);
|
||||
|
||||
return EV_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ShellAssociation(const wchar_t *argv0)
|
||||
{
|
||||
SHELLEXECUTEINFOW sei;
|
||||
HMODULE hShell32;
|
||||
ShellExecuteExW_t shellExecuteEx;
|
||||
int rc = EV_FAILURE;
|
||||
BOOL ret;
|
||||
|
||||
#if defined(GCC_VERSION) && (GCC_VERSION >= 80000)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||
#endif
|
||||
hShell32 = LoadLibraryA("shell32.dll");
|
||||
if (hShell32 == NULL) {
|
||||
fwprintf(stderr, L"\n%ls: couldn't load shell32.dll\n", PROGNAME);
|
||||
return EV_FAILURE;
|
||||
}
|
||||
shellExecuteEx = (ShellExecuteExW_t) GetProcAddress(hShell32, "ShellExecuteExW");
|
||||
if (shellExecuteEx == NULL) {
|
||||
fwprintf(stderr, L"\n%ls: couldn't resolve ShellExecuteExW in shell32.dll\n", PROGNAME);
|
||||
FreeLibrary(hShell32);
|
||||
return EV_FAILURE;
|
||||
}
|
||||
#if defined(GCC_VERSION) && (GCC_VERSION >= 80000)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
if (overbose) fwprintf(stdout, L"SHELL: %ls\n", argv0);
|
||||
|
||||
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||
|
||||
memset(&sei, 0, sizeof(sei));
|
||||
sei.cbSize = sizeof(sei);
|
||||
sei.fMask = SEE_MASK_NOCLOSEPROCESS|SEE_MASK_NO_CONSOLE|SEE_MASK_FLAG_NO_UI;
|
||||
if (! overbose) sei.fMask |= SEE_MASK_FLAG_NO_UI;
|
||||
// SEE_MASK_NOCLOSEPROCESS
|
||||
// Use to indicate that the hProcess member receives the process handle.
|
||||
// SEE_MASK_NO_CONSOLE
|
||||
// inherit the parent's console for the new process instead of having it create a new console.
|
||||
// SEE_MASK_FLAG_NO_UI
|
||||
// Do not display user interface (UI) error dialogs that would normally be presented
|
||||
sei.lpVerb = L"open";
|
||||
// edit - Launches an editor and opens the document for editing.
|
||||
// open - Launches an application. If this file is not an executable file, its associated application is launched.
|
||||
sei.lpFile = argv0;
|
||||
sei.lpParameters = NULL;
|
||||
sei.lpDirectory = NULL;
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
|
||||
if (! shellExecuteEx(&sei)) {
|
||||
const DWORD dwExitCode = GetLastError();
|
||||
|
||||
switch(dwExitCode) {
|
||||
case ERROR_FILE_NOT_FOUND: // The specified file was not found.
|
||||
case ERROR_PATH_NOT_FOUND: // The specified path was not found.
|
||||
rc = EV_NOT_FOUND;
|
||||
break;
|
||||
case ERROR_CANCELLED: // The function prompted the user for additional information, but the user canceled the request.
|
||||
if (! PathFileExistsW(argv0)) {
|
||||
rc = EV_NOT_FOUND;
|
||||
}
|
||||
break;
|
||||
case ERROR_NO_ASSOCIATION: // There is no application associated with the specified file name extension.
|
||||
case ERROR_DLL_NOT_FOUND: // One of the library files necessary to run the application can't be found.
|
||||
rc = EV_NOTOOL;
|
||||
break;
|
||||
}
|
||||
ShimErrorMessage(PROGNAME, dwExitCode);
|
||||
|
||||
} else {
|
||||
ret = EV_SUCCESS;
|
||||
if (owait && sei.hProcess) {
|
||||
DWORD dwExitCode = 0;
|
||||
WaitForSingleObject(sei.hProcess, INFINITE);
|
||||
GetExitCodeProcess(sei.hProcess, &dwExitCode);
|
||||
if (overbose) fwprintf(stderr, L"\n%ls: rc=%u\n", PROGNAME, (unsigned)dwExitCode);
|
||||
}
|
||||
CloseHandle(sei.hProcess);
|
||||
}
|
||||
|
||||
CoUninitialize();
|
||||
FreeLibrary(hShell32);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
//end
|
||||
|
23
mcwin32/apps/mcstart.rc
Normal file
23
mcwin32/apps/mcstart.rc
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* windows resource file
|
||||
*
|
||||
* This file is part of the Midnight Commander.
|
||||
*
|
||||
* The Midnight Commander is free software: you can redistribute it
|
||||
* and/or modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the License,
|
||||
* or (at your option) any later version.
|
||||
*
|
||||
* The Midnight Commander is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define APPNAME "mcstart"
|
||||
#include "shim.rc"
|
||||
|
||||
//end
|
@ -27,23 +27,12 @@
|
||||
|
||||
#include "shim.h"
|
||||
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#endif
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef _countof
|
||||
#define _countof(__type) (sizeof(__type)/sizeof(__type[0]))
|
||||
#endif
|
||||
#if defined(__WATCOMC__)
|
||||
#define wcsdup(__x) _wcsdup(__x)
|
||||
#endif
|
||||
|
||||
BOOL WINAPI CtrlHandler(DWORD ctrlType);
|
||||
|
||||
@ -86,41 +75,49 @@ Basename(wchar_t *path)
|
||||
}
|
||||
|
||||
|
||||
static BOOL
|
||||
CreateChild(PROCESS_INFORMATION *ppi, const wchar_t *name, const wchar_t *path, wchar_t *cmdline)
|
||||
int
|
||||
ShimCreateChild(PROCESS_INFORMATION *ppi, const wchar_t *name, const wchar_t *path, const wchar_t *cmdline)
|
||||
{
|
||||
wchar_t *t_cmdline = _wcsdup(cmdline); // command line, cloned.
|
||||
STARTUPINFOW si = {0};
|
||||
|
||||
GetStartupInfoW(&si); // process information
|
||||
|
||||
if (! CreateProcessW(path, cmdline, NULL, NULL, TRUE, CREATE_SUSPENDED, NULL, NULL, &si, ppi)) {
|
||||
const DWORD error = GetLastError();
|
||||
wchar_t *message = NULL;
|
||||
if (NULL == t_cmdline ||
|
||||
! CreateProcessW(path, t_cmdline, NULL, NULL, TRUE, CREATE_SUSPENDED, NULL, NULL, &si, ppi)) {
|
||||
|
||||
if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR) &message, 0, NULL) && message) {
|
||||
|
||||
wchar_t *nl, *rt; // trailing newline/return
|
||||
|
||||
nl = wcsrchr(message, '\n'); // trim
|
||||
rt = wcsrchr(message, '\r'); // trim
|
||||
|
||||
if (nl) *nl = 0;
|
||||
if (rt) *rt = 0;
|
||||
|
||||
wprintf(L"%s: unable to execute child : %s (0x%08lx)\n", name, message, error);
|
||||
|
||||
} else {
|
||||
wprintf(L"%s: unable to execute child : 0x%08lx.\n", name, error);
|
||||
}
|
||||
|
||||
LocalFree(message);
|
||||
ShimErrorMessage(name, GetLastError());
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ShimErrorMessage(const wchar_t *name, DWORD wrc)
|
||||
{
|
||||
wchar_t *message = NULL;
|
||||
|
||||
if (FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, wrc, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR) &message, 0, NULL) && message) {
|
||||
|
||||
wchar_t *nl, *rt; // trailing newline/return
|
||||
|
||||
nl = wcsrchr(message, '\n'); // trim
|
||||
rt = wcsrchr(message, '\r'); // trim
|
||||
|
||||
if (nl) *nl = 0;
|
||||
if (rt) *rt = 0;
|
||||
|
||||
wprintf(L"%s: unable to execute child : %s (0x%08lx)\n", name, message, wrc);
|
||||
|
||||
} else {
|
||||
wprintf(L"%s: unable to execute child : 0x%08lx.\n", name, wrc);
|
||||
}
|
||||
|
||||
LocalFree(message);
|
||||
}
|
||||
|
||||
static wchar_t orgpath[1024] = {0};
|
||||
static wchar_t newpath[1024] = {0};
|
||||
|
||||
@ -136,11 +133,17 @@ static wchar_t newpath[1024] = {0};
|
||||
*/
|
||||
void
|
||||
ApplicationShim(const wchar_t *name, const wchar_t *alias)
|
||||
{
|
||||
ApplicationShimCmd(name, alias, GetCommandLineW());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ApplicationShimCmd(const wchar_t *name, const wchar_t *alias, const wchar_t *cmdline)
|
||||
{
|
||||
const BOOL diagositics = Diagnostics(); // optional runtime diagnostics
|
||||
const unsigned aliassz = wcslen(alias), // alias length, in characters.
|
||||
pathsz = GetModuleFileNameW(NULL, orgpath, _countof(orgpath)); // fully qualified path.
|
||||
wchar_t *cmdline = wcsdup(GetCommandLineW()); // original command line, cloned.
|
||||
wchar_t *base;
|
||||
|
||||
HANDLE job = INVALID_HANDLE_VALUE;
|
||||
@ -182,11 +185,14 @@ ApplicationShim(const wchar_t *name, const wchar_t *alias)
|
||||
joli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE | JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK;
|
||||
SetInformationJobObject(job, JobObjectExtendedLimitInformation, &joli, sizeof(joli));
|
||||
|
||||
if (! CreateChild(&pi, name, newpath, cmdline)) {
|
||||
if (! ShimCreateChild(&pi, name, newpath, cmdline)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// redirect signals and monitor termination
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable:6387) // handle maybe 0
|
||||
#endif
|
||||
SetConsoleCtrlHandler(CtrlHandler, TRUE);
|
||||
AssignProcessToJobObject(job, pi.hProcess);
|
||||
ResumeThread(pi.hThread);
|
||||
|
@ -26,13 +26,27 @@
|
||||
* ==end==
|
||||
*/
|
||||
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#endif
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
|
||||
#include <stdlib.h> // EXIT_FAILURE
|
||||
#include <wchar.h> // wchar_t
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ApplicationShim(const wchar_t *name, const wchar_t *alias);
|
||||
void ApplicationShimCmd(const wchar_t *name, const wchar_t *alias, const wchar_t *cmdline);
|
||||
|
||||
int ShimCreateChild(PROCESS_INFORMATION *ppi, const wchar_t *name, const wchar_t *path, const wchar_t *cmdline);
|
||||
void ShimErrorMessage(const wchar_t *name, DWORD wrc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
BIN
mcwin32/art/sample06.png
Normal file
BIN
mcwin32/art/sample06.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 131 KiB |
@ -9,8 +9,7 @@
|
||||
*
|
||||
* The Midnight Commander is free software: you can redistribute it
|
||||
* and/or modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the License,
|
||||
* or (at your option) any later version.
|
||||
* published by the Free Software Foundation, version 3 of the License.
|
||||
*
|
||||
* The Midnight Commander is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@ -22,6 +21,10 @@
|
||||
* ==end==
|
||||
*/
|
||||
|
||||
#if !defined(_LARGEFILE64_SOURCE)
|
||||
#define _LARGEFILE64_SOURCE /* enable large-file support */
|
||||
#endif
|
||||
|
||||
#include "w32config.h" /* common configuration */
|
||||
|
||||
#define WIN32_UNISTD_MAP /* enable unistd API mapping */
|
||||
@ -31,7 +34,9 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning (disable : 4102) /* unreferenced label */
|
||||
#pragma warning (disable : 4127) /* conditional expression is constant */
|
||||
#pragma warning (disable : 4146) /* unary minus operator applied to unsigned type, result still unsigned */
|
||||
#pragma warning (disable : 4201) /* nonstandard extension used : nameless struct/union */
|
||||
#pragma warning (disable : 4204) /* nonstandard extension used : non-constant aggregate initializer */
|
||||
#pragma warning (disable : 4244) /* possible loss of data */
|
||||
@ -47,6 +52,7 @@
|
||||
#pragma disable_message(124) /* Comparison result always 0 */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* build information
|
||||
*/
|
||||
@ -61,6 +67,16 @@
|
||||
#define MC_USERCONF_DIR MC_APPLICATION_DIR /* see: fileloc.h, default "mc" */
|
||||
#undef MC_HOMEDIR_XDG /* enforce Freedesktop recommended dirs, not required */
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE)
|
||||
typedef struct stat64 mc_stat_t;
|
||||
typedef off64_t mc_off_t;
|
||||
#define SIZEOF_OFF_T 8
|
||||
#else
|
||||
typedef struct stat mc_stat_t;
|
||||
typedef off_t mc_off_t;
|
||||
#define SIZEOF_OFF_T 4
|
||||
#endif
|
||||
|
||||
const char * mc_aspell_dllpath(void);
|
||||
const char * mc_get_locale(void);
|
||||
const char * mc_BUSYBOX(void);
|
||||
|
77
mcwin32/doc/EXTENSIONS.md
Normal file
77
mcwin32/doc/EXTENSIONS.md
Normal file
@ -0,0 +1,77 @@
|
||||
# Extension
|
||||
|
||||
## Wrapper scripts
|
||||
|
||||
On exit, the shell shall return Midnight Commander to the same directory it was started from, instead of the last active directory.
|
||||
Using the ```--printwd``` command line option wrapper scripts may inherit the current directory on exit.
|
||||
|
||||
```
|
||||
-P file, --printwd=file
|
||||
```
|
||||
|
||||
Print the last working directory to the specified file. This option is not meant to be used directly. Instead, it's used from a special shell script that automatically changes the current directory of the shell to the last directory Midnight Commander was in.
|
||||
|
||||
Several bundled implementations are available within the installation under the sub-directory _libexec_.
|
||||
|
||||
For example, for use within a command shell setup an aliases:
|
||||
|
||||
```
|
||||
doskey mc=call "%ProgramFiles(x86)%\Midnight Commander\libexec\mc-wrapper.bat" $*
|
||||
```
|
||||
|
||||
## Opening files
|
||||
|
||||
Midnight Commander reads the MC_XDG_OPEN environment variable to open files, which defaults to _mcstart_ when unset; mcstart is the equivalent of the window _start_ command.
|
||||
|
||||
```
|
||||
Usage: mcstart [options] file|url
|
||||
|
||||
Options:
|
||||
-C Execute using cmd start, otherwise shell execute (default).
|
||||
-W Wait for the child to exit.
|
||||
-V Version/build information.
|
||||
-v Verbose output.
|
||||
-h Command line usage.
|
||||
|
||||
Description:
|
||||
mcstart opens a file or URL in the user's preferred application. If a URL is
|
||||
provided the URL will be opened in the user's preferred web browser. If a file
|
||||
is provided the file will be opened in the preferred application for files of
|
||||
that type. mcstart supports any file with an assigned file-association.
|
||||
See ASSOC command for details.
|
||||
|
||||
Exit Codes:
|
||||
An exit code of 0 indicates success while a non-zero exit code indicates
|
||||
failure. The following failure codes can be returned:
|
||||
|
||||
1 - Error in command line syntax, or help.
|
||||
2 - One of the files passed on the command line did not exist.
|
||||
3 - A required tool could not be found.
|
||||
4 - The action failed.
|
||||
```
|
||||
|
||||
## Application mappings
|
||||
|
||||
Word, Excel and PowerPoint, mapping:
|
||||
|
||||
```
|
||||
# Microsoft Word Document
|
||||
regex/i/\.(do[ct]|wri|docx)$
|
||||
Open=cmd /c start winword %p
|
||||
View=cmd /c start winword %p
|
||||
type/^Microsoft\ Word
|
||||
Open=cmd /c start winword %p
|
||||
View=cmd /c start winword %p
|
||||
|
||||
# Microsoft Excel Worksheet
|
||||
regex/i/\.(xl[sw]|xlsx)$
|
||||
Open=cmd /c start excel %p
|
||||
View=cmd /c start excel %p
|
||||
type/^Microsoft\ Excel
|
||||
Open=cmd /c start excel %p
|
||||
View=cmd /c start excel %p
|
||||
|
||||
# Microsoft PowerPoint Presentation
|
||||
regex/i/\.(pp[ts]|pptx)$
|
||||
Open=cmd /c start powerpnt %p
|
||||
```
|
469
mcwin32/doc/INSTALL.md
Normal file
469
mcwin32/doc/INSTALL.md
Normal file
@ -0,0 +1,469 @@
|
||||
|
||||
# Midnight Commander Win32
|
||||
|
||||
## Installation instructions
|
||||
|
||||
The project can be built from source, using one of several supported tool-chains.
|
||||
The following environments and toolchains are supported.
|
||||
|
||||
* Microsoft Visual C++ (MSVC) 2015 - 2022; or
|
||||
* Open-Watcom (OWC) 1.9 or 2.0; or
|
||||
* Mingw64, both 32 and 64 bit targets.
|
||||
|
||||
The build status of these packages is below.
|
||||
|
||||
[](https://github.com/adamyg/mcwin32/actions)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To build and install mcwin32, you shall need:
|
||||
|
||||
* Clone of the source repository.
|
||||
* A supported operating system; Windows 10 or 11, plus in theory older version XP thru to Windows 7.
|
||||
* Git tooling for windows.
|
||||
* Perl 5 with core modules, see [NOTES-PERL.md](doc/NOTES-PERL.md).
|
||||
* CoreUtils, includes various text and system utilities.
|
||||
* Make.
|
||||
* An ANSI C/C++ compiler.
|
||||
* A development environment in the form of development libraries and C header files.
|
||||
|
||||
For additional platform specific requirements, solutions to specific issues and other details, please read one of these:
|
||||
|
||||
* [Notes on Perl](doc/NOTES-PERL.md)
|
||||
|
||||
Plus additional information is available within the _GitHub_ [workflows](.github/workflows/build.yml).
|
||||
|
||||
Quick Installation Guide
|
||||
========================
|
||||
|
||||
If you just want to get going without bothering too much about the details,
|
||||
here is the short version of how to build and install Midnight Commander Win32.
|
||||
|
||||
Confirm both a _Perl_ and tooling which provides _CoreUtils_ and git are installed; for example [__GIT for Windows__](https://gitforwindows.org/). Additional information can be found in later sections.
|
||||
|
||||
Create a suitable developer command prompt. If you are using Visual Studio, for example Visual Studio C/C++ 2019, open a "Developer Command Prompt" and issue the following commands:
|
||||
|
||||
Clone the github repository
|
||||
|
||||
````
|
||||
git clone https://github.com/adamyg/mcwin32.git mc
|
||||
````
|
||||
|
||||
Change directory to the primary tree
|
||||
|
||||
```
|
||||
cd mc\mcwin32
|
||||
```
|
||||
|
||||
Update external dependencies
|
||||
|
||||
````
|
||||
git submodule update --init --recursive
|
||||
````
|
||||
|
||||
Dependent on the available toolchain, prime using a suitable configuration profile.
|
||||
|
||||
```
|
||||
.\support\vc2019config
|
||||
```
|
||||
|
||||
Several alternative profiles are available:
|
||||
|
||||
* Microsoft Visual C++ (MSVC) 2015 - 2022; or
|
||||
|
||||
* vc2015config - Visual Studio C/C++ 2015.
|
||||
* vc2017config - Visual Studio C/C++ 2017.
|
||||
* vc2019config - Visual Studio C/C++ 2019.
|
||||
* vc2022config - Visual Studio C/C++ 2022.
|
||||
|
||||
* Open-Watcom (OWC) 1.9 or 2.0; or
|
||||
|
||||
* owcconfig - Open Watcom 1.9
|
||||
* owc20config - Open Watcom 2.0
|
||||
|
||||
* MingW64, both 32 and 64 bit targets.
|
||||
|
||||
* mingw32config - mingW64 tool-chain.
|
||||
* mingw64config - mingW64, 64bit tool-chain.
|
||||
|
||||
|
||||
The resulting build profile and options shall be available.
|
||||
|
||||
```
|
||||
-
|
||||
- Configuration:
|
||||
-
|
||||
- PackageName: Midnight Commander WIN32
|
||||
- Version: 4.8.33
|
||||
-
|
||||
- ToolChain: Visual Studio 2019
|
||||
- Compiler: cl / cl
|
||||
- CFLAGS: -nologo -MD$(RTSUFFIX) -fp:precise
|
||||
- CXXFLAGS: -nologo -MD$(RTSUFFIX) -EHsc -fp:precise -Zc:offsetof-
|
||||
- Release: -O2 -GL -Gy -DNDEBUG
|
||||
- Debug: -Zi -RTC1 -Od
|
||||
- LDFLAGS: -nologo -MD$(RTSUFFIX)
|
||||
-
|
||||
-
|
||||
- Virtual File Systems: cpio, extfs, shell, ftp, sfs, sftp, tar (see: config.h)
|
||||
- Screen library: console
|
||||
- Mouse support: native
|
||||
- Subshell support: n/a
|
||||
- Background operations: n/a
|
||||
- Internal editor: yes
|
||||
- Diff viewer: yes
|
||||
-
|
||||
|
||||
Review the options above for accuracy.
|
||||
|
||||
Execute to build:
|
||||
|
||||
"make release" - build software.
|
||||
|
||||
To generate an installer:
|
||||
|
||||
"make release package" - build installer.
|
||||
|
||||
Optionally after installation:
|
||||
|
||||
"make release clean" - remove build tree.
|
||||
```
|
||||
|
||||
Once reviewed execute the following:
|
||||
|
||||
$ .\support\gmake-42 release
|
||||
|
||||
and optionally a local installer
|
||||
|
||||
$ .\support\gmake-42 release package
|
||||
|
||||
alternatively zip and copy the ``bin.<toolchain>/release`` tree to your desired install location.
|
||||
|
||||
|
||||
Tool-chains
|
||||
===========
|
||||
|
||||
The follow offers a more detailed discussion of the requirements and instruction, for each of actively supported tool-chain and third-party tooling solutions:
|
||||
|
||||
- [Native builds using Open-Watcom](#native-builds-using-openwatcom-c-c)
|
||||
- [Native builds using Visual C++](#native-builds-using-visual-c-c)
|
||||
- [Native builds using MinGW64](#native-builds-using-mingw)
|
||||
|
||||
Native builds using Open-Watcom C/C++
|
||||
====================================
|
||||
|
||||
### Perl
|
||||
|
||||
A Perl installation needs to be available plus the installation should be visible within the current PATH.
|
||||
|
||||
Strawberry Perl is recommended, available from <http://strawberryperl.com/>,
|
||||
as an alternative is ActiveState Perl, <https://www.activestate.com/ActivePerl>.
|
||||
|
||||
### Watcom C/C++
|
||||
|
||||
Watcom C/C++ (currently Open Watcom C/C++) is an integrated development environment (IDE) product from Watcom International Corporation for the C, C++, and Fortran programming languages. Watcom C/C++ was a commercial product until it was discontinued, then released under the Sybase ``Open Watcom`` Public License as ``Open Watcom C/C++``.
|
||||
|
||||
Two versions of ``Open Watcom C/C++`` are freely available, the legacy _1.9_ version and the current Open _2.0_ development stream, both are actively supported.
|
||||
These are available from <https://www.openwatcom.org> and <https://github.com/open-watcom/open-watcom-v2>.
|
||||
|
||||
Note: Open-Watcom is the current tool-chain published builds utilise.
|
||||
|
||||
### Binary utilises
|
||||
|
||||
In addition to Perl and the selected compiler tool-chain, several utilises are required. Under Unix like environments these are referred to as the ``binutils`` package, yet are not generally installed on Windows host.
|
||||
|
||||
Minimal tools required are:
|
||||
|
||||
* gmake - _GNU make utility_.
|
||||
|
||||
make is a utility which can determine automatically which pieces of a large program need to be recompiled, and issue the commands to recompile them.
|
||||
|
||||
* busybox - _The Swiss Army Knife of Embedded Linux_
|
||||
|
||||
BusyBox combines tiny versions of many common UNIX utilities into a single small executable. It provides replacements for most of the utilities you usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox generally have fewer options than their full-featured GNU cousins; however, the options that are included provide the expected functionality and behave very much like their GNU counterparts. BusyBox provides a fairly complete environment for any small or embedded system
|
||||
|
||||
* coreutils - Collection of file and text manipulation utilities; including
|
||||
|
||||
* cp - _copy files and directories_.
|
||||
|
||||
* mv - _move (rename) files_.
|
||||
|
||||
* rm - _remove files or directories_.
|
||||
|
||||
* grep/egrep - _print lines that match patterns_.
|
||||
|
||||
* gzip, gunzip, zcat - _compress or expand files_.
|
||||
|
||||
* tar - _an archiving utility_.
|
||||
|
||||
Coreutils are bundled with [__GIT for Windows__](https://gitforwindows.org/),
|
||||
alternatively install [__MSYS2__](https://www.msys2.org/).
|
||||
|
||||
Once installed the required commands should be visible within the path.
|
||||
|
||||
To support native Windows builds, the make tool ``gmake-42``, web tool ``wget`` and the shell support tool ``busybox`` are bundled within the source repository sub-directory ``win32/``.
|
||||
|
||||
- ``gmake`` was built from its original source available from [GNU binutils](https://www.gnu.org/software/binutils/).
|
||||
|
||||
- Whereas ``busybox`` was sourced from a recent stable release [BusyBox for Windows](https://frippery.org/busybox).
|
||||
|
||||
The configure front-end shall attempt to select the most suitable tools available on the build host.
|
||||
|
||||
### InnoSetup
|
||||
|
||||
To package the build application as an installer, ``Inno Setup`` is utilised.
|
||||
``Inno Setup`` is a free installer for Windows program's, available from <https://jrsoftware.org/>.
|
||||
|
||||
The Inno package is optional and only required if an installer is being built.
|
||||
|
||||
``Inno Setup`` 5.6.x or greater is required. Note 6.x Inno and later shall only function on Vista or greater. 6.x and later versions of Inno no longer support Windows 2000, XP, and Server 2003.
|
||||
|
||||
Using Chocolatey, to install _Inno Setup_, run the following on a command line:
|
||||
|
||||
$ choco install innosetup --version=5.6.1
|
||||
|
||||
Note: Inno-Setup 5.6.x (Unicode version) is used to package the current installers.
|
||||
|
||||
|
||||
Quick start
|
||||
-----------
|
||||
|
||||
* Install _Perl_
|
||||
|
||||
* Install _Inno-Setup_
|
||||
|
||||
Install ``Inno Setup`` 5.6.x within its default installation path; if modified the arguments to the support scripts below shall need to be adjusted to match, set the environment variable ``INNO="<install-path>"`` prior to priming the tree.
|
||||
|
||||
* Make sure _Perl_ is on your __\$PATH__.
|
||||
|
||||
* Create a _Open Watcom_ command Prompt and confirm that ``wcl386`` is within your path.
|
||||
|
||||
From the source root, a suitable environment can be setup using the one of the following dependent on the desired toolchain, were ``C:\Watcom`` is the toolchain installation directory.
|
||||
|
||||
* owcconfig- Open Watcom 1.9
|
||||
* owc20config - Open Watcom 2.0
|
||||
|
||||
* From the root of the source directory perform the following:
|
||||
|
||||
* Configure and prime the build system.
|
||||
|
||||
$ .\support\owcconfig C:\Watcom
|
||||
|
||||
Note: Optional installation directory
|
||||
|
||||
on completion the make system is ready, run only make shall present usage information:
|
||||
|
||||
$ .\support\gmake-42
|
||||
|
||||
|
|
||||
| make [VERBOSE=1] [release or debug] target
|
||||
|
|
||||
| Build one or more of the following targets recursively within each sub-directory
|
||||
| for the toolchain "Visual Studio 2019" (vs160).
|
||||
|
|
||||
| Options:
|
||||
| VERBOSE - increase run-time diagnostics; suppress stderr filtering.
|
||||
|
|
||||
| Targets:
|
||||
|
|
||||
| build - build everything.
|
||||
| package - build package.
|
||||
| clean - delete everything which can be remade.
|
||||
| vclean - delete all.
|
||||
| help - command line usage.
|
||||
.
|
||||
|
||||
* Build mcwin32 and associated third-party components.
|
||||
|
||||
$ .\support\gmake-42 release build
|
||||
|
||||
* Optionally, build the installer.
|
||||
|
||||
$ .\support\gmake-42 release package
|
||||
|
||||
Alternatively zip and copy the ``bin.<toolchain>/release`` tree to your desired install location.
|
||||
|
||||
The resulting work flow could look like the following, inside a Open Watcom 1.9 developer prompt:
|
||||
|
||||
```
|
||||
cd c:\projects
|
||||
|
||||
git clone https://github.com/adamyg/mcwin32.git mc
|
||||
|
||||
cd c:\projects\mc\mcwin32
|
||||
|
||||
git submodule update --init --recursive
|
||||
|
||||
set PERL=c:\Strawberry\perl\bin\perl
|
||||
set PATH=c:\msys64\usr\bin;%PATH%
|
||||
|
||||
.\support\owcconfig
|
||||
|
||||
.\support\gmake-42 release
|
||||
.\support\gmake-42 release package
|
||||
```
|
||||
|
||||
|
||||
Native builds using Visual C/C++
|
||||
================================
|
||||
|
||||
Visual C/C++ offers an alternative way to build native __mcwin32__, similar to Open-Watcom C/C++ builds.
|
||||
|
||||
Microsoft Visual is available in several, all are suitable:
|
||||
|
||||
* Microsoft Visual C++ 2015 - 2002 Professional -
|
||||
|
||||
Standard Microsoft Visual C++ installations.
|
||||
|
||||
* Microsoft Visual C++ 2015 - 2022 Community Edition -
|
||||
|
||||
These free versions of Visual C++ 2015-2022 Professional contain the same compilers and linkers that ship with the full versions,
|
||||
and also contain everything necessary to build mcwin32.
|
||||
|
||||
* Microsoft C++ Build Tools -
|
||||
|
||||
There's also a standalone (IDE-less) version of the build tools mentioned above containing the MSVC compiler
|
||||
available for download from https://visualstudio.microsoft.com/visual-cpp-build-tools/.
|
||||
|
||||
Note: Since these are proprietary and ever-changing I cannot test them all. Older versions may not work, it is recommended to use a recent version wherever possible.
|
||||
|
||||
* Install _Perl_
|
||||
|
||||
* Install _Inno-Setup_
|
||||
|
||||
* Make sure _Perl_ is on your __\$PATH__.
|
||||
|
||||
* Use Visual Studio Developer Command Prompt with administrative privileges, choosing one of its variants depending on the intended architecture. Or run `cmd` and execute `vcvarsall.bat` with one of the options `x86`, `x86_amd64`, `x86_arm`, `x86_arm64`, `amd64`, `amd64_x86`, `amd64_arm`, or `amd64_arm64`. This all setup the environment variables needed for the compiler `cl.exe`.
|
||||
|
||||
See also <https://docs.microsoft.com/cpp/build/building-on-the-command-line>
|
||||
|
||||
* Select a suitable build profile
|
||||
|
||||
* vc2015config - Visual Studio C/C++ 2015.
|
||||
* vc2017config - Visual Studio C/C++ 2017.
|
||||
* vc2019config - Visual Studio C/C++ 2019.
|
||||
* vc2022config - Visual Studio C/C++ 2022.
|
||||
|
||||
* From the root of the source directory perform the following:
|
||||
|
||||
* Configure and prime the build system.
|
||||
|
||||
$ .\support\vc####config
|
||||
|
||||
where #### representes the toolchain, for example 2019.
|
||||
|
||||
$ .\support\vc2019config
|
||||
|
||||
* Build mcwin32 and associated third-party components.
|
||||
|
||||
$ .\support\gmake-42 release
|
||||
|
||||
* Optionally, build the installer.
|
||||
|
||||
$ .\support\gmake-42 release package
|
||||
|
||||
The resulting work flow could look like the following, inside a 2019 developer prompt:
|
||||
|
||||
```
|
||||
cd c:\projects
|
||||
|
||||
git clone https://github.com/adamyg/mcwin32.git mc
|
||||
|
||||
cd c:\projects\mc\mcwin32
|
||||
|
||||
git submodule update --init --recursive
|
||||
|
||||
set PERL=c:\Strawberry\perl\bin\perl
|
||||
set PATH=c:\msys64\usr\bin;%PATH%
|
||||
|
||||
.\support\vc2019config
|
||||
|
||||
.\support\gmake-42 release
|
||||
.\support\gmake-42 release package
|
||||
```
|
||||
|
||||
Native builds using Mingw
|
||||
=========================
|
||||
|
||||
Mingw64 (32/64) offers another alternative way to build native __mcwin32__, similar to Open-Watcom C/C++ builds.
|
||||
|
||||
MSYS2 provides GNU tools, a Unix-like command prompt, and a UNIX compatibility layer for applications,
|
||||
available from https://www.mingw-w64.org. However, in this context it is only used for building mcwin32.
|
||||
The resulting application does not rely on MSYS2 to run and is fully native.
|
||||
|
||||
* _MSYS2_ shell, from https://www.msys2.org/
|
||||
|
||||
* _Perl_, at least version 5.10.0, which usually comes pre-installed with MSYS2.
|
||||
|
||||
* Install _Inno-Setup_
|
||||
|
||||
* Create a MSYS/Mingw64 Command Prompt.
|
||||
|
||||
To install the minimal tools required:
|
||||
|
||||
$ pacman --noconfirm -S base-devel
|
||||
|
||||
plus one of the following
|
||||
|
||||
$ pacman --noconfirm -S mingw-w64-x86_64-gcc
|
||||
$ pacman --noconfirm -S mingw-w64-i686-gcc
|
||||
|
||||
These compilers must be on your MSYS2 \$PATH, example below assuming the default installation path ``c:/msys64/``.
|
||||
A common error is to not have these on your \$PATH. The MSYS2 version of gcc will not work correctly here.
|
||||
|
||||
* From the root of the source directory perform the following:
|
||||
|
||||
* Configure and prime the build system.
|
||||
|
||||
* x64 tool-chain
|
||||
|
||||
PATH=c:\msys64\mingw64\bin;c:\msys64\usr\bin
|
||||
$ .\support\mingw64config
|
||||
|
||||
* x86 tool-chain.
|
||||
|
||||
PATH=c:\msys64\mingw32\bin;c:\msys64\usr\bin
|
||||
$ .\support\mingw32config
|
||||
|
||||
* Build mcwin32 and associated third-party components.
|
||||
|
||||
$ .\support\gmake-42 release
|
||||
|
||||
* Optionally, build the installer.
|
||||
|
||||
$ .\support\gmake-42 release package
|
||||
|
||||
The resulting work flow could look like the following, inside either a terminal/command or msys prompt:
|
||||
|
||||
Install any missing components
|
||||
|
||||
```
|
||||
c:\msys64\usr\bin\pacman --noconfirm -S base-devel
|
||||
c:\msys64\usr\bin\pacman --noconfirm -S mingw-w64-i686-gcc
|
||||
c:\msys64\usr\bin\pacman --noconfirm -S mingw-w64-i686-gettext-tools
|
||||
c:\msys64\usr\bin\pacman --noconfirm -S zip
|
||||
```
|
||||
|
||||
Prime sandbox and build
|
||||
|
||||
```
|
||||
cd c:\projects
|
||||
|
||||
git clone https://github.com/adamyg/mcwin32.git mc
|
||||
|
||||
cd c:\projects\mc\mcwin32
|
||||
|
||||
git submodule update --init --recursive
|
||||
|
||||
set PERL=c:\Strawberry\perl\bin\perl
|
||||
set PATH=c:\msys64\mingw32\bin;c:\msys64\usr\bin;%PATH%
|
||||
|
||||
.\support\mingw32config
|
||||
|
||||
.\support\gmake-42 release
|
||||
.\support\gmake-42 release package
|
||||
```
|
||||
|
||||
Last updated: _April/25_
|
||||
|
||||
-end-
|
@ -1,141 +0,0 @@
|
||||
|
||||
This file contains:
|
||||
|
||||
- Build requirements for GNU Midnight Commander
|
||||
- Installation instructions for GNU Midnight Commander
|
||||
- Where to get more information on GNU Midnight Commander
|
||||
- Notes about GNU Midnight Commander installation
|
||||
- Obtaining related software
|
||||
|
||||
|
||||
Build requirements for GNU Midnight Commander
|
||||
----------------------------------------------------
|
||||
|
||||
The following external requirements/packages need to be available
|
||||
|
||||
- busybox-win32
|
||||
- glib2 (pre build 201)
|
||||
- make / binutils
|
||||
- perl
|
||||
- supported compiler tool-chain
|
||||
- Inno
|
||||
|
||||
|
||||
Installation instructions for GNU Midnight Commander
|
||||
----------------------------------------------------
|
||||
|
||||
To compile this package:
|
||||
|
||||
1. Install the required packages,
|
||||
|
||||
Confirm/update as required the installation paths with the
|
||||
./win32/Makefile
|
||||
|
||||
GTKINSTALL - base path of the glib installation.
|
||||
|
||||
|
||||
Other components are assumed to be within the current active
|
||||
PATH, including
|
||||
|
||||
perl, make, busybox, compiler, rc
|
||||
|
||||
|
||||
Modify either Makefile and/or Makefile.common as needed.
|
||||
|
||||
|
||||
2. 'make all' within the win32 source tree ./win32
|
||||
|
||||
3. mc-win32-setup.exe
|
||||
|
||||
|
||||
Obtaining related software
|
||||
----------------------------------------------------
|
||||
|
||||
o busybox-win32
|
||||
|
||||
Busybox is utilised both during make operations, plus is packaged
|
||||
with the Midnight commander setup for run-time execution by the shell
|
||||
sub-system of unix style scripts, for example by the internal vfs
|
||||
implementation (i.e. gz decompression).
|
||||
|
||||
BusyBox combines tiny versions of many common UNIX utilities into a
|
||||
single small executable. It provides minimalist replacements for most
|
||||
of the utilities you usually find in bzip2, coreutils, dhcp,
|
||||
diffutils, e2fsprogs, file, findutils, gawk, grep, inetutils, less,
|
||||
modutils, net-tools, procps, sed, shadow, sysklogd, sysvinit, tar,
|
||||
util-linux, and vim. The utilities in BusyBox often have fewer
|
||||
options than their full-featured cousins; however, the options that
|
||||
are included provide the expected functionality and behave very much
|
||||
like their larger counterparts.
|
||||
|
||||
The current distribution is available from
|
||||
|
||||
https://github.com/pclouds/busybox-w32
|
||||
|
||||
o glib - pre build 201
|
||||
|
||||
The only "hard" dependency of GNU Midnight Commander is glib
|
||||
|
||||
Minimal version of glib: 2.8.x
|
||||
Recommended version: 2.14.x and higher.
|
||||
|
||||
Newer versions may work, but haven't been tested.
|
||||
|
||||
You can get glib from
|
||||
|
||||
ftp://ftp.gtk.org/pub/glib/
|
||||
|
||||
or use the current pre-build win23 packages available from
|
||||
|
||||
https://live.gnome.org/GTK+/Win32/MSVCCompilationOfGTKStack
|
||||
|
||||
at present only the following components are required
|
||||
|
||||
intl.dll
|
||||
libglib-2.0-0.dll
|
||||
|
||||
o make / binutils
|
||||
|
||||
You can retrieve the required system applications from
|
||||
|
||||
http://gnuwin32.sourceforge.net/packages.html
|
||||
|
||||
the best installation solution is thru the getgnuwin32, which is an
|
||||
"Automated gnuwin32 download tool", available at
|
||||
|
||||
http://sourceforge.net/projects/getgnuwin32/
|
||||
|
||||
|
||||
o perl
|
||||
|
||||
A local perl installation is required during the build process.
|
||||
|
||||
ActivePerl is the leading commercial-grade distribution of the open source Perl
|
||||
scripting language. Download ActivePerl Community Edition free binaries for
|
||||
your development projects and internal deployments.
|
||||
|
||||
You can retrieve the required installation packages from
|
||||
|
||||
http://www.activestate.com/
|
||||
|
||||
|
||||
o compiler
|
||||
|
||||
Currently tested against the following tool chains
|
||||
|
||||
o Open Watcom C/C++ 1.9
|
||||
|
||||
o Microsoft Visual Studio C/C++ 2013 (or greater)
|
||||
|
||||
|
||||
o inno
|
||||
|
||||
Inno Setup is a free installer for Windows programs. First introduced
|
||||
in 1997, Inno Setup today rivals and even surpasses many commercial
|
||||
installers in feature set and stability.
|
||||
|
||||
www.jrsoftware.org/isinfo.php/
|
||||
|
||||
|
||||
Last update 14/08/12
|
||||
|
55
mcwin32/doc/LICENSE.mandoc
Normal file
55
mcwin32/doc/LICENSE.mandoc
Normal file
@ -0,0 +1,55 @@
|
||||
$Id: LICENSE.mandoc,v 1.1 2025/04/06 20:18:52 cvsuser Exp $
|
||||
|
||||
With the exceptions noted below, all non-trivial files contained
|
||||
in the mandoc toolkit are protected by the Copyright of the following
|
||||
developers:
|
||||
|
||||
Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
Copyright (c) 2010-2021 Ingo Schwarze <schwarze@openbsd.org>
|
||||
Copyright (c) 1999, 2004, 2017 Marc Espie <espie@openbsd.org>
|
||||
Copyright (c) 2009, 2010, 2011, 2012 Joerg Sonnenberger <joerg@netbsd.org>
|
||||
Copyright (c) 2013 Franco Fichtner <franco@lastsummer.de>
|
||||
Copyright (c) 2014 Baptiste Daroussin <bapt@freebsd.org>
|
||||
Copyright (c) 2016 Ed Maste <emaste@freebsd.org>
|
||||
Copyright (c) 2017 Michael Stapelberg <stapelberg@debian.org>
|
||||
Copyright (c) 2017 Anthony Bentley <bentley@openbsd.org>
|
||||
Copyright (c) 1998, 2004, 2010, 2015 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
Copyright (c) 2008, 2017 Otto Moerbeek <otto@drijf.net>
|
||||
Copyright (c) 2004 Ted Unangst <tedu@openbsd.org>
|
||||
Copyright (c) 1994 Christos Zoulas <christos@netbsd.org>
|
||||
Copyright (c) 2003, 2007, 2008, 2014 Jason McIntyre <jmc@openbsd.org>
|
||||
|
||||
See the individual files for information about who contributed
|
||||
to which file during which years.
|
||||
|
||||
|
||||
The mandoc distribution as a whole is distributed by its developers
|
||||
under the following license:
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
The following files included from outside sources are protected by
|
||||
other people's Copyright and are distributed under various 2-clause
|
||||
and 3-clause BSD licenses; see these individual files for details.
|
||||
|
||||
soelim.c, soelim.1:
|
||||
Copyright (c) 2014 Baptiste Daroussin <bapt@freebsd.org>
|
||||
|
||||
compat_err.c, compat_fts.c, compat_fts.h,
|
||||
compat_getsubopt.c, compat_strcasestr.c, compat_strsep.c,
|
||||
man.1:
|
||||
Copyright (c) 1989,1990,1993,1994 The Regents of the University of California
|
||||
|
||||
compat_stringlist.c, compat_stringlist.h:
|
||||
Copyright (c) 1994 Christos Zoulas <christos@netbsd.org>
|
30
mcwin32/doc/NOTES-PERL.md
Normal file
30
mcwin32/doc/NOTES-PERL.md
Normal file
@ -0,0 +1,30 @@
|
||||
Notes on Perl
|
||||
=============
|
||||
|
||||
- [General Notes](#general-notes)
|
||||
- [Perl on Linux](#perl-on-linux)
|
||||
- [Perl on Windows](#perl-on-windows)
|
||||
|
||||
General Notes
|
||||
-------------
|
||||
|
||||
The build environment relies on Perl to perform a mix of tasks. Under Linux Perl is generally available.
|
||||
|
||||
However, if you need to install Perl as binary packages, a recent version of Perl-5 is required.
|
||||
|
||||
Perl on Linux
|
||||
-------------
|
||||
|
||||
On Linux distributions based on Debian, the package `perl` will install the core Perl modules as well, so you will be fine.
|
||||
|
||||
On Linux distributions based on RPMs, you will need to install `perl-core` rather than just `perl`.
|
||||
|
||||
|
||||
Perl on Windows
|
||||
---------------
|
||||
|
||||
There are a number of build targets that can be viewed as "Windows". There are several configs targeting __Open-Watcom C/C++__, __Visual Studio C/C++__, as well as __MinGW__ and __Cygwin__.
|
||||
|
||||
The key recommendation is to use a Perl installation that matches the build environment. For example, if you will build on Cygwin be sure to use the Cygwin package manager to install Perl. For MSYS builds use the MSYS provided Perl.
|
||||
|
||||
For standard target _Strawberry Perl_ is recommend, from <http://strawberryperl.com>. An alternative is ActiveState Perl, from <http://www.activestate.com/ActivePerl>.
|
@ -1,25 +1,36 @@
|
||||
|
||||
Package List: build 223
|
||||
Package List: build 232
|
||||
|
||||
mc.exe
|
||||
mcdiff.exe
|
||||
mcedit.exe
|
||||
mchelp.exe
|
||||
|
||||
mcbsddiff.exe
|
||||
mcmandoc.exe
|
||||
mcupdater.exe
|
||||
mcfile.exe
|
||||
busybox.exe
|
||||
file.exe
|
||||
|
||||
magic.mgc
|
||||
man2hlp.pl
|
||||
|
||||
libautoupdater.1.0.dll
|
||||
libglib-2.0.2.51.dll
|
||||
libgmodule-2.0.2.51.dll
|
||||
libintl.1.0.dll
|
||||
libmagic.5.41.dll
|
||||
libmbedcrypto.2.27.dll
|
||||
libmbedtls.2.27.dll
|
||||
libmbedx509.2.27.dll
|
||||
libssh2.1.10.dll
|
||||
libw32.1.2.dll
|
||||
libz.1.2.dll
|
||||
|
||||
libautoupdater.1.0.1.dll
|
||||
libenca.1.19.dll
|
||||
libglib.2.54.3.dll
|
||||
libgmodule.2.54.3.dll
|
||||
libintl.1.0.1.dll
|
||||
libmagic.5.45.dll
|
||||
libmbedcrypto.3.6.2.dll
|
||||
libmbedtls.3.6.2.dll
|
||||
libmbedx509.3.6.2.dll
|
||||
libpcre2-16.10.45.dll
|
||||
libpcre2-32.10.45.dll
|
||||
libpcre2-8.10.45.dll
|
||||
libpcre2posix.10.45.dll
|
||||
libssh2.1.11.1.dll
|
||||
libw32.1.2.0.dll
|
||||
libz.1.3.1.dll
|
||||
|
||||
mt7r19.dll
|
||||
plbr19.dll
|
||||
clbr19.dll
|
||||
|
@ -6,7 +6,45 @@ Native GNU Midnight Commander for Win32
|
||||
Windows XP+/32 bit native port of GNU Midnight Commander, based on
|
||||
the current 4.8.x development stream.
|
||||
|
||||
Version Latest Build
|
||||
Version Build Notes
|
||||
|
||||
4.8.33 232
|
||||
|
||||
- internal tools front-ends, externalized (#78)
|
||||
|
||||
o mchelp (#116)
|
||||
|
||||
- upgrades/bug-fixes
|
||||
|
||||
o obey NODRIVES group policy (#121)
|
||||
o getmntinfo, networked/mapped drive (#120)
|
||||
o non-ascii group name handling (#118)
|
||||
o mandoc integration (#116)
|
||||
o stat/seek64 (#35) and (#89)
|
||||
o unzip vfs (#88)
|
||||
|
||||
4.8.33 231 (mc merge 4.8.33)
|
||||
|
||||
- internal tools front-ends, externalized (#78)
|
||||
|
||||
o mcedit
|
||||
o mcdiff and mcbsddiff (diff backend)
|
||||
o mcview
|
||||
|
||||
- upgrades/bugfixes
|
||||
|
||||
o vio: wide-character handling (#115)
|
||||
o wputenv() cross tool-chain usage (#113)
|
||||
o pcre2 10.45 (#106)
|
||||
o appupdater (#102)
|
||||
o glib 2.54.3 (#102)
|
||||
o zlib-1.3.1 (#102)
|
||||
o mbedtls-3.6.2 (#100)
|
||||
o improved UNC and extended prefix support, plus stat optimisations (#98)
|
||||
o libssh2-1.11.1 (#95)
|
||||
o enhanced utf8 support, directory plus username; non-ascii user name support (#97)
|
||||
o EXDEV, cross-device detection rename failure; allowing alt move logic (#85)
|
||||
o x64 installer path (#79)
|
||||
|
||||
4.8.31 230 (mc merge 4.8.31)
|
||||
|
||||
@ -216,3 +254,5 @@ A few items are unix specific (e.g. chown), which shall be updated over
|
||||
time.
|
||||
|
||||
-end-
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- mode: mak; indent-tabs-mode: t; tab-width: 8 -*-
|
||||
# $Id: Makefile.in,v 1.29 2025/03/08 16:40:00 cvsuser Exp $
|
||||
# $Id: Makefile.in,v 1.31 2025/04/01 16:15:14 cvsuser Exp $
|
||||
# libwin32 makefile.
|
||||
#
|
||||
#
|
||||
@ -154,6 +154,7 @@ CSOURCES=\
|
||||
w32_gistrerror.c \
|
||||
w32_grp.c \
|
||||
w32_iconv.c \
|
||||
w32_fopen.c \
|
||||
w32_iconv_native.c \
|
||||
w32_ino.c \
|
||||
w32_io.c \
|
||||
@ -163,6 +164,7 @@ CSOURCES=\
|
||||
w32_mkstemp.c \
|
||||
w32_mmap.c \
|
||||
w32_neterr.c \
|
||||
w32_open.c \
|
||||
w32_pipe.c \
|
||||
w32_poll.c \
|
||||
w32_popen.c \
|
||||
@ -175,6 +177,7 @@ CSOURCES=\
|
||||
w32_rename.c \
|
||||
w32_reparse.c \
|
||||
w32_rwlock.c \
|
||||
w32_seek.c \
|
||||
w32_setrlimit.c \
|
||||
w32_select.c \
|
||||
w32_shell.c \
|
||||
|
@ -197,15 +197,12 @@ LIBW32_API void SLsmg_forward (int n);
|
||||
LIBW32_API int SLtt_initialize (const char *term);
|
||||
LIBW32_API void SLtt_save (void);
|
||||
LIBW32_API void SLtt_restore (void);
|
||||
// LIBW32_API int SLtt_set_font (const char *font);
|
||||
LIBW32_API const char * SLtt_get_font (char *buffer, size_t buflen);
|
||||
LIBW32_API void SLtt_set_color (int, const char *, const char *, const char *);
|
||||
LIBW32_API void SLtt_set_mono (int, char *, SLtt_Char_Type);
|
||||
LIBW32_API void SLtt_add_color_attribute (int, SLtt_Char_Type);
|
||||
|
||||
// LIBW32_API void SLtt_write_string (const char *);
|
||||
LIBW32_API void SLtt_beep (void);
|
||||
// LIBW32_API void SLtt_normal_video (void);
|
||||
|
||||
LIBW32_API int SLtt_tgetnum (const char *);
|
||||
LIBW32_API char * SLtt_tigetent (const char *);
|
||||
|
@ -208,7 +208,7 @@ typedef struct copyoutctx {
|
||||
static int vio_init(void);
|
||||
static COORD vio_size(HANDLE console, int *rows, int *cols);
|
||||
static void vio_profile(int rebuild);
|
||||
static void vio_setsize(int rows, int cols);
|
||||
static BOOL vio_setsize(int rows, int cols);
|
||||
static void vio_reset(void);
|
||||
static void vio_setcursor(int col, int row);
|
||||
static int rgb_search(const int maxval, const COLORREF rgb);
|
||||
@ -1192,22 +1192,46 @@ IsConsole2(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
static BOOL
|
||||
vio_setsize(int rows, int cols)
|
||||
{
|
||||
const int orows = vio.rows, ocols = vio.cols;
|
||||
HANDLE chandle = vio.chandle;
|
||||
SMALL_RECT rect = {0, 0, 0, 0};
|
||||
SMALL_RECT rect = { 0, 0, 0, 0 };
|
||||
COORD msize, nbufsz;
|
||||
int bufwin = FALSE;
|
||||
|
||||
msize = GetLargestConsoleWindowSize(chandle);
|
||||
|
||||
if (rows <= 0) rows = orows; // current
|
||||
else if (rows >= msize.Y) rows = msize.Y-1; // limit
|
||||
if (vio.isvirtualconsole) {
|
||||
//
|
||||
// GetLargestConsoleWindowSize() reports an incorrectly scaled value.
|
||||
// It uses the current screen resolution (in pixels) and divides by an invalid font size.
|
||||
//
|
||||
return FALSE; // not-supported
|
||||
}
|
||||
|
||||
if (cols <= 0) cols = ocols; // current
|
||||
else if (cols >= msize.X) cols = msize.X-1; // limit
|
||||
if (rows <= 0) {
|
||||
rows = orows; // current
|
||||
} else {
|
||||
if (rows >= msize.Y) {
|
||||
rows = msize.Y - 1; // limit
|
||||
}
|
||||
if (rows >= VIO_MAXROWS) {
|
||||
rows = VIO_MAXROWS;
|
||||
}
|
||||
}
|
||||
|
||||
if (cols <= 0) {
|
||||
cols = ocols; // current
|
||||
} else {
|
||||
if (cols >= msize.X) {
|
||||
cols = msize.X - 1; // limit
|
||||
}
|
||||
if (cols >= VIO_MAXCOLS) {
|
||||
cols = VIO_MAXCOLS;
|
||||
}
|
||||
}
|
||||
|
||||
rect.Top = 0;
|
||||
rect.Bottom = (SHORT)(rows - 1);
|
||||
@ -1243,6 +1267,8 @@ vio_setsize(int rows, int cols)
|
||||
SetConsoleScreenBufferSize(chandle, nbufsz);
|
||||
SetConsoleWindowInfo(chandle, TRUE, &rect);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -1991,7 +2017,7 @@ CopyOutVirtual(copyoutctx_t *ctx, size_t pos, size_t cnt, unsigned flags)
|
||||
|
||||
WCHAR wcbuf[2 * 1024], // ExtTextOut limit
|
||||
*wcend = wcbuf + ((sizeof(wcbuf) / sizeof(wcbuf[0])) - 128);
|
||||
char u8buf[sizeof(wcbuf) * 4];
|
||||
char u8buf[sizeof(wcbuf) * 4];
|
||||
|
||||
assert(pos < vio.size);
|
||||
assert(0 == (pos % cols));
|
||||
@ -3198,13 +3224,18 @@ vio_toggle_size(int *rows, int *cols)
|
||||
if (0 == vio.inited) return -1; /* uninitialised */
|
||||
|
||||
if (vio.maximised <= 0) {
|
||||
if (! vio_setsize(0xffff, 0xffff)) {
|
||||
return -1; /* not supported */
|
||||
}
|
||||
|
||||
if (-1 == vio.maximised) {
|
||||
vio.maximised_oldrows = vio.rows;
|
||||
vio.maximised_oldcols = vio.cols;
|
||||
}
|
||||
vio_setsize(0xffff, 0xffff);
|
||||
|
||||
vio.maximised = 1;
|
||||
ret = 1;
|
||||
|
||||
} else {
|
||||
vio_setsize(vio.maximised_oldrows, vio.maximised_oldcols);
|
||||
vio.maximised = 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef LIBW32_UNISTD_H_INCLUDED
|
||||
#define LIBW32_UNISTD_H_INCLUDED
|
||||
#include <edidentifier.h>
|
||||
__CIDENT_RCSID(gr_libw32_unistd_h,"$Id: unistd.h,v 1.48 2025/03/06 17:39:04 cvsuser Exp $")
|
||||
__CIDENT_RCSID(gr_libw32_unistd_h,"$Id: unistd.h,v 1.49 2025/03/30 17:16:02 cvsuser Exp $")
|
||||
__CPRAGMA_ONCE
|
||||
|
||||
/* -*- mode: c; indent-width: 4; -*- */
|
||||
@ -146,6 +146,29 @@ __CPRAGMA_ONCE
|
||||
#define WIN32_UNISTD_MAP 1
|
||||
#endif
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE)
|
||||
#if !defined(OFF64_T)
|
||||
#define OFF64_T 1
|
||||
#define FPOS64_T 1
|
||||
#if defined(__WATCOMC__)
|
||||
typedef long long off64_t;
|
||||
typedef long long fpos64_t;
|
||||
#define stat64 _stati64 // Note: sizeof(st_size)==8, sizeof(st_atime)==4
|
||||
#else
|
||||
typedef __int64 off64_t;
|
||||
typedef __int64 fpos64_t;
|
||||
#define stat64 _stat64 // Note: sizeof(st_size)==8, sizeof(time_t/st_atime)==8
|
||||
#endif
|
||||
#endif // OFF64_T
|
||||
#endif //_LARGEFILE64_SOURCE
|
||||
|
||||
#define EMODEINIT() UINT __errmode = 0;
|
||||
// 0 - system default, displays all error dialog boxes.
|
||||
#define EMODESUPPRESS() __errmode = SetErrorMode (SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX);
|
||||
// SEM_FAILCRITICALERRORS - system does not display the critical-error handler message box.
|
||||
// SEM_NOGPFAULTERRORBOX - system does not invoke Windows Error Reporting.
|
||||
#define EMODERESTORE() SetErrorMode (__errmode);
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*limits*/
|
||||
@ -460,8 +483,8 @@ LIBW32_API int getsubopt (char **optionp, char * const *tokens, char **
|
||||
#define NEED_STRCASECMP /*see: w32_string.c*/
|
||||
#endif
|
||||
#if defined(NEED_STRCASECMP)
|
||||
LIBW32_API int strcasecmp(const char *s1, const char *s2);
|
||||
LIBW32_API int strncasecmp(const char *s1, const char *s2, size_t len);
|
||||
LIBW32_API int strcasecmp (const char *s1, const char *s2);
|
||||
LIBW32_API int strncasecmp (const char *s1, const char *s2, size_t len);
|
||||
#endif /*NEED_STRCASECMP*/
|
||||
|
||||
#if (defined(_MSC_VER) && (_MSC_VER < 1400)) || \
|
||||
@ -534,18 +557,32 @@ LIBW32_API int w32_utf8filenames_enable (void);
|
||||
LIBW32_API int w32_open (const char *path, int, ...);
|
||||
LIBW32_API int w32_openA (const char *path, int, int);
|
||||
LIBW32_API int w32_openW (const wchar_t *path, int, int);
|
||||
|
||||
LIBW32_API int w32_stat (const char *path, struct stat *sb);
|
||||
LIBW32_API int w32_statA (const char *path, struct stat *sb);
|
||||
LIBW32_API int w32_statW (const wchar_t *path, struct stat *sb);
|
||||
LIBW32_API int w32_lstat (const char *path, struct stat *sb);
|
||||
LIBW32_API int w32_lstatA (const char *path, struct stat *sb);
|
||||
LIBW32_API int w32_lstatW (const wchar_t *path, struct stat *sb);
|
||||
LIBW32_API int w32_fstat (int fd, struct stat *sb);
|
||||
LIBW32_API int w32_fstatA (int fd, struct stat *sb);
|
||||
LIBW32_API int w32_fstatW (int fd, struct stat *sb);
|
||||
LIBW32_API int w32_read (int fd, void *buffer, size_t cnt);
|
||||
LIBW32_API int w32_write (int fd, const void *buffer, size_t cnt);
|
||||
LIBW32_API int w32_close (int fd);
|
||||
LIBW32_API int w32_fstat (int fildes, struct stat *sb);
|
||||
LIBW32_API int w32_fstatA (int fildes, struct stat *sb);
|
||||
LIBW32_API int w32_fstatW (int fildes, struct stat *sb);
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE)
|
||||
LIBW32_API int w32_stat64 (const char *path, struct stat64 *sb);
|
||||
LIBW32_API int w32_stat64A (const char *path, struct stat64 *sb);
|
||||
LIBW32_API int w32_stat64W (const wchar_t *path, struct stat64 *sb);
|
||||
LIBW32_API int w32_lstat64 (const char *path, struct stat64 *sb);
|
||||
LIBW32_API int w32_lstat64A (const char *path, struct stat64 *sb);
|
||||
LIBW32_API int w32_lstat64W (const wchar_t *path, struct stat64 *sb);
|
||||
LIBW32_API int w32_fstat64 (int fildes, struct stat64 *sb);
|
||||
LIBW32_API int w32_fstat64A (int fildes, struct stat64 *sb);
|
||||
LIBW32_API int w32_fstat64W (int fildes, struct stat64 *sb);
|
||||
#endif
|
||||
|
||||
LIBW32_API int w32_read (int fildes, void *buffer, size_t cnt);
|
||||
LIBW32_API int w32_write (int fildes, const void *buffer, size_t cnt);
|
||||
LIBW32_API int w32_close (int fildes);
|
||||
LIBW32_API const char * w32_strerror (int errnum);
|
||||
|
||||
LIBW32_API int w32_link (const char *from, const char *to);
|
||||
@ -571,21 +608,43 @@ LIBW32_API int w32_renameW (const wchar_t *ofile, const wchar_t *nfile)
|
||||
LIBW32_API ssize_t pread (int fildes, void *buf, size_t nbyte, off_t offset);
|
||||
LIBW32_API ssize_t pwrite (int fildes, const void *buf, size_t nbyte, off_t offset);
|
||||
|
||||
LIBW32_API int w32_pipe(int fildes[2]);
|
||||
#if defined(_LARGEFILE64_SOURCE)
|
||||
LIBW32_API off64_t w32_lseek64 (int fildes, off64_t offset, int whence);
|
||||
LIBW32_API off64_t w32_tell64 (int fildes);
|
||||
LIBW32_API off64_t w32_filelength64 (int fildes);
|
||||
|
||||
LIBW32_API off64_t w32_fseeko64 (FILE *stream, off64_t offset, int whence);
|
||||
LIBW32_API off64_t w32_ftello64 (FILE *stream);
|
||||
LIBW32_API int w32_fgetpos64 (FILE *stream, fpos64_t *pos);
|
||||
|
||||
LIBW32_API ssize_t pread64 (int fildes, void *buf, size_t nbyte, off64_t offset);
|
||||
LIBW32_API ssize_t pwrite64 (int fildes, const void *buf, size_t nbyte, off64_t offset);
|
||||
#endif
|
||||
|
||||
LIBW32_API int w32_pipe (int fildes[2]);
|
||||
|
||||
#if defined(WIN32_UNISTD_MAP)
|
||||
#define open w32_open
|
||||
#define stat(a,b) w32_stat(a, b)
|
||||
#define lstat(a,b) w32_lstat(a, b)
|
||||
#define fstat(a,b) w32_fstat(a, b)
|
||||
#define read(a,b,c) w32_read(a, b, c)
|
||||
#define write(a,b,c) w32_write(a, b, c)
|
||||
#define close(a) w32_close(a)
|
||||
#define link(f,t) w32_link(f,t)
|
||||
#define unlink(p) w32_unlink(p)
|
||||
#define access(p,m) w32_access(p, m)
|
||||
#define rename(a,b) w32_rename(a,b)
|
||||
#define pipe(__f) w32_pipe(__f)
|
||||
#if defined(_LARGEFILE64_SOURCE)
|
||||
#define stat(a,b) w32_stat64 (a, b)
|
||||
#define lstat(a,b) w32_lstat64 (a, b)
|
||||
#define fstat(a,b) w32_fstat64 (a, b)
|
||||
#define lseek(a,b,c) w32_lseek64 (a, b, c)
|
||||
#define tell(a) w32_tell64 (a)
|
||||
#define filelength(a) w32_filelength64 (a)
|
||||
#else
|
||||
#define stat(a,b) w32_stat (a, b)
|
||||
#define lstat(a,b) w32_lstat (a, b)
|
||||
#define fstat(a,b) w32_fstat (a, b)
|
||||
#endif
|
||||
#define read(a,b,c) w32_read (a, b, c)
|
||||
#define write(a,b,c) w32_write (a, b, c)
|
||||
#define close(a) w32_close (a)
|
||||
#define link(f,t) w32_link (f,t)
|
||||
#define unlink(p) w32_unlink (p)
|
||||
#define access(p,m) w32_access (p, m)
|
||||
#define rename(a,b) w32_rename (a,b)
|
||||
#define pipe(__f) w32_pipe (__f)
|
||||
#endif /*WIN32_UNISTD_MAP*/
|
||||
|
||||
#if defined(WIN32_UNISTD_MAP) || \
|
||||
@ -664,6 +723,12 @@ LIBW32_API int ftruncate (int fildes, off_t size);
|
||||
LIBW32_API int truncate (const char *path, off_t length);
|
||||
LIBW32_API int truncateA (const char *path, off_t length);
|
||||
LIBW32_API int truncateW (const wchar_t *path, off_t length);
|
||||
#if defined(_LARGEFILE64_SOURCE)
|
||||
LIBW32_API int ftruncate64 (int fildes, off64_t size);
|
||||
LIBW32_API int truncate64 (const char *path, off64_t size);
|
||||
LIBW32_API int truncate64A (const char *path, off64_t length);
|
||||
LIBW32_API int truncate64W (const wchar_t *path, off64_t length);
|
||||
#endif
|
||||
|
||||
LIBW32_API int w32_readlink (const char *path, char *name, size_t sz);
|
||||
LIBW32_API int w32_readlinkA (const char *path, char *name, size_t sz);
|
||||
@ -734,8 +799,8 @@ LIBW32_API long long strtoll (const char * nptr, char ** endptr, int base);
|
||||
#endif
|
||||
#endif /*_MSC_VER*/
|
||||
|
||||
LIBW32_API void setproctitle(const char *fmt, ...);
|
||||
LIBW32_API void setproctitle_fast(const char *fmt, ...);
|
||||
LIBW32_API void setproctitle (const char *fmt, ...);
|
||||
LIBW32_API void setproctitle_fast (const char *fmt, ...);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <edidentifier.h>
|
||||
__CIDENT_RCSID(gr_w32_access_c,"$Id: w32_access.c,v 1.7 2025/03/06 16:59:46 cvsuser Exp $")
|
||||
__CIDENT_RCSID(gr_w32_access_c,"$Id: w32_access.c,v 1.8 2025/04/01 16:15:14 cvsuser Exp $")
|
||||
|
||||
/* -*- mode: c; indent-width: 4; -*- */
|
||||
/*
|
||||
@ -30,8 +30,14 @@ __CIDENT_RCSID(gr_w32_access_c,"$Id: w32_access.c,v 1.7 2025/03/06 16:59:46 cvsu
|
||||
*/
|
||||
|
||||
#include "win32_internal.h"
|
||||
#include "win32_io.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
static int W32AccessA(const char *path, int amode);
|
||||
static int W32AccessW(const wchar_t *path, int amode);
|
||||
|
||||
|
||||
/*
|
||||
// NAME
|
||||
// access - determine accessibility of a file.
|
||||
@ -127,7 +133,7 @@ w32_access(const char *path, int amode)
|
||||
int
|
||||
w32_accessA(const char *path, int amode)
|
||||
{
|
||||
int ret = -1;
|
||||
int ret = -1; // success=0, otherwise=-1
|
||||
|
||||
if (NULL == path) {
|
||||
errno = EFAULT;
|
||||
@ -136,16 +142,21 @@ w32_accessA(const char *path, int amode)
|
||||
errno = ENOENT;
|
||||
|
||||
} else {
|
||||
const char *expath;
|
||||
char symbuf[WIN32_PATH_MAX];
|
||||
|
||||
if (NULL != (expath = w32_extendedpathA(path))) {
|
||||
path = expath; // abs-path to expanded
|
||||
if (w32_resolvelinkA(path, symbuf, _countof(symbuf), NULL) != NULL) {
|
||||
path = symbuf; // symlink
|
||||
}
|
||||
|
||||
#undef _access
|
||||
ret = _access(path, amode);
|
||||
|
||||
free((void*)expath);
|
||||
if ((ret = W32AccessA(path, amode)) == -1) {
|
||||
if (ENOTDIR == errno || ENOENT == errno) {
|
||||
if (path != symbuf) { // component error, expand embedded shortcut
|
||||
if (w32_expandlinkA(path, symbuf, _countof(symbuf), SHORTCUT_COMPONENT)) {
|
||||
ret = W32AccessA(symbuf, amode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@ -154,7 +165,7 @@ w32_accessA(const char *path, int amode)
|
||||
int
|
||||
w32_accessW(const wchar_t *path, int amode)
|
||||
{
|
||||
int ret = -1;
|
||||
int ret = -1; // success=0, otherwise=-1
|
||||
|
||||
if (NULL == path) {
|
||||
errno = EFAULT;
|
||||
@ -163,18 +174,59 @@ w32_accessW(const wchar_t *path, int amode)
|
||||
errno = ENOENT;
|
||||
|
||||
} else {
|
||||
const wchar_t *expath;
|
||||
wchar_t symbuf[WIN32_PATH_MAX];
|
||||
|
||||
if (NULL != (expath = w32_extendedpathW(path))) {
|
||||
path = expath; // abs-path to expanded
|
||||
if (w32_resolvelinkW(path, symbuf, _countof(symbuf), NULL) != NULL) {
|
||||
path = symbuf; // symlink
|
||||
}
|
||||
|
||||
#undef _waccess
|
||||
ret = _waccess(path, amode);
|
||||
|
||||
free((void*)expath);
|
||||
if ((ret = W32AccessW(path, amode)) == -1) {
|
||||
if (ENOTDIR == errno || ENOENT == errno) {
|
||||
if (path != symbuf) { // component error, expand embedded shortcut
|
||||
if (w32_expandlinkW(path, symbuf, _countof(symbuf), SHORTCUT_COMPONENT)) {
|
||||
ret = W32AccessW(symbuf, amode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
W32AccessA(const char *path, int amode)
|
||||
{
|
||||
const char *expath;
|
||||
int ret;
|
||||
|
||||
if (NULL != (expath = w32_extendedpathA(path))) {
|
||||
path = expath; // extended abs-path
|
||||
}
|
||||
|
||||
#undef _access
|
||||
ret = _access(path, amode);
|
||||
|
||||
free((void*)expath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
W32AccessW(const wchar_t *path, int amode)
|
||||
{
|
||||
const wchar_t *expath;
|
||||
int ret;
|
||||
|
||||
if (NULL != (expath = w32_extendedpathW(path))) {
|
||||
path = expath; // extended abs-path
|
||||
}
|
||||
|
||||
#undef _waccess
|
||||
ret = _waccess(path, amode);
|
||||
|
||||
free((void*)expath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*end*/
|
||||
|
@ -115,7 +115,7 @@ w32_basenameW(wchar_t *path)
|
||||
* basename() shall return a pointer to the string ".".
|
||||
*/
|
||||
if (path == NULL || *path == '\0')
|
||||
return (__DECONST(wchar_t *, "."));
|
||||
return (__DECONST(wchar_t *, L"."));
|
||||
|
||||
/* Find end of last pathname component and null terminate it. */
|
||||
ptr = path + wcslen(path);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <edidentifier.h>
|
||||
__CIDENT_RCSID(gr_w32_child_c,"$Id: w32_child.c,v 1.25 2025/03/06 16:59:46 cvsuser Exp $")
|
||||
__CIDENT_RCSID(gr_w32_child_c,"$Id: w32_child.c,v 1.26 2025/03/30 17:16:02 cvsuser Exp $")
|
||||
|
||||
/* -*- mode: c; indent-width: 4; -*- */
|
||||
/*
|
||||
@ -51,7 +51,6 @@ __CIDENT_RCSID(gr_w32_child_c,"$Id: w32_child.c,v 1.25 2025/03/06 16:59:46 cvsus
|
||||
#pragma warning(disable : 4244) // conversion from 'xxx' to 'xxx', possible loss of data
|
||||
#pragma warning(disable : 4312) // type cast' : conversion from 'xxx' to 'xxx' of greater size
|
||||
#endif
|
||||
|
||||
struct procdata {
|
||||
int type;
|
||||
DWORD dwProcessId;
|
||||
@ -321,7 +320,7 @@ w32_waitpid(int pid, int *status, int options)
|
||||
/*
|
||||
* wait for the child whose process ID is equal to the value of pid.
|
||||
*/
|
||||
if (w32_child_wait(w32_ITOH(pid), status, options & WNOHANG)) {
|
||||
if (w32_child_wait(w32_ftoh(pid), status, options & WNOHANG)) {
|
||||
ret = pid;
|
||||
}
|
||||
}
|
||||
@ -449,7 +448,7 @@ LIBW32_API int
|
||||
w32_kill(int pid, int value)
|
||||
{
|
||||
if (pid > 0) {
|
||||
HANDLE hProc = w32_ITOH(pid);
|
||||
HANDLE hProc = w32_ftoh(pid);
|
||||
|
||||
/* Still running ?? */
|
||||
if (WaitForSingleObject(hProc, 0) != WAIT_TIMEOUT) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <edidentifier.h>
|
||||
__CIDENT_RCSID(gr_w32_chmod_c,"$Id: w32_chmod.c,v 1.9 2025/03/06 16:59:46 cvsuser Exp $")
|
||||
__CIDENT_RCSID(gr_w32_chmod_c,"$Id: w32_chmod.c,v 1.10 2025/04/01 16:15:14 cvsuser Exp $")
|
||||
|
||||
/* -*- mode: c; indent-width: 4; -*- */
|
||||
/*
|
||||
@ -33,8 +33,12 @@ __CIDENT_RCSID(gr_w32_chmod_c,"$Id: w32_chmod.c,v 1.9 2025/03/06 16:59:46 cvsuse
|
||||
#endif
|
||||
|
||||
#include "win32_internal.h"
|
||||
#include "win32_io.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
static int W32ChmodA(const char *path, mode_t mode);
|
||||
static int W32ChmodW(const wchar_t *path, mode_t mode);
|
||||
|
||||
/*
|
||||
// NAME
|
||||
@ -106,31 +110,98 @@ w32_chmod(const char *pathname, mode_t mode)
|
||||
LIBW32_API int
|
||||
w32_chmodA(const char *pathname, mode_t mode)
|
||||
{
|
||||
const char *expath;
|
||||
int ret;
|
||||
int ret = -1; // success=0, otherwise=-1
|
||||
|
||||
if (NULL != (expath = w32_extendedpathA(pathname))) {
|
||||
pathname = expath; // abs-path to expanded
|
||||
if (NULL == pathname) {
|
||||
errno = EFAULT;
|
||||
|
||||
} else if (!*pathname) {
|
||||
errno = ENOENT;
|
||||
|
||||
} else {
|
||||
char symbuf[WIN32_PATH_MAX];
|
||||
|
||||
if (w32_resolvelinkA(pathname, symbuf, _countof(symbuf), NULL) != NULL) {
|
||||
pathname = symbuf; // symlink
|
||||
}
|
||||
|
||||
if ((ret = W32ChmodA(pathname, mode)) == -1) {
|
||||
if (ENOTDIR == errno || ENOENT == errno) {
|
||||
if (pathname != symbuf) { // component error, expand embedded shortcut
|
||||
if (w32_expandlinkA(pathname, symbuf, _countof(symbuf), SHORTCUT_COMPONENT)) {
|
||||
ret = W32ChmodA(symbuf, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef chmod
|
||||
ret = chmod(pathname, mode);
|
||||
free((void*)expath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
LIBW32_API int
|
||||
w32_chmodW(const wchar_t *pathname, mode_t mode)
|
||||
{
|
||||
int ret = -1; // success=0, otherwise=-1
|
||||
|
||||
if (NULL == pathname) {
|
||||
errno = EFAULT;
|
||||
|
||||
} else if (!*pathname) {
|
||||
errno = ENOENT;
|
||||
|
||||
} else {
|
||||
wchar_t symbuf[WIN32_PATH_MAX];
|
||||
|
||||
if (w32_resolvelinkW(pathname, symbuf, _countof(symbuf), NULL) != NULL) {
|
||||
pathname = symbuf; // symlink
|
||||
}
|
||||
|
||||
if ((ret = W32ChmodW(pathname, mode)) == -1) {
|
||||
if (ENOTDIR == errno || ENOENT == errno) {
|
||||
if (pathname != symbuf) { // component error, expand embedded shortcut
|
||||
if (w32_expandlinkW(pathname, symbuf, _countof(symbuf), SHORTCUT_COMPONENT)) {
|
||||
ret = W32ChmodW(symbuf, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
W32ChmodA(const char *pathname, mode_t mode)
|
||||
{
|
||||
const char *expath;
|
||||
int ret;
|
||||
|
||||
if (NULL != (expath = w32_extendedpathA(pathname))) {
|
||||
pathname = expath; // extended abs-path
|
||||
}
|
||||
|
||||
#undef chmod
|
||||
ret = chmod(pathname, mode);
|
||||
|
||||
free((void*)expath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
W32ChmodW(const wchar_t *pathname, mode_t mode)
|
||||
{
|
||||
const wchar_t *expath;
|
||||
int ret;
|
||||
|
||||
if (NULL != (expath = w32_extendedpathW(pathname))) {
|
||||
pathname = expath; // abs-path to expanded
|
||||
pathname = expath; // extended abs-path
|
||||
}
|
||||
|
||||
#undef _wchmod
|
||||
ret = _wchmod(pathname, mode);
|
||||
|
||||
free((void*)expath);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <edidentifier.h>
|
||||
__CIDENT_RCSID(gr_w32_dir_c, "$Id: w32_dir.c,v 1.28 2025/03/20 17:22:45 cvsuser Exp $")
|
||||
__CIDENT_RCSID(gr_w32_dir_c, "$Id: w32_dir.c,v 1.30 2025/04/01 16:15:14 cvsuser Exp $")
|
||||
|
||||
/* -*- mode: c; indent-width: 4; -*- */
|
||||
/*
|
||||
@ -171,7 +171,7 @@ w32_mkdirA(const char *path, int mode)
|
||||
int ret = 0;
|
||||
|
||||
if (NULL != (expath = w32_extendedpathA(path))) {
|
||||
path = expath; // abs-path to expanded
|
||||
path = expath; // extended abs-path
|
||||
}
|
||||
|
||||
(void) mode;
|
||||
@ -191,7 +191,7 @@ w32_mkdirW(const wchar_t *path, int mode)
|
||||
int ret = 0;
|
||||
|
||||
if (NULL != (expath = w32_extendedpathW(path))) {
|
||||
path = expath; // abs-path to expanded
|
||||
path = expath; // extended abs-path
|
||||
}
|
||||
|
||||
(void) mode;
|
||||
@ -284,6 +284,7 @@ w32_chdirA(const char *path)
|
||||
{
|
||||
const char *expath;
|
||||
BOOL success, isunc = FALSE;
|
||||
EMODEINIT()
|
||||
int root;
|
||||
|
||||
if (NULL == path || !*path) {
|
||||
@ -295,6 +296,7 @@ w32_chdirA(const char *path)
|
||||
return root;
|
||||
}
|
||||
|
||||
EMODESUPPRESS()
|
||||
expath = w32_extendedpathA(path); // abs-path to expanded
|
||||
success = SetCurrentDirectoryA(expath ? expath : path);
|
||||
|
||||
@ -328,6 +330,7 @@ w32_chdirA(const char *path)
|
||||
} else {
|
||||
isunc = w32_unc_validA(path);
|
||||
}
|
||||
EMODERESTORE()
|
||||
|
||||
free((void*)expath);
|
||||
expath = NULL;
|
||||
@ -348,6 +351,7 @@ w32_chdirW(const wchar_t *path)
|
||||
{
|
||||
const wchar_t *expath;
|
||||
BOOL success, isunc = FALSE;
|
||||
EMODEINIT()
|
||||
int root;
|
||||
|
||||
if (NULL == path || !*path) {
|
||||
@ -359,6 +363,7 @@ w32_chdirW(const wchar_t *path)
|
||||
return root;
|
||||
}
|
||||
|
||||
EMODESUPPRESS()
|
||||
expath = w32_extendedpathW(path); // abs-path to expanded
|
||||
success = SetCurrentDirectoryW(expath ? expath : path);
|
||||
|
||||
@ -392,6 +397,7 @@ w32_chdirW(const wchar_t *path)
|
||||
} else {
|
||||
isunc = w32_unc_validW(path);
|
||||
}
|
||||
EMODERESTORE()
|
||||
|
||||
free((void*)expath);
|
||||
expath = NULL;
|
||||
@ -581,7 +587,7 @@ cache_directory()
|
||||
* =C:=C:\Program and Settings\users\
|
||||
*/
|
||||
env_var[1] = toupper(cwd[0]);
|
||||
w32_unix2dos(cwd);
|
||||
w32_unix2dosA(cwd);
|
||||
|
||||
(void) SetEnvironmentVariableA(env_var, cwd);
|
||||
}
|
||||
@ -715,7 +721,7 @@ w32_rmdirA(const char *path)
|
||||
int ret = 0;
|
||||
|
||||
if (NULL != (expath = w32_extendedpathA(path))) {
|
||||
path = expath; // abs-path to expanded
|
||||
path = expath; // extended abs-path
|
||||
}
|
||||
|
||||
if (! RemoveDirectoryA(path)) {
|
||||
@ -734,7 +740,7 @@ w32_rmdirW(const wchar_t *path)
|
||||
int ret = 0;
|
||||
|
||||
if (NULL != (expath = w32_extendedpathW(path))) {
|
||||
path = expath; // abs-path to expanded
|
||||
path = expath; // extended abs-path
|
||||
}
|
||||
|
||||
if (! RemoveDirectoryW(path)) {
|
||||
@ -766,7 +772,7 @@ w32_expandlinkA(const char *name, char *buf, size_t buflen, unsigned flags)
|
||||
for (cursor = t_name + length, end = cursor; --cursor >= t_name;) {
|
||||
if ('.' == *cursor) { // extension
|
||||
if (1 == ++dots) { // last/trailing
|
||||
if (0 == w32_io_strnicmp(cursor, ".lnk", 4) && (cursor + 4) == end) {
|
||||
if (0 == w32_iostrnicmpA(cursor, ".lnk", 4) && (cursor + 4) == end) {
|
||||
//
|
||||
// <shortcut>.lnk
|
||||
// - attempt expansion, allowing one within any given path.
|
||||
@ -824,7 +830,7 @@ w32_expandlinkW(const wchar_t *name, wchar_t *buf, size_t buflen, unsigned flags
|
||||
for (cursor = t_name + length, end = cursor; --cursor >= t_name;) {
|
||||
if ('.' == *cursor) { // extension
|
||||
if (1 == ++dots) { // last/trailing
|
||||
if (0 == w32_io_wstrnicmp(cursor, ".lnk", 4) && (cursor + 4) == end) {
|
||||
if (0 == w32_iostrnicmpW(cursor, ".lnk", 4) && (cursor + 4) == end) {
|
||||
//
|
||||
// <shortcut>.lnk
|
||||
// - attempt expansion, allowing one within any given path.
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <edidentifier.h>
|
||||
__CIDENT_RCSID(gr_w32_dirent_c,"$Id: w32_dirent.c,v 1.32 2025/03/06 16:59:46 cvsuser Exp $")
|
||||
__CIDENT_RCSID(gr_w32_dirent_c,"$Id: w32_dirent.c,v 1.34 2025/04/01 16:15:14 cvsuser Exp $")
|
||||
|
||||
/* -*- mode: c; indent-width: 4; -*- */
|
||||
/*
|
||||
@ -218,11 +218,11 @@ opendirA(const char *dirname)
|
||||
|
||||
/* Is a directory ? */
|
||||
if (0 != strcmp(path, ".")) {
|
||||
UINT errormode;
|
||||
EMODEINIT()
|
||||
DWORD attr;
|
||||
int rc = 0;
|
||||
|
||||
errormode = SetErrorMode(0); // disable hard errors
|
||||
EMODESUPPRESS() // disable hard errors
|
||||
if (INVALID_FILE_ATTRIBUTES == (attr = GetFileAttributesA(path))) {
|
||||
switch (GetLastError()) {
|
||||
case ERROR_ACCESS_DENIED:
|
||||
@ -249,7 +249,7 @@ opendirA(const char *dirname)
|
||||
}
|
||||
}
|
||||
}
|
||||
(void) SetErrorMode(errormode); // restore errors
|
||||
EMODERESTORE() // restore errors
|
||||
|
||||
if (rc) {
|
||||
if (w32_unc_rootA(path, NULL)) { // "//servername[/]"
|
||||
@ -361,11 +361,11 @@ opendirW(const wchar_t *dirname)
|
||||
|
||||
/* Is a directory ? */
|
||||
if (0 != wcscmp(path, L".")) {
|
||||
UINT errormode;
|
||||
EMODEINIT()
|
||||
DWORD attr;
|
||||
int rc = 0;
|
||||
|
||||
errormode = SetErrorMode(0); // disable hard errors
|
||||
EMODESUPPRESS() // disable hard errors
|
||||
if (INVALID_FILE_ATTRIBUTES == (attr = GetFileAttributesW(path))) {
|
||||
switch(GetLastError()) {
|
||||
case ERROR_ACCESS_DENIED:
|
||||
@ -392,7 +392,7 @@ opendirW(const wchar_t *dirname)
|
||||
}
|
||||
}
|
||||
}
|
||||
(void) SetErrorMode(errormode); // restore errors
|
||||
EMODERESTORE() // restore errors
|
||||
|
||||
if (rc) {
|
||||
if (w32_unc_rootW(path, NULL)) { // "//servername[/]"
|
||||
@ -464,7 +464,7 @@ IsShortcutA(const char *name)
|
||||
|
||||
for (cursor = name + len; --cursor >= name;) {
|
||||
if (*cursor == '.') { // extension
|
||||
return (*++cursor && 0 == w32_io_stricmp(cursor, "lnk"));
|
||||
return (*++cursor && 0 == w32_iostricmpA(cursor, "lnk"));
|
||||
}
|
||||
if (*cursor == '/' || *cursor == '\\') {
|
||||
break; // delimiter
|
||||
@ -482,7 +482,7 @@ IsShortcutW(const wchar_t *name)
|
||||
|
||||
for (cursor = name + len; --cursor >= name;) {
|
||||
if (*cursor == '.') { // extension
|
||||
return (*++cursor && 0 == w32_io_wstricmp(cursor, "lnk"));
|
||||
return (*++cursor && 0 == w32_iostricmpW(cursor, "lnk"));
|
||||
}
|
||||
if (*cursor == '/' || *cursor == '\\') {
|
||||
break; // delimiter
|
||||
@ -540,13 +540,13 @@ dir_populateA(DIR *dp, const char *path)
|
||||
WIN32_FIND_DATAA fd = {0};
|
||||
HANDLE hSearch = INVALID_HANDLE_VALUE;
|
||||
struct _dirlist *dplist;
|
||||
UINT errormode;
|
||||
EMODEINIT()
|
||||
BOOL isHPFS = FALSE;
|
||||
int rc, ret = 0;
|
||||
|
||||
errormode = SetErrorMode(0); // disable hard errors
|
||||
EMODESUPPRESS() // disable hard errors
|
||||
hSearch = FindFirstFileA(path, &fd);
|
||||
(void) SetErrorMode(errormode); // restore errors
|
||||
EMODERESTORE() // restore errors
|
||||
|
||||
if (INVALID_HANDLE_VALUE == hSearch) {
|
||||
return dir_errno(GetLastError());
|
||||
@ -624,13 +624,13 @@ dir_populateW(DIR *dp, const wchar_t *path)
|
||||
WIN32_FIND_DATAW fd = {0};
|
||||
struct _dirlist *dplist = NULL;
|
||||
HANDLE hSearch = INVALID_HANDLE_VALUE;
|
||||
UINT errormode;
|
||||
EMODEINIT()
|
||||
BOOL isHPFS = FALSE;
|
||||
int rc, ret = 0;
|
||||
|
||||
errormode = SetErrorMode(0); // disable hard errors
|
||||
EMODESUPPRESS() // disable hard errors
|
||||
hSearch = FindFirstFileW(path, &fd);
|
||||
(void) SetErrorMode(errormode); // restore errors
|
||||
EMODERESTORE() // restore errors
|
||||
|
||||
if (INVALID_HANDLE_VALUE == hSearch) {
|
||||
return dir_errno(GetLastError());
|
||||
@ -1272,7 +1272,7 @@ static int
|
||||
dir_ishpfA(const char *directory)
|
||||
{
|
||||
int namelen;
|
||||
UINT errormode;
|
||||
EMODEINIT()
|
||||
DWORD flags = 0, maxname;
|
||||
BOOL rc = 0;
|
||||
|
||||
@ -1297,10 +1297,10 @@ dir_ishpfA(const char *directory)
|
||||
}
|
||||
*cursor = 0;
|
||||
|
||||
errormode = SetErrorMode(0); // disable hard errors
|
||||
EMODESUPPRESS() // disable hard errors
|
||||
rc = GetVolumeInformationA(rootdir, (LPSTR)NULL, 0,
|
||||
(LPDWORD)NULL, &maxname, &flags, (LPSTR)NULL, 0);
|
||||
(void) SetErrorMode(errormode); // restore errors
|
||||
EMODERESTORE() // restore errors
|
||||
|
||||
} else {
|
||||
char rootdir[4] = "x:\\";
|
||||
@ -1317,10 +1317,11 @@ dir_ishpfA(const char *directory)
|
||||
}
|
||||
|
||||
rootdir[0] = (char)(driveno + 'A');
|
||||
errormode = SetErrorMode(0); // disable hard errors
|
||||
|
||||
EMODESUPPRESS() // disable hard errors
|
||||
rc = GetVolumeInformationA(rootdir, (LPSTR)NULL, 0,
|
||||
(LPDWORD)NULL, &maxname, &flags, (LPSTR)NULL, 0);
|
||||
(void) SetErrorMode(errormode); // restore errors
|
||||
EMODERESTORE() // restore errors
|
||||
}
|
||||
|
||||
return ((rc) &&
|
||||
@ -1332,7 +1333,7 @@ static int
|
||||
dir_ishpfW(const wchar_t *directory)
|
||||
{
|
||||
int namelen;
|
||||
UINT errormode;
|
||||
EMODEINIT()
|
||||
DWORD flags = 0, maxname;
|
||||
BOOL rc = 0;
|
||||
|
||||
@ -1357,10 +1358,10 @@ dir_ishpfW(const wchar_t *directory)
|
||||
}
|
||||
*cursor = 0;
|
||||
|
||||
errormode = SetErrorMode(0); // disable hard errors
|
||||
EMODESUPPRESS() // disable hard errors
|
||||
rc = GetVolumeInformationW(rootdir, (LPWSTR)NULL, 0,
|
||||
(LPDWORD)NULL, &maxname, &flags, (LPWSTR)NULL, 0);
|
||||
(void) SetErrorMode(errormode); // restore errors
|
||||
EMODERESTORE() // restore errors
|
||||
|
||||
} else {
|
||||
wchar_t rootdir[4] = L"x:\\";
|
||||
@ -1377,10 +1378,11 @@ dir_ishpfW(const wchar_t *directory)
|
||||
}
|
||||
|
||||
rootdir[0] = (char)(driveno + 'A');
|
||||
errormode = SetErrorMode(0); // disable hard errors
|
||||
|
||||
EMODESUPPRESS() // disable hard errors
|
||||
rc = GetVolumeInformationW(rootdir, (LPWSTR)NULL, 0,
|
||||
(LPDWORD)NULL, &maxname, &flags, (LPWSTR)NULL, 0);
|
||||
(void) SetErrorMode(errormode); // restore errors
|
||||
EMODERESTORE() // restore errors
|
||||
}
|
||||
|
||||
return ((rc) &&
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user