Changeset 54611 in vbox for trunk/src/VBox
- Timestamp:
- Mar 3, 2015 9:23:06 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp
r54607 r54611 151 151 #endif 152 152 if (eWhich == WRITE_LOG || eWhich == USAGE_ALL) 153 doUsage("", g_pszProgName, "writelog [- -] <msg>");153 doUsage("", g_pszProgName, "writelog [-n|--no-newline] [--] <msg>"); 154 154 if (eWhich == TAKE_SNAPSHOT || eWhich == USAGE_ALL) 155 155 doUsage("", g_pszProgName, "takesnapshot"); … … 1765 1765 static const RTGETOPTDEF s_aOptions[] = 1766 1766 { 1767 { "-- dummy", 'D', RTGETOPT_REQ_NOTHING }1767 { "--no-newline", 'n', RTGETOPT_REQ_NOTHING }, 1768 1768 }; 1769 bool fNoNewline = false; 1769 1770 1770 1771 RTGETOPTSTATE GetOptState; … … 1780 1781 { 1781 1782 case VINF_GETOPT_NOT_OPTION: 1782 rc = VbglR3WriteLog(ValueUnion.psz, strlen(ValueUnion.psz)); 1783 { 1784 size_t cch = strlen(ValueUnion.psz); 1785 if ( fNoNewline 1786 || (cch > 0 && ValueUnion.psz[cch - 1] == '\n') ) 1787 rc = VbglR3WriteLog(ValueUnion.psz, cch); 1788 else 1789 { 1790 char *pszDup = (char *)RTMemDupEx(ValueUnion.psz, cch, 2); 1791 if (RT_SUCCESS(rc)) 1792 { 1793 pszDup[cch++] = '\n'; 1794 pszDup[cch] = '\0'; 1795 rc = VbglR3WriteLog(pszDup, cch); 1796 RTMemFree(pszDup); 1797 } 1798 else 1799 rc = VERR_NO_MEMORY; 1800 } 1783 1801 if (RT_FAILURE(rc)) 1784 1802 return VBoxControlError("VbglR3WriteLog: %Rrc", rc); 1803 break; 1804 } 1805 1806 case 'n': 1807 fNoNewline = true; 1785 1808 break; 1786 1809
Note:
See TracChangeset
for help on using the changeset viewer.