slocate-02-string.diff revision 18861
18861N/ACommon subdirectories: slocate-3.1.orig/debian and slocate-3.1/debian
18861N/ACommon subdirectories: slocate-3.1.orig/doc and slocate-3.1/doc
18861N/ACommon subdirectories: slocate-3.1.orig/src and slocate-3.1/src
18861N/Adiff -ur slocate-3.1.orig/src/cmds.c slocate-3.1/src/cmds.c
18861N/A--- slocate-3.1.orig/src/cmds.c Wed Mar 8 12:40:11 2006
18861N/A+++ slocate-3.1/src/cmds.c Fri May 8 15:16:16 2009
18861N/A@@ -585,9 +585,9 @@
18861N/A head_ptr = fbuf;
18861N/A while (head_ptr) {
18861N/A /* find filesystem type */
18861N/A- if ((head_ptr = strchr(head_ptr,' '))) {
18861N/A+ if ((head_ptr = strchr(head_ptr,'\t'))) {
18861N/A head_ptr += 1;
18861N/A- head_ptr = strchr(head_ptr,' ');
18861N/A+ head_ptr = strchr(head_ptr,'\t');
18861N/A }
18861N/A
18861N/A if (!head_ptr)
18861N/A@@ -595,7 +595,7 @@
18861N/A
18861N/A head_ptr += 1;
18861N/A
18861N/A- tail_ptr = strchr(head_ptr,' ');
18861N/A+ tail_ptr = strchr(head_ptr,'\t');
18861N/A if (!tail_ptr) {
18861N/A head_ptr = NULL;
18861N/A continue;
18861N/A@@ -614,7 +614,7 @@
18861N/A matched = 1;
18861N/A }
18861N/A
18861N/A- *tail_ptr = ' ';
18861N/A+ *tail_ptr = '\t';
18861N/A
18861N/A if (matched) {
18861N/A /* go backwards a bit so that we can get the
18861N/A@@ -621,7 +621,7 @@
18861N/A * mount point of the filesystem */
18861N/A head_ptr -= 2;
18861N/A
18861N/A- while (*head_ptr != ' ' && head_ptr != fbuf)
18861N/A+ while (*head_ptr != '\t' && head_ptr != fbuf)
18861N/A head_ptr -= 1;
18861N/A
18861N/A if (head_ptr == fbuf) {
18861N/A@@ -631,7 +631,7 @@
18861N/A
18861N/A head_ptr += 1;
18861N/A
18861N/A- if (!(tail_ptr = strchr(head_ptr,' '))) {
18861N/A+ if (!(tail_ptr = strchr(head_ptr,'\t'))) {
18861N/A report_error(g_data, FATAL, "parse_fs_exclude: File System Exclude: (2) corrupt mtab file: %s\n", MTAB_FILE);
18861N/A goto EXIT;
18861N/A }
18861N/A@@ -648,7 +648,7 @@
18861N/A strcat(exclude_str, ",");
18861N/A strcat(exclude_str, head_ptr);
18861N/A
18861N/A- *tail_ptr = ' ';
18861N/A+ *tail_ptr = '\t';
18861N/A }
18861N/A
18861N/A
18861N/A@@ -707,7 +707,7 @@
18861N/A if (strcmp(g_data->progname, "updatedb") == 0)
18861N/A cmd_data->updatedb = TRUE;
18861N/A
18861N/A- while ((ch = getopt(argc,argv,"VvuhqU:r:o:e:l:d:-:n:f:c:i")) != EOF) {
18861N/A+ while ((ch = getopt(argc,argv,":VvuhqU:r:o:e:l:d:-:n:f:c:i")) != EOF) {
18861N/A switch(ch) {
18861N/A /* Help */
18861N/A case 'h':
18861N/A@@ -823,6 +823,20 @@
18861N/A goto EXIT;
18861N/A }
18861N/A break;
18861N/A+ case '?':
18861N/A+ if ( optopt == '-' ) {
18861N/A+ char *tmp_optarg;
18861N/A+ tmp_optarg = argv[optind-1] + 2;
18861N/A+
18861N/A+ dash_ret = parse_dash(g_data, tmp_optarg);
18861N/A+ if (!dash_ret)
18861N/A+ goto EXIT;
18861N/A+ else if (dash_ret == 2) {
18861N/A+ cmd_data->exit_but_nice = 1;
18861N/A+ goto EXIT;
18861N/A+ }
18861N/A+ }
18861N/A+ break;
18861N/A default:
18861N/A break;
18861N/A }
18861N/Adiff -ur slocate-3.1.orig/src/cmds.h slocate-3.1/src/cmds.h
18861N/A--- slocate-3.1.orig/src/cmds.h Sat Jan 7 02:30:38 2006
18861N/A+++ slocate-3.1/src/cmds.h Fri May 8 15:06:31 2009
18861N/A@@ -30,4 +30,24 @@
18861N/A int parse_fs_exclude(struct g_data_s *g_data, char *data_str);
18861N/A int parse_exclude(struct g_data_s *g_data, char *estr);
18861N/A
18861N/A+#ifdef getopt
18861N/A+#undef getopt
18861N/A+#endif
18861N/A+
18861N/A+#ifdef optarg
18861N/A+#undef optarg
18861N/A+#endif
18861N/A+
18861N/A+#ifdef optind
18861N/A+#undef optind
18861N/A+#endif
18861N/A+
18861N/A+#ifdef opterr
18861N/A+#undef opterr
18861N/A+#endif
18861N/A+
18861N/A+#ifdef optopt
18861N/A+#undef optopt
18861N/A+#endif
18861N/A+
18861N/A #endif
18861N/Adiff -ur slocate-3.1.orig/src/conf.c slocate-3.1/src/conf.c
18861N/A--- slocate-3.1.orig/src/conf.c Tue Dec 20 14:30:39 2005
18861N/A+++ slocate-3.1/src/conf.c Fri May 8 15:03:01 2009
18861N/A@@ -25,8 +25,8 @@
18861N/A #include "slocate.h"
18861N/A #include "utils.h"
18861N/A #include "cmds.h"
18861N/A+char *strndup ( const char *s, size_t n);
18861N/A
18861N/A-
18861N/A char * get_next_char(char ch, char *ptr)
18861N/A {
18861N/A while (*ptr && *ptr != ch && *ptr != '\n')
18861N/A@@ -239,4 +239,23 @@
18861N/A }
18861N/A
18861N/A return res;
18861N/A+}
18861N/A+
18861N/A+char *strndup ( const char *s, size_t n)
18861N/A+{
18861N/A+ size_t nAvail;
18861N/A+ char *p;
18861N/A+
18861N/A+ if ( !s )
18861N/A+ return 0;
18861N/A+
18861N/A+ if ( strlen(s) > n )
18861N/A+ nAvail = n + 1;
18861N/A+ else
18861N/A+ nAvail = strlen(s) + 1;
18861N/A+ p = malloc ( nAvail );
18861N/A+ memcpy ( p, s, nAvail );
18861N/A+ p[nAvail - 1] = '\0';
18861N/A+
18861N/A+ return p;
18861N/A }
18861N/Adiff -ur slocate-3.1.orig/src/slocate.c slocate-3.1/src/slocate.c
18861N/A--- slocate-3.1.orig/src/slocate.c Wed Mar 8 12:40:11 2006
18861N/A+++ slocate-3.1/src/slocate.c Fri May 8 15:03:01 2009
18861N/A@@ -347,7 +347,7 @@
18861N/A if (!encode(g_data, fd, file->fts_path, &enc_data))
18861N/A goto EXIT;
18861N/A } else if (matched != -1) {
18861N/A- fts_set(dir, file, FTS_SKIP);
18861N/A+ fts_set(NULL, file, FTS_SKIP);
18861N/A } else {
18861N/A goto EXIT;
18861N/A }
18861N/Adiff -ur slocate-3.1.orig/src/slocate.h slocate-3.1/src/slocate.h
18861N/A--- slocate-3.1.orig/src/slocate.h Wed Mar 8 12:40:11 2006
18861N/A+++ slocate-3.1/src/slocate.h Fri May 8 15:03:01 2009
18861N/A@@ -32,7 +32,7 @@
18861N/A /* Printable version of WARN_SECONDS. */
18861N/A #define WARN_MESSAGE "8 days"
18861N/A
18861N/A-#define MTAB_FILE "/etc/mtab"
18861N/A+#define MTAB_FILE "/etc/mnttab"
18861N/A #define UPDATEDB_FILE "/etc/updatedb.conf"
18861N/A
18861N/A /* More fitting paths for FreeBSD -matt */
18861N/Adiff -ur slocate-3.1.orig/src/utils.c slocate-3.1/src/utils.c
18861N/A--- slocate-3.1.orig/src/utils.c Fri Jan 6 08:16:19 2006
18861N/A+++ slocate-3.1/src/utils.c Fri May 8 15:03:01 2009
18861N/A@@ -34,6 +34,7 @@
18861N/A #endif
18861N/A
18861N/A #define RAND_MAX 9999
18861N/A+char* strcasestr( char *, char *);
18861N/A
18861N/A /* Duplicate string and make all characters lowercase */
18861N/A char * tolower_strdup(char *str)
18861N/A@@ -59,7 +60,7 @@
18861N/A int ret = 0;
18861N/A int nmatch = 32;
18861N/A regmatch_t pmatch[32];
18861N/A-#ifndef FNM_CASEFOLD
18861N/A+#ifdef FNM_CASEFOLD
18861N/A char *nocase_str = NULL;
18861N/A char *nocase_path = NULL;
18861N/A #endif
18861N/A@@ -129,9 +130,14 @@
18861N/A goto EXIT;
18861N/A }
18861N/A
18861N/A- } else
18861N/A- foundit = (strcasestr(search_str, search_str) != NULL);
18861N/A+ } else {
18861N/A
18861N/A+ if (strcasestr(full_path, search_str) != NULL)
18861N/A+ foundit = 1;
18861N/A+ else
18861N/A+ foundit = 0;
18861N/A+ }
18861N/A+
18861N/A #endif /* FNM_CASEFOLD */
18861N/A }
18861N/A
18861N/A@@ -544,3 +550,15 @@
18861N/A EXIT:
18861N/A return ret;
18861N/A }
18861N/A+
18861N/A+char *strcasestr(char *a, char *b) {
18861N/A+ size_t l;
18861N/A+ char f[3];
18861N/A+
18861N/A+ snprintf(f, sizeof(f), "%c%c", tolower(*b), toupper(*b));
18861N/A+ for (l = strcspn(a, f); l != strlen(a); l += strcspn(a + l + 1, f) + 1)
18861N/A+ if (strncasecmp(a + l, b, strlen(b)) == 0)
18861N/A+ return(a + l);
18861N/A+ return(NULL);
18861N/A+}
18861N/A+