2022-06-13 04:13:35 +00:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include "syncIO.h"
|
|
|
|
|
#include "syncInt.h"
|
|
|
|
|
#include "syncUtil.h"
|
|
|
|
|
|
|
|
|
|
void usage(char* exe) {
|
|
|
|
|
printf("Usage: %s host port \n", exe);
|
|
|
|
|
printf("Usage: %s u64 \n", exe);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
|
if (argc == 2) {
|
|
|
|
|
uint64_t u64 = atoll(argv[1]);
|
|
|
|
|
char host[128];
|
|
|
|
|
uint16_t port;
|
|
|
|
|
syncUtilU642Addr(u64, host, sizeof(host), &port);
|
2022-06-14 06:54:11 +00:00
|
|
|
printf("%lu -> %s:%d \n", u64, host, port);
|
2022-06-13 04:13:35 +00:00
|
|
|
|
|
|
|
|
} else if (argc == 3) {
|
|
|
|
|
uint64_t u64;
|
|
|
|
|
char* host = argv[1];
|
|
|
|
|
uint16_t port = atoi(argv[2]);
|
2022-06-14 06:54:11 +00:00
|
|
|
u64 = syncUtilAddr2U64(host, port);
|
|
|
|
|
printf("%s:%d -> %lu \n", host, port, u64);
|
2022-06-13 04:13:35 +00:00
|
|
|
} else {
|
|
|
|
|
usage(argv[0]);
|
|
|
|
|
exit(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|