You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by mc...@apache.org on 2014/08/19 21:21:00 UTC

svn commit: r1618947 - in /qpid/proton/trunk/proton-c: docs/man/CMakeLists.txt docs/man/proton-dump.1 src/proton-dump.c

Author: mcpierce
Date: Tue Aug 19 19:20:59 2014
New Revision: 1618947

URL: http://svn.apache.org/r1618947
Log:
PROTON-650: Added a help option to proton-dump.

If no arguments are provided on the command line then the help output is
displayed.

Also created a manpage from the help output using help2man.

Added:
    qpid/proton/trunk/proton-c/docs/man/proton-dump.1
Modified:
    qpid/proton/trunk/proton-c/docs/man/CMakeLists.txt
    qpid/proton/trunk/proton-c/src/proton-dump.c

Modified: qpid/proton/trunk/proton-c/docs/man/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/docs/man/CMakeLists.txt?rev=1618947&r1=1618946&r2=1618947&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/docs/man/CMakeLists.txt (original)
+++ qpid/proton/trunk/proton-c/docs/man/CMakeLists.txt Tue Aug 19 19:20:59 2014
@@ -17,6 +17,6 @@
 # under the License.
 #
 
-INSTALL (FILES proton.1
+INSTALL (FILES proton.1 proton-dump.1
          DESTINATION ${MAN_INSTALL_DIR}/man1)
 

Added: qpid/proton/trunk/proton-c/docs/man/proton-dump.1
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/docs/man/proton-dump.1?rev=1618947&view=auto
==============================================================================
--- qpid/proton/trunk/proton-c/docs/man/proton-dump.1 (added)
+++ qpid/proton/trunk/proton-c/docs/man/proton-dump.1 Tue Aug 19 19:20:59 2014
@@ -0,0 +1,19 @@
+.\" 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.
+.PP
+Displays the content of an AMQP dump file containing frame data.
+.TP
+[FILEn]
+Dump file to be displayed.
+.SH "SEE ALSO"
+proton(1)

Modified: qpid/proton/trunk/proton-c/src/proton-dump.c
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/src/proton-dump.c?rev=1618947&r1=1618946&r2=1618947&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/src/proton-dump.c (original)
+++ qpid/proton/trunk/proton-c/src/proton-dump.c Tue Aug 19 19:20:59 2014
@@ -19,7 +19,9 @@
  *
  */
 
+#include <libgen.h>
 #include <stdio.h>
+#include <unistd.h>
 #include <proton/buffer.h>
 #include <proton/codec.h>
 #include <proton/error.h>
@@ -98,8 +100,34 @@ int dump(const char *file)
   return 0;
 }
 
+void usage(char* prog) {
+  printf("Usage: %s [FILE1] [FILEn] ...\n", basename(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;
+  }
+
+  int c;
+
+  while ( (c = getopt(argc, argv, "h")) != -1 ) {
+    switch(c) {
+    case 'h':
+      usage(argv[0]);
+      return 0;
+      break;
+
+    case '?':
+      usage(argv[0]);
+      return 1;
+    }
+  }
+
   for (int i = 1; i < argc; i++) {
     int err = dump(argv[i]);
     if (err) return err;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org