http://qs1969.pair.com?node_id=8993
Category: data formatting
Author/Contact Info T.R. Fullhart, kayos@kayos.org
Description:

This writes COPYRIGHT files for me. Sometimes we give clients code with a very specific license. This lets me set the policies. It spits out the license statement on standard out.

Call it like this

mkcopyright "licensee"

I'll probably make changes to this code based on your comments, so check back later if you want a more flexible version

#!/usr/bin/perl
# $Id: mkcopyright,v 1.2 2000/05/11 16:34:02 kayos Exp $

my $cols = 70;
my $writer = "Virtual Focus, Inc.";
my $licensee = $ARGV[0] || "the licensee";
my $date = (localtime)[5] + 1900;
my $c = "#";
my $body;

# policies
my $allow_modification  = 1;            # implemented
my $warranty            = 0;            # implemented
my $responsible_for_damage = 0;         # implemented
my $client_can_resell   = 0;            # implemented

my $indefinite_licensing        = 1;
my $limited_time_licensing      = 0;


#--------------------------------------------------------------

my $tmpbody = '<' x ($cols - 5);
eval(qq{
format STDOUT =
\@ ^$tmpbody \@
\$c,\$body,\$c
.
});

sub print_divider {
        print $c x $cols,"\n";
}

sub print_body {
        $body = join(' ',@_);
        $body =~ s/\s+/ /gs;
        $body =~ s/^\s+//g;
        $body =~ s/\.+/./g;
        $body ||= " ";
        while($body) {
        write;
        }
}

#--------------------------------------------------------------

print_divider();
print_body("This program Copyright $date $writer");

print_body(qq{
        Program originally Copyrighted by $writer, 
        now licensed for use to $licensee
});

print_divider();
print_body("  COPYRIGHT NOTICE:");
print_body("Copyright $date $writer. All Rights Reserved.");

print_body();
print_body();

# do we warranty that the program does a particular function?
if(! $warranty) {
        print_body(qq{
                The program is provided "as is" without warranty of an
+y
                kind, either express or implied, including, but not li
+mited
                to warranties of merchantability or fitness for a
                particular purpose.
        });
        print_body();
}


# do we accept responsibility if "bad things" happen?
if(! $responsible_for_damage) {
        print_body(qq{
                In no event will $writer be liable to $licensee for an
+y
                damages, including incidental or consequential damages
+, 
                arising out of the use of the program, even if advised
+ of 
                the possibility of such damages. By licensing this cod
+e, 
                $licensee is now legally responsible for this copy of 
+the 
                program, and further agrees to indemnify $writer from 
+any 
                liability that might arise from its use. 
        });
        print_body();
}


if( $allow_modification ) {
        print_body(qq{
                This script may modified free of charge by $licensee.
                Any changes made to this program by $licensee will not
+ 
                be the responsibility of $writer.
        });
        print_body();
}

if(! $client_can_resell) {
        print_body(qq{
                Selling the code for this program without prior writte
+n
                consent is expressly forbidden.
        });
        print_body();
}

print_body(qq{
        $temp1
        $writer is still the owner of this program but grants 
        indefinite licensing use permission to $licensee.
});

print_body();

print_body(qq{
        You acknowledge that you have read the license, understand it
        and agree to be bound by its terms as the complete and exclusi
+ve
        statement of the agreement between us, superseding any proposa
+l
        or prior agreement, oral or written, and any other communicati
+ons
        between us relating to the subject matter of this license.
});

print_body();
print_divider();