| 770 | |
| 771 | |
| 772 | LIST * builtin_glob( FRAME * frame, int flags ) |
| 773 | { |
| 774 | LIST * const l = lol_get( frame->args, 0 ); |
| 775 | LIST * const r = lol_get( frame->args, 1 ); |
| 776 | |
| 777 | LISTITER iter; |
| 778 | LISTITER end; |
| 779 | struct globbing globbing; |
| 780 | |
| 781 | globbing.results = L0; |
| 782 | globbing.patterns = r; |
| 783 | |
| 784 | globbing.case_insensitive = |
| 785 | # if defined( OS_NT ) || defined( OS_CYGWIN ) || defined( OS_VMS ) |
| 786 | l; /* Always case-insensitive if any files can be found. */ |
| 787 | # else |
| 788 | lol_get( frame->args, 2 ); |
| 789 | # endif |
| 790 | |
| 791 | if ( globbing.case_insensitive ) |
| 792 | globbing.patterns = downcase_list( r ); |
| 793 | |
| 794 | iter = list_begin( l ); |
| 795 | end = list_end( l ); |
| 796 | for ( ; iter != end; iter = list_next( iter ) ) |
| 797 | file_dirscan( list_item( iter ), builtin_glob_back, &globbing ); |
| 798 | |
| 799 | if ( globbing.case_insensitive ) |
| 800 | list_free( globbing.patterns ); |
| 801 | |
| 802 | return globbing.results; |
| 803 | } |
| 804 | |
| 805 | |
| 806 | static int has_wildcards( char const * const str ) |
no test coverage detected