diff --git a/ChangeLog b/ChangeLog index b5a83838..18baff53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24332,3 +24332,6 @@ fail with the message "Voicetrack Found". 2023-08-04 Fred Gleason * Added a rivendell(7) man page. +2023-08-04 Fred Gleason + * Added copyright and license notices to the standard '--version' + output. diff --git a/lib/rd.h b/lib/rd.h index 04e71690..25c2d841 100644 --- a/lib/rd.h +++ b/lib/rd.h @@ -21,11 +21,18 @@ #ifndef RD_H #define RD_H +#include + /* * Copyright Notice */ #define RD_COPYRIGHT_NOTICE "© 2002-2023 Fred Gleason" +/* + * License Notice + */ +#define RD_LICENSE_NOTICE QObject::tr("This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.") + /* * Default Configuration File */ diff --git a/lib/rdcmd_switch.cpp b/lib/rdcmd_switch.cpp index 694e5fe2..c08f4301 100644 --- a/lib/rdcmd_switch.cpp +++ b/lib/rdcmd_switch.cpp @@ -26,7 +26,9 @@ #include #include -#include +#include "rd.h" +#include "rdcmd_switch.h" +#include "rdconf.h" RDCmdSwitch::RDCmdSwitch(const QString &modname,const QString &usage) { @@ -38,6 +40,8 @@ RDCmdSwitch::RDCmdSwitch(const QString &modname,const QString &usage) QString value=args.at(i); if(value=="--version") { printf("Rivendell v%s [%s]\n",VERSION,modname.toUtf8().constData()); + printf("%s\n",RD_COPYRIGHT_NOTICE); + printf("%s\n",RDWrapText(RD_LICENSE_NOTICE,78).toUtf8().constData()); exit(0); } if(value=="--help") { @@ -93,6 +97,7 @@ RDCmdSwitch::RDCmdSwitch(int argc,char *argv[],const QString &modname, QString value=QString::fromUtf8(argv[i]); if(value=="--version") { printf("Rivendell v%s [%s]\n",VERSION,modname.toUtf8().constData()); + printf("%s\n",RD_COPYRIGHT_NOTICE); exit(0); } if(value=="--help") { diff --git a/lib/rdconf.cpp b/lib/rdconf.cpp index 51766f10..52fcfa28 100644 --- a/lib/rdconf.cpp +++ b/lib/rdconf.cpp @@ -1179,3 +1179,25 @@ QString RDMimeType(const QByteArray &data,bool *ok) return ret; } + + +QString RDWrapText(const QString &str,int width) +{ + QString line; + QString ret; + QStringList f0=str.split(" ",QString::KeepEmptyParts); + int fn=0; + + while(fn