Package: wrapsrv
Version: 1.0.0-1+b2
Severity: minor
Tags: patch

Dear Maintainer,
this patch improves the integrated help, so novice users will able
to use this tool. The patch also slightly improves performance by removing an
unnecessary call and corrects the use of system streams.

Regards,
Lorenzo

-- System Information:
Debian Release: 10.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-6-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8), 
LANGUAGE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages wrapsrv depends on:
ii  libc6  2.28-10

wrapsrv recommends no packages.

wrapsrv suggests no packages.

-- no debconf information
Description: add missing fundamental information in the help.
 This patch completes the guide by adding essential information for new users.
 It also slightly improves performance and corrects the use of standard
 system streams (stderr, stdout).
Author: Lorenzo L. Ancora <ad...@lorenzoancora.info>
Last-Update: 2020-01-04

--- wrapsrv-1.0.0.orig/wrapsrv.c
+++ wrapsrv-1.0.0/wrapsrv.c
@@ -39,6 +39,14 @@
 #define NS_MAXMSG 65535
 #endif
 
+#define USAGE_TXT "Usage: wrapsrv <SRVNAME> <COMMAND> [COMMAND OPTIONS]\n\n\
+Use all matching DNS SRV (RFC 2782) records to build/execute command lines.\n\
+SRVNAME is the symbolic name of the service (case insensitive).\n\
+%%h and %%p sequences in COMMAND will be converted to hostname and port.\n\n\
+Example (URL building and printing):\n\t\
+wrapsrv _ftps._tcp.domain.example echo ftps://%%h:%%p/\n\n\
+Copyright (c) Farsight Security, Inc.; licensed under 'Apache License 2.0'.\n"
+
 /* Data types. */
 
 struct srv {
@@ -70,7 +78,7 @@ static struct srv *next_tuple(void);
 static void free_tuples(void);
 static void insert_tuple(char *, uint16_t, uint16_t, uint16_t);
 static void parse_answer_section(ns_msg *);
-static void usage(void);
+static void usage(FILE*);
 
 #ifdef DEBUG
 static void print_tuples(void);
@@ -349,10 +357,8 @@ do_cmd(struct srv *se, int argc, char **
 }
 
 static void
-usage(void) {
-       fprintf(stderr, "Usage: wrapsrv <SRVNAME> <COMMAND> [OPTION]...\n");
-       fprintf(stderr, "%%h and %%p sequences will be converted to "
-               "hostname and port.\n");
+usage(FILE* stream) {
+       fprintf(stream, USAGE_TXT);
        exit(EXIT_FAILURE);
 }
 
@@ -367,8 +373,10 @@ main(int argc, char **argv) {
        struct timeval tv;
        unsigned int seed = 0;
 
-       if (argc < 3)
-               usage();
+       if (argc <= 1)
+               usage(stdout);
+       else if (argc < 3)
+               usage(stderr);
 
        ISC_LIST_INIT(prio_list);
 

Reply via email to