Changeset 23222 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Sep 22, 2009 3:48:26 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r23129 r23222 772 772 } 773 773 #ifdef VBOX_DYNAMIC_NET_ATTACH 774 /* here the order in which strncmp is called is important 775 * cause nictracefile can be very well compared with 776 * nictrace and nic and thus everything will always fail 777 * if the order is changed 778 */ 779 else if (!strncmp(a->argv[1], "nictracefile", 12)) 780 { 781 /* Get the number of network adapters */ 782 ULONG NetworkAdapterCount = 0; 783 ComPtr <ISystemProperties> info; 784 CHECK_ERROR_BREAK (a->virtualBox, COMGETTER(SystemProperties) (info.asOutParam())); 785 CHECK_ERROR_BREAK (info, COMGETTER(NetworkAdapterCount) (&NetworkAdapterCount)); 786 787 unsigned n = parseNum(&a->argv[1][12], NetworkAdapterCount, "NIC"); 788 if (!n) 789 { 790 rc = E_FAIL; 791 break; 792 } 793 if (a->argc <= 2) 794 { 795 errorArgument("Missing argument to '%s'", a->argv[1]); 796 rc = E_FAIL; 797 break; 798 } 799 800 /* get the corresponding network adapter */ 801 ComPtr<INetworkAdapter> adapter; 802 CHECK_ERROR_BREAK (sessionMachine, GetNetworkAdapter(n - 1, adapter.asOutParam())); 803 if (adapter) 804 { 805 BOOL fEnabled; 806 adapter->COMGETTER(Enabled)(&fEnabled); 807 if (fEnabled) 808 { 809 if (a->argv[2]) 810 { 811 CHECK_ERROR_RET(adapter, COMSETTER(TraceFile) (Bstr(a->argv[2])), 1); 812 } 813 else 814 { 815 errorArgument("Invalid filename or filename not specified for NIC %lu", n); 816 rc = E_FAIL; 817 break; 818 } 819 } 820 else 821 { 822 RTPrintf("The NIC %d is currently disabled and thus can't change its tracefile\n", n); 823 } 824 } 825 } 826 else if (!strncmp(a->argv[1], "nictrace", 8)) 827 { 828 /* Get the number of network adapters */ 829 ULONG NetworkAdapterCount = 0; 830 ComPtr <ISystemProperties> info; 831 CHECK_ERROR_BREAK (a->virtualBox, COMGETTER(SystemProperties) (info.asOutParam())); 832 CHECK_ERROR_BREAK (info, COMGETTER(NetworkAdapterCount) (&NetworkAdapterCount)); 833 834 unsigned n = parseNum(&a->argv[1][8], NetworkAdapterCount, "NIC"); 835 if (!n) 836 { 837 rc = E_FAIL; 838 break; 839 } 840 if (a->argc <= 2) 841 { 842 errorArgument("Missing argument to '%s'", a->argv[1]); 843 rc = E_FAIL; 844 break; 845 } 846 847 /* get the corresponding network adapter */ 848 ComPtr<INetworkAdapter> adapter; 849 CHECK_ERROR_BREAK (sessionMachine, GetNetworkAdapter(n - 1, adapter.asOutParam())); 850 if (adapter) 851 { 852 BOOL fEnabled; 853 adapter->COMGETTER(Enabled)(&fEnabled); 854 if (fEnabled) 855 { 856 if (!strcmp(a->argv[2], "on")) 857 { 858 CHECK_ERROR_RET(adapter, COMSETTER(TraceEnabled)(TRUE), 1); 859 } 860 else if (!strcmp(a->argv[2], "off")) 861 { 862 CHECK_ERROR_RET(adapter, COMSETTER(TraceEnabled)(FALSE), 1); 863 } 864 else 865 { 866 errorArgument("Invalid nictrace%lu argument '%s'", n, Utf8Str(a->argv[2]).raw()); 867 rc = E_FAIL; 868 break; 869 } 870 } 871 else 872 { 873 RTPrintf("The NIC %d is currently disabled and thus can't change its tracefile\n", n); 874 } 875 } 876 } 774 877 else if (!strncmp(a->argv[1], "nic", 3)) 775 878 {
Note:
See TracChangeset
for help on using the changeset viewer.