This commit is contained in:
Jfreegman 2013-08-05 02:33:15 -04:00
commit 17f121c58e
11 changed files with 101 additions and 82 deletions

View File

@ -2,12 +2,16 @@ cmake_minimum_required(VERSION 2.6.0)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
if(UNIX)
find_package(Curses REQUIRED)
option(SHARED_TOXCORE "Build Core as a shared library")
if(WIN32)
option(SHARED_LIBSODIUM "Links libsodium as a shared library")
else()
option(USE_NACL "Use NaCl library instead of libsodium")
endif()
if(NOT WIN32)
option(USE_NACL "Use NaCl library instead of libsodium")
if(UNIX)
find_package(Curses REQUIRED)
endif()
if(USE_NACL)
@ -17,6 +21,12 @@ if(USE_NACL)
add_definitions(-DVANILLA_NACL)
set(LINK_CRYPTO_LIBRARY ${NACL_LIBRARIES})
else()
find_package(SODIUM REQUIRED)
include_directories(${SODIUM_INCLUDE_DIR})
set(LINK_CRYPTO_LIBRARY ${SODIUM_LIBRARY})
endif()
#MinGW prints more warnings for -Wall than gcc does, thus causing build to fail
@ -25,25 +35,15 @@ if(NOT WIN32)
message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
endif()
find_package(SODIUM REQUIRED)
endif()
if(NOT USE_NACL)
set(LINK_CRYPTO_LIBRARY ${SODIUM_LIBRARY})
endif()
macro(linkCoreLibraries exe_name)
add_dependencies(${exe_name} toxcore)
if(WIN32)
include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
target_link_libraries(${exe_name} toxcore
${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a
ws2_32)
else()
include_directories(${SODIUM_INCLUDE_DIR})
target_link_libraries(${exe_name} toxcore
${LINK_CRYPTO_LIBRARY})
target_link_libraries(${exe_name} toxcore
${LINK_CRYPTO_LIBRARY})
if(WIN32)
target_link_libraries(${exe_name} ws2_32)
endif()
endmacro()

View File

@ -60,6 +60,10 @@ cd ProjectTox-Core
mkdir build && cd build
cmake ..
```
Advance cmake options:
- `-DSHARED_TOXCORE=ON` (default `OFF`) — Build Core as a shared library.
- `-DUSE_NACL=ON` (default `OFF`) — Use NaCl library instead of libsodium.
Note that you should call cmake on the root [`CMakeLists.txt`](/CMakeLists.txt) file only.
Then you can build any of the [`/testing`](/testing) and [`/other`](/other) that are currently supported on your platform by running:
@ -143,6 +147,10 @@ Navigate in `cmd` to this repo and run:
mkdir build && cd build
cmake -G "MinGW Makefiles" ..
```
Advance cmake options:
- `-DSHARED_TOXCORE=ON` (default OFF) — Build Core as a shared library.
- `-DSHARED_LIBSODIUM=ON` (default OFF) — Link libsodium as a shared library.
Note that you should call cmake on the root [`CMakeLists.txt`](/CMakeLists.txt) file only.
Then you can build any of the [`/testing`](/testing) and [`/other`](/other) that are currently supported on your platform by running:

View File

@ -26,11 +26,12 @@ set(_SODIUM_ROOT_HINTS
set(_SODIUM_ROOT_PATHS
"$ENV{PROGRAMFILES}/sodium"
"${CMAKE_SOURCE_DIR}/sodium"
)
find_path(SODIUM_ROOT_DIR
NAMES
include/cmocka.h
include/sodium.h
HINTS
${_SODIUM_ROOT_HINTS}
PATHS
@ -45,8 +46,15 @@ find_path(SODIUM_INCLUDE_DIR
${SODIUM_ROOT_DIR}/include
)
if(SHARED_LIBSODIUM)
set(WIN32_LIBSODIUM_FILENAME libsodium.dll.a)
else()
set(WIN32_LIBSODIUM_FILENAME libsodium.a)
endif()
find_library(SODIUM_LIBRARY
NAMES
${WIN32_LIBSODIUM_FILENAME}
sodium
PATHS
${SODIUM_ROOT_DIR}/lib

View File

@ -1,12 +1,6 @@
cmake_minimum_required(VERSION 2.6.0)
project(toxcore C)
if(WIN32)
include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
else(WIN32)
include_directories(${SODIUM_INCLUDE_DIR})
endif()
set(core_sources
DHT.c
network.c
@ -16,5 +10,14 @@ set(core_sources
LAN_discovery.c
Messenger.c)
add_library(toxcore SHARED ${core_sources})
target_link_libraries(toxcore ${SODIUM_LIBRARY})
if(SHARED_TOXCORE)
add_library(toxcore SHARED ${core_sources})
else()
add_library(toxcore ${core_sources})
endif()
target_link_libraries(toxcore ${LINK_CRYPTO_LIBRARY})
if(WIN32)
target_link_libraries(toxcore ws2_32)
endif()

View File

@ -119,7 +119,7 @@ static Pinged send_nodes[LSEND_NODES_ARRAY];
* return 1 if client_id1 is closer
* return 2 if client_id2 is closer
*/
int id_closest(uint8_t * id, uint8_t * id1, uint8_t * id2)
static int id_closest(uint8_t * id, uint8_t * id1, uint8_t * id2)
{
size_t i;
uint8_t distance1, distance2;
@ -137,17 +137,17 @@ int id_closest(uint8_t * id, uint8_t * id1, uint8_t * id2)
return 0;
}
int ipport_equal(IP_Port a, IP_Port b)
static int ipport_equal(IP_Port a, IP_Port b)
{
return (a.ip.i == b.ip.i) && (a.port == b.port);
}
int id_equal(uint8_t* a, uint8_t* b)
static int id_equal(uint8_t* a, uint8_t* b)
{
return memcmp(a, b, CLIENT_ID_SIZE) == 0;
}
int is_timeout(uint64_t time_now, uint64_t timestamp, uint64_t timeout)
static int is_timeout(uint64_t time_now, uint64_t timestamp, uint64_t timeout)
{
return timestamp + timeout <= time_now;
}
@ -159,7 +159,7 @@ int is_timeout(uint64_t time_now, uint64_t timestamp, uint64_t timeout)
*
* TODO: maybe optimize this.
*/
int client_in_list(Client_data * list, uint32_t length, uint8_t * client_id, IP_Port ip_port)
static int client_in_list(Client_data * list, uint32_t length, uint8_t * client_id, IP_Port ip_port)
{
uint32_t i;
uint64_t temp_time = unix_time();
@ -184,7 +184,7 @@ int client_in_list(Client_data * list, uint32_t length, uint8_t * client_id, IP_
/* check if client with client_id is already in node format list of length length.
* return True(1) or False(0)
*/
int client_in_nodelist(Node_format * list, uint32_t length, uint8_t * client_id)
static int client_in_nodelist(Node_format * list, uint32_t length, uint8_t * client_id)
{
uint32_t i;
@ -215,7 +215,7 @@ static int friend_number(uint8_t * client_id)
*
* TODO: For the love of based Allah make this function cleaner and much more efficient.
*/
int get_close_nodes(uint8_t * client_id, Node_format * nodes_list)
static int get_close_nodes(uint8_t * client_id, Node_format * nodes_list)
{
uint32_t i, j, k;
uint64_t temp_time = unix_time();
@ -301,7 +301,7 @@ int get_close_nodes(uint8_t * client_id, Node_format * nodes_list)
* return 0 if successful
* return 1 if not (list contains no bad nodes)
*/
int replace_bad( Client_data * list,
static int replace_bad( Client_data * list,
uint32_t length,
uint8_t * client_id,
IP_Port ip_port )
@ -325,7 +325,7 @@ int replace_bad( Client_data * list,
}
/* replace the first good node that is further to the comp_client_id than that of the client_id in the list */
int replace_good( Client_data * list,
static int replace_good( Client_data * list,
uint32_t length,
uint8_t * client_id,
IP_Port ip_port,
@ -351,7 +351,7 @@ int replace_good( Client_data * list,
/* Attempt to add client with ip_port and client_id to the friends client list
* and close_clientlist
*/
void addto_lists(IP_Port ip_port, uint8_t * client_id)
static void addto_lists(IP_Port ip_port, uint8_t * client_id)
{
uint32_t i;
@ -393,7 +393,7 @@ void addto_lists(IP_Port ip_port, uint8_t * client_id)
/* If client_id is a friend or us, update ret_ip_port
* nodeclient_id is the id of the node that sent us this info
*/
void returnedip_ports(IP_Port ip_port, uint8_t * client_id, uint8_t * nodeclient_id)
static void returnedip_ports(IP_Port ip_port, uint8_t * client_id, uint8_t * nodeclient_id)
{
uint32_t i, j;
uint64_t temp_time = unix_time();
@ -431,7 +431,7 @@ void returnedip_ports(IP_Port ip_port, uint8_t * client_id, uint8_t * nodeclient
*
* TODO: optimize this
*/
int is_pinging(IP_Port ip_port, uint64_t ping_id)
static int is_pinging(IP_Port ip_port, uint64_t ping_id)
{
uint32_t i;
uint8_t pinging;
@ -456,7 +456,7 @@ int is_pinging(IP_Port ip_port, uint64_t ping_id)
}
/* Same as last function but for get_node requests. */
int is_gettingnodes(IP_Port ip_port, uint64_t ping_id)
static int is_gettingnodes(IP_Port ip_port, uint64_t ping_id)
{
uint32_t i;
uint8_t pinging;
@ -486,7 +486,7 @@ int is_gettingnodes(IP_Port ip_port, uint64_t ping_id)
*
* TODO: optimize this
*/
uint64_t add_pinging(IP_Port ip_port)
static uint64_t add_pinging(IP_Port ip_port)
{
uint32_t i, j;
uint64_t ping_id = ((uint64_t)random_int() << 32) + random_int();
@ -507,7 +507,7 @@ uint64_t add_pinging(IP_Port ip_port)
}
/* Same but for get node requests */
uint64_t add_gettingnodes(IP_Port ip_port)
static uint64_t add_gettingnodes(IP_Port ip_port)
{
uint32_t i, j;
uint64_t ping_id = ((uint64_t)random_int() << 32) + random_int();
@ -676,7 +676,7 @@ static int sendnodes(IP_Port ip_port, uint8_t * public_key, uint8_t * client_id,
/* Packet handling functions, one to handle each types of packets we receive
* Returns 0 if handled correctly, 1 if packet is bad.
*/
int handle_pingreq(uint8_t * packet, uint32_t length, IP_Port source)
static int handle_pingreq(uint8_t * packet, uint32_t length, IP_Port source)
{
uint64_t ping_id;
if(length != 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES + sizeof(ping_id) + ENCRYPTION_PADDING)
@ -702,7 +702,7 @@ int handle_pingreq(uint8_t * packet, uint32_t length, IP_Port source)
return 0;
}
int handle_pingres(uint8_t * packet, uint32_t length, IP_Port source)
static int handle_pingres(uint8_t * packet, uint32_t length, IP_Port source)
{
uint64_t ping_id;
if(length != 1 + CLIENT_ID_SIZE + crypto_box_NONCEBYTES + sizeof(ping_id) + ENCRYPTION_PADDING)
@ -729,7 +729,7 @@ int handle_pingres(uint8_t * packet, uint32_t length, IP_Port source)
return 1;
}
int handle_getnodes(uint8_t * packet, uint32_t length, IP_Port source)
static int handle_getnodes(uint8_t * packet, uint32_t length, IP_Port source)
{
uint64_t ping_id;
@ -761,7 +761,7 @@ int handle_getnodes(uint8_t * packet, uint32_t length, IP_Port source)
return 0;
}
int handle_sendnodes(uint8_t * packet, uint32_t length, IP_Port source)
static int handle_sendnodes(uint8_t * packet, uint32_t length, IP_Port source)
{
uint64_t ping_id;
uint32_t cid_size = 1 + CLIENT_ID_SIZE;
@ -1029,7 +1029,7 @@ int route_tofriend(uint8_t * friend_id, uint8_t * packet, uint32_t length)
/* Send the following packet to one random person who tells us they are connected to friend_id
* returns the number of nodes it sent the packet to
*/
int routeone_tofriend(uint8_t * friend_id, uint8_t * packet, uint32_t length)
static int routeone_tofriend(uint8_t * friend_id, uint8_t * packet, uint32_t length)
{
int num = friend_number(friend_id);
if (num == -1)
@ -1079,7 +1079,7 @@ int friend_ips(IP_Port * ip_portlist, uint8_t * friend_id)
/*----------------------------------------------------------------------------------*/
/*---------------------BEGINNING OF NAT PUNCHING FUNCTIONS--------------------------*/
int send_NATping(uint8_t * public_key, uint64_t ping_id, uint8_t type)
static int send_NATping(uint8_t * public_key, uint64_t ping_id, uint8_t type)
{
uint8_t data[sizeof(uint64_t) + 1];
uint8_t packet[MAX_DATA_SIZE];
@ -1105,7 +1105,7 @@ int send_NATping(uint8_t * public_key, uint64_t ping_id, uint8_t type)
}
/* Handle a recieved ping request for */
int handle_NATping(uint8_t * packet, uint32_t length, IP_Port source)
static int handle_NATping(uint8_t * packet, uint32_t length, IP_Port source)
{
if (length < crypto_box_PUBLICKEYBYTES * 2 + crypto_box_NONCEBYTES + ENCRYPTION_PADDING
&& length > MAX_DATA_SIZE + ENCRYPTION_PADDING)

View File

@ -29,7 +29,7 @@
/* get the first working broadcast address that's not from "lo"
* returns higher than 0 on success
* returns 0 on error */
uint32_t get_broadcast(void)
static uint32_t get_broadcast(void)
{
/* not sure how many platforms this will
* run on, so it's wrapped in __linux for now */
@ -76,7 +76,7 @@ uint32_t get_broadcast(void)
#endif
/* Return the broadcast ip */
IP broadcast_ip()
static IP broadcast_ip()
{
IP ip;
#ifdef __linux
@ -92,7 +92,7 @@ IP broadcast_ip()
/*return 0 if ip is a LAN ip
return -1 if it is not */
int LAN_ip(IP ip)
static int LAN_ip(IP ip)
{
if (ip.c[0] == 127)/* Loopback */
return 0;
@ -107,7 +107,7 @@ int LAN_ip(IP ip)
return -1;
}
int handle_LANdiscovery(uint8_t *packet, uint32_t length, IP_Port source)
static int handle_LANdiscovery(uint8_t *packet, uint32_t length, IP_Port source)
{
if (LAN_ip(source.ip) == -1)
return 1;

View File

@ -149,7 +149,7 @@ static uint32_t randtable[6][256];
*
* TODO: make this better
*/
uint32_t handshake_id(IP_Port source)
static uint32_t handshake_id(IP_Port source)
{
uint32_t id = 0, i;
for (i = 0; i < 6; ++i) {
@ -168,7 +168,7 @@ uint32_t handshake_id(IP_Port source)
*
* TODO: make this better
*/
void change_handshake(IP_Port source)
static void change_handshake(IP_Port source)
{
uint8_t rand = random_int() % 4;
randtable[rand][((uint8_t *)&source)[rand]] = random_int();
@ -234,7 +234,7 @@ int new_connection(IP_Port ip_port)
* Returns an integer corresponding to the connection id.
* Return -1 if it could not initialize the connection.
*/
int new_inconnection(IP_Port ip_port)
static int new_inconnection(IP_Port ip_port)
{
if (getconnection_id(ip_port) != -1)
return -1;
@ -470,7 +470,7 @@ uint32_t missing_packets(int connection_id, uint32_t * requested)
* see http://wiki.tox.im/index.php/Lossless_UDP for more information.
*/
int send_handshake(IP_Port ip_port, uint32_t handshake_id1, uint32_t handshake_id2)
static int send_handshake(IP_Port ip_port, uint32_t handshake_id1, uint32_t handshake_id2)
{
uint8_t packet[1 + 4 + 4];
uint32_t temp;
@ -484,7 +484,7 @@ int send_handshake(IP_Port ip_port, uint32_t handshake_id1, uint32_t handshake_i
return sendpacket(ip_port, packet, sizeof(packet));
}
int send_SYNC(uint32_t connection_id)
static int send_SYNC(uint32_t connection_id)
{
uint8_t packet[(BUFFER_PACKET_NUM*4 + 4 + 4 + 2)];
uint16_t index = 0;
@ -511,7 +511,7 @@ int send_SYNC(uint32_t connection_id)
}
int send_data_packet(uint32_t connection_id, uint32_t packet_num)
static int send_data_packet(uint32_t connection_id, uint32_t packet_num)
{
uint32_t index = packet_num % MAX_QUEUE_NUM;
uint32_t temp;
@ -526,7 +526,7 @@ int send_data_packet(uint32_t connection_id, uint32_t packet_num)
}
/* sends 1 data packet */
int send_DATA(uint32_t connection_id)
static int send_DATA(uint32_t connection_id)
{
int ret;
uint32_t buffer[BUFFER_PACKET_NUM];
@ -555,7 +555,7 @@ int send_DATA(uint32_t connection_id)
/* Return 0 if handled correctly, 1 if packet is bad. */
int handle_handshake(uint8_t * packet, uint32_t length, IP_Port source)
static int handle_handshake(uint8_t * packet, uint32_t length, IP_Port source)
{
if (length != (1 + 4 + 4))
return 1;
@ -591,7 +591,7 @@ int handle_handshake(uint8_t * packet, uint32_t length, IP_Port source)
}
/* returns 1 if sync packet is valid 0 if not. */
int SYNC_valid(uint32_t length)
static int SYNC_valid(uint32_t length)
{
if (length < 4 + 4 + 2)
return 0;
@ -602,7 +602,7 @@ int SYNC_valid(uint32_t length)
}
/* case 1 in handle_SYNC: */
int handle_SYNC1(IP_Port source, uint32_t recv_packetnum, uint32_t sent_packetnum)
static int handle_SYNC1(IP_Port source, uint32_t recv_packetnum, uint32_t sent_packetnum)
{
if (handshake_id(source) == recv_packetnum) {
int x = new_inconnection(source);
@ -622,7 +622,7 @@ int handle_SYNC1(IP_Port source, uint32_t recv_packetnum, uint32_t sent_packetnu
}
/* case 2 in handle_SYNC: */
int handle_SYNC2(int connection_id, uint8_t counter, uint32_t recv_packetnum, uint32_t sent_packetnum)
static int handle_SYNC2(int connection_id, uint8_t counter, uint32_t recv_packetnum, uint32_t sent_packetnum)
{
if (recv_packetnum == connections[connection_id].orecv_packetnum) {
/* && sent_packetnum == connections[connection_id].osent_packetnum) */
@ -635,7 +635,7 @@ int handle_SYNC2(int connection_id, uint8_t counter, uint32_t recv_packetnum, ui
return 1;
}
/* case 3 in handle_SYNC: */
int handle_SYNC3(int connection_id, uint8_t counter, uint32_t recv_packetnum, uint32_t sent_packetnum, uint32_t * req_packets,
static int handle_SYNC3(int connection_id, uint8_t counter, uint32_t recv_packetnum, uint32_t sent_packetnum, uint32_t * req_packets,
uint16_t number)
{
uint8_t comp_counter = (counter - connections[connection_id].recv_counter );
@ -669,7 +669,7 @@ int handle_SYNC3(int connection_id, uint8_t counter, uint32_t recv_packetnum, ui
return 1;
}
int handle_SYNC(uint8_t *packet, uint32_t length, IP_Port source)
static int handle_SYNC(uint8_t *packet, uint32_t length, IP_Port source)
{
if (!SYNC_valid(length))
@ -708,7 +708,7 @@ int handle_SYNC(uint8_t *packet, uint32_t length, IP_Port source)
* Add a packet to the received buffer and set the recv_packetnum of the
* connection to its proper value. Return 1 if data was too big, 0 if not.
*/
int add_recv(int connection_id, uint32_t data_num, uint8_t *data, uint16_t size)
static int add_recv(int connection_id, uint32_t data_num, uint8_t *data, uint16_t size)
{
if (size > MAX_DATA_SIZE)
return 1;
@ -742,7 +742,7 @@ int add_recv(int connection_id, uint32_t data_num, uint8_t *data, uint16_t size)
return 0;
}
int handle_data(uint8_t *packet, uint32_t length, IP_Port source)
static int handle_data(uint8_t *packet, uint32_t length, IP_Port source)
{
int connection = getconnection_id(source);
@ -793,7 +793,7 @@ int LosslessUDP_handlepacket(uint8_t *packet, uint32_t length, IP_Port source)
* Send handshake requests
* handshake packets are sent at the same rate as SYNC packets
*/
void doNew()
static void doNew()
{
uint32_t i;
uint64_t temp_time = current_time();
@ -817,7 +817,7 @@ void doNew()
}
}
void doSYNC()
static void doSYNC()
{
uint32_t i;
uint64_t temp_time = current_time();
@ -830,7 +830,7 @@ void doSYNC()
}
}
void doData()
static void doData()
{
uint32_t i;
uint64_t j;
@ -851,7 +851,7 @@ void doData()
*
* TODO: flow control.
*/
void adjustRates()
static void adjustRates()
{
uint32_t i;
uint64_t temp_time = current_time();

View File

@ -126,7 +126,7 @@ int decrypt_data(uint8_t *public_key, uint8_t *secret_key, uint8_t *nonce,
}
/* increment the given nonce by 1 */
void increment_nonce(uint8_t *nonce)
static void increment_nonce(uint8_t *nonce)
{
uint32_t i;
for (i = 0; i < crypto_box_NONCEBYTES; ++i) {
@ -243,7 +243,7 @@ int handle_request(uint8_t *public_key, uint8_t *data, uint8_t *packet, uint16_t
/* Send a crypto handshake packet containing an encrypted secret nonce and session public key
to peer with connection_id and public_key
the packet is encrypted with a random nonce which is sent in plain text with the packet */
int send_cryptohandshake(int connection_id, uint8_t *public_key, uint8_t *secret_nonce, uint8_t *session_key)
static int send_cryptohandshake(int connection_id, uint8_t *public_key, uint8_t *secret_nonce, uint8_t *session_key)
{
uint8_t temp_data[MAX_DATA_SIZE];
uint8_t temp[crypto_box_NONCEBYTES + crypto_box_PUBLICKEYBYTES];
@ -266,7 +266,7 @@ int send_cryptohandshake(int connection_id, uint8_t *public_key, uint8_t *secret
/* Extract secret nonce, session public key and public_key from a packet(data) with length length
return 1 if successful
return 0 if failure */
int handle_cryptohandshake(uint8_t *public_key, uint8_t *secret_nonce,
static int handle_cryptohandshake(uint8_t *public_key, uint8_t *secret_nonce,
uint8_t *session_key, uint8_t *data, uint16_t length)
{
int pad = (- crypto_box_BOXZEROBYTES + crypto_box_ZEROBYTES);
@ -295,7 +295,7 @@ int handle_cryptohandshake(uint8_t *public_key, uint8_t *secret_nonce,
/* get crypto connection id from public key of peer
return -1 if there are no connections like we are looking for
return id if it found it */
int getcryptconnection_id(uint8_t *public_key)
static int getcryptconnection_id(uint8_t *public_key)
{
uint32_t i;
for (i = 0; i < MAX_CRYPTO_CONNECTIONS; ++i) {
@ -465,7 +465,7 @@ void load_keys(uint8_t *keys)
adds an incoming connection to the incoming_connection list.
returns 0 if successful
returns 1 if failure */
int new_incoming(int id)
static int new_incoming(int id)
{
uint32_t i;
for (i = 0; i < MAX_INCOMING; ++i) {

View File

@ -8,11 +8,10 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/DHT_test.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Lossless_UDP_testclient.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Lossless_UDP_testserver.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Messenger_test.cmake)
if(WIN32)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/nTox_win32.cmake)
endif()
if(NOT WIN32)
else()
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/nTox.cmake)
add_subdirectory(toxic)
endif()

View File

@ -428,7 +428,9 @@ int main(int argc, char *argv[])
}
for(i = 0; i < argc; i++) {
if(argv[i][0] == '-') {
if (argv[i] == NULL){
break;
} else if(argv[i][0] == '-') {
if(argv[i][1] == 'h') {
print_help();
exit(0);

View File

@ -265,6 +265,5 @@ ToxWindow new_chat(int friendnum) {
x->friendnum = friendnum;
ret.x = (void*) x;
free(x);
return ret;
}