From bcf90a2431b2abb5ffc962b2cee359a56d7191d1 Mon Sep 17 00:00:00 2001 From: Marcus Brinkmann Date: Sun, 16 Jul 2006 13:27:08 +0000 Subject: [PATCH] 2006-07-16 Marcus Brinkmann * rungpg.c (read_status): Strip potential carriage return. * genkey.c (get_key_parameter): Skip potential carriage return. * version.c (_gpgme_get_program_version): Strip potential carriage return. --- trunk/gpgme/ChangeLog | 5 +++++ trunk/gpgme/genkey.c | 3 ++- trunk/gpgme/rungpg.c | 2 ++ trunk/gpgme/version.c | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index 23e0e56..447190f 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,5 +1,10 @@ 2006-07-16 Marcus Brinkmann + * rungpg.c (read_status): Strip potential carriage return. + * genkey.c (get_key_parameter): Skip potential carriage return. + * version.c (_gpgme_get_program_version): Strip potential carriage + return. + * data.c (gpgme_data_set_file_name): Allow to clear the file name by passing NULL. diff --git a/trunk/gpgme/genkey.c b/trunk/gpgme/genkey.c index 3489c89..afebb7c 100644 --- a/trunk/gpgme/genkey.c +++ b/trunk/gpgme/genkey.c @@ -142,7 +142,8 @@ get_key_parameter (const char *parms, gpgme_data_t *key_parameter) endtag = strstr (content, ""); /* FIXME: Check that there are no control statements inside. */ - while (*content == '\n') + while (content[0] == '\n' + || (content[0] == '\r' && content[1] == '\n')) content++; return gpgme_data_new_from_mem (key_parameter, content, diff --git a/trunk/gpgme/rungpg.c b/trunk/gpgme/rungpg.c index 1cb4d39..349b24d 100644 --- a/trunk/gpgme/rungpg.c +++ b/trunk/gpgme/rungpg.c @@ -845,6 +845,8 @@ read_status (engine_gpg_t gpg) if (*p == '\n') { /* (we require that the last line is terminated by a LF) */ + if (p > buffer && p[-1] = '\r') + p[-1] = 0; *p = 0; if (!strncmp (buffer, "[GNUPG:] ", 9) && buffer[9] >= 'A' && buffer[9] <= 'Z') diff --git a/trunk/gpgme/version.c b/trunk/gpgme/version.c index f417f9c..26d2dae 100644 --- a/trunk/gpgme/version.c +++ b/trunk/gpgme/version.c @@ -200,6 +200,8 @@ _gpgme_get_program_version (const char *const file_name) mark = strchr (&line[linelen], '\n'); if (mark) { + if (mark > &line[0] && *mark == '\r') + mark--; *mark = '\0'; break; } -- 2.26.2