Skip to content

Instantly share code, notes, and snippets.

@metasta
Created February 17, 2012 05:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metasta/1851020 to your computer and use it in GitHub Desktop.
Save metasta/1851020 to your computer and use it in GitHub Desktop.
AND search mlocate

"AND search" mlocate

locate is a Unix utility used to find files on filesystems.

By default it is "OR search".

How to build "AND search" mlocate

1. Get mlocate

(https://fedorahosted.org/mlocate/wiki/MlocateDownloads)

2. Unarchive

3. Patch

$ cd src/
$ patch < locate.diff

4. Build

$ cd ../
$ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib
$ make
$ sudo chown :mlocate src/locate
$ sudo chmod 2755 src/locate

5. Done

--- locate.c.orig 2009-04-14 18:41:30.000000000 +0900
+++ locate.c 2012-02-17 14:00:00.000000000 +0900
@@ -358,7 +358,7 @@
/* .. after this zero-length marker */
static void *uc_obstack_mark;
-/* Does STRING match one of conf_patterns? */
+/* Does STRING match all of conf_patterns? */
static bool
string_matches_pattern (const char *string)
{
@@ -394,7 +394,7 @@
conf_ignore_case != false ? FNM_CASEFOLD : 0)
== 0);
}
- if (matched != false)
+ if (matched == false)
break;
}
return matched;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment