Intelligent VFS symlink

Pavel Roskin proski at gnu.org
Wed Jul 25 22:11:44 UTC 2001


Hi, Michal!

> This patch modifies VFS symlink behavior to be a little more intelligent
> -- similar to the "ln -s /path/file /newpath/". There would be no need to
> enter the file name twice by hand if it is the same.

It's a very good idea!  Thank you.

> If I want to symlink /path/file (it is a current file) and /newpath/ is
> the other panel, it would be enough to just press Ctrl+X and S and Enter.
> Now, the user has to switch to the target field and append the source
> filename.

Yes, this would be very handy.

> Any comments?

Please write a ChangeLog entry next time.  It would be much easier to
understand your change if you commented it in a "formal" manner.

> +int
> +mc_symlink (char *oldpath, char *newpath)

Using VFS is probably wrong.  It's not uncommon to compile mc without VFS
for embedded systems.  Users of mc without VFS will not be able to use
Ctrl+X S Enter in the way you are describing for no real reason.

I would prefer to have "smart functions" on a higher level, closer to the
user interface.

> +    if (result == -1)
> +      (*__errno_location ())  = vfs->symlink ? ferrno (vfs) : 38;

I'm pretty sure that __errno_location() is not portable.  Please don't use
any new functions unless you add a configure check for them or you have
reasons to believe that they are _very_ portable (e.g. they are described
in the POSIX standard _and_ "info glibc" documents them _and_ it doesn't
say that it's not portable to older systems).

-- 
Regards,
Pavel Roskin





More information about the mc-devel mailing list