Re: [cssed-devel] Plugin problems in BSD and MacOsX
Brought to you by:
iagorubio
From: <mic...@ea...> - 2004-09-10 21:51:38
|
Le 10 sept. 2004, =E0 18:50, Iago Rubio a =E9crit : > On Fri, 2004-09-10 at 18:08, Mich=E8le Garoche wrote: >> Le 10 sept. 2004, =E0 17:56, Iago Rubio a =E9crit : >> >>> The find in files plugin is being fixed and I expect a working = update >>> tomorrow. >> I'm waiting for it :-) >> >> =46rom my investigation, it works with the getline you have = commented >> out, then if you use: >> >> find /Users/toto -maxdepth 1 type -f | xargs grep -n "foo" >> >> it should work (at least it works on the command line) >> >> The problem is a permission problem and a type problem and a depth >> problem. >> 1 - You could not search at depth 0 >> 2 - You could not search files that are not regular files (I mean >> printer drivers, symbolic links, directories) with this syntax. > > Oh! Great help, lots of thanks. > > I was fiddling in the getline function and was unable to fix it. > >> See if it works on BSD with this syntax (maxdepth >=3D1 and = obligatory), >> type -f (silently added). > > Will do it right now. It always prints only one line, that's something to correct, maybe use=20= -print at the end. This is the logic, but correct it to be right C code cmd_line =3D g_strdup_printf ("find %s ", basedir_str); if( = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox_depth)) ){ depth_str =3D g_strdup_printf( "-maxdepth %d ",=20 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinbutton_depth)) ); // In case the malicious user changes it to 0 #ifdef DARWIN or #ifdef BSD if depth_Str < 1 then %d =3D=3D 1 #endif old_ptr =3D cmd_line; // Silently add -type f for DARWIN and BSD #ifdef DARWIN or #idfef BSD cmd_line =3D g_strdup_printf("%s %s -type f", old_ptr, = depth_str ); #elif=09 cmd_line =3D g_strdup_printf("%s %s", old_ptr, depth_str = ); #endif g_free(old_ptr); g_free(depth_str); else { // Force to 1 for BSD and DARWIN #ifdef DARWIN or #ifdef BSD old_ptr =3D cmd_line; cmd_line =3D g_strdup_printf("%s %s -type f", old_ptr, = depth_str ); g_free(old_ptr); #endif }=09 old_ptr =3D cmd_line; cmd_line =3D g_strdup_printf("%s | xargs grep -n %s", old_ptr,=20= searchterm_str ); g_free( old_ptr ); Mich=E8le <http://micmacfr.homeunix.org>#ifdef DARWIN or #ifdef BSD #ifdef DARWIN or #ifdef BSD |