texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

texinfo/util install-info.c,1.3,1.4


From: karl
Subject: texinfo/util install-info.c,1.3,1.4
Date: Sat, 27 Mar 2004 01:24:49 +0100

Update of /cvsroot/texinfo/texinfo/util
In directory sheep:/tmp/cvs-serv13008

Modified Files:
        install-info.c 
Log Message:
(menu_item_equal): compare basenames, so lilypond/
subdir will match.  Bug report from Werner,
21 Mar 2004 08:31:10 +0100.


Index: install-info.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/install-info.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** install-info.c      18 Mar 2004 22:15:38 -0000      1.3
--- install-info.c      27 Mar 2004 00:24:44 -0000      1.4
***************
*** 316,322 ****
  menu_item_equal (const char *item, char term_char, const char *name)
  {
    unsigned name_len = strlen (name);
    /* First, ITEM must actually match NAME (usually it won't).  */
!   int ret = strncasecmp (item, name, name_len) == 0;
    if (ret)
      {
--- 316,341 ----
  menu_item_equal (const char *item, char term_char, const char *name)
  {
+   const char *item_basename = item;
    unsigned name_len = strlen (name);
+ 
+   /* We must compare the basename in ITEM, since we are passed the
+      basename of the original info file.  Otherwise, a new entry like
+      "lilypond/lilypond" won't match "lilypond".
+      
+      Actually, it seems to me that we should really compare the whole
+      name, and not just the basename.  Couldn't there be dir1/foo.info
+      and dir2/foo.info?  Also, it seems like we should be using the
+      filename from the new dir entries, not the filename on the command
+      line.  Not worrying about those things right now, though.  --karl,
+      26mar04.  */
+   while (*item_basename && !IS_SLASH (*item_basename))
+     item_basename++;
+   if (! *item_basename)  
+     item_basename = item;  /* no /, use original */
+   else
+     item_basename++;       /* have /, move past it */
+     
    /* First, ITEM must actually match NAME (usually it won't).  */
!   int ret = strncasecmp (item_basename, name, name_len) == 0;
    if (ret)
      {
***************
*** 336,341 ****
            char *suffix = suffixes[i];
            unsigned suffix_len = strlen (suffix);
!           ret = strncasecmp (item + name_len, suffix, suffix_len) == 0
!                 && item[name_len + suffix_len] == term_char;
          }
      }
--- 355,360 ----
            char *suffix = suffixes[i];
            unsigned suffix_len = strlen (suffix);
!           ret = strncasecmp (item_basename + name_len, suffix, suffix_len) == 0
!                 && item_basename[name_len + suffix_len] == term_char;
          }
      }
***************
*** 1115,1120 ****
            if (dirfile)
              {
!               fprintf (stderr, _("%s: Specify the Info directory only 
once.\n"),
!                        progname);
                suggest_asking_for_help ();
              }
--- 1134,1139 ----
            if (dirfile)
              {
!               fprintf (stderr, _("%s: already have dir file: %s\n"),
!                        progname, dirfile);
                suggest_asking_for_help ();
              }
***************
*** 1125,1130 ****
            if (dirfile)
              {
!               fprintf (stderr, _("%s: Specify the Info directory only 
once.\n"),
!                        progname);
                suggest_asking_for_help ();
              }
--- 1144,1149 ----
            if (dirfile)
              {
!               fprintf (stderr, _("%s: already have dir file: %s\n"),
!                        progname, dirfile);
                suggest_asking_for_help ();
              }
***************
*** 1296,1300 ****
       In each section, find the proper alphabetical place to add
       each of the entries.  */
- 
    if (!delete_flag)
      {
--- 1315,1318 ----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]