Re: XForms: fselector file name patterns

Steve Lamont (spl@szechuan.ucsd.edu)
Thu, 16 Oct 97 17:20:17 PDT

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> How do I (or is it possible to) set the pattern regexp of
> an fselector to specify, say, all files that end with a
> .xx or .yy extension? The c-shell like "*.{xx,yy}" doesn't
> do the trick...

I don't think it's possible directly since the file browser really
doesn't do regular expressions. About the best thing I can suggest is
to set your own file filter with fl_set_dirlist_filter() and concoct
your own regular expression handling using the regexp or regex
functions. It's a kluge but it should work:

fl_set_dirlist_filter( my_filter );
fl_show_fselector( "foo!", ".", "*", "" );

[...]

int my_filter( const char *filename, int type )

{

char *re_comp();
int re_exec();

re_comp( ".*\\.xx$" );
if ( re_exec( filename ) )
return 1;
re_comp( ".*\\.yy$" );
if ( re_exec( filename ) )
return 1;
return 0;

}

The limitations of this approach, I think, are pretty obvious.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/