Changeset f830d84 for commands.c
- Timestamp:
- Sep 1, 2008, 10:39:10 PM (16 years ago)
- Branches:
- master, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- fd472a7
- Parents:
- 740d5f7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
commands.c
rcdc6ff1 rf830d84 193 193 OWLCMD_ARGS("subscribe", owl_command_subscribe, OWL_CTX_ANY, 194 194 "subscribe to a zephyr class, instance, recipient", 195 "subscribe [-t] <class> <instance> [recipient]", 196 "Subscribe the specified class and instance. If the recipient\n" 197 "is not listed on the command line it defaults\n" 198 "to * (the wildcard recipient). If the -t option is present\n" 199 "the subscription will only be temporary, i.e., it will not\n" 200 "be written to the subscription file and will therefore not\n" 201 "be present the next time owl is started.\n"), 195 "subscribe [-t] <class> [instance] [recipient]", 196 "Subscribe the specified class and instance. If the\n" 197 "instance or recipient is not listed on the command\n" 198 "line they default to * (the wildcard recipient).\n" 199 "If the -t option is present the unsubscription will\n" 200 "only be temporary, i.e., it will not be written to\n" 201 "the subscription file and will therefore not be\n" 202 "present the next time owl is started.\n"), 202 203 OWLCMD_ALIAS("sub", "subscribe"), 203 204 204 205 OWLCMD_ARGS("unsubscribe", owl_command_unsubscribe, OWL_CTX_ANY, 205 206 "unsubscribe from a zephyr class, instance, recipient", 206 "unsubscribe [-t] <class> <instance>[recipient]",207 "unsubscribe [-t] <class> [instance] [recipient]", 207 208 "Unsubscribe from the specified class and instance. If the\n" 208 "recipient is not listed on the command line it defaults\n" 209 "to * (the wildcard recipient). If the -t option is present\n" 210 "the unsubscription will only be temporary, i.e., it will not\n" 211 "be updated in the subscription file and will therefore not\n" 212 "be in effect the next time owl is started.\n"), 209 "instance or recipient is not listed on the command\n" 210 "line they default to * (the wildcard recipient).\n" 211 "If the -t option is present the subscription will\n" 212 "only be temporary, i.e., it will not be written to\n" 213 "the subscription file and will therefore not be\n" 214 "present the next time owl is started.\n"), 213 215 OWLCMD_ALIAS("unsub", "unsubscribe"), 214 216 … … 1743 1745 char *owl_command_subscribe(int argc, char **argv, char *buff) 1744 1746 { 1745 char * recip="";1747 char *class, *instance, *recip=""; 1746 1748 int temp=0; 1747 1749 int ret=0; 1748 1749 if (argc <3) {1750 1751 if (argc < 2) { 1750 1752 owl_function_makemsg("Not enough arguments to the subscribe command"); 1751 1753 return(NULL); … … 1759 1761 argv++; 1760 1762 } 1761 if (argc <2) {1763 if (argc < 1) { 1762 1764 owl_function_makemsg("Not enough arguments to the subscribe command"); 1763 1765 return(NULL); 1764 1766 } 1765 1767 1766 if (argc >3) {1768 if (argc > 3) { 1767 1769 owl_function_makemsg("Too many arguments to the subscribe command"); 1768 1770 return(NULL); 1769 1771 } 1770 1772 1771 if (argc==2) { 1773 class = argv[0]; 1774 1775 if (argc == 1) { 1776 instance = "*"; 1777 } else { 1778 instance = argv[1]; 1779 } 1780 1781 if (argc <= 2) { 1772 1782 recip=""; 1773 1783 } else if (argc==3) { … … 1775 1785 } 1776 1786 1777 ret = owl_function_subscribe( argv[0], argv[1], recip);1787 ret = owl_function_subscribe(class, instance, recip); 1778 1788 if (!temp && !ret) { 1779 owl_zephyr_addsub(NULL, argv[0], argv[1], recip);1789 owl_zephyr_addsub(NULL, class, instance, recip); 1780 1790 } 1781 1791 return(NULL); … … 1785 1795 char *owl_command_unsubscribe(int argc, char **argv, char *buff) 1786 1796 { 1787 char * recip="";1797 char *class, *instance, *recip=""; 1788 1798 int temp=0; 1789 1799 1790 if (argc <3) {1800 if (argc < 2) { 1791 1801 owl_function_makemsg("Not enough arguments to the unsubscribe command"); 1792 1802 return(NULL); … … 1800 1810 argv++; 1801 1811 } 1802 if (argc <2) {1803 owl_function_makemsg("Not enough arguments to the subscribe command");1804 return(NULL); 1805 } 1806 1807 if (argc >3) {1812 if (argc < 1) { 1813 owl_function_makemsg("Not enough arguments to the unsubscribe command"); 1814 return(NULL); 1815 } 1816 1817 if (argc > 3) { 1808 1818 owl_function_makemsg("Too many arguments to the unsubscribe command"); 1809 1819 return(NULL); 1810 1820 } 1811 1821 1812 if (argc==2) { 1822 class = argv[0]; 1823 1824 if (argc == 1) { 1825 instance = "*"; 1826 } else { 1827 instance = argv[1]; 1828 } 1829 1830 if (argc <= 2) { 1813 1831 recip=""; 1814 1832 } else if (argc==3) { … … 1816 1834 } 1817 1835 1818 owl_function_unsubscribe( argv[0], argv[1], recip);1836 owl_function_unsubscribe(class, instance, recip); 1819 1837 if (!temp) { 1820 owl_zephyr_delsub(NULL, argv[0], argv[1], recip);1838 owl_zephyr_delsub(NULL, class, instance, recip); 1821 1839 } 1822 1840 return(NULL);
Note: See TracChangeset
for help on using the changeset viewer.