From 1517f0e945d98966316219fb5601c6a8cce69a84 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Tue, 22 Mar 2005 23:41:08 +0000 Subject: * gpgkeys_ldap.c, ksutil.h, ksutil.c (print_nocr): Moved from gpgkeys_ldap.c. Print a string, but strip out any CRs. * gpgkeys_finger.c (get_key), gpgkeys_hkp.c (get_key), gpgkeys_http.c (get_key): Use it here when outputting key material to canonicalize line endings. --- keyserver/ksutil.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'keyserver/ksutil.c') diff --git a/keyserver/ksutil.c b/keyserver/ksutil.c index 0a5d779e1..78154c377 100644 --- a/keyserver/ksutil.c +++ b/keyserver/ksutil.c @@ -294,3 +294,21 @@ ks_action_to_string(enum ks_action action) return "?"; } + +/* Canonicalize CRLF to just LF by stripping CRs. This actually makes + sense, since on Unix-like machines LF is correct, and on win32-like + machines, our output buffer is opened in textmode and will + re-canonicalize line endings back to CRLF. Since we only need to + handle armored keys, we don't have to worry about odd cases like + CRCRCR and the like. */ + +void +print_nocr(FILE *stream,const char *str) +{ + while(*str) + { + if(*str!='\r') + fputc(*str,stream); + str++; + } +} -- cgit v1.2.3