From 2039f20afdd24a72e8b2b58e66196150855a8b4b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Mon, 10 Feb 2003 18:35:07 +0100
Subject: [PATCH] * sexp-format.c (sexp_vformat): Allow whitespace in format
 string.

Rev: src/nettle/sexp-format.c:1.7
Rev: src/nettle/sexp.h:1.13
---
 sexp-format.c | 5 ++++-
 sexp.h        | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/sexp-format.c b/sexp-format.c
index 6fdc8910..1db2563a 100644
--- a/sexp-format.c
+++ b/sexp-format.c
@@ -97,7 +97,7 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args)
       default:
 	{
 	  const char *start = format - 1;
-	  unsigned length = 1 + strcspn(format, "()%");
+	  unsigned length = 1 + strcspn(format, "()% \t");
 	  unsigned output_length = format_string(buffer, length, start);
 	  if (!output_length)
 	    return 0;
@@ -107,6 +107,9 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args)
 
 	  break;
 	}
+      case ' ': case '\t':
+	break;
+	
       case '\0':
 	assert(!nesting);
 	    
diff --git a/sexp.h b/sexp.h
index 1849988b..21252796 100644
--- a/sexp.h
+++ b/sexp.h
@@ -135,7 +135,8 @@ struct nettle_buffer;
  * buffer == NULL, just compute length.
  *
  * Format strings can contained matched parentheses, tokens ("foo" in
- * the format string is formatted as "3:foo"), and the following
+ * the format string is formatted as "3:foo"), whitespace (which
+ * separates tokens but is otherwise ignored) and the following
  * formatting specifiers:
  *
  *   %s   String represented as unsigned length, const uint8_t *data.
-- 
GitLab