Kannel: Open Source WAP and SMS gateway  svn-r5335
test_octstr_format.c File Reference
#include "gwlib/gwlib.h"

Go to the source code of this file.

Functions

int main (void)
 

Function Documentation

◆ main()

int main ( void  )

Definition at line 63 of file test_octstr_format.c.

References gwlib_init(), gwlib_shutdown(), octstr_destroy(), octstr_dump, octstr_format(), and octstr_format_append().

64 {
65  Octstr *os, *os2, *os3, *os4, *os5;
66  unsigned long long n = 18446744073709551615ull;
67 
68  gwlib_init();
69 
70  os = octstr_format("hi, %% %-5.*s, <%*s>, %-5d + %05d = %d, -%5.2f",
71  3, "world", 3, "", 1, 2, 3, 3.1415927);
72  octstr_dump(os, 0);
73 
74  os2 = octstr_format("<%S>", os);
75  octstr_dump(os2, 0);
76 
77  octstr_format_append(os2, "yeehaa!");
78  octstr_dump(os2, 0);
79 
80  os3 = octstr_format("NULL=%p &os=%p", (void *) NULL, (void *) &os);
81  octstr_dump(os3, 0);
82 
83  os4 = octstr_format("Encode %E and limited %-10.10E", os, os);
84  octstr_dump(os4, 0);
85 
86  os5 = octstr_format("Encode %%llu: %llu", n);
87  octstr_dump(os5, 0);
88 
89  octstr_destroy(os);
90  octstr_destroy(os2);
91  octstr_destroy(os3);
92  octstr_destroy(os4);
93  octstr_destroy(os5);
94 
96 
97  return 0;
98 }
#define octstr_dump(ostr, level,...)
Definition: octstr.h:564
Octstr * octstr_format(const char *fmt,...)
Definition: octstr.c:2464
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
Definition: octstr.c:118
void octstr_format_append(Octstr *os, const char *fmt,...)
Definition: octstr.c:2507
void gwlib_shutdown(void)
Definition: gwlib.c:94
void gwlib_init(void)
Definition: gwlib.c:78
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.