#!/bin/sh
# The next line restarts using tclsh8.0 \
exec tclsh8.0 $0 ${1+"$@"}

set dirs ". ./unix ./library ./generic ./tests ./doc ./mac ./win ./win/rc"
set package "+"
set version "8.0.3"
set date "9/24/98"

#
# This is a tcl-script that will search a list of directories
# for ".orig"-files. For all of these it will make a "diff",
# and create a patch-file.
#
#	Written by:	Jan Nijtmans
#			CMG (Computer Managemeng Group) Arnhem B.V.
#			email: Jan.Nijtmans@wxs.nl (private)
#			       Jan.Nijtmans@cmg.nl (work)
#			url:   http://home.wxs.nl/~nijtmans/

set patchlevel ""
set dfiles ""

set file [open pluspatch.orig w]
close $file
set file [open README.PLUS.orig w]
close $file

foreach dir $dirs {
    set files [eval exec ls $dir]
    foreach file $files {
	if {[regexp ".*\.orig" $file]} {
	    set file $dir/[string range $file 0 [expr [string length $file]-6]]
	    if {$file=="$dir/tk.h"} {
		set patchlevel $file.diff
	    } else {
		lappend dfiles $file.diff
	    }
	    set file [string range $file 2 [string length $file]]
	    puts stdout "creating $file.diff"
	    catch "exec diff -c $file.orig $file >$file.diff"
	}
    }
}

puts stdout "creating tk${version}plus.patch"
set file [open tk${version}plus.patch w]
puts $file "
tk${version}plus.patch -   $date

This patch file updates from Tk ${version} to Tk ${version}${package}. It should be applied
by running the \"patch\" program in the top-level directory of a clean
Tk ${version} release, using the command \"patch -p0 <tk${version}plus.patch\"

If you are using Solaris, don't be surprised if the patch utility does not
work. This is a known problem. Better install GNU patch version 2.1 or later.

Prereq: \"${version}\"
[eval exec cat $patchlevel $dfiles]"
close $file

file delete pluspatch.diff pluspatch.orig README.PLUS.diff README.PLUS.orig
