Commit Graph

395 Commits

Author SHA1 Message Date
Slava Zanko 512ad7d962 Make working with GError in more right way (like with exceptions).
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2014-07-22 13:12:07 +04:00
Andrew Borodin 2d9cf4cad1 (vfs_s_get_line_interruptible): disable interrrupt after finish of read
...and type accuracies.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-07-22 13:10:41 +04:00
Andrew Borodin e5203cb023 Fix name of FSF in all *.c files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-28 13:33:17 +04:00
Eugene San (eugenesan) 198334ccc4 From ticket #3116: fix possible segfault when freeing a VFS.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-10 16:27:03 +04:00
Andrew Borodin f0da49345a Collapse list of copyright years to ranges. Add 2014 year.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-10 16:27:03 +04:00
Andrew Borodin 094fd0cd89 Use symbolic names for standard file descriptors.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2014-02-10 16:26:17 +04:00
Egmont Koblinger 7866bf7342 Ticket #3093: keep symlinks in cwd at startup.
If you navigate in your shell to a directory containing symlinks and
then start mc, mc will show the canonical path instead. It would be nice
to make it show the directory with the symlinks.

Example: in your shell execute these:

user:~$ mkdir -p /tmp/a/b /tmp/x ; ln -s /tmp/a/b /tmp/x/y
user:~$ cd /tmp/x/y
user:/tmp/x/y$ mc

In mc you'll find yourself in /tmp/a/b, though it'd be nicer to see
/tmp/x/y at the top, and correspondingly navigating to the parent would
take you to /tmp/x.

If you start bash or zsh from /tmp/x/y, the new instance will start
displaying the working directory as such. They do this via the PWD env
variable. On one hand, they set and maintain PWD to point to the current
directory, using the path as specified by the user (possibly containing
symbolic links). On the other hand, they check its value at startup. If
$PWD points to the same physical directory as the actual working
directory then they use this value. If $PWD points somewhere else then
it's simply ignored (so it's a hint only as to which symlinks to use to
get to the working directory, but never alters the actual cwd).

Now mc also does the same at startup (with respect of "Cd follows
links" option). Relative directories specified in the command line  are
applied after possibly replacing the canonical cwd with $PWD. This way
for example

user:/tmp/x/y$ mc . ..

opens two panels in /tmp/x/y and /tmp/x instead of /tmp/a/b and /tmp/a
(whereas /tmp/x is actually a different directory than /tmp/a).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-12-27 19:07:58 +04:00
Andrew Borodin bb65b46790 Fix use of uninitialized memory in sigaction structure.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-11-25 13:47:40 +04:00
Slava Zanko 0ed4a91d7d Reduce cppcheck warnings (style) in lib subdirectory.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-11-25 13:47:39 +04:00
Slava Zanko 0d489acd58 cppcheck: reduce variable scope.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-11-25 13:47:39 +04:00
Slava Zanko a57d45d590 Ticket #3098: vfs_path_from_str_flags() doesn't support VPF_STRIP_HOME
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-11-08 16:57:42 +03:00
Andrew Borodin e78b1fdf66 Remove redundant checks for g_strdup().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-10-04 09:14:08 +04:00
Andrew Borodin 034e973fbf (vfs_translate_path): return const char *.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-10-04 09:14:08 +04:00
Andrew Borodin 546e89f611 (vfs_path_tokens_get): minor refactoring: replace while() by for().
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-10-04 09:11:04 +04:00
Andrew Borodin 26fbddf6f4 (vfs_path_tokens_count): refactoring: get rid of extra memory allocation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-10-04 09:11:04 +04:00
Slava Zanko 857fe38e87 Fix panel recoding
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-07-23 14:15:24 +04:00
Andrew Borodin ab3f53fbbe Add DIR_IS_DOT and DIR_IS_DOTDOT macros
...to detect "." and ".." directories, respectively.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-23 14:15:24 +04:00
Amadeusz Sławiński 33c47b5734 Ticket #3025: race condition when creating temporary directory.
When there's no mc-tmpdir and a user tries to start two mc sessions
simultaneously, sometimes (in one out of ten attempts on my machine) one
mc session emits the following error message:

Cannot create temporary directory /tmp/mc-lars: File exists (17)
Temporary files will be created in /tmp
Press any key to continue...

Steps to reproduce:

# rm /tmp/mc-$(whoami) -rf
# uxterm -e mc & uxterm -e mc

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-07-05 20:58:41 +04:00
Slava Zanko d2eac2f5af Code reorganization and fixes around the vfs_path_as_str() function
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-06-28 09:21:16 +04:00
Andrew Borodin 32bc72a1d7 (vfs_path_as_string): clarify return value.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-28 09:21:16 +04:00
Andrew Borodin e7dc599e42 Use "'" instead of "`" for messages and comments quoting.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-03 14:21:03 +03:00
Andrew Borodin 3662b84ba1 (vfs_get_encoding): optimization and enhancement:
* get rid of extra memory duplication;
  * support of recursive search of correct encoding;
  * add tests.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2013-06-03 14:21:02 +03:00
Slava Zanko 2640b21bb9 Remove vfs_path_to_str() function for avoid often memory allocations.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-06-03 14:21:01 +03:00
Slava Zanko c984447f8e Rename vfs_path_cmp() to vfs_path_equals()
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-03-09 16:04:18 +04:00
Slava Zanko f866709186 Concretize the usage of autocompliting in different input fields.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-02-04 15:48:21 +03:00
Slava Zanko 2d58735deb Extend QUICK_INPUT and QUICK_LABELED_INPUT macros for getting completion flags via parameters instead of using hardcoded value
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-02-04 15:29:15 +03:00
Slava Zanko ee8aaf6181 Avoid compiler errors like: error: variable 'xxx' set but not used [-Werror=unused-but-set-variable]
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-01-17 15:21:35 +03:00
Andrew Borodin 5e070286b1 Indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-12-20 16:22:23 +04:00
Andrew Borodin 17cadc50ec Portability: use g_ascii_strtoll instead of strtoll, atoll and atof.
Set minimal version of GLib up to 2.12 because of g_ascii_strtoll.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-12-20 15:35:35 +04:00
Andrew Borodin 82b1d7bff3 Parenthesis around some -1.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-12-20 15:35:35 +04:00
Pavel Vasilyev f84bbd8583 vfs_s_subclass::linear_read: return ssize_t instead of int.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-12-20 15:35:18 +04:00
Pavel Vasilyev fafd75c807 lib/vfs/direntry.c: types accuracy.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-12-20 15:35:18 +04:00
Andrew Borodin 848318f95f lib/vfs/vfs.h: indentation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-12-20 15:35:18 +04:00
Andrew Borodin 60727b9b79 Clarify usage of AM_CPPFLAGS.
Use AM_CPPFLAGS not AM_CFLAGS for includes. GLIB_CFLAGS are CPPFLAGS, actually.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-12-18 16:27:49 +04:00
Andrew Borodin 2940b7455d Fix of DOXYGEN docs: @return instead of @returns
...and other minor corrections.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-11-09 10:05:13 +04:00
Andrew Borodin 1d3132c08f Clarify of sig_atomic_t usage (got from Mutt).
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-11-09 10:05:13 +04:00
Andrew Borodin 8b3ed9bfdc (mc_mkstemps): use g_mkstemp() to generate name of temporary file.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-10-20 15:39:44 +04:00
Ilia Maslakov 55c8f041da fixed doxygen documentation
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2012-09-10 14:29:53 +03:00
Andrew Borodin 4a0004f6c2 Ticket #2874: enter on directory named '~' goes to the home one.
Revert "Support of use ~ as home directory in hotlist."
This partially reverts commit dd9c7516a3.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-09-06 10:30:28 +04:00
Slava Zanko 949d257f37 Ticket #2791: Fixed: cannot Copy/Move files with filename encoding change
Steps to reproduce:
 * run mc
 * change encoding one of panels to any different from system encoding
 * try to copy any file to panel with changed encoding

Expected result: files should be copied.

Actual result: error box here.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-08-29 13:30:28 +03:00
Andrew Borodin 908e747861 Optimization of ini files load.
Some ini files (keymaps, skins) are loaded in read-only mode. For those
files, we don't need load and keep comments.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-07-31 14:50:11 +04:00
Andrew Borodin acdac76a49 Revert "Try fix of compile warnings about assigned but unused variables"
This reverts commit 6505f7d6fa.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-07-18 12:03:31 +04:00
Slava Zanko 94bd4b1f78 Code indentation.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-07-17 17:04:05 +04:00
Slava Zanko 6505f7d6fa Try fix of compile warnings about assigned but unused variables
...as returned values of functions declared with attribute
warn_unused_result [-Wunused-result].

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-07-17 17:04:05 +04:00
Andrew Borodin 23c95d36ac Code cleanup: removed unused variables amd removed unnedeed code.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-07-17 17:04:05 +04:00
Slava Zanko c277ac5b6f Ticket #2834: Fixed bug 'FTBFS with --disable-vfs'
Steps to reproduce:
 * ./configure --disable-vfs
 * make

Expected result: project should be builded successfully.

Actual result:
build stopped with errors:
lib/vfs/interface.c: In function 'mc_chdir':
lib/vfs/interface.c:714: error: 'struct vfs_s_super' has no member named 'path_element'
lib/vfs/interface.c:716: error: 'struct vfs_s_super' has no member named 'path_element'
lib/vfs/interface.c:717: error: 'struct vfs_s_super' has no member named 'path_element'

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-06-29 12:45:57 +03:00
Andrew Borodin 315c499c09 Ticket #2827: tweak and cleanup of code in case of --disable-charset option usage.
First step: tweak vfs-related code.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-06-25 16:56:11 +04:00
Slava Zanko a2a01d94e9 Ticket #2821: Fixed defect: ftp to a second site does not work
Steps to reproduce:

 * cd  ftp://ftp.gnome.org/
 * Run "cd" in the panel where the remote site is open
 * cd  ftp://ftp.kernel.org/

Actual result: The directory content from ftp.gnome.org FTP-server.
Expected results: The directory content from kernel.org FTP-server.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-06-06 12:07:54 +03:00
Slava Zanko 5c6ae102f2 lib/vfs/interface.c: Added checking if super->path_element is not NULL
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-05-18 13:44:12 +03:00
Slava Zanko 21d1f61b40 Ticket #2800: Garbage directory listing in ftpfs
Just open any non-anonymous FTP connection.
2012-05-18 12:31:29 +03:00
Andrew Borodin a878a2dd37 (vfs_expare): changed argument type from int to gboolean.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-04-22 11:25:11 +03:00
Andrew Borodin 0073a137af (vfs_url_split): optimized to get rid of multiple string length caclulation.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-04-22 11:25:11 +03:00
Andrew Borodin 58cf4e735c (vfs_path_element_clone): ret rid of extra actions.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-04-22 11:25:10 +03:00
Andrew Borodin a4426ee8d7 (vfs_get_raw_current_dir): return pointer to constant.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-04-22 11:25:10 +03:00
Slava Zanko 0a44a9ff5f Ticket #2779: Active VFS directories list contain incorrect current path
1) login to any ftp or fish resource
2) select ftp/fish entry and change current path
3) go back to old path
4) press Ctrl+X A (open "Active VFS directories" dialog)

Expected result: should be correct path to current VFS path
Actual result: path is incorrect.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-04-22 10:23:13 +03:00
Slava Zanko 33ea9092f5 Ticket #2777: Stale symlinks in vfs
How to reproduce:
 * mkdir -p a/b/c
 * touch a/b/c/d
 * ln -s d a/b/c/e
 * tar -cf bad.tar a
 * rm -rf a
 * cd bad.tar/utar://a/b/c

Expected result: 'e' should be valid symlink to 'd'
Actual result: 'e' looks like broken link

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-04-18 15:55:13 +03:00
Slava Zanko 88483f5fac Fixed creating string from relative non-local VFS.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-25 15:28:45 +03:00
Slava Zanko ecda2061f2 Ticket #2758: cd command not working in shell link
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-25 15:28:45 +03:00
Slava Zanko 49532ac834 Ticket #2755: cannot copy zero-length files with [Preallocate space] option
If [Preallocate space] option is enabled, MC can't copy zero-length files:
"Cannot preallocate space for target file ... Invalid argument (22)"

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-25 15:20:17 +03:00
Andrew Borodin 308237aa11 Fixed preprocessor conditions.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-03-19 11:06:00 +03:00
Andrew Borodin 1b4df2bdd2 Removed check of unused header files.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-03-19 11:04:57 +03:00
Andrew Borodin 13a660d2e0 Allow setup mc home directory using MC_HOME environment variable.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-03-19 11:43:55 +03:00
Ilia Maslakov 0f9083f9c0 fixed reading the not initialized data
Signed-off-by: Ilia Maslakov <il.smind@gmail.com>
2012-03-15 12:47:46 +03:00
Andrew Borodin dd9c7516a3 Support of use ~ as home directory in hotlist.
Expand tilde while vfs path canonicalize.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-03-12 16:23:59 +03:00
Slava Zanko 05d220a9c6 vfs_path: Fixed broken relative paths processing.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:52:31 +03:00
Slava Zanko a8da7179d0 Return values of following functions are constants now:
* vfs_path_get_last_path_str()
  * vfs_path_get_last_path_vfs()
  * vfs_path_get_by_index()
  * vfs_class_find_by_handle()

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2012-03-06 11:52:31 +03:00
Slava Zanko 2b5c28b316 Changes to handle vfs_path_t object:
* removed strip_password () function;
 * Added new vfs_path flag: VPF_HIDE_CHARSET;
 * added vfs_path_add_element() function.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:52:31 +03:00
Slava Zanko 18d8b06238 VFS: Added new function vfs_path_to_str_flags()
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:52:31 +03:00
Slava Zanko 8562a215be Code refactoring: removed concat_dir_and_file() function.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:52:30 +03:00
Slava Zanko db58cd9ca7 Changed internal editor to use vfs_path_t objects.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:52:30 +03:00
Slava Zanko ddf8c542c9 Added function vfs_path_cmp()
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:45:51 +03:00
Slava Zanko b319ddfbab Added vfs_path_cmp() ans vfs_path_ncmp() functions
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:45:51 +03:00
Slava Zanko 78f9f4252e VFS: internal changes in vfs_path_t type.
Changed type of array from slower GList to faster GArray.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:45:50 +03:00
Slava Zanko 902e5cb978 Changed format of string 'current directory path' at header of panel.
* path elements now are separated and shown one-by-one
   (eg. ftp://some.in.net instead of ~/some/path/ftp://some.in.net)
 * encoding info is shown separated at top of header line

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:45:50 +03:00
Slava Zanko 0aa10fd6cb Changed type of WPanel::cwd (char *) and WPanel::lwd (char *)
...to WPanel::cwd_vpath (vfs_path_tr *) and WPanel::lwd_vpath (vfs_path_t *).

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:45:50 +03:00
Slava Zanko 66e5af24d9 Added new fnction for manipulate vpath objects:
* vfs_path_append_vpath_new ()
 * vfs_path_vtokens_get ()

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:26 +03:00
Slava Zanko a34a3b3aa5 Added vfs_path_tokens_count() and vfs_path_tokens_get() functions
...for easy work with vfs_path_t tokens.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:26 +03:00
Slava Zanko 75c2b483ff Changed interface of functions mc_getlocalcopy() and mc_ungetlocalcopy()
...to handle vfs_path_t object as parameter.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:26 +03:00
Slava Zanko ff69719304 Added inline function vfs_path_get_last_path_vfs()
...to simple get VFS class for last path element without malloc/free
operations.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:26 +03:00
Slava Zanko 02f31f4db6 Added inline function vfs_path_get_last_path_str()
...to simple get path string without malloc/free operations.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:26 +03:00
Slava Zanko 389ac85992 Changed input parameters of mc_mkstemp() and mc_tempdir() functions
to handle vfs_path_t type.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:26 +03:00
Slava Zanko 53c500f58c Moved functions mc_mkstemp() and mc_tempdir() to VFS module.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:25 +03:00
Slava Zanko 4945d0f9a6 Changed interface of function mc_open() for handle vfs_path_t object as parameter
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:25 +03:00
Slava Zanko 0a7caff306 Changed interface of function mc_symlink()
...to handle vfs_path_t object as parameter.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:25 +03:00
Slava Zanko b27f686f87 Changed interface of functions mc_link() and mc_rename()
...to handle vfs_path_t object as parameter.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:25 +03:00
Slava Zanko 3f6f89bc49 Changed interface of following functions to handle vfs_path_t object as parameter:
* mc_chmod()
 * mc_chown()
 * mc_utime()
 * mc_readlink()
 * mc_unlink()
 * mc_mkdir()
 * mc_rmdir()
 * mc_mknod()

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:25 +03:00
Slava Zanko 031e994cba changed interface of function mc_setctl() for handle vfs_path_t object as parameter
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:25 +03:00
Slava Zanko 9177b954df Removed split_dir_name() function.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:25 +03:00
Slava Zanko 034252a71a Changed interface of function mc_opendir()
...to handle vfs_path_t object as parameter.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:24 +03:00
Slava Zanko eeaad790ab Changed interface of mc_stat() and mc_lstat() functions
...to handle vfs_path_t object as parameter.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:41:24 +03:00
Slava Zanko c47bc3778e added vfs_path_build_filename() function
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:33:12 +03:00
Slava Zanko 8ec4f94dc6 changed interface of function mc_chdir() for handle vfs_path_t object as parameter
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:33:12 +03:00
Slava Zanko d69d9b31f1 VFS core: vfs_s_free_inode() function have global visibility
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:33:12 +03:00
Slava Zanko e2c326997f Added usage of VFS_S_USETMP flag
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:33:12 +03:00
Slava Zanko 73a7f1ce67 Ticket #2695: The vfs_path_t expansion to 'src/' subdirectory
Added vfs_subclass_flags_t type

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2012-03-06 11:33:12 +03:00
Slava Zanko ffbd9561f0 Ticket #2652: SMB is broken
After #2361, smb vfs module doesn't work at all.
The error message "Cannot chdir to ..." raises after hostname enter.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-10-31 23:31:59 +03:00
Andrew Borodin 0035a1de73 Ticket #2643: can't compile on OpenIndiana (Solaris)
lib/vfs/parse_ls_vga.c: added #include "lib/unixcompat.h" where makedev
macro is defined.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-10-28 11:59:33 +04:00
Sergei Trofimovich fbb770d47a fix build error in ‘vfs_preallocate’: vfs.c:613:12: error: ‘dest_desc’ undeclared (first use in this function)
When platform does not define HAVE_POSIX_FALLOCATE we get this error:

  CC     vfs.lo
../../../../mc/lib/vfs/vfs.c: In function 'vfs_preallocate':
../../../../mc/lib/vfs/vfs.c:613:12: error: 'dest_desc' undeclared (first use in this function)
../../../../mc/lib/vfs/vfs.c:613:12: note: each undeclared identifier is reported only once for each function it appears in
../../../../mc/lib/vfs/vfs.c:610:22: warning: unused parameter 'dest_vfs_fd' [-Wunused-parameter]

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2011-10-26 07:56:46 +03:00
Sergey 95c553c467 Ticket #2635: mc adds spaces an the beginning of all files/dirs at the ftp server
For FTP servers, that do not send ".." in directory listing, mc adds one space to the name of every file and directory. Attached patch should fix this problem.

Steps to reproduce:
cd /#ftp:ftp.symantec.com

Expected result:
Correct list of files/directories

Actual result:
File/directory names with leading spaces

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-10-24 21:17:28 +03:00
Slava Zanko 41af257135 Added configuration option 'preallocate_space' for toggle space preallocating behaviour.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-10-20 10:51:08 +03:00
Slava Zanko 323fedecd7 Added implementation for files space preallocation
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-10-20 10:51:08 +03:00
Andrew Borodin 664b3efcda Ticket #2623: vfs: use data after free.
(vfs_s_close): vfs-specific data of file handler
vfs_file_handler_t::data is freed in vfs_s_subclass::fh_close method and
then can be used in vfs_s_subclass::file_store_one. Bug is related to
ftp and fish VFSes.

Added new vfs_s_subclass::fh_free_data method to free vfs-specific data
of file handler vfs_file_handler_t::data. Use it in ftp and vfs VFSes.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-10-19 12:45:28 +04:00
Slava Zanko 0138645541 Ticket 1551: Update GPL version from 2 to 3
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-10-18 14:08:34 +03:00
Andrew Borodin 6dabcb5f55 VFS small optimization
(vfs_class_data_find_by_handle, vfs_class_find_by_handle): move same
code to the separate function vfs_get_openfile().

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-10-17 13:30:03 +03:00
Andrew Borodin b61e0fc6a9 (_vfs_get_cwd): fixed memory leak.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2011-10-17 13:30:03 +03:00
Slava Zanko 12dfe1bd55 VFS ftpfs: fixed broken filenames in unaligned 'ls' command output
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-09-08 20:10:48 +03:00
Slava Zanko 20c4694ee5 Ticket #2594: ftp failures - leading white space in file name
Code cleanup: move 'ls' output parser (and functions-satellites) to
new file parse_ls_vga.c

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-09-08 20:10:48 +03:00
Slava Zanko 20a79d52ab Ticket #2595: Broken panels recode in current master
Fixed path recoding

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-09-08 13:50:02 +03:00
Slava Zanko 4e56efafe6 Ticket #81: savannah: can't access files on ftp starting with space
files starting with space can't be acessed by mc through ftp - it
shows the file as not having the leading space and attempts to
access it produce 'permission denied' errors.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-07-11 19:50:32 +03:00
Slava Zanko 0f249bd9b5 Fixed errors while connect to IPv6 hosts
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-07-05 16:09:57 +03:00
Slava Zanko 32a9f8257d Deprecated parser now used just in Hotlist widget.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-07-05 16:09:57 +03:00
Slava Zanko 12af8e5db0 fixed relative symlink operations. Symlink now stay relative
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-07-05 16:09:57 +03:00
Andrew Borodin ea4078e52e Ticket #2361: VFS URI reimplementation
Code cleanup:

 * (vfs_set_raw_current_dir): remove redundant check.
 * VFS: minor optimizations.
 * Fixed type of mode argument of vfs_class:chmod method.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-07-05 16:09:23 +03:00
Slava Zanko c8ae0a5aaf Code cleanup
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:02 +03:00
Slava Zanko 91fe0d71bb vfs_path_get_by_index(): added check for valid element index
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:02 +03:00
Slava Zanko 5fa1070225 Fixed memory leaks in folowing functions:
* mc_opendir()
 * mc_chdir()
 * vfs_release_path()
 * check_panel_timestamp()

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:02 +03:00
Slava Zanko 60123b7c99 Removed function vfs_s_get_path(); Function vfs_s_get_path_mangle() renamed to vfs_s_get_path()
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:02 +03:00
Slava Zanko 04a4ed0ece added vfs_path_element_valid() function
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:01 +03:00
Slava Zanko bba132381e vfs_path_to_str() now return URL string instead of old representation
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:01 +03:00
Slava Zanko 2ec4cc59ab Added URL-like path parser
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:01 +03:00
Slava Zanko 39462b9b76 Reorder VFS parser to work with VFS parameters:
* Removed vfs_path_element_t->raw_url_str;
 * Changed some VFS prefixes (colon now used when need to split VFS prefix and VFS parameters);
 * Removed vfs_translate_url() functions and related code;
 * added converter of VFS parameters to string representation.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:01 +03:00
Slava Zanko e6ec447585 Following prototypes of functions was changed in VFS-module API:
* archive_check
 * archive_same
 * open_archive

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:00 +03:00
Slava Zanko e9ed6a41cf Added function vfs_path_url_split() for parse VFS parameters
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:00 +03:00
Slava Zanko 3d1e2df9b7 Removed vfs_get_class() function
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:00 +03:00
Slava Zanko 922114a1d0 Following prototypes of functions was changed in VFS-module API:
* archive_check
 * archive_same
 * open_archive

Added new functions:

 * vfs_path_element_clone()
 * vfs_path_clone()
 * vfs_path_remove_element_by_index()

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:00 +03:00
Slava Zanko 997876a109 Remove vfs_url_t structure (replace with vfs_path_element_t)
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:00 +03:00
Slava Zanko 3eafe7308a Added serialization and deserialization for vfs_path_t object
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:00 +03:00
Slava Zanko e8d58f188d Fixed segfault while trying create dir in r/o VFS'es
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:45:00 +03:00
Slava Zanko ac939a1bea Fixed path recoding in VFS modules
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:59 +03:00
Slava Zanko 691c06ce30 removed vfs_path_t->unparsed variable
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:59 +03:00
Slava Zanko a5dc2de78b Added vfs_change_encoding() and vfs_path_element_need_cleanup_converter() functions.
Changes for handling directory encoding.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:59 +03:00
Slava Zanko c0004807d4 vfs_path_element_t->encoding now handled in lib/vfs/path.c
Added testcase for testinh path encoding.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:59 +03:00
Slava Zanko cedad03833 Move vfs_get_encoding() to path.c and make as static function.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:59 +03:00
Slava Zanko b0df841a4a Removed vfs_path_t->unparsed_encoding.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:59 +03:00
Slava Zanko ebe519ef15 remove struct dirinfo definition
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:59 +03:00
Slava Zanko 405cc98cea VFS: Make functions vfs_canon_and_translate() and vfs_canon() as static in lib/vfs/path.c
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:59 +03:00
Slava Zanko 8ea49095c3 Changed functions vfs_file_is_local() and vfs_file_class_flags() for handle vfs_path_t type
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:59 +03:00
Slava Zanko 7745006b60 VFS: removed interface.h
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:59 +03:00
Slava Zanko 093128c532 VFS: Current directory handler now have type vfs_path_t
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:59 +03:00
Slava Zanko a12fdfbb0e VFS: many changes for use vfs_path_t
* completed vfs_path_from_str();
 * completed vfs_path_to_str() and vfs_path_to_str_elements_count();
 * removed deprecated vfs_split();
 * changes in all related code;
 * new unit tests.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:59 +03:00
Slava Zanko 9e4dc03e9e lib/vfs/direntry.c: vfs_s_inode_from_path() and vfs_s_get_path() now handle vfs_path_t
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:59 +03:00
Slava Zanko 6329976c89 VFS: fixed # sign in passwd or in path string
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:58 +03:00
Slava Zanko 152124d9b7 Following prototypes of functions was changed in VFS-module API:
* getid
 * mkdir
 * rmdir
 * setctl

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:58 +03:00
Slava Zanko d67da5dfa8 Following prototypes of functions was changed in VFS-module API:
* readlink
 * symlink
 * rename
 * link
 * unlink
 * mknod

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:58 +03:00
Slava Zanko 1406eb5035 Following prototypes of functions was changed in VFS-module API:
* opendir
 * stat
 * lstat
 * chdir

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:58 +03:00
Slava Zanko dd19ca201d Following prototypes of functions was changed in VFS-module API:
* chmod
 * chown
 * utime

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:58 +03:00
Slava Zanko 479902f83e Following prototypes of functions was changed in VFS-module API:
* open
 * getlocalcopy
 * ungetlocalcopy

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:58 +03:00
Slava Zanko 41f2e27f8d VFS: Use vfs_path_t in some interface functions
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:58 +03:00
Slava Zanko 3a1936aade Added vfs_path_t structure
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:57 +03:00
Slava Zanko 2c0ae5aa55 Moved interface functions from lib/vfs/vfs.[ch] to lib/vfs/interface.[ch]
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2011-06-23 14:44:57 +03:00