add OSMO_STRBUF_PRINTF()

We are using macros like this or different workarounds in libmsc. In the course
of implementing inter-MSC handover, I am encountering yet another such
situation of appending multiple strings to a limited char buffer. Standardize.

Add a unit test to utils_test.c.

Change-Id: I2497514e26c5e7a5d88985fc7e58343be1a027b2
diff --git a/tests/utils/utils_test.ok b/tests/utils/utils_test.ok
index 8d7ced8..1215ddd 100644
--- a/tests/utils/utils_test.ok
+++ b/tests/utils/utils_test.ok
@@ -325,3 +325,20 @@
                    = 62, "ABCDEFGHIJKLMNOPQRSTUVWXYZA"
 osmo_str_toupper_buf(28, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
                    = 27, "ABCDEFGHIJKLMNOPQRSTUVWXYZA"
+
+strbuf_test
+OSMO_STRBUF_APPEND():
+     The answer is 42 
+would have needed 423470 bytes
+
+OSMO_STRBUF_PRINTF():
+1: (need 42 chars, had size=23) T minus 10 9 8 7 6 5 4
+2: (need 42 chars, had size=42) T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off
+3: (need 42 chars, had size=42+1) T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off!
+4: (need 42 chars, had size=0) 0x2b 0x2b 0x2b...
+5: (need 42 chars, had NULL buffer)
+
+cascade:
+(need 134 chars)
+T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off! -- T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off! -- T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off!
+(need 134 chars, had size=63) T minus 10 9 8 7 6 5 4 3 2 1 ... Lift off! -- T minus 10 9 8 7