Skip to content

Commit

Permalink
Issue 58 fixes (Squashed commit)
Browse files Browse the repository at this point in the history
 * host option now also works when host:port given (no proper
   [ipv6]:port parsing though)
 * Travis CI build for armhf now ignores undefined reference errors for
   external libraries due to regression in the libxml2 build
  • Loading branch information
speters committed Jan 7, 2020
1 parent b69a835 commit a51bc41
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion cmake/Toolchain-rpi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)

SET(FLAGS "-Wl,-rpath-link,${CHROOT_DIR}/lib/arm-linux-gnueabihf -Wl,-rpath-link,${CHROOT_DIR}/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,${CHROOT_DIR}/usr/local/lib")
SET(FLAGS "-Wl,-rpath-link,${CHROOT_DIR}/lib/arm-linux-gnueabihf -Wl,-rpath-link,${CHROOT_DIR}/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,${CHROOT_DIR}/usr/local/lib,-unresolved-symbols=ignore-in-shared-libs")

UNSET(CMAKE_C_FLAGS CACHE)
UNSET(CMAKE_CXX_FLAGS CACHE)
Expand Down
4 changes: 4 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ ssize_t readn(int fd, void *vptr, size_t n);
#define MAXBUF 4096
#endif

#ifndef DEFAULT_PORT
#define DEFAULT_PORT 3002
#endif

#define logIT1(class, string) logIT(class, "%s", string)

#endif // COMMON_H
32 changes: 19 additions & 13 deletions src/vclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int main(int argc, char *argv[])
{
// Get the command line options
char *host;
int port = 3002;
int port = 0;
char commands[512] = "";
const char *cmdfile = NULL;
const char *csvfile = NULL;
Expand Down Expand Up @@ -261,9 +261,6 @@ int main(int argc, char *argv[])
host = "localhost";
}

if (verbose) {
printf("Host: %s Port: %d\n",host,port);
}
// Collect any remaining command line arguments (not options).
// and use the as commands like for the -c option.
if (optind < argc) {
Expand Down Expand Up @@ -292,11 +289,7 @@ int main(int argc, char *argv[])
}
}

initLog(0, dummylog, verbose);
if (! *commands && !cmdfile) {
usage();
}
/* Check for :<port> if port==0
/* Check for :<port> if port==0
then separate the port number from the host name
or the IP adsress.
The IP address could be a plain old IPv4 or a IPv6 one,
Expand All @@ -310,14 +303,27 @@ int main(int argc, char *argv[])
char *last_colon = NULL;

last_colon = strrchr(host, ':');
port = atoi(last_colon + 1);
//printf(">>> port=%d\n", port);
*last_colon = '\0';
if (last_colon != NULL) {
port = atoi(last_colon + 1);
*last_colon = '\0';
}
}
if (port == 0) {
port = DEFAULT_PORT;
}

if (verbose) {
printf("Host: %s Port: %d\n",host,port);
}

initLog(0, dummylog, verbose);
if (! *commands && !cmdfile) {
usage();
}

sockfd = connectServer(host, port);
if (sockfd < 0) {
logIT(LOG_ERR, "No connection to %s", host);
logIT(LOG_ERR, "No connection to host %s on port %d", host, port);
exit(1);
}

Expand Down

0 comments on commit a51bc41

Please sign in to comment.