Shorten symlinks in terminfo directories

View: New views
2 Messages — Rating Filter:   Alert me  

Shorten symlinks in terminfo directories

by Sven Joachim :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm revising the patches in the Debian ncurses package.  Thought you
might be interested in this one, created in version 5.5-2 by Daniel
Jacobowitz:

,----
| ncurses (5.5-2) unstable; urgency=low
| [...]
|   * Use shorter symlinks within terminfo directories when possible
|     (e.g. xx -> xy instead of xx -> ../x/xy).
|
|  -- Daniel Jacobowitz <dan@...>  Sun, 30 Apr 2006 16:35:05 -0400
`----


---
 ncurses/tinfo/write_entry.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/ncurses/tinfo/write_entry.c
+++ b/ncurses/tinfo/write_entry.c
@@ -418,8 +418,13 @@
  {
     int code;
 #if USE_SYMLINKS
-    strcpy(symlinkname, "../");
-    strncat(symlinkname, filename, sizeof(symlinkname) - 4);
+    if (first_name[0] == linkname[0])
+      strncpy (symlinkname, first_name, sizeof (symlinkname) - 1);
+    else
+      {
+ strcpy(symlinkname, "../");
+ strncat(symlinkname, filename, sizeof(symlinkname) - 4);
+      }
     symlinkname[sizeof(symlinkname) - 1] = '\0';
 #endif /* USE_SYMLINKS */
 #if HAVE_REMOVE


(Of course, the indentation does not match your style.)

Cheers,
       Sven

_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses

Re: Shorten symlinks in terminfo directories

by Thomas Dickey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 16 Sep 2009, Sven Joachim wrote:

> Hi,
>
> I'm revising the patches in the Debian ncurses package.  Thought you
> might be interested in this one, created in version 5.5-2 by Daniel
> Jacobowitz:
>
> ,----
> | ncurses (5.5-2) unstable; urgency=low
> | [...]
> |   * Use shorter symlinks within terminfo directories when possible
> |     (e.g. xx -> xy instead of xx -> ../x/xy).
> |
> |  -- Daniel Jacobowitz <dan@...>  Sun, 30 Apr 2006 16:35:05 -0400
> `----

thanks - I don't recall seeing this one.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net


_______________________________________________
Bug-ncurses mailing list
Bug-ncurses@...
http://lists.gnu.org/mailman/listinfo/bug-ncurses