mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 01:18:00 +00:00
Stop copying the licence text into C source code.
Now all the uses of the licence text or the short copyright notice get it from a new header "licence.h", which in turn is built by a Perl script licence.pl invoked by mkfiles.pl, using LICENCE itself as the source. Hence, I can completely remove a whole section from the list of licence locations in CHECKLST.txt :-)
This commit is contained in:
parent
2eb952ca31
commit
9ddd071ec2
1
.gitignore
vendored
1
.gitignore
vendored
@ -63,6 +63,7 @@
|
||||
/missing
|
||||
/uxconfig.in
|
||||
/uxconfig.h
|
||||
/licence.h
|
||||
/*.a
|
||||
/charset/sbcsdat.c
|
||||
/contrib/cygtermd/cygtermd.exe
|
||||
|
19
CHECKLST.txt
19
CHECKLST.txt
@ -4,7 +4,7 @@ Checklists for PuTTY administrative procedures
|
||||
Locations of the licence
|
||||
------------------------
|
||||
|
||||
The PuTTY copyright notice and licence are stored in quite a few
|
||||
The PuTTY copyright notice and licence are stored in multiple
|
||||
places. At the start of a new year, the copyright year needs
|
||||
updating in all of them; and when someone sends a massive patch,
|
||||
their name needs adding in all of them too.
|
||||
@ -13,23 +13,6 @@ The LICENCE file in the main source distribution:
|
||||
|
||||
- putty/LICENCE
|
||||
|
||||
The various About and Licence boxes:
|
||||
|
||||
- putty/windows/winpgnt.c
|
||||
+ the copyright date appears twice, once in the About box and
|
||||
once in the Licence box. Don't forget to change both!
|
||||
- putty/windows/winpgen.c
|
||||
+ the copyright date appears twice, once in the About box and
|
||||
once in the Licence box. Don't forget to change both!
|
||||
- putty/windows/windlg.c
|
||||
+ the copyright date appears twice, once in the About box and
|
||||
once in the Licence box. Don't forget to change both!
|
||||
- putty/windows/version.rc2
|
||||
+ the copyright date appears once only.
|
||||
- putty/unix/gtkdlg.c
|
||||
+ the copyright date appears twice, once in the About box and
|
||||
once in the Licence box. Don't forget to change both!
|
||||
|
||||
The documentation (both the preamble blurb and the licence appendix):
|
||||
|
||||
- putty/doc/blurb.but
|
||||
|
64
licence.pl
Normal file
64
licence.pl
Normal file
@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env perl -w
|
||||
|
||||
# This script generates licence.h (containing the PuTTY licence in the
|
||||
# form of macros expanding to C string literals) from the LICENCE
|
||||
# master file.
|
||||
|
||||
use File::Basename;
|
||||
|
||||
$infile = "LICENCE";
|
||||
$outfile = "licence.h";
|
||||
open my $in, $infile or die "$infile: open: $!\n";
|
||||
open my $out, ">", $outfile or die "$outfile: open: $!\n";
|
||||
select $out;
|
||||
|
||||
print "/*\n";
|
||||
print " * $outfile - macro definitions for the PuTTY licence.\n";
|
||||
print " *\n";
|
||||
print " * Generated by @{[basename __FILE__]} from $infile.\n";
|
||||
print " * You should edit those files rather than editing this one.\n";
|
||||
print " */\n";
|
||||
print "\n";
|
||||
|
||||
my @lines = ();
|
||||
while (<$in>) {
|
||||
chomp;
|
||||
push @lines, $_;
|
||||
}
|
||||
close $in;
|
||||
|
||||
# Format into paragraphs.
|
||||
my @paras = ();
|
||||
my $para = undef;
|
||||
for my $line (@lines) {
|
||||
if ($line eq "") {
|
||||
$para = undef;
|
||||
} elsif (!defined $para) {
|
||||
push @paras, $line;
|
||||
$para = \$paras[$#paras];
|
||||
} else {
|
||||
$$para .= " " . $line;
|
||||
}
|
||||
}
|
||||
|
||||
print "#define LICENCE_TEXT(parsep) \\\n";
|
||||
for my $i (0..$#paras) {
|
||||
my $lit = &stringlit($paras[$i]);
|
||||
print " parsep \\\n" if $i > 0;
|
||||
print " \"$lit\"";
|
||||
print " \\" if $i < $#paras;
|
||||
print "\n";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
die "bad format of first paragraph\n"
|
||||
unless $paras[0] =~ m!copyright ([^\.]*)\.!i;
|
||||
|
||||
printf "#define SHORT_COPYRIGHT_DETAILS \"%s\"\n", &stringlit($1);
|
||||
|
||||
sub stringlit {
|
||||
my ($lit) = @_;
|
||||
$lit =~ s!\\!\\\\!g;
|
||||
$lit =~ s!"!\\"!g;
|
||||
return $lit;
|
||||
}
|
@ -45,9 +45,10 @@ open IN, "Recipe" or do {
|
||||
};
|
||||
|
||||
# HACK: One of the source files in `charset' is auto-generated by
|
||||
# sbcsgen.pl. We need to generate that _now_, before attempting
|
||||
# dependency analysis.
|
||||
# sbcsgen.pl, and licence.h is likewise generated by licence.pl. We
|
||||
# need to generate those _now_, before attempting dependency analysis.
|
||||
eval 'chdir "charset"; require "sbcsgen.pl"; chdir ".."; select STDOUT;';
|
||||
eval 'require "licence.pl"; select STDOUT;';
|
||||
|
||||
@srcdirs = ("./");
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "storage.h"
|
||||
#include "dialog.h"
|
||||
#include "tree234.h"
|
||||
#include "licence.h"
|
||||
|
||||
#if GTK_CHECK_VERSION(2,0,0)
|
||||
/* Decide which of GtkFileChooserDialog and GtkFileSelection to use */
|
||||
@ -3626,39 +3627,9 @@ static void licence_clicked(GtkButton *button, gpointer data)
|
||||
{
|
||||
char *title;
|
||||
|
||||
const char *licence =
|
||||
"Copyright 1997-2015 Simon Tatham.\n\n"
|
||||
|
||||
"Portions copyright Robert de Bath, Joris van Rantwijk, Delian "
|
||||
"Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas "
|
||||
"Barry, Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, "
|
||||
"Markus Kuhn, Colin Watson, Christopher Staite, and CORE SDI S.A.\n\n"
|
||||
|
||||
"Permission is hereby granted, free of charge, to any person "
|
||||
"obtaining a copy of this software and associated documentation "
|
||||
"files (the ""Software""), to deal in the Software without restriction, "
|
||||
"including without limitation the rights to use, copy, modify, merge, "
|
||||
"publish, distribute, sublicense, and/or sell copies of the Software, "
|
||||
"and to permit persons to whom the Software is furnished to do so, "
|
||||
"subject to the following conditions:\n\n"
|
||||
|
||||
"The above copyright notice and this permission notice shall be "
|
||||
"included in all copies or substantial portions of the Software.\n\n"
|
||||
|
||||
"THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT "
|
||||
"WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, "
|
||||
"INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF "
|
||||
"MERCHANTABILITY, FITNESS FOR A PARTICULAR "
|
||||
"PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE "
|
||||
"COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES "
|
||||
"OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, "
|
||||
"TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN "
|
||||
"CONNECTION WITH THE SOFTWARE OR THE USE OR "
|
||||
"OTHER DEALINGS IN THE SOFTWARE.";
|
||||
|
||||
title = dupcat(appname, " Licence", NULL);
|
||||
assert(aboutbox != NULL);
|
||||
messagebox(aboutbox, title, licence,
|
||||
messagebox(aboutbox, title, LICENCE_TEXT("\n\n"),
|
||||
string_width("LONGISH LINE OF TEXT SO THE LICENCE"
|
||||
" BOX ISN'T EXCESSIVELY TALL AND THIN"),
|
||||
TRUE, "OK", 'o', 1, 1, NULL);
|
||||
@ -3702,7 +3673,7 @@ void about_box(void *window)
|
||||
char *label_text = dupprintf
|
||||
("%s\n\n%s\n\n%s",
|
||||
appname, ver,
|
||||
"Copyright 1997-2015 Simon Tatham. All rights reserved");
|
||||
"Copyright " SHORT_COPYRIGHT_DETAILS ". All rights reserved");
|
||||
w = gtk_label_new(label_text);
|
||||
gtk_label_set_justify(GTK_LABEL(w), GTK_JUSTIFY_CENTER);
|
||||
#if GTK_CHECK_VERSION(2,0,0)
|
||||
|
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
#include "version.h"
|
||||
#include "licence.h"
|
||||
|
||||
/*
|
||||
* The actual VERSIONINFO resource.
|
||||
@ -44,7 +45,7 @@ BEGIN
|
||||
VALUE "OriginalFilename", APPNAME
|
||||
VALUE "FileVersion", TEXTVER
|
||||
VALUE "ProductVersion", TEXTVER
|
||||
VALUE "LegalCopyright", "Copyright \251 1997-2015 Simon Tatham."
|
||||
VALUE "LegalCopyright", "Copyright \251 " SHORT_COPYRIGHT_DETAILS "."
|
||||
#if (!defined SNAPSHOT) && (!defined RELEASE) && (!defined PRERELEASE)
|
||||
/* Only if VS_FF_PRIVATEBUILD. */
|
||||
VALUE "PrivateBuild", TEXTVER /* NBI */
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "win_res.h"
|
||||
#include "storage.h"
|
||||
#include "dialog.h"
|
||||
#include "licence.h"
|
||||
|
||||
#include <commctrl.h>
|
||||
#include <commdlg.h>
|
||||
@ -170,37 +171,7 @@ static int CALLBACK LicenceProc(HWND hwnd, UINT msg,
|
||||
char *str = dupprintf("%s Licence", appname);
|
||||
SetWindowText(hwnd, str);
|
||||
sfree(str);
|
||||
|
||||
SetDlgItemText(hwnd, IDA_TEXT,
|
||||
"Copyright 1997-2015 Simon Tatham.\r\n\r\n"
|
||||
|
||||
"Portions copyright Robert de Bath, Joris van Rantwijk, Delian "
|
||||
"Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas "
|
||||
"Barry, Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, "
|
||||
"Markus Kuhn, Colin Watson, Christopher Staite, and CORE SDI S.A.\r\n\r\n"
|
||||
|
||||
"Permission is hereby granted, free of charge, to any person "
|
||||
"obtaining a copy of this software and associated documentation "
|
||||
"files (the ""Software""), to deal in the Software without restriction, "
|
||||
"including without limitation the rights to use, copy, modify, merge, "
|
||||
"publish, distribute, sublicense, and/or sell copies of the Software, "
|
||||
"and to permit persons to whom the Software is furnished to do so, "
|
||||
"subject to the following conditions:\r\n\r\n"
|
||||
|
||||
"The above copyright notice and this permission notice shall be "
|
||||
"included in all copies or substantial portions of the Software.\r\n\r\n"
|
||||
|
||||
"THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT "
|
||||
"WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, "
|
||||
"INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF "
|
||||
"MERCHANTABILITY, FITNESS FOR A PARTICULAR "
|
||||
"PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE "
|
||||
"COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES "
|
||||
"OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, "
|
||||
"TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN "
|
||||
"CONNECTION WITH THE SOFTWARE OR THE USE OR "
|
||||
"OTHER DEALINGS IN THE SOFTWARE."
|
||||
);
|
||||
SetDlgItemText(hwnd, IDA_TEXT, LICENCE_TEXT("\r\n\r\n"));
|
||||
}
|
||||
return 1;
|
||||
case WM_COMMAND:
|
||||
@ -232,7 +203,7 @@ static int CALLBACK AboutProc(HWND hwnd, UINT msg,
|
||||
char *text = dupprintf
|
||||
("%s\r\n\r\n%s\r\n\r\n%s",
|
||||
appname, ver,
|
||||
"\251 1997-2015 Simon Tatham. All rights reserved.");
|
||||
"\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
|
||||
SetDlgItemText(hwnd, IDA_TEXT, text);
|
||||
sfree(text);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "putty.h"
|
||||
#include "ssh.h"
|
||||
#include "licence.h"
|
||||
|
||||
#include <commctrl.h>
|
||||
|
||||
@ -253,36 +254,7 @@ static INT_PTR CALLBACK LicenceProc(HWND hwnd, UINT msg,
|
||||
rd.right - rd.left, rd.bottom - rd.top, TRUE);
|
||||
}
|
||||
|
||||
SetDlgItemText(hwnd, 1000,
|
||||
"Copyright 1997-2015 Simon Tatham.\r\n\r\n"
|
||||
|
||||
"Portions copyright Robert de Bath, Joris van Rantwijk, Delian "
|
||||
"Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas "
|
||||
"Barry, Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, "
|
||||
"Markus Kuhn, Colin Watson, Christopher Staite, and CORE SDI S.A.\r\n\r\n"
|
||||
|
||||
"Permission is hereby granted, free of charge, to any person "
|
||||
"obtaining a copy of this software and associated documentation "
|
||||
"files (the ""Software""), to deal in the Software without restriction, "
|
||||
"including without limitation the rights to use, copy, modify, merge, "
|
||||
"publish, distribute, sublicense, and/or sell copies of the Software, "
|
||||
"and to permit persons to whom the Software is furnished to do so, "
|
||||
"subject to the following conditions:\r\n\r\n"
|
||||
|
||||
"The above copyright notice and this permission notice shall be "
|
||||
"included in all copies or substantial portions of the Software.\r\n\r\n"
|
||||
|
||||
"THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT "
|
||||
"WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, "
|
||||
"INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF "
|
||||
"MERCHANTABILITY, FITNESS FOR A PARTICULAR "
|
||||
"PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE "
|
||||
"COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES "
|
||||
"OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, "
|
||||
"TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN "
|
||||
"CONNECTION WITH THE SOFTWARE OR THE USE OR "
|
||||
"OTHER DEALINGS IN THE SOFTWARE."
|
||||
);
|
||||
SetDlgItemText(hwnd, 1000, LICENCE_TEXT("\r\n\r\n"));
|
||||
return 1;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
@ -326,7 +298,7 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
|
||||
char *text = dupprintf
|
||||
("Pageant\r\n\r\n%s\r\n\r\n%s",
|
||||
ver,
|
||||
"\251 1997-2015 Simon Tatham. All rights reserved.");
|
||||
"\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
|
||||
SetDlgItemText(hwnd, 1000, text);
|
||||
sfree(text);
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "tree234.h"
|
||||
#include "winsecur.h"
|
||||
#include "pageant.h"
|
||||
#include "licence.h"
|
||||
|
||||
#include <shellapi.h>
|
||||
|
||||
@ -125,36 +126,7 @@ static INT_PTR CALLBACK LicenceProc(HWND hwnd, UINT msg,
|
||||
{
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
SetDlgItemText(hwnd, 1000,
|
||||
"Copyright 1997-2015 Simon Tatham.\r\n\r\n"
|
||||
|
||||
"Portions copyright Robert de Bath, Joris van Rantwijk, Delian "
|
||||
"Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas "
|
||||
"Barry, Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, "
|
||||
"Markus Kuhn, Colin Watson, Christopher Staite, and CORE SDI S.A.\r\n\r\n"
|
||||
|
||||
"Permission is hereby granted, free of charge, to any person "
|
||||
"obtaining a copy of this software and associated documentation "
|
||||
"files (the ""Software""), to deal in the Software without restriction, "
|
||||
"including without limitation the rights to use, copy, modify, merge, "
|
||||
"publish, distribute, sublicense, and/or sell copies of the Software, "
|
||||
"and to permit persons to whom the Software is furnished to do so, "
|
||||
"subject to the following conditions:\r\n\r\n"
|
||||
|
||||
"The above copyright notice and this permission notice shall be "
|
||||
"included in all copies or substantial portions of the Software.\r\n\r\n"
|
||||
|
||||
"THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT "
|
||||
"WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, "
|
||||
"INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF "
|
||||
"MERCHANTABILITY, FITNESS FOR A PARTICULAR "
|
||||
"PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE "
|
||||
"COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES "
|
||||
"OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, "
|
||||
"TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN "
|
||||
"CONNECTION WITH THE SOFTWARE OR THE USE OR "
|
||||
"OTHER DEALINGS IN THE SOFTWARE."
|
||||
);
|
||||
SetDlgItemText(hwnd, 1000, LICENCE_TEXT("\r\n\r\n"));
|
||||
return 1;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
@ -183,7 +155,7 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
|
||||
char *text = dupprintf
|
||||
("Pageant\r\n\r\n%s\r\n\r\n%s",
|
||||
ver,
|
||||
"\251 1997-2015 Simon Tatham. All rights reserved.");
|
||||
"\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
|
||||
SetDlgItemText(hwnd, 1000, text);
|
||||
sfree(text);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user