From 2957aa4ce53442d4e93a1dd3866e294af9b18998 Mon Sep 17 00:00:00 2001 From: Nedko Arnaudov Date: Mon, 16 Apr 2001 05:09:51 +0000 Subject: [PATCH] Added support for escape sequences when setting string value. svn path=/trunk/; revision=1803 --- .../sysutils/regexpl/ShellCommandSetValue.cpp | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/rosapps/sysutils/regexpl/ShellCommandSetValue.cpp b/rosapps/sysutils/regexpl/ShellCommandSetValue.cpp index 2d1d1612256..061acf1489c 100644 --- a/rosapps/sysutils/regexpl/ShellCommandSetValue.cpp +++ b/rosapps/sysutils/regexpl/ShellCommandSetValue.cpp @@ -1,4 +1,4 @@ -/* $Id: ShellCommandSetValue.cpp,v 1.4 2001/01/13 23:55:37 narnaoud Exp $ +/* $Id: ShellCommandSetValue.cpp,v 1.5 2001/04/16 05:09:51 narnaoud Exp $ * * regexpl - Console Registry Explorer * @@ -330,7 +330,42 @@ CheckValueArgument: } dwValueSize *= sizeof(TCHAR); pDataBuffer = (BYTE *) new BYTE [dwValueSize]; - _tcscpy((TCHAR *)pDataBuffer,pszValueData); + + { + const TCHAR *pchSrc = pszValueData; + TCHAR *pchDest = (TCHAR *)pDataBuffer; + while(*pchSrc) + { + if (pchSrc[0] == _T('\\')) + { + if (pchSrc[1] == _T('a')) + *pchDest = _T('\a'); + else if (pchSrc[1] == _T('b')) + *pchDest = _T('\b'); + else if (pchSrc[1] == _T('f')) + *pchDest = _T('\f'); + else if (pchSrc[1] == _T('n')) + *pchDest = _T('\n'); + else if (pchSrc[1] == _T('r')) + *pchDest = _T('\r'); + else if (pchSrc[1] == _T('t')) + *pchDest = _T('\t'); + else + *pchDest = pchSrc[1]; + + pchSrc +=2; + pchDest++; + dwValueSize--; + } + else + { + *pchDest = *pchSrc; + pchSrc++; + pchDest++; + } + } + *pchDest = _T('\0'); + } break; default: ASSERT(FALSE);