Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 May 1998 20:05:05 +0900
From:      KIRIYAMA Kazuhiko <kiri@kiri.toba-cmt.ac.jp>
To:        ports@FreeBSD.ORG
Subject:   install-info can't delete XEmacs-style dir entry!
Message-ID:  <19980512200505C.kiri@kiri.toba-cmt.ac.jp>

next in thread | raw e-mail | index | archive | help
Hi Dear all.

I've found install-info built-in FreeBSD(GNU install-info (Texinfo
3.9) 1.2) can't delete dir entries like a "* Mew::Messaging in the
Emacs World" because it doesn't recognize XEmacs-style info dir
entry. 

I've changed install-info to make it possible. I tested in XEmacs-20.4 
and Mule-2.3 and in both it's ok. I'd like to built in this in present 
install-info.c, but which address should I send-pr to FreeBSD-* or
GNU*? , or has it already shooted in latest version TeXinfo?  Anyway I 
put diff from -current install-info.c.

--- /usr/src/contrib/texinfo/util/install-info.c	Sun Jun 29 20:52:51 1997
+++ install-info.c	Tue May 12 18:05:29 1998
@@ -20,8 +20,11 @@
 #define INSTALL_INFO_VERSION_STRING "GNU install-info (Texinfo 3.9) 1.2"
 
 #include <stdio.h>
+#include <string.h>
 #include <errno.h>
 #include <getopt.h>
+#include <ctype.h>
+#include <sys/cdefs.h>
 #include <sys/types.h>
 
 /* Get O_RDONLY.  */
@@ -150,6 +153,26 @@
   return result;
 }
 
+/* Like a strncmp but without case detection. */
+
+int
+strnccmp(s1, s2, n)
+     register const char *s1, *s2;
+     register size_t n;
+{
+
+  if (n == 0)
+    return (0);
+  do {
+    if (tolower(*s1) != tolower(*s2++))
+      return (*(const unsigned char *)s1 -
+	      *(const unsigned char *)(s2 - 1));
+    if (*s1++ == 0)
+      break;
+  } while (--n != 0);
+  return (0);
+}
+
 /* Return a newly-allocated string whose contents concatenate those of s1, s2, s3.  */
 
 char *
@@ -750,22 +773,35 @@
          Delete all entries which specify this file name.  */
       if (*dir_lines[i].start == '*')
         {
-          char *p = dir_lines[i].start;
+          char *p = dir_lines[i].start, *q;
 
+	  p++;
+          while (*p == ' ') p++;
+	  q = p;
           while (*p != 0 && *p != ':')
             p++;
           p++;
-          while (*p == ' ') p++;
-          if (*p == '(')
-            {
-              p++;
-              if ((dir_lines[i].size
-                   > (p - dir_lines[i].start + infilelen_sans_info))
-                  && !strncmp(p, infile_sans_info, infilelen_sans_info)
-                  && ( p[infilelen_sans_info] == ')' ||
-		       strncmp (p + infilelen_sans_info, ".info)", 6) == 0))
+	  if (*p == ':')
+	    {
+              if (!strnccmp(q, infile_sans_info, infilelen_sans_info)
+                  && ( *(q + infilelen_sans_info) == ':' ||
+		       strnccmp (q + infilelen_sans_info, ".info)", 6) == 0))
                 dir_lines[i].delete = 1;
             }
+	  else
+	    {
+	      while (*p == ' ') p++;
+	      if (*p == '(')
+		{
+		  p++;
+		  if ((dir_lines[i].size
+		       > (p - dir_lines[i].start + infilelen_sans_info))
+		      && !strncmp(p, infile_sans_info, infilelen_sans_info)
+		      && ( *(p + infilelen_sans_info) == ')' ||
+			   strncmp (p + infilelen_sans_info, ".info)", 6) == 0))
+		    dir_lines[i].delete = 1;
+		}
+	    }
         }
       /* Treat lines that start with whitespace
          as continuations; if we are deleting an entry,

________________________________________________________________________
KIRIYAMA Kazuhiko <kiri@kiri.toba-cmt.ac.jp>    Toba National College of 
                                                     Maritime Technology
                         Department of Electronic Mechanical Engineering

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980512200505C.kiri>