use signal safe ust_safe_snprintf()
[ust.git] / snprintf / prog.c
diff --git a/snprintf/prog.c b/snprintf/prog.c
new file mode 100644 (file)
index 0000000..157511b
--- /dev/null
@@ -0,0 +1,18 @@
+#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+       char buf[100];
+
+       char *expected;
+
+       expected = "header 9999, hello, 003";
+       ust_safe_snprintf(buf, 99, "header %d, %s, %03d", 9999, "hello", 3);
+       if(strcmp(buf, expected) != 0) {
+               printf("Error: expected \"%s\" and got \"%s\"\n", expected, buf);
+               return 1;
+       }
+
+       return 0;
+}
This page took 0.023602 seconds and 4 git commands to generate.