Partially revert #c325ca3e028388ae6f934df2a4057229d24d021e to strip spaces in strings again.
This commit is contained in:
parent
836d4d9e35
commit
9136cf2946
@ -396,8 +396,11 @@ static void readline(unsigned char *line)
|
||||
*line='\0'; /* delete line */
|
||||
cont=FALSE;
|
||||
} else {
|
||||
/* check whether to erase leading whitespace after '\\' on next line */
|
||||
/* check whether to erase leading spaces */
|
||||
if (cont) {
|
||||
unsigned char *ptr=line;
|
||||
while (*ptr<=' ' && *ptr!='\0')
|
||||
ptr++;
|
||||
if (ptr!=line)
|
||||
memmove(line,ptr,strlen((char*)ptr)+1);
|
||||
} /* if */
|
||||
@ -512,6 +515,8 @@ static void stripcomment(unsigned char *line)
|
||||
if (icomment==2)
|
||||
*line++=' ';
|
||||
} else if (*line=='/' && *(line+1)=='/'){ /* comment to end of line */
|
||||
if (strchr((char*)line,'\a')!=NULL)
|
||||
error(49); /* invalid line continuation */
|
||||
#if !defined SC_LIGHT
|
||||
if (*(line+2)=='/' && *(line+3)<=' ') {
|
||||
/* documentation comment */
|
||||
@ -903,6 +908,23 @@ static const unsigned char *getstring(unsigned char *dest,int max,const unsigned
|
||||
return line;
|
||||
}
|
||||
|
||||
/* strdupwithouta
|
||||
*
|
||||
* Duplicate a string, stripping out `\a`s.
|
||||
*/
|
||||
static char* strdupwithouta(const char* sourcestring)
|
||||
{
|
||||
char* result=strdup(sourcestring);
|
||||
char* a=result;
|
||||
if (result==NULL) {
|
||||
return NULL;
|
||||
}
|
||||
while ((a=strchr(a,'\a'))!=NULL) {
|
||||
strcpy(a,a+1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
enum {
|
||||
CMD_NONE,
|
||||
CMD_TERM,
|
||||
@ -1115,7 +1137,7 @@ static int command(void)
|
||||
/* remove leading whitespace */
|
||||
while (*lptr<=' ' && *lptr!='\0')
|
||||
lptr++;
|
||||
pc_deprecate=strdup((const char *)lptr);
|
||||
pc_deprecate=strdupwithouta((const char *)lptr);
|
||||
if (pc_deprecate!=NULL) {
|
||||
char *ptr=pc_deprecate+strlen(pc_deprecate)-1;
|
||||
/* remove trailing whitespace */
|
||||
@ -1499,7 +1521,7 @@ static int command(void)
|
||||
while (*lptr<=' ' && *lptr!='\0')
|
||||
lptr++;
|
||||
if (!SKIPPING) {
|
||||
char *usermsg=strdup((const char *)lptr);
|
||||
char *usermsg=strdupwithouta((const char *)lptr);
|
||||
if (usermsg!=NULL) {
|
||||
char *ptr=usermsg+strlen(usermsg)-1;
|
||||
/* remove trailing whitespace and newlines */
|
||||
@ -1893,6 +1915,10 @@ static const unsigned char *unpackedstring(const unsigned char *lptr,int *flags)
|
||||
while (*lptr==' ' || *lptr=='\t') /* this is as defines with parameters may add them */
|
||||
lptr++; /* when you use a space after , in a match pattern */
|
||||
while (*lptr!='\0') {
|
||||
if (*lptr=='\a') {
|
||||
lptr++;
|
||||
continue;
|
||||
} /* if */
|
||||
if (!instring) {
|
||||
if (*lptr=='\"') {
|
||||
instring=1;
|
||||
@ -1963,6 +1989,10 @@ static const unsigned char *packedstring(const unsigned char *lptr,int *flags)
|
||||
i=sizeof(ucell)-(sCHARBITS/8); /* start at most significant byte */
|
||||
val=0;
|
||||
while (*lptr!='\0') {
|
||||
if (*lptr=='\a') { /* ignore '\a' (which was inserted at a line concatenation) */
|
||||
lptr++;
|
||||
continue;
|
||||
} /* if */
|
||||
if (!instring) {
|
||||
if (*lptr=='\"') {
|
||||
instring=1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user