Re: XForms: Wildcards in fselector filter

Steve Lamont (spl@szechuan.ucsd.edu)
Mon, 18 Oct 99 11:38:29 PDT

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

> Is is possible to specify more than one extension in the filename filter
> field? ...

Not directly.

You may, however, install your own filter which can filter on any
expression. For example:

#include <sys/types.h>
#include <regex.h>

[...]

regex_t reg;

int my_filter( const char *name, int type )

{

return regexec( &reg, name, (size_t) 0, NULL, 0 ) ? 0 : 1;

}

[...]

const char *name;

regcomp( &reg, ".*\\.(h|c)$", REG_EXTENDED | REG_NOSUB );

fl_set_dirlist_filter( my_filter );
name = fl_show_fselector("Load file:", NULL, "*", NULL ) );
regfree( &reg );

The above will select all files with the suffix `.c' or `.h'.

It would be nice if fl_show_fselector() and fl_get_dirlist() would
accept shell type expressions.

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