From c0a2659a05db42097e5dc0a773d2d3ba8bb1249d Mon Sep 17 00:00:00 2001 From: kichik Date: Thu, 21 Nov 2002 19:09:02 +0000 Subject: [PATCH] Support for escaping quotes using $" Source\lineparse.h Source\script.cpp git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1802 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/lineparse.h | 24 +++++++++++++++++++++++- Source/script.cpp | 2 +- TODO.txt | 2 ++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Source/lineparse.h b/Source/lineparse.h index fd811e7d..d40f5d22 100644 --- a/Source/lineparse.h +++ b/Source/lineparse.h @@ -119,6 +119,15 @@ class LineParser { int nc=0; while (*line) { + if (line[0] == '$' && line[1] == '\\') { + switch (line[2]) { + case '"': + case '\'': + case '`': + nc += 3; + line += 3; + } + } if (lstate==1 && *line =='\"') break; if (lstate==2 && *line =='\'') break; if (lstate==4 && *line =='`') break; @@ -128,8 +137,21 @@ class LineParser { } if (m_tokens) { + char *p; + int i; m_tokens[m_nt]=(char*)malloc(nc+1); - strncpy(m_tokens[m_nt],line-nc,nc); + for (i = 0, p = line - nc; p < line; i++, p++) { + if (p[0] == '$' && p[1] == '\\') { + switch (p[2]) { + case '"': + case '\'': + case '`': + p += 2; + } + } + m_tokens[m_nt][i] = *p; + } + //strncpy(m_tokens[m_nt],line-nc,nc); m_tokens[m_nt][nc]=0; } m_nt++; diff --git a/Source/script.cpp b/Source/script.cpp index 590461ca..0f1bce82 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -2427,7 +2427,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char ent.offsets[4] |= (c) << 16; } } - SCRIPT_MSG("CreateShortCut: \"%s\"->\"%s\" %s icon:%s,%d, showmode=0x%X, hotkey=0x%X, comment=%s\n", + SCRIPT_MSG("CreateShortCut: \"%s\"->\"%s\" %s icon:%s,%d, showmode=0x%X, hotkey=0x%X, comment=%s\n", line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3), line.gettoken_str(4),ent.offsets[4]&0xff,(ent.offsets[4]>>8)&0xff,ent.offsets[4]>>16,line.gettoken_str(8)); return add_entry(&ent); diff --git a/TODO.txt b/TODO.txt index 09ed44fe..f3c2c193 100644 --- a/TODO.txt +++ b/TODO.txt @@ -10,6 +10,8 @@ DOCUMENTATION * go over everything and search for mistakes :) +* write something about me and nsis 2 in the intro + EXAMPLES * write an advanced paging example showing multiple components page with multiple instfiles pages \ No newline at end of file