| 460 | | void mutt_select_file (char *f, size_t flen, int buffy) |
| | 465 | int file_tag (MUTTMENU *menu, int n) |
| | 466 | { |
| | 467 | struct folder_file *ff = &(((struct folder_file *)menu->data)[n]); |
| | 468 | if (S_ISDIR (ff->mode) || (S_ISLNK (ff->mode) && link_is_dir (ff->name))) |
| | 469 | { |
| | 470 | mutt_error _("Can't attach a directory!"); |
| | 471 | return 0; |
| | 472 | } |
| | 473 | |
| | 474 | return ((ff->tagged = !ff->tagged) ? 1 : -1); |
| | 475 | } |
| | 476 | |
| | 477 | void _mutt_select_file (char *f, size_t flen, int buffy, |
| | 478 | int multiple, char ***files, int *numfiles) |
| | 647 | if (multiple) |
| | 648 | { |
| | 649 | char **tfiles; |
| | 650 | int i, j; |
| | 651 | |
| | 652 | if (menu->tagged) |
| | 653 | { |
| | 654 | *numfiles = menu->tagged; |
| | 655 | tfiles = safe_malloc (*numfiles * sizeof (char *)); |
| | 656 | for (i = 0, j = 0; i < state.entrylen; i++) |
| | 657 | { |
| | 658 | struct folder_file ff = state.entry[i]; |
| | 659 | char full[_POSIX_PATH_MAX]; |
| | 660 | if (ff.tagged) |
| | 661 | { |
| | 662 | snprintf (full, sizeof (full), "%s/%s", LastDir, ff.name); |
| | 663 | mutt_expand_path (full, sizeof (full)); |
| | 664 | tfiles[j++] = safe_strdup (full); |
| | 665 | } |
| | 666 | } |
| | 667 | *files = tfiles; |
| | 668 | } |
| | 669 | else if (f[0]) /* no tagged entries. return selected entry */ |
| | 670 | { |
| | 671 | *numfiles = 1; |
| | 672 | tfiles = safe_malloc (*numfiles * sizeof (char *)); |
| | 673 | mutt_expand_path (f, flen); |
| | 674 | tfiles[0] = safe_strdup (f); |
| | 675 | *files = tfiles; |
| | 676 | } |
| | 677 | } |
| | 678 | |