mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-22 03:02:06 +03:00
Ticket #2447: code cleanup before 4.7.5 release.
VFS: post-indentation fixups. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
7e3c35e31d
commit
7a8dc2665e
@ -128,7 +128,7 @@ int fish_directory_timeout = 900;
|
||||
return -1; \
|
||||
} \
|
||||
rpath = strutils_shell_escape (crpath); \
|
||||
g_free (mpath);
|
||||
g_free (mpath)
|
||||
|
||||
/*** file scope type declarations ****************************************************************/
|
||||
|
||||
@ -1221,9 +1221,11 @@ static int
|
||||
fish_chmod (struct vfs_class *me, const char *path, int mode)
|
||||
{
|
||||
gchar *shell_commands = NULL;
|
||||
PREFIX
|
||||
shell_commands = g_strconcat (SUP.scr_env, "FISH_FILENAME=%s FISH_FILEMODE=%4.4o;\n",
|
||||
SUP.scr_chmod, (char *) NULL);
|
||||
|
||||
PREFIX;
|
||||
|
||||
shell_commands = g_strconcat (SUP.scr_env, "FISH_FILENAME=%s FISH_FILEMODE=%4.4o;\n",
|
||||
SUP.scr_chmod, (char *) NULL);
|
||||
g_snprintf (buf, sizeof (buf), shell_commands, rpath, mode & 07777);
|
||||
g_free (shell_commands);
|
||||
g_free (rpath);
|
||||
@ -1252,10 +1254,11 @@ fish_chown (struct vfs_class *me, const char *path, uid_t owner, gid_t group)
|
||||
{
|
||||
gchar *shell_commands = NULL;
|
||||
|
||||
PREFIX
|
||||
shell_commands = g_strconcat (SUP.scr_env,
|
||||
"FISH_FILENAME=%s FISH_FILEOWNER=%s FISH_FILEGROUP=%s;\n",
|
||||
SUP.scr_chown, (char *) NULL);
|
||||
PREFIX;
|
||||
|
||||
shell_commands = g_strconcat (SUP.scr_env,
|
||||
"FISH_FILENAME=%s FISH_FILEOWNER=%s FISH_FILEGROUP=%s;\n",
|
||||
SUP.scr_chown, (char *) NULL);
|
||||
g_snprintf (buf, sizeof (buf), shell_commands, rpath, sowner, sgroup);
|
||||
g_free (shell_commands);
|
||||
fish_send_command (me, super, buf, OPT_FLUSH);
|
||||
@ -1272,8 +1275,10 @@ static int
|
||||
fish_unlink (struct vfs_class *me, const char *path)
|
||||
{
|
||||
gchar *shell_commands = NULL;
|
||||
PREFIX
|
||||
shell_commands =
|
||||
|
||||
PREFIX;
|
||||
|
||||
shell_commands =
|
||||
g_strconcat (SUP.scr_env, "FISH_FILENAME=%s;\n", SUP.scr_unlink, (char *) NULL);
|
||||
g_snprintf (buf, sizeof (buf), shell_commands, rpath);
|
||||
g_free (shell_commands);
|
||||
@ -1287,8 +1292,10 @@ static int
|
||||
fish_exists (struct vfs_class *me, const char *path)
|
||||
{
|
||||
gchar *shell_commands = NULL;
|
||||
PREFIX
|
||||
shell_commands =
|
||||
|
||||
PREFIX;
|
||||
|
||||
shell_commands =
|
||||
g_strconcat (SUP.scr_env, "FISH_FILENAME=%s;\n", SUP.scr_exists, (char *) NULL);
|
||||
g_snprintf (buf, sizeof (buf), shell_commands, rpath);
|
||||
g_free (shell_commands);
|
||||
@ -1306,7 +1313,9 @@ fish_mkdir (struct vfs_class *me, const char *path, mode_t mode)
|
||||
gchar *shell_commands = NULL;
|
||||
int ret_code;
|
||||
|
||||
PREFIX (void) mode;
|
||||
PREFIX;
|
||||
|
||||
(void) mode;
|
||||
|
||||
shell_commands = g_strconcat (SUP.scr_env, "FISH_FILENAME=%s;\n", SUP.scr_mkdir, (char *) NULL);
|
||||
g_snprintf (buf, sizeof (buf), shell_commands, rpath);
|
||||
@ -1331,9 +1340,10 @@ static int
|
||||
fish_rmdir (struct vfs_class *me, const char *path)
|
||||
{
|
||||
gchar *shell_commands = NULL;
|
||||
PREFIX
|
||||
shell_commands =
|
||||
g_strconcat (SUP.scr_env, "FISH_FILENAME=%s;\n", SUP.scr_rmdir, (char *) NULL);
|
||||
|
||||
PREFIX;
|
||||
|
||||
shell_commands = g_strconcat (SUP.scr_env, "FISH_FILENAME=%s;\n", SUP.scr_rmdir, (char *) NULL);
|
||||
g_snprintf (buf, sizeof (buf), shell_commands, rpath);
|
||||
g_free (shell_commands);
|
||||
g_free (rpath);
|
||||
|
@ -810,34 +810,40 @@ mc_open (const char *filename, int flags, ...)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
#define MC_NAMEOP(name, inarg, callarg) \
|
||||
int mc_##name inarg \
|
||||
{ \
|
||||
struct vfs_class *vfs; \
|
||||
int result; \
|
||||
char *mpath = vfs_canon_and_translate (path); \
|
||||
char *mpath; \
|
||||
mpath = vfs_canon_and_translate (path); \
|
||||
if (mpath == NULL) \
|
||||
return -1; \
|
||||
vfs = vfs_get_class (mpath); \
|
||||
if (vfs == NULL){ \
|
||||
g_free (mpath); \
|
||||
return -1; \
|
||||
if (vfs == NULL) \
|
||||
{ \
|
||||
g_free (mpath); \
|
||||
return -1; \
|
||||
} \
|
||||
result = vfs->name != NULL ? vfs->name callarg : -1; \
|
||||
g_free (mpath); \
|
||||
if (result == -1) \
|
||||
errno = vfs->name != NULL ? ferrno (vfs) : E_NOTSUPP; \
|
||||
errno = vfs->name != NULL ? ferrno (vfs) : E_NOTSUPP; \
|
||||
return result; \
|
||||
}
|
||||
|
||||
MC_NAMEOP (chmod, (const char *path, mode_t mode), (vfs, mpath, mode));
|
||||
MC_NAMEOP (chown, (const char *path, uid_t owner, gid_t group), (vfs, mpath, owner, group));
|
||||
MC_NAMEOP (utime, (const char *path, struct utimbuf * times), (vfs, mpath, times));
|
||||
MC_NAMEOP (readlink, (const char *path, char *buf, size_t bufsiz), (vfs, mpath, buf, bufsiz));
|
||||
MC_NAMEOP (unlink, (const char *path), (vfs, mpath));
|
||||
MC_NAMEOP (mkdir, (const char *path, mode_t mode), (vfs, mpath, mode));
|
||||
MC_NAMEOP (rmdir, (const char *path), (vfs, mpath));
|
||||
MC_NAMEOP (mknod, (const char *path, mode_t mode, dev_t dev), (vfs, mpath, mode, dev));
|
||||
MC_NAMEOP (chmod, (const char *path, mode_t mode), (vfs, mpath, mode))
|
||||
MC_NAMEOP (chown, (const char *path, uid_t owner, gid_t group), (vfs, mpath, owner, group))
|
||||
MC_NAMEOP (utime, (const char *path, struct utimbuf * times), (vfs, mpath, times))
|
||||
MC_NAMEOP (readlink, (const char *path, char *buf, size_t bufsiz), (vfs, mpath, buf, bufsiz))
|
||||
MC_NAMEOP (unlink, (const char *path), (vfs, mpath))
|
||||
MC_NAMEOP (mkdir, (const char *path, mode_t mode), (vfs, mpath, mode))
|
||||
MC_NAMEOP (rmdir, (const char *path), (vfs, mpath))
|
||||
MC_NAMEOP (mknod, (const char *path, mode_t mode, dev_t dev), (vfs, mpath, mode, dev))
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
@ -877,6 +883,8 @@ mc_symlink (const char *name1, const char *path)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
#define MC_HANDLEOP(name, inarg, callarg) \
|
||||
ssize_t mc_##name inarg \
|
||||
{ \
|
||||
@ -893,8 +901,8 @@ ssize_t mc_##name inarg \
|
||||
return result; \
|
||||
}
|
||||
|
||||
MC_HANDLEOP (read, (int handle, void *buffer, size_t count), (vfs_info (handle), buffer, count));
|
||||
MC_HANDLEOP (write, (int handle, const void *buf, size_t nbyte), (vfs_info (handle), buf, nbyte));
|
||||
MC_HANDLEOP (read, (int handle, void *buffer, size_t count), (vfs_info (handle), buffer, count))
|
||||
MC_HANDLEOP (write, (int handle, const void *buf, size_t nbyte), (vfs_info (handle), buf, nbyte))
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
@ -928,11 +936,15 @@ int mc_##name (const char *fname1, const char *fname2) \
|
||||
return result; \
|
||||
}
|
||||
|
||||
MC_RENAMEOP (link) MC_RENAMEOP (rename);
|
||||
MC_RENAMEOP (link)
|
||||
MC_RENAMEOP (rename)
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
mc_ctl (int handle, int ctlop, void *arg)
|
||||
int
|
||||
mc_ctl (int handle, int ctlop, void *arg)
|
||||
{
|
||||
struct vfs_class *vfs = vfs_op (handle);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user