From 3e3f80d2449128884b70929feee97fa3c240421a Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 15 Feb 1998 04:32:43 +0000 Subject: netrc improvement. svn path=/trunk/; revision=1624 --- NEWS | 1 + netrc.c | 37 +++++++++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 414b7517..2e31498a 100644 --- a/NEWS +++ b/NEWS @@ -47,6 +47,7 @@ fetchmail-4.3.7 () multidrop environment. * Doug Muth's runfetchmail version 1.1. * Minor port patches from Philippe De Muyter. +* Patch by Chun-Chung Chen to handle quotes in .netrc fetchmail-4.3.6 (Fri Jan 23 00:25:57 EST 1998) * Improved RPM packaging with correct grouping and an icon. diff --git a/netrc.c b/netrc.c index 635228a7..44339590 100644 --- a/netrc.c +++ b/netrc.c @@ -133,6 +133,9 @@ parse_netrc (file) /* If we are defining macros, then skip parsing the line. */ while (*p && last_token != tok_macdef) { + char quote_char = 0; + char *pp; + /* Skip any whitespace. */ while (*p && isspace (*p)) p++; @@ -141,15 +144,41 @@ parse_netrc (file) if (*p == '#') break; - tok = p; + tok = pp = p; /* Find the end of the token. */ - while (*p && !isspace (*p)) - p ++; - + while (*p && (quote_char || !isspace (*p))) + { + if (quote_char) + { + if (quote_char == *p) + { + quote_char = 0; + p ++; + } + else + { + *pp = *p; + p ++; + pp ++; + } + } + else + { + if (*p == '"' || *p == '\'') + quote_char = *p; + else + { + *pp = *p; + pp ++; + } + p ++; + } + } /* Null-terminate the token, if it isn't already. */ if (*p) *p ++ = '\0'; + *pp = 0; switch (last_token) { -- cgit v1.2.3