diff -Nru prips-1.0.2/ChangeLog prips-1.1.0/ChangeLog --- prips-1.0.2/ChangeLog 2018-01-15 09:58:35.000000000 +0000 +++ prips-1.1.0/ChangeLog 2018-05-13 21:45:02.000000000 +0000 @@ -1,6 +1,10 @@ -Release 1.0.2 +Release 1.1.0 ------------- +* Remove a stray blank line in this change log. +* Add the -h, --help, --version, and --features options. +Release 1.0.2 +------------- * Allow the Makefile install commands to be overridden. Release 1.0.1 diff -Nru prips-1.0.2/debian/changelog prips-1.1.0/debian/changelog --- prips-1.0.2/debian/changelog 2018-01-15 10:25:00.000000000 +0000 +++ prips-1.1.0/debian/changelog 2018-05-13 22:04:17.000000000 +0000 @@ -1,3 +1,11 @@ +prips (1.1.0-1) unstable; urgency=low + + * Use my Debian address as maintainer. + * Declare compliance with Debian Policy 4.1.3 with no changes. + * Use the B-D: debhelper-compat (= 11) mechanism. + + -- Peter Pentchev Mon, 14 May 2018 01:04:17 +0300 + prips (1.0.2-1) unstable; urgency=medium * Declare compliance with Debian Policy 4.1.3: diff -Nru prips-1.0.2/debian/compat prips-1.1.0/debian/compat --- prips-1.0.2/debian/compat 2018-01-15 10:07:13.000000000 +0000 +++ prips-1.1.0/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -11 diff -Nru prips-1.0.2/debian/control prips-1.1.0/debian/control --- prips-1.0.2/debian/control 2018-01-15 10:07:13.000000000 +0000 +++ prips-1.1.0/debian/control 2018-05-13 21:56:40.000000000 +0000 @@ -1,10 +1,10 @@ Source: prips Section: net Priority: optional -Maintainer: Peter Pentchev +Maintainer: Peter Pentchev Uploaders: tony mancill -Build-Depends: debhelper (>> 11~) -Standards-Version: 4.1.3 +Build-Depends: debhelper-compat (= 11) +Standards-Version: 4.1.4 Homepage: https://devel.ringlet.net/sysutils/prips/ Vcs-Git: https://gitlab.com/prips/prips.git -b debian Vcs-Browser: https://gitlab.com/prips/prips/tree/debian diff -Nru prips-1.0.2/debian/source/lintian-overrides prips-1.1.0/debian/source/lintian-overrides --- prips-1.0.2/debian/source/lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ prips-1.1.0/debian/source/lintian-overrides 2018-05-13 21:56:40.000000000 +0000 @@ -0,0 +1,7 @@ +# lintian does not understand the "debhelper-compat (= X)" +# build-dependency +prips source: debhelper-compat-file-is-missing +prips source: package-uses-deprecated-debhelper-compat-version 1 +prips source: package-uses-debhelper-but-lacks-build-depends +prips source: package-lacks-versioned-build-depends-on-debhelper 1 +prips source: missing-build-dependency debhelper diff -Nru prips-1.0.2/main.c prips-1.1.0/main.c --- prips-1.0.2/main.c 2018-01-15 09:58:35.000000000 +0000 +++ prips-1.1.0/main.c 2018-05-13 21:45:02.000000000 +0000 @@ -36,21 +36,23 @@ #define FORMATS "hex", "dec", "dot" +#define VERSION_NUMBER "1.1.0" + const char * const MAINTAINER = "Peter Pentchev "; const char * const VERSION = -"prips 1.0.2\n" +"prips " VERSION_NUMBER "\n" "This program comes with NO WARRANTY,\n" "to the extent permitted by law.\n" "You may redistribute copies under \n" -"the terms of the GNU General Public License.\n"; +"the terms of the GNU General Public License."; -static void usage(const char *prog); +static void usage(bool error, const char *prog); static AddrFormat get_format(const char *format); int main(const int argc, char * const argv[]) { int ch; - const char * const argstr = "d:f:i:e:cv"; + const char * const argstr = "d:hf:i:e:cv-:"; uint32_t start = 0, end = 0; int octet[4][256]; /* Holds all of the exceptions if -e is used */ int format = FORMAT_DOT; /* Dotted decimal by default */ @@ -60,6 +62,9 @@ /* flags */ bool exception_flag = false; /* If one, check for exclusions */ bool print_as_cidr_flag= false; /* If one, print range as addr/offset */ + bool version_flag = false; + bool usage_flag = false; + bool features_flag = false; opterr = 0; while ((ch = getopt(argc, argv, argstr)) != EOF) { @@ -76,6 +81,9 @@ case 'f': format = get_format(optarg); break; + case 'h': + usage_flag = true; + break; case 'i': if((increment = atoi(optarg)) < 1) errx(1, "increment must be a positive integer"); @@ -85,12 +93,30 @@ exception_flag = true; break; case 'v': - printf("%s", VERSION); - exit(0); + version_flag = true; + break; + case '-': + if (strcmp(optarg, "help") == 0) + usage_flag = true; + else if (strcmp(optarg, "version") == 0) + version_flag = true; + else if (strcmp(optarg, "features") == 0) + features_flag = true; + else + usage(true, argv[0]); + break; case '?': - usage(argv[0]); + usage(true, argv[0]); } } + if (version_flag) + puts(VERSION); + if (usage_flag) + usage(false, argv[0]); + if (features_flag) + puts("Features: prips=" VERSION_NUMBER); + if (version_flag || usage_flag || features_flag) + return 0; /*************************************************************/ /* Figure out what we have to work with. argc - optind is */ @@ -116,7 +142,7 @@ } else { - usage(argv[0]); + usage(true, argv[0]); } } break; @@ -127,7 +153,7 @@ errx(1, "bad IP address"); break; default: - usage(argv[0]); + usage(true, argv[0]); } /***************************************************************/ @@ -168,9 +194,10 @@ return(0); } /* end main */ -static void usage(const char *prog) +static void usage(bool error, const char *prog) { - fprintf(stderr, "usage: %s [options] \n\ + fprintf(error ? stderr : stdout, + "usage: %s [options] \n\ -c print range in CIDR notation\n\ -d set the delimiter to the character with ASCII code 'x'\n\ where 0 <= x <= 255 \n\ @@ -180,9 +207,12 @@ -e exclude a range from the output, e.g. -e ..4. will\n\ not print 192.168.4.[0-255]\n\ \n\ + %s --help | --version | --features\n\ + \n\ \rReport bugs to %s\n", - prog, MAINTAINER); - exit(1); + prog, prog, MAINTAINER); + if (error) + exit(1); } static AddrFormat get_format(const char * const format) diff -Nru prips-1.0.2/prips.c prips-1.1.0/prips.c --- prips-1.0.2/prips.c 2018-01-15 09:58:35.000000000 +0000 +++ prips-1.1.0/prips.c 2018-05-13 21:45:02.000000000 +0000 @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2003 Daniel Kelly - * Copyright (C) 2009, 2013, 2016 Peter Pentchev + * Copyright (C) 2009, 2013, 2016, 2018 Peter Pentchev * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by