standardization pass: conditional statement spacing, removed NULL shorthand making checks more explicit
This commit is contained in:
@@ -14,7 +14,7 @@ char *msg = (char*)"welcome to the machine";
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if(argc != 5) {
|
||||
if (argc != 5) {
|
||||
printf("\nlibzt example client\n");
|
||||
printf("client [config_file_path] [nwid] [remote_addr] [remote_port]\n");
|
||||
exit(0);
|
||||
@@ -43,11 +43,11 @@ int main(int argc, char **argv)
|
||||
sleep(2);
|
||||
|
||||
// socket()
|
||||
if((sockfd = zts_socket(AF_INET, SOCK_STREAM, 0)) < 0)
|
||||
if ((sockfd = zts_socket(AF_INET, SOCK_STREAM, 0)) < 0)
|
||||
DEBUG_ERROR("error creating ZeroTier socket");
|
||||
|
||||
// connect()
|
||||
if((err = zts_connect(sockfd, (const struct sockaddr *)&in4, sizeof(in4))) < 0)
|
||||
if ((err = zts_connect(sockfd, (const struct sockaddr *)&in4, sizeof(in4))) < 0)
|
||||
DEBUG_ERROR("error connecting to remote host (%d)", err);
|
||||
|
||||
// tx
|
||||
|
||||
@@ -37,7 +37,7 @@ unsigned short csum(unsigned short *buf, int nwords)
|
||||
|
||||
int main(int argc , char *argv[])
|
||||
{
|
||||
if(argc < 3) {
|
||||
if (argc < 3) {
|
||||
fprintf(stderr, "usage: layer2 <zt_home_dir> <nwid>\n");
|
||||
return 1;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ int main(int argc , char *argv[])
|
||||
|
||||
// create socket
|
||||
int fd;
|
||||
if((fd = zts_socket(AF_INET, SOCK_RAW, IPPROTO_UDP)) < 0) {
|
||||
if ((fd = zts_socket(AF_INET, SOCK_RAW, IPPROTO_UDP)) < 0) {
|
||||
printf("There was a problem creating the raw socket\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,7 @@
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if(argc != 4) {
|
||||
if (argc != 4) {
|
||||
printf("\nlibzt example server\n");
|
||||
printf("server [config_file_path] [nwid] [bind_port]\n");
|
||||
exit(0);
|
||||
@@ -40,19 +40,19 @@ int main(int argc, char **argv)
|
||||
sleep(2);
|
||||
|
||||
// socket()
|
||||
if((sockfd = zts_socket(AF_INET, SOCK_STREAM, 0)) < 0)
|
||||
if ((sockfd = zts_socket(AF_INET, SOCK_STREAM, 0)) < 0)
|
||||
DEBUG_ERROR("error creating ZeroTier socket");
|
||||
|
||||
// bind()
|
||||
if((err = zts_bind(sockfd, (struct sockaddr *)&in4, sizeof(struct sockaddr_in)) < 0))
|
||||
if ((err = zts_bind(sockfd, (struct sockaddr *)&in4, sizeof(struct sockaddr_in)) < 0))
|
||||
DEBUG_ERROR("error binding to interface (%d)", err);
|
||||
|
||||
// listen()
|
||||
if((err = zts_listen(sockfd, 100)) < 0)
|
||||
if ((err = zts_listen(sockfd, 100)) < 0)
|
||||
DEBUG_ERROR("error placing socket in LISTENING state (%d)", err);
|
||||
|
||||
// accept()
|
||||
if((accfd = zts_accept(sockfd, (struct sockaddr *)&acc_in4, (socklen_t *)sizeof(struct sockaddr_in))) < 0)
|
||||
if ((accfd = zts_accept(sockfd, (struct sockaddr *)&acc_in4, (socklen_t *)sizeof(struct sockaddr_in))) < 0)
|
||||
DEBUG_ERROR("error accepting connection (%d)", err);
|
||||
|
||||
// getpeername()
|
||||
|
||||
Reference in New Issue
Block a user