* find.c (search_content): Redo recent change without infinite loop ;-),
egrep_path hardcoded to "egrep" as it is done in locate_egrep () (locate_egrep): commented out (rotating_dash) [!HAVE_X]: moved into do_search to prevent warning
Этот коммит содержится в:
родитель
c267347457
Коммит
ea0cfde3c9
@ -1,3 +1,12 @@
|
|||||||
|
2001-04-27 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||||
|
|
||||||
|
* find.c (search_content): Redo recent change without infinite loop ;-),
|
||||||
|
egrep_path hardcoded to "egrep" as it is done in locate_egrep ()
|
||||||
|
|
||||||
|
(locate_egrep): commented out
|
||||||
|
|
||||||
|
(rotating_dash) [!HAVE_X]: moved into do_search to prevent warning
|
||||||
|
|
||||||
2001-04-26 Pavel Roskin <proski@gnu.org>
|
2001-04-26 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
* find.c (search_content): Undo a recent change that caused an
|
* find.c (search_content): Undo a recent change that caused an
|
||||||
@ -8,7 +17,7 @@
|
|||||||
* view.c (get_line_at): previous newline is right condition
|
* view.c (get_line_at): previous newline is right condition
|
||||||
for regexp '^' pattern also, fixed
|
for regexp '^' pattern also, fixed
|
||||||
|
|
||||||
(search) [HAVE_GNOME]: gnome_message_box_new don't expand printf
|
(search) [HAVE_GNOME]: gnome_message_box_new doesn't expand printf
|
||||||
pattern, so g_strdup_printf used
|
pattern, so g_strdup_printf used
|
||||||
|
|
||||||
* find.c (find_parameters): don't use stat structure if mc_stat failed
|
* find.c (find_parameters): don't use stat structure if mc_stat failed
|
||||||
|
33
src/find.c
33
src/find.c
@ -111,9 +111,6 @@ static WLabel *status_label; /* Finished, Searching etc. */
|
|||||||
static WListbox *find_list; /* Listbox with the file list */
|
static WListbox *find_list; /* Listbox with the file list */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* For nice updating */
|
|
||||||
static char *rotating_dash = "|/-\\";
|
|
||||||
|
|
||||||
/* This keeps track of the directory stack */
|
/* This keeps track of the directory stack */
|
||||||
typedef struct dir_stack {
|
typedef struct dir_stack {
|
||||||
char *name;
|
char *name;
|
||||||
@ -388,12 +385,12 @@ find_add_match (Dlg_head *h, char *dir, char *file)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static char *
|
static char *
|
||||||
locate_egrep (void)
|
locate_egrep (void)
|
||||||
{
|
{
|
||||||
/* commented out because mc runs egrep via execvp() which searches PATH
|
/* commented out because mc runs egrep via execvp() which searches PATH
|
||||||
itself. It is likely that egrep in PATH is better than in /bin */
|
itself. It is likely that egrep in PATH is better than in /bin */
|
||||||
#if 0
|
|
||||||
char *paths [] = {
|
char *paths [] = {
|
||||||
"/bin/egrep",
|
"/bin/egrep",
|
||||||
"/usr/bin/egrep",
|
"/usr/bin/egrep",
|
||||||
@ -408,9 +405,9 @@ locate_egrep (void)
|
|||||||
if (stat (*p, &s) == 0)
|
if (stat (*p, &s) == 0)
|
||||||
return *p;
|
return *p;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return "egrep";
|
return "egrep";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* search_content:
|
* search_content:
|
||||||
@ -428,7 +425,7 @@ search_content (Dlg_head *h, char *directory, char *filename)
|
|||||||
char c;
|
char c;
|
||||||
int i;
|
int i;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
static char *egrep_path;
|
char *egrep_path = "egrep";
|
||||||
char *egrep_opts = case_sensitive ? "-n" : "-in";
|
char *egrep_opts = case_sensitive ? "-n" : "-in";
|
||||||
|
|
||||||
fname = concat_dir_and_file (directory, filename);
|
fname = concat_dir_and_file (directory, filename);
|
||||||
@ -444,9 +441,6 @@ search_content (Dlg_head *h, char *directory, char *filename)
|
|||||||
if (file_fd == -1)
|
if (file_fd == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!egrep_path)
|
|
||||||
egrep_path = locate_egrep ();
|
|
||||||
|
|
||||||
#ifndef GREP_STDIN
|
#ifndef GREP_STDIN
|
||||||
pipe = mc_doublepopen (file_fd, -1, &pid, egrep_path, egrep_path, egrep_opts, content_pattern, NULL);
|
pipe = mc_doublepopen (file_fd, -1, &pid, egrep_path, egrep_path, egrep_opts, content_pattern, NULL);
|
||||||
#else /* GREP_STDIN */
|
#else /* GREP_STDIN */
|
||||||
@ -468,10 +462,7 @@ search_content (Dlg_head *h, char *directory, char *filename)
|
|||||||
enable_interrupt_key ();
|
enable_interrupt_key ();
|
||||||
got_interrupt ();
|
got_interrupt ();
|
||||||
|
|
||||||
while (1){
|
while ((i = read (pipe, &c, 1)) == 1){
|
||||||
i = read (pipe, &c, 1);
|
|
||||||
if (i == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (c == '\n'){
|
if (c == '\n'){
|
||||||
p = buffer;
|
p = buffer;
|
||||||
@ -564,7 +555,7 @@ do_search (struct Dlg_head *h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
strcpy (directory, tmp);
|
strcpy (directory, tmp);
|
||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
|
|
||||||
if (verbose){
|
if (verbose){
|
||||||
char buffer [BUF_SMALL];
|
char buffer [BUF_SMALL];
|
||||||
@ -614,9 +605,12 @@ do_search (struct Dlg_head *h)
|
|||||||
|
|
||||||
/* Displays the nice dot */
|
/* Displays the nice dot */
|
||||||
count++;
|
count++;
|
||||||
if (!(count & 31)){
|
|
||||||
if (verbose){
|
|
||||||
#ifndef HAVE_X
|
#ifndef HAVE_X
|
||||||
|
if (!(count & 31)){
|
||||||
|
/* For nice updating */
|
||||||
|
char *rotating_dash = "|/-\\";
|
||||||
|
|
||||||
|
if (verbose){
|
||||||
pos = (pos + 1) % 4;
|
pos = (pos + 1) % 4;
|
||||||
attrset (NORMALC);
|
attrset (NORMALC);
|
||||||
dlg_move (h, FIND2_Y-6, FIND2_X - 4);
|
dlg_move (h, FIND2_Y-6, FIND2_X - 4);
|
||||||
@ -625,9 +619,6 @@ do_search (struct Dlg_head *h)
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
goto do_search_begin;
|
goto do_search_begin;
|
||||||
#else
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
x_flush_events ();
|
x_flush_events ();
|
||||||
return 1;
|
return 1;
|
||||||
@ -895,7 +886,7 @@ get_list_info (char **file, char **dir)
|
|||||||
gtk_clist_get_text (GTK_CLIST (g_clist), current_row, 0, file);
|
gtk_clist_get_text (GTK_CLIST (g_clist), current_row, 0, file);
|
||||||
*dir = gtk_clist_get_row_data (GTK_CLIST (g_clist), current_row);
|
*dir = gtk_clist_get_row_data (GTK_CLIST (g_clist), current_row);
|
||||||
}
|
}
|
||||||
#else
|
#else /* HAVE_GNOME */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_list_info (char **file, char **dir)
|
get_list_info (char **file, char **dir)
|
||||||
@ -1091,7 +1082,7 @@ kill_gui (void)
|
|||||||
set_idle_proc (find_dlg, 0);
|
set_idle_proc (find_dlg, 0);
|
||||||
destroy_dlg (find_dlg);
|
destroy_dlg (find_dlg);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* HAVE_GNOME */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
find_file (char *start_dir, char *pattern, char *content, char **dirname, char **filename)
|
find_file (char *start_dir, char *pattern, char *content, char **dirname, char **filename)
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user