syncRaftIdCheck.cpp 721 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#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);
S
Shengliang Guan 已提交
18
    printf("" PRIu64 " -> %s:%d \n", u64, host, port);
19 20 21 22 23

  } else if (argc == 3) {
    uint64_t u64;
    char*    host = argv[1];
    uint16_t port = atoi(argv[2]);
24
    u64 = syncUtilAddr2U64(host, port);
S
Shengliang Guan 已提交
25
    printf("%s:%d ->: %" PRIu64 " \n", host, port, u64);
26 27 28 29 30 31 32
  } else {
    usage(argv[0]);
    exit(-1);
  }

  return 0;
}