Skip to content

Commit

Permalink
fix: Removed escaped newlines for Windows (popen call, mostly)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregungory committed Jul 29, 2020
1 parent d330e4e commit 0198d5f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/common/fgetline.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: fgetline.c,v 2.9 2016/03/04 00:21:21 greg Exp $";
static const char RCSid[] = "$Id: fgetline.c,v 2.10 2020/07/29 18:19:31 greg Exp $";
#endif
/*
* fgetline.c - read line with escaped newlines.
Expand Down Expand Up @@ -34,5 +34,10 @@ fgetline( /* read in line with escapes, elide final newline */
if ((cp == s) & (c == EOF))
return(NULL);
*cp = '\0';
#if defined(_WIN32) || defined(_WIN64)
/* remove escaped newlines */
for (cp = s; (cp = strchr(cp, '\\')) != NULL && cp[1] == '\n'; )
memmove(cp, cp+2, strlen(cp+2)+1);
#endif
return(s);
}

0 comments on commit 0198d5f

Please sign in to comment.