PROTON-1142: Remove proton-dump
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/1bfc05e4 Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/1bfc05e4 Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/1bfc05e4 Branch: refs/heads/master Commit: 1bfc05e4c15ae4c39ebcb807b95a0cd987f90a8f Parents: a22e6c7 Author: Andrew Stitcher <[email protected]> Authored: Fri Feb 19 16:34:03 2016 -0500 Committer: Andrew Stitcher <[email protected]> Committed: Tue Feb 23 00:36:10 2016 -0500 ---------------------------------------------------------------------- proton-c/CMakeLists.txt | 24 +----- proton-c/docs/man/CMakeLists.txt | 22 ------ proton-c/docs/man/proton-dump.1 | 12 --- proton-c/src/proton-dump.c | 144 ---------------------------------- 4 files changed, 1 insertion(+), 201 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1bfc05e4/proton-c/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt index 862a520..f10aa5b 100644 --- a/proton-c/CMakeLists.txt +++ b/proton-c/CMakeLists.txt @@ -290,7 +290,6 @@ pn_absolute_install_dir(INCLUDEDIR ${INCLUDE_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX add_subdirectory(bindings) add_subdirectory(docs/api) -add_subdirectory(docs/man) add_subdirectory(../tests/tools/apps/c ../tests/tools/apps/c) set (qpid-proton-platform @@ -424,23 +423,6 @@ if (MSVC) include(WindowsC99CheckDef) endif(MSVC) -add_executable ( - proton-dump - src/proton-dump.c - # Internal dependencies - src/buffer.c - src/util.c - src/framing/framing.c - ) -target_link_libraries (proton-dump qpid-proton) - -set_target_properties ( - proton-dump - PROPERTIES - COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_PLATFORM_FLAGS}" - LINK_FLAGS "${LTO}" - ) - macro(pn_c_files) foreach (src_file ${ARGN}) if (${src_file} MATCHES "^.*[.]c$") @@ -452,13 +434,9 @@ macro(pn_c_files) endforeach (src_file) endmacro(pn_c_files) -pn_c_files (${qpid-proton-core} ${qpid-proton-platform} src/proton-dump.c) +pn_c_files (${qpid-proton-core} ${qpid-proton-platform}) # Install executables and libraries -install (TARGETS proton-dump - RUNTIME DESTINATION bin - ARCHIVE DESTINATION ${LIB_INSTALL_DIR} - LIBRARY DESTINATION ${LIB_INSTALL_DIR}) install (TARGETS qpid-proton EXPORT proton RUNTIME DESTINATION bin http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1bfc05e4/proton-c/docs/man/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/proton-c/docs/man/CMakeLists.txt b/proton-c/docs/man/CMakeLists.txt deleted file mode 100644 index 764b845..0000000 --- a/proton-c/docs/man/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -INSTALL (FILES proton-dump.1 - DESTINATION ${MAN_INSTALL_DIR}/man1) - http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1bfc05e4/proton-c/docs/man/proton-dump.1 ---------------------------------------------------------------------- diff --git a/proton-c/docs/man/proton-dump.1 b/proton-c/docs/man/proton-dump.1 deleted file mode 100644 index 8af73ad..0000000 --- a/proton-c/docs/man/proton-dump.1 +++ /dev/null @@ -1,12 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.44.1. -.TH USAGE: "1" "August 2014" "Usage: proton-dump [FILE1] [FILEn] ..." "User Commands" -.SH NAME -proton-dump - display the contents of an AMQP dump file containing frame data -.SH SYNOPSIS -.B proton-dump -[\fIFILE1\fR] [\fIFILEn\fR] ... -.SH DESCRIPTION -Displays the content of an AMQP dump file containing frame data. -.TP -[FILEn] -Dump file to be displayed. http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1bfc05e4/proton-c/src/proton-dump.c ---------------------------------------------------------------------- diff --git a/proton-c/src/proton-dump.c b/proton-c/src/proton-dump.c deleted file mode 100644 index 0da65eb..0000000 --- a/proton-c/src/proton-dump.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <stdio.h> -#include <proton/codec.h> -#include <proton/error.h> -#include "buffer.h" -#include "framing/framing.h" -#include "util.h" - -void fatal_error(const char *msg, const char *arg, int err) -{ - fprintf(stderr, msg, arg); - fflush(stderr); - errno = err; - perror(" , exiting"); - exit(1); -} - -int dump(const char *file) -{ - FILE *in = fopen(file, "r"); - if (!in) fatal_error("proton-dump: dump: opening %s", file, errno); - - pn_buffer_t *buf = pn_buffer(1024); - pn_data_t *data = pn_data(16); - bool header = false; - - char bytes[1024]; - size_t n; - while ((n = fread(bytes, 1, 1024, in))) { - int err = pn_buffer_append(buf, bytes, n); - if (err) return err; - - while (true) { - pn_bytes_t available = pn_buffer_bytes(buf); - if (!available.size) break; - - if (!header) { - header = true; - while (available.size >= 8) { - pn_bytes_t b = pn_buffer_bytes(buf); - if (b.start[0] == 'A' && - b.start[1] == 'M' && - b.start[2] == 'Q' && - b.start[3] == 'P') { - fprintf(stdout, "AMQP Header: "); - pn_fprint_data(stdout, b.start, 8); - fprintf(stdout, "\n"); - - pn_buffer_trim(buf, 8, 0); - available = pn_buffer_bytes(buf); - } else { - break; - } - } - } - if (available.size < 8) - break; - - pn_frame_t frame; - ssize_t consumed = pn_read_frame(&frame, available.start, available.size, 0); - if (consumed > 0) { - pn_data_clear(data); - ssize_t dsize = pn_data_decode(data, frame.payload, frame.size); - if (dsize < 0) { - fprintf(stderr, "Error decoding frame: %s\n", pn_code(err)); - pn_fprint_data(stderr, frame.payload, frame.size); - fprintf(stderr, "\n"); - return err; - } else { - pn_data_print(data); - printf("\n"); - } - pn_buffer_trim(buf, consumed, 0); - } else if (consumed < 0) { - fprintf(stderr, "Error decoding frame: invalid frame format\n"); - return -1; - } else { - break; - } - } - } - - if (ferror(in)) fatal_error("proton-dump: dump: reading %s", file, errno); - if (pn_buffer_size(buf) > 0) { - fprintf(stderr, "Trailing data: "); - pn_bytes_t b = pn_buffer_bytes(buf); - pn_fprint_data(stderr, b.start, b.size); - fprintf(stderr, "\n"); - } - - fclose(in); - - return 0; -} - -void usage(char* prog) { - printf("Usage: %s [FILE1] [FILEn] ...\n", prog); - printf("Displays the content of an AMQP dump file containing frame data.\n"); - printf("\n [FILEn] Dump file to be displayed.\n\n"); -} - -int main(int argc, char **argv) -{ - if(argc == 1) { - usage(argv[0]); - return 0; - } - - // There are no actual options for proton-dump so just scan for anything - // starting with '-' and print the usage message if we find something. - for (int c = 1; c < argc; c++) { - if (*argv[c]=='-') { - usage(argv[0]); - return 1; - } - } - - for (int i = 1; i < argc; i++) { - int err = dump(argv[i]); - if (err) return err; - } - - return 0; -} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
