changeset 173:23dcc2dc47a9

Add the license into the program itself, displayable via --license option.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 04 Jun 2018 02:57:48 +0300
parents 6dcf4ca1dce7
children e203761c4007
files sidinfo.c
diffstat 1 files changed, 46 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sidinfo.c	Mon Jun 04 02:57:09 2018 +0300
+++ b/sidinfo.c	Mon Jun 04 02:57:48 2018 +0300
@@ -118,6 +118,7 @@
 {
     { 0, '?', "help",       "Show this help", OPT_NONE },
 //    { 1, 'v', "verbose",    "Be more verbose", OPT_NONE },
+    {10,   0, "license",    "Print out this program's license agreement", OPT_NONE },
     { 2, 'p', "parsable",   "Output in script-parsable format", OPT_NONE },
     { 5, 'n', "noprefix",   "Output without field name prefix", OPT_NONE },
     { 6, 'l', "line",       "Output in one line format, -l <field separator>", OPT_ARGREQ },
@@ -131,6 +132,42 @@
 static const int optListN = sizeof(optList) / sizeof(optList[0]);
 
 
+void argShowLicense(void)
+{
+    printf("%s - %s\n%s\n", th_prog_name, th_prog_desc, th_prog_author);
+    printf(
+    "\n"
+    "Redistribution and use in source and binary forms, with or without\n"
+    "modification, are permitted provided that the following conditions\n"
+    "are met:\n"
+    "\n"
+    " 1. Redistributions of source code must retain the above copyright\n"
+    "    notice, this list of conditions and the following disclaimer.\n"
+    "\n"
+    " 2. Redistributions in binary form must reproduce the above copyright\n"
+    "    notice, this list of conditions and the following disclaimer in\n"
+    "    the documentation and/or other materials provided with the\n"
+    "    distribution.\n"
+    "\n"
+    " 3. The name of the author may not be used to endorse or promote\n"
+    "    products derived from this software without specific prior written\n"
+    "    permission.\n"
+    "\n"
+    "THIS SOFTWARE IS PROVIDED BY THE AUTHOR \"AS IS\" AND ANY EXPRESS OR\n"
+    "IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n"
+    "WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n"
+    "ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n"
+    "INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n"
+    "(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n"
+    "SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n"
+    "HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n"
+    "STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n"
+    "IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n"
+    "POSSIBILITY OF SUCH DAMAGE.\n"
+    );
+}
+
+
 void argShowHelp(void)
 {
     int index, len;
@@ -634,6 +671,11 @@
         exit(0);
         break;
 
+    case 10:
+        argShowLicense();
+        exit(0);
+        break;
+
     case 1:
         th_verbosity++;
         break;
@@ -941,7 +983,10 @@
 int main(int argc, char *argv[])
 {
     // Initialize
-    th_init("SIDInfo", "PSID/RSID information displayer", "0.7.3", NULL, NULL);
+    th_init("SIDInfo", "PSID/RSID information displayer", "0.7.3",
+        "By Matti 'ccr' Hamalainen (C) Copyright 2014-2018 TNSP",
+        "This program is distributed under a 3-clause BSD -style license.");
+
     th_verbosity = 0;
 
     memset(&optFormat, 0, sizeof(optFormat));