Changeset ef56a67 for commands.c
- Timestamp:
- Jun 22, 2003, 9:38:21 AM (21 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- f1cbb7a
- Parents:
- 3723f31
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
commands.c
r0c502e9 ref56a67 486 486 OWLCMD_ARGS("view", owl_command_view, OWL_CTX_INTERACTIVE, 487 487 "view messages matching a filter", 488 "view [<viewname>] [-f <filter> | --home ] [-s <style>]\n" 488 489 "view <filter>\n" 489 490 "view -d <expression>\n" 490 491 "view --home", 491 "In the first usage, The view command sets the current view to\n" 492 "the specified filter. This causes only messages matching\n" 493 "that filter to be displayed.\n" 492 "The view command sets information associated with a particular view,\n" 493 "such as view's filter or style. In the first general usage listed\n" 494 "above <viewname> is the name of the view to be changed. If not\n" 495 "specified the default view 'main' will be used. A filter can be set\n" 496 "for the view by listing a named filter after the -f argument. If\n" 497 "the --home argument is used the filter will be set to the filter named\n" 498 "by the\n 'view_home' variable. The style can be set by listing the\n" 499 "name style after the -s argument.\n" 494 500 "\n" 495 "In the second usage a filter expression\n" 496 "and be specified directly\n" 497 "after -d. Owl will build an internal filter based on this\n" 498 "filter and change the current view to use it.\n\n" 499 "If --home is specified, switches to the view specified by\n" 500 "the 'view_home' variable.\n\n" 501 "The other usages listed above are abbreivated forms that simply set\n" 502 "the filter of the current view. The -d option allows you to write a\n" 503 "filter expression that will be dynamically created by owl and then\n" 504 "applied as the view's filter\n" 501 505 "SEE ALSO: filter, viewclass, viewuser\n"), 502 506 … … 558 562 "show terminal\n" 559 563 "show version\n" 564 "show view [<view>]\n" 560 565 "show status\n", 561 566 … … 1651 1656 1652 1657 char *owl_command_view(int argc, char **argv, char *buff) { 1653 if (argc<2) { 1654 owl_function_makemsg("Wrong number of arguments to view command"); 1655 return NULL; 1656 } 1657 1658 1659 /* Backwards compatability has made this kind of complicated: 1660 * view [<viewname>] [-f <filter> | -d <expression> | --home ] [-s <style>] 1661 * view <filter> 1662 * view -d <expression> 1663 * view --home 1664 */ 1665 1666 /* First take the 'view --home' case */ 1658 1667 if (argc == 2 && !strcmp(argv[1], "--home")) { 1659 1668 owl_function_change_view(owl_global_get_view_home(&g)); 1660 return NULL; 1661 } 1662 1663 /* is it a dynamic filter? */ 1664 if (!strcmp(argv[1], "-d")) { 1669 return(NULL); 1670 } 1671 1672 /* Now look for 'view <filter>' */ 1673 if (argc==2) { 1674 owl_function_change_view(argv[1]); 1675 return(NULL); 1676 } 1677 1678 /* Now get 'view -d <expression>' */ 1679 if (argc==3 && !strcmp(argv[1], "-d")) { 1665 1680 char **myargv; 1666 1681 int i; … … 1678 1693 } 1679 1694 1680 /* otherwise it's a normal view command */ 1681 if (argc>2) { 1682 owl_function_makemsg("Wrong number of arguments to view command"); 1683 return NULL; 1684 } 1685 owl_function_change_view(argv[1]); 1686 return NULL; 1695 /* Finally handle the general case */ 1696 if (argc<3) { 1697 owl_function_makemsg("Too few arguments to the view command."); 1698 return(NULL); 1699 } 1700 argc--; 1701 argv++; 1702 if (strcmp(argv[0], "-f") && strcmp(argv[0], "-d") && strcmp(argv[0], "--home") && strcmp(argv[0], "-s")) { 1703 if (strcmp(argv[0], "main")) { 1704 owl_function_makemsg("No view named '%s'", argv[0]); 1705 return(NULL); 1706 } 1707 argc--; 1708 argv++; 1709 } 1710 while (argc) { 1711 if (!strcmp(argv[0], "-f")) { 1712 if (argc<2) { 1713 owl_function_makemsg("Too few argments to the view command"); 1714 return(NULL); 1715 } 1716 owl_function_change_view(argv[1]); 1717 argc-=2; 1718 argv+=2; 1719 } else if (!strcmp(argv[0], "--home")) { 1720 owl_function_change_view(owl_global_get_view_home(&g)); 1721 argc--; 1722 argv++; 1723 } else if (!strcmp(argv[0], "-s")) { 1724 if (argc<2) { 1725 owl_function_makemsg("Too few argments to the view command"); 1726 return(NULL); 1727 } 1728 owl_function_change_style(owl_global_get_current_view(&g), argv[1]); 1729 argc-=2; 1730 argv+=2; 1731 } else { 1732 owl_function_makemsg("Too few argments to the view command"); 1733 return(NULL); 1734 } 1735 1736 } 1737 return(NULL); 1687 1738 } 1688 1739 … … 1722 1773 owl_function_show_keymap(argv[2]); 1723 1774 } 1775 } else if (!strcmp(argv[1], "view")) { 1776 if (argc==3) { 1777 owl_function_show_view(argv[2]); 1778 } else { 1779 owl_function_show_view(NULL); 1780 } 1724 1781 } else if (!strcmp(argv[1], "colors")) { 1725 1782 owl_function_show_colors();
Note: See TracChangeset
for help on using the changeset viewer.