bug-findutils
[Top][All Lists]
Advanced

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

Re: [Patch] Locate: Allow reading database from stdin.


From: Buzz
Subject: Re: [Patch] Locate: Allow reading database from stdin.
Date: Wed, 8 Jun 2005 17:26:16 +0200 (MET DST)
User-agent: slrn/0.9.8.1 (Win32) Hamster/2.0.6.0 KorrNews/4.2

Op Wed,  8 Jun 2005 15:34:24 +0200 (MET DST) schreef ik
in <address@hidden>:
:  Hi,
:
:  Here is a patch which moves reading from the database and generating
:  the base_name into visitors. Support for reading a database from stdin
:  slipped in somehow...

A liitle addition for the ChangeLog:

2005-06-08  Bas van Gompel  <address@hidden>

        * NEWS, locate/locate.1, doc/find.texi: Document usage of `-'
        to refer to stdin in database-path for locate.
        * locate/locate.c: Change prototype for visitors and processors
        throughout. Move reading the database and generating base_name
        into visitors. Allow `-' to refer to stdin in database-path.
        (visit_locate02_format): Error out when new count is negative.


In the patch, I somehow turned char bigram1[128] into char *bigram1[128]
(ditto for bigram2). If you apply the patch from this mail to your
local copy, before the original patch, /it/ should apply without too
much fuzz, and leave you with a correctly patched dir. (Or, if you
prefer I can send a separate patch to fix this later.)

diff --exclude='*~' -Ndrup curr/findutils/locate/locate.c 
mine2/findutils/locate/locate.c
--- findutils/locate/locate.c   2005-06-08 02:08:24.000000000 +0200
+++ findutils/locate/locate.c   2005-06-08 14:33:34.000000000 +0200
@@ -298,9 +298,24 @@ struct regular_expression
 };
 
 
+struct process_data
+{
+  int c;                       /* An input byte.  */
+  int count; /* The length of the prefix shared with the previous database 
entry.  */
+  int len;
+  char *original_filename;     /* The current input database entry. */
+  size_t pathsize;             /* Amount allocated for it.  */
+  char *munged_filename;       /* path or base_name(path) */
+  FILE *fp;                    /* The pathname database.  */
+  char *dbfile;                        /* It's name, or "<stdin>" */
+  /* for the old database format,
+     the first and second characters of the most common bigrams.  */
+  char bigram1[128];
+  char bigram2[128];
+};
 
-typedef int (*visitfunc)(const char *munged_filename,
-                        const char *original_filename,
+
+typedef int (*visitfunc)(struct process_data *procdata,
                         void *context);
 
 struct visitor


L8r,

Buzz.
-- 
  ) |  | ---/ ---/  Yes, this | This message consists of true | I do not
--  |  |   /    /   really is |   and false bits entirely.    | mail for
  ) |  |  /    /    a 72 by 4 +-------------------------------+ any1 but
--  \--| /--- /---  .sigfile. |   |perl -pe "s.u(z)\1.as."    | me. 4^re




reply via email to

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