Skip to content

Commit

Permalink
setenv(): Fix to backslash handling (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathon-love authored and eddelbuettel committed Aug 17, 2017
1 parent 9b353c7 commit 6c08434
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/setenv/setenv.c
Expand Up @@ -60,8 +60,16 @@ extern "C" int setenv(const char *env_var, const char *env_val, int dummy) {
}

if(!inquote && *p == '\\') {
if(*(p+1) == '\n') p++;
else if(*(p+1) == '\\') *q++ = *p;
if(*(p+1) == '\n') {
p++;
}
else if(*(p+1) == '\\') {
*q++ = '/';
p++;
}
else {
*q++ = '/';
}
continue;
}

Expand Down

0 comments on commit 6c08434

Please sign in to comment.