myadm

Simple MySQL client for the terminal
git clone git://git.bitsmanent.org/myadm
Log | Files | Refs | README | LICENSE

stflfrag.c (513B)


      1 #include <langinfo.h>
      2 #include <stdio.h>
      3 #include <stfl.h>
      4 #include <string.h>
      5 
      6 int
      7 main(int argc, char **argv) {
      8 	struct stfl_form *form;
      9 	struct stfl_ipool *ipool;
     10 	const wchar_t *frag;
     11 	wchar_t file[256];
     12 
     13 	if(argc != 2)
     14 		return 1;
     15 	ipool = stfl_ipool_create(nl_langinfo(CODESET));
     16 	swprintf(file, sizeof file - 1, L"<%ls>", stfl_ipool_towc(ipool, argv[1]));
     17 	if(!(form = stfl_create(file)))
     18 		return 1;
     19 	frag = stfl_dump(form, NULL, NULL, 0);
     20 	wprintf(L"%ls", frag);
     21 	stfl_ipool_destroy(ipool);
     22 	return 0;
     23 }