Re: Intelligent VFS symlink
- From: Pavel Roskin <proski gnu org>
- To: Max Schedriviy <max tavrida net>
- Cc: <mc-devel gnome org>
- Subject: Re: Intelligent VFS symlink
- Date: Thu, 26 Jul 2001 11:49:01 -0400 (EDT)
Hi, Max!
> > Any comments?
>
> May be I don't understand you, but this patch make the same.
Yes, it's a simple solution that may just be Ok for now (i.e. for 4.5.55).
Actually, it's handy to have the filename typed in the destination field -
you may want to edit it. I'm applying your patch with two minor changes:
1) The filename should be copied (not appended) if panel doesn't exist
(GMC) or is not used for listing (info screen).
2) strcat() to static buffers is not safe (I'm not saying that the
original code is good). Now using dynamic buffers.
Thank you!
There is still a lot of work to do with do_link() - it should support
selected files. But this can be done later.
-----------------------------------------
--- ChangeLog
+++ ChangeLog
@@ -2,2 +2,7 @@
+ * cmd.c (do_link): Append filename to the default symlink
+ target. Don't add path separator if there is no listing on
+ the other panel. Avoid using fixed size buffers.
+ From Max Schedriviy <max tavrida net>
+
* main.c [HAVE_X]: Disable eight_bit_clean and full_eight_bits.
--- cmd.c
+++ cmd.c
@@ -1032,26 +1032,22 @@ do_link (int symbolic_link, char *fname)
if (-1 == mc_link (fname, dest))
message (1, MSG_ERROR, _(" link: %s "), unix_error_string (errno));
} else {
-#ifdef OLD_SYMLINK_VERSION
- symlink_dialog (fname, "", &dest, &src);
-#else
+ char *s;
+ char *d;
+
/* suggest the full path for symlink */
- char s[MC_MAXPATHLEN];
- char d[MC_MAXPATHLEN];
-
- strcpy(s, cpanel->cwd);
- if ( ! ((s[0] == '/') && (s[1] == 0)))
- strcat(s, "/");
- strcat(s, fname);
- if (get_other_type () == view_listing)
- strcpy(d, opanel->cwd);
- else
- strcpy (d,"");
-
- if ( ! ((d[0] == '/') && (d[1] == 0)))
- strcat(d, "/");
+ s = concat_dir_and_file (cpanel->cwd, fname);
+
+ if (get_other_type () == view_listing) {
+ d = concat_dir_and_file (opanel->cwd, fname);
+ } else {
+ d = g_strdup (fname);
+ }
+
symlink_dialog (s, d, &dest, &src);
-#endif /* !OLD_SYMLINK_VERSION */
+ g_free (d);
+ g_free (s);
+
if (!dest || !*dest || !src || !*src) {
if (src)
g_free (src);
-----------------------------------------
--
Regards,
Pavel Roskin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]