Changeset: ec17bc8e67c5 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ec17bc8e67c5 Removed Files: clients/mapiclient/mnc.c Modified Files: CMakeLists.txt clients/mapiclient/Makefile.ag Branch: cmake-fun Log Message:
Fixed tar ignore list and removed obsolete mnc.c file. diffs (truncated from 333 to 300 lines): diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -788,9 +788,9 @@ set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_D set(CPACK_PACKAGE_FILE_NAME "MonetDB-${MONETDB_VERSION}") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/license.txt") # Using regular expressions for ignored files, later we could move to a generated variable -set(CPACK_SOURCE_IGNORE_FILES "/bootstrap" "/buildtools/autogen/" "/debian/" "/de-bootstrap" "/libversions" "/MacOSX/" - "/NT/" "/rpm.mk.in" "/tools/monetdbbincopy" "/testing/quicktest" "/testing/cmptests.py" "/vertoo.config" - "/vertoo.data" "/\.idea/" "/\.git/" "/\.hg/" "ChangeLog.*" "CMakeFiles*" "\.hg.*" "#" "\.ac$" "\.ag$" "\.dll$" - "\.exe$" "\.la$" "\.lib$" "\.lo$" "\.lst$" "\.mal\.sh$" "\.o$" "\.obj$" "\.pdb$" "\.pyc$" "\.swp$" "~") +set(CPACK_SOURCE_IGNORE_FILES "/bootstrap" "/buildtools/autogen/" "/clients/odbc/doc" "/debian/" "/de-bootstrap" + "/libversions" "/MacOSX/" "/rpm.mk.in" "/tools/monetdbbincopy" "/testing/quicktest" "/testing/cmptests.py" + "/vertoo.config" "/vertoo.data" "/\.idea/" "/\.git/" "/\.hg/" "ChangeLog.*" "CMakeFiles*" "\.hg.*" "#" "~" "\.ac$" + "\.ag$" "\.lst$" "\.mal\.sh$") set(CPACK_SOURCE_PACKAGE_FILE_NAME "MonetDB-${MONETDB_VERSION}") include(CPack) diff --git a/clients/mapiclient/Makefile.ag b/clients/mapiclient/Makefile.ag --- a/clients/mapiclient/Makefile.ag +++ b/clients/mapiclient/Makefile.ag @@ -54,15 +54,6 @@ bin_tomograph = { $(SOCKET_LIBS) $(zlib_LIBS) $(bzip2_LIBS) $(snappy_LIBS) $(lz4_LIBS) $(liblzma_LIBS) $(curl_LIBS) $(LTLIBICONV) $(openssl_LIBS) } -# disabled: it's not really a tool for users, more to debug mapi -# problems, or measure performance -#bin_mnc = { -# SOURCES = mnc.c -# LIBS = ../../common/stream/libstream \ -# ../mapilib/libmapi \ -# $(curl_LIBS) $(MALLOC_LIBS) $(PTHREAD_LIBS) $(SOCKET_LIBS) -#} - man_MANS = mclient.1 msqldump.1 EXTRA_DIST = $(man_MANS) diff --git a/clients/mapiclient/mnc.c b/clients/mapiclient/mnc.c deleted file mode 100644 --- a/clients/mapiclient/mnc.c +++ /dev/null @@ -1,292 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. - */ - -/** - * mnc - * Fabian Groffen - * - * MCL netcat - * Simple utility meant to measure the protocol overhead incurred by our - * stream library compared to "plain" netcat (nc). - */ - -#include "monetdb_config.h" -#include "mapi.h" -#include "stream.h" -#include "stream_socket.h" -#include <string.h> -#include <signal.h> -#include <unistd.h> -#ifdef HAVE_PTHREAD_H -#include <pthread.h> -#endif -#include <sys/types.h> -#ifdef HAVE_SYS_SOCKET_H -# include <sys/socket.h> -#endif -#ifdef NATIVE_WIN32 -# include <winsock.h> -#endif -#ifdef HAVE_NETDB_H -# include <netdb.h> -#endif - -#ifndef HAVE_GETOPT_LONG -# include "monet_getopt.h" -#else -# ifdef HAVE_GETOPT_H -# include "getopt.h" -# endif -#endif - -#if !defined(HAVE_ACCEPT4) || !defined(SOCK_CLOEXEC) -#define accept4(sockfd, addr, addlen, flags) accept(sockfd, addr, addrlen) -#endif - -static void -usage(void) -{ - fprintf(stderr, "mnc [options] destination port\n"); - fprintf(stderr, " -l | --listen listen for connection instead\n"); - /* TODO - fprintf(stderr, " -u | --udp use UDP instead of TCP\n"); - fprintf(stderr, " -g | --gzip use gzip stream wrapper\n"); - fprintf(stderr, " -j | --bzip2 use bzip2 stream wrapper\n"); - fprintf(stderr, " -b | --buffer use buffered stream\n"); - */ - fprintf(stderr, " -B | --block use block stream\n"); -} - -int -main(int argc, char **argv) -{ - int a = 1; - char *host = NULL; - int port = 0; - char clisten = 0; - /* char udp = 0; */ - /* char zip = 0; */ - /* char buffer = 0; */ - char block = 0; - SOCKET s = INVALID_SOCKET; - stream *in = NULL; - stream *out = NULL; - char buf[8096]; - ssize_t len; - fd_set fds; - char seeneof = 0; - char seenflush = 0; - - static struct option long_options[8] = { - { "listen", 0, 0, 'l' }, - { "udp", 0, 0, 'u' }, - { "gzip", 0, 0, 'g' }, - { "bzip2", 0, 0, 'j' }, - { "buffer", 0, 0, 'b' }, - { "block", 0, 0, 'B' }, - { "help", 0, 0, '?' }, - { 0, 0, 0, 0 } - }; - while (1) { - int option_index = 0; - int c = getopt_long(argc, argv, "lugjbB?h", - long_options, &option_index); - if (c == -1) - break; - switch (c) { - case 'l': - clisten = 1; - break; - case 'u': - /* udp = 1; */ - break; - case 'g': - /* zip = 1; */ - break; - case 'j': - /* zip = 2; */ - break; - case 'b': - /* buffer = 1; */ - break; - case 'B': - block = 1; - break; - default: - usage(); - exit(0); - } - } - - a = optind; - if (argc - a != 2) { - fprintf(stderr, "%s: need destination and port arguments\n", argv[0]); - usage(); - exit(-1); - } - - host = argv[a++]; - port = atoi(argv[a]); - - /* call the stream wrappers based on the user's choice, stream - * everything from/to stdin/stdout */ - - if (!clisten) { //All available platforms have getaddrinfo - struct addrinfo hints, *res, *rp; - char sport[32]; - int ret; - - snprintf(sport, sizeof(sport), "%d", port & 0xFFFF); - - hints = (struct addrinfo) { - .ai_family = AF_UNSPEC, - .ai_socktype = SOCK_STREAM, - .ai_protocol = IPPROTO_TCP, - }; - ret = getaddrinfo(host, sport, &hints, &res); - if (ret) { - fprintf(stderr, "getaddrinfo failed: %s\n", gai_strerror(ret)); - exit(1); - } - for (rp = res; rp; rp = rp->ai_next) { - s = socket(rp->ai_family, rp->ai_socktype -#ifdef SOCK_CLOEXEC - | SOCK_CLOEXEC -#endif - , rp->ai_protocol); - if (s == INVALID_SOCKET) - continue; - if (connect(s, rp->ai_addr, (socklen_t) rp->ai_addrlen) != SOCKET_ERROR) - break; /* success */ - closesocket(s); - } -#if !defined(SOCK_CLOEXEC) && defined(HAVE_FCNTL) - (void) fcntl(s, F_SETFD, FD_CLOEXEC); -#endif - freeaddrinfo(res); - if (rp == NULL) { - fprintf(stderr, "could not connect to %s:%s: %s\n", - host, sport, strerror(errno)); - exit(1); - } - } else { - struct sockaddr_in server; - socklen_t length = 0; - SOCKET sock = INVALID_SOCKET; - int on = 1; - int i = 0; - - if (port <= 0 || port > 65535) { - fprintf(stderr, "invalid port: %d\n", port); - exit(1); - } - - if ((sock = socket(AF_INET, SOCK_STREAM -#ifdef SOCK_CLOEXEC - | SOCK_CLOEXEC -#endif - , 0)) == INVALID_SOCKET) { - fprintf(stderr, "failed to create socket: %s\n", strerror(errno)); - exit(1); - } -#if !defined(SOCK_CLOEXEC) && defined(HAVE_FCNTL) - (void) fcntl(sock, F_SETFD, FD_CLOEXEC); -#endif - - setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof on); - - server.sin_family = AF_INET; - server.sin_addr.s_addr = htonl(INADDR_ANY); - for (i = 0; i < 8; i++) - server.sin_zero[i] = 0; - length = (socklen_t) sizeof(server); - - server.sin_port = htons((unsigned short) ((port) & 0xFFFF)); - if (bind(sock, (SOCKPTR) &server, length) == SOCKET_ERROR) { - closesocket(sock); - fprintf(stderr, "bind to port %d failed: %s\n", - port, strerror(errno)); - exit(1); - } - - if(listen(sock, 1) == -1) { - closesocket(sock); - fprintf(stderr, "failed to set socket to listen: %s\n", - strerror(errno)); - exit(1); - } - if ((s = accept4(sock, (SOCKPTR)0, (socklen_t *)0, SOCK_CLOEXEC)) == INVALID_SOCKET) { - closesocket(sock); - fprintf(stderr, "failed to accept connection: %s\n", - strerror(errno)); - exit(1); - } -#if defined(HAVE_FCNTL) && (!defined(SOCK_CLOEXEC) || !defined(HAVE_ACCEPT4)) - (void) fcntl(s, F_SETFD, FD_CLOEXEC); -#endif - } - - out = socket_wstream(s, "write stream"); - in = socket_rstream(s, "read stream"); - - if (block) { - out = block_stream(out); - in = block_stream(in); - } - - while (1) { - FD_ZERO(&fds); - FD_SET(s, &fds); - FD_SET(0, &fds); - - select((int)s + 1, &fds, NULL, NULL, NULL); - if (FD_ISSET(s, &fds)) { - if ((len = mnstr_read(in, buf, 1, sizeof(buf))) > 0) { - /* on Windows: unsigned int, - * elsewhere: size_t, but then - * unsigned int shouldn't harm */ - if (!write(1, buf, (unsigned int) len)) { - mnstr_destroy(in); - mnstr_destroy(out); - exit(2); - } - seenflush = 0; - } else { _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list