| 637 | * Creates a filelink_t |
| 638 | */ |
| 639 | private static void Link_f(List<String> args) { |
| 640 | |
| 641 | if (args.size() != 3) { |
| 642 | Com.Printf("USAGE: link <from> <to>\n"); |
| 643 | return; |
| 644 | } |
| 645 | |
| 646 | // see if the link already exists |
| 647 | String from = args.get(1); |
| 648 | String to = args.get(2); |
| 649 | for (Iterator<filelink_t> it = fs_links.iterator(); it.hasNext();) { |
| 650 | filelink_t entry = it.next(); |
| 651 | |
| 652 | if (entry.from.equals(from)) { |
| 653 | if (to.isEmpty()) { |
| 654 | // delete it |
| 655 | it.remove(); |
| 656 | return; |
| 657 | } |
| 658 | entry.to = to; |
| 659 | return; |
| 660 | } |
| 661 | } |
| 662 | |
| 663 | // create a new link if the <to> is not empty |
| 664 | if (!to.isEmpty()) { |
| 665 | fs_links.add(new filelink_t(from, to)); |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | /* |
| 670 | * ListFiles |