Kannel: Open Source WAP and SMS gateway  svn-r5335
test_charset.c File Reference
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include "gwlib/gwlib.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 69 of file test_charset.c.

References charset_gsm_to_utf8(), charset_utf8_to_gsm(), debug(), gwlib_init(), gwlib_shutdown(), octstr_append_from_hex(), octstr_compare(), octstr_create, octstr_destroy(), octstr_dump, octstr_duplicate, and panic.

70 {
71  Octstr *os1, *os2;
72 
73  gwlib_init();
74 
75  os1 = octstr_create("");
76  octstr_append_from_hex(os1, "411810124550421715161a");
77  os2 = octstr_duplicate(os1);
78  debug("", 0, "Orginal GSM charset data:");
79  octstr_dump(os1, 0);
81  debug("", 0, "Same data mapped to URT-8 charset:");
82  octstr_dump(os1, 0);
84  debug("", 0, "Same data mapped back again to GSM charset:");
85  octstr_dump(os1, 0);
86 
87  if (octstr_compare(os1, os2) != 0)
88  panic(0, "Data is not the same after re-mapping!");
89  else
90  debug("",0,"Data is same, ok.");
91 
92  octstr_destroy(os1);
93  octstr_destroy(os2);
95  return 0;
96 }
void octstr_append_from_hex(Octstr *ostr, char *hex)
Definition: octstr.c:451
void charset_utf8_to_gsm(Octstr *ostr)
Definition: charset.c:288
#define octstr_duplicate(ostr)
Definition: octstr.h:187
#define octstr_dump(ostr, level,...)
Definition: octstr.h:564
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
#define octstr_create(cstr)
Definition: octstr.h:125
Definition: octstr.c:118
void debug(const char *place, int err, const char *fmt,...)
Definition: log.c:726
#define panic
Definition: log.h:87
void gwlib_shutdown(void)
Definition: gwlib.c:94
void gwlib_init(void)
Definition: gwlib.c:78
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)
Definition: octstr.c:871
void charset_gsm_to_utf8(Octstr *ostr)
Definition: charset.c:220
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.