]> git.ozlabs.org Git - ccan/blobdiff - ccan/cast/_info
base64: fix for unsigned chars (e.g. ARM).
[ccan] / ccan / cast / _info
index d66e7091b42ccfc45a1d7c86c12b114f6b4b4d3a..29128b8d5cf7cff915b07fa01783c2c44727073f 100644 (file)
@@ -1,5 +1,6 @@
-#include <string.h>
 #include "config.h"
+#include <stdio.h>
+#include <string.h>
 
 /**
  * cast - routines for safer casting.
  * License: LGPL (v2.1 or any later version)
  *
  * Example:
- *     // Given "test" contains "3 t's in 'test string'
+ *     // Given "test" output contains "3 t's in 'test string'"
  *     #include <ccan/cast/cast.h>
  *     #include <stdint.h>
  *     #include <stdio.h>
+ *     #include <stdlib.h>
  *
  *     // Find char @orig in @str, if @repl, replace them.  Return number.
  *     static size_t find_chars(char *str, char orig, char repl)
@@ -52,6 +54,9 @@
  *     {
  *             uint64_t hash;
  *
+ *             if (argc != 2) {
+ *                     fprintf(stderr, "Needs argument\n"); exit(1);
+ *             }
  *             // find_chars wants a non-const string, but doesn't
  *             // need it if repl == 0.
  *             printf("%zu %c's in 'test string'\n",