]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
(sexp_vformat): Handle %( and %).
authorNiels Möller <nisse@lysator.liu.se>
Tue, 11 Feb 2003 08:45:53 +0000 (09:45 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Tue, 11 Feb 2003 08:45:53 +0000 (09:45 +0100)
Rev: src/nettle/sexp-format.c:1.8
Rev: src/nettle/sexp.h:1.14

sexp-format.c
sexp.h

index 1db2563aac3608178faa6a38c0716cf3e51e5cb1..134a081d5eb6f43fb053d577b8ba5d4181a25ca7 100644 (file)
@@ -146,6 +146,14 @@ sexp_vformat(struct nettle_buffer *buffer, const char *format, va_list args)
            default:
              abort();
 
+           case '(':
+           case ')':
+             /* Allow unbalanced parenthesis */
+             if (buffer && !NETTLE_BUFFER_PUTC(buffer, format[-1]))
+               return 0;
+             done++;
+             break;
+             
            case 's':
              {
                const char *s;
diff --git a/sexp.h b/sexp.h
index 212527961686808063c41db87cf6bfcfaa9826b8..2b72a2be8129b8cc0999af714fe9b4a9af2497fa 100644 (file)
--- a/sexp.h
+++ b/sexp.h
@@ -153,14 +153,15 @@ struct nettle_buffer;
  *        subexpression. Represented as unsigned length, const uint8_t
  *        *data.
  *
+ *   %(, %)  Allows insertion of unbalanced parenthesis.
+ *
  * Modifiers:
  *
  *   %0   For %s, %t and %l, says that there's no length argument,
  *        instead the string is NUL-terminated, and there's only one
  *        const uint8_t * argument.
- *
- * FIXME: Allow "%(" for unbalanced parenthesis. */
-
+ */
 unsigned
 sexp_format(struct nettle_buffer *buffer,
            const char *format, ...);