Added namesys/proquint_test, a small test sample.

This commit is contained in:
Jose Marcial Vieira Bisneto 2016-11-29 21:04:40 -03:00
parent 75f86b4107
commit 8f686f6115

37
namesys/proquint_test.c Normal file
View file

@ -0,0 +1,37 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int ProquintIsProquint(char *str);
char *ProquintEncode(char *buf);
char *ProquintDecode(char *str);
int main(void) {
char *r, *s;
int i;
char *p[] = {"lusab-babad", "gutih-tugad", "gutuk-bisog", "mudof-sakat",
"haguz-biram", "mabiv-gibot", "natag-lisaf", "tibup-zujah",
"tobog-higil", "todah-vobij", "sinid-makam", "budov-kuras",
NULL};
for (i = 0 ; p[i] ; i++) {
r = ProquintDecode (p[i]);
if (r) {
struct in_addr ip_addr;
memcpy (&(ip_addr.s_addr), r, sizeof(ip_addr.s_addr));
printf ("%s\t%s", p[i], inet_ntoa(ip_addr));
s = ProquintEncode(r);
free (r);
if (s) {
printf ("\t%s", s);
free (s);
}
printf("\n");
}
}
return 0;
}