# HG changeset patch # User Matti Hamalainen # Date 1528070268 -10800 # Node ID 23dcc2dc47a93458fd28f635b66dcca60cf30400 # Parent 6dcf4ca1dce78b65b156a74c8aeabbb59b435bde Add the license into the program itself, displayable via --license option. diff -r 6dcf4ca1dce7 -r 23dcc2dc47a9 sidinfo.c --- 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 ", 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));