summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
authorCoren[m] <Break@Ocean>2013-09-11 15:19:39 +0200
committerCoren[m] <Break@Ocean>2013-09-11 15:19:39 +0200
commitd35fee43ba7fe131e9c3dcda5167a46eacbf315a (patch)
treedcd539e4964b084312e0086072abbc8f25c3033e /toxcore
parenta326e851ba532756fefd9b83555be66f3c9de764 (diff)
toxcore/util.h:
- moved cmdline_parsefor_ipv46() to testing/misc_tools.c
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/util.c32
-rw-r--r--toxcore/util.h2
2 files changed, 0 insertions, 34 deletions
diff --git a/toxcore/util.c b/toxcore/util.c
index 7b5ddc49..19d464d4 100644
--- a/toxcore/util.c
+++ b/toxcore/util.c
@@ -43,38 +43,6 @@ void id_cpy(uint8_t *dest, uint8_t *src)
43 memcpy(dest, src, CLIENT_ID_SIZE); 43 memcpy(dest, src, CLIENT_ID_SIZE);
44} 44}
45 45
46int cmdline_parsefor_ipv46(int argc, char **argv, uint8_t *ipv6enabled)
47{
48 int argvoffset = 0, argi;
49 for(argi = 1; argi < argc; argi++)
50 if (!strncasecmp(argv[argi], "--ipv", 5)) {
51 if (argv[argi][5] && !argv[argi][6]) {
52 char c = argv[argi][5];
53 if (c == '4')
54 *ipv6enabled = 0;
55 else if (c == '6')
56 *ipv6enabled = 1;
57 else {
58 printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]);
59 return -1;
60 }
61 }
62 else {
63 printf("Invalid argument: %s. Try --ipv4 or --ipv6!\n", argv[argi]);
64 return -1;
65 }
66
67 if (argvoffset != argi - 1) {
68 printf("Argument must come first: %s.\n", argv[argi]);
69 return -1;
70 }
71
72 argvoffset++;
73 }
74
75 return argvoffset;
76};
77
78#ifdef LOGGING 46#ifdef LOGGING
79char logbuffer[512]; 47char logbuffer[512];
80static FILE *logfile = NULL; 48static FILE *logfile = NULL;
diff --git a/toxcore/util.h b/toxcore/util.h
index e7be2d51..71be84ca 100644
--- a/toxcore/util.h
+++ b/toxcore/util.h
@@ -16,8 +16,6 @@ uint64_t random_64b();
16bool id_eq(uint8_t *dest, uint8_t *src); 16bool id_eq(uint8_t *dest, uint8_t *src);
17void id_cpy(uint8_t *dest, uint8_t *src); 17void id_cpy(uint8_t *dest, uint8_t *src);
18 18
19int cmdline_parsefor_ipv46(int argc, char **argv, uint8_t *ipv6enabled);
20
21#undef LOGGING 19#undef LOGGING
22/* #define LOGGING */ 20/* #define LOGGING */
23#ifdef LOGGING 21#ifdef LOGGING