summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-02-19 13:41:49 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-02-19 13:41:49 (GMT)
commit98179c2eb0bc81ab39b0b65d730bccbba5f07fd4 (patch)
tree13c46f5ecaeed1a5d59b4a2abec2f931d84c805b
parent0399234c3de3213b5bcd19d06ca35f1bd9cf9c18 (diff)
downloadtk-98179c2eb0bc81ab39b0b65d730bccbba5f07fd4.zip
tk-98179c2eb0bc81ab39b0b65d730bccbba5f07fd4.tar.gz
tk-98179c2eb0bc81ab39b0b65d730bccbba5f07fd4.tar.bz2
[Tcl Bug 2954638]: Correct behaviour of manual page installer. Also added
armouring to check that assumptions about the initial state are actually valid (e.g., look for existing input file).
-rw-r--r--ChangeLog253
-rwxr-xr-xunix/installManPage133
-rw-r--r--xlib/xutil.c3
3 files changed, 221 insertions, 168 deletions
diff --git a/ChangeLog b/ChangeLog
index 94bc6c0..813bb95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,139 +1,144 @@
+2010-02-19 Donal K. Fellows <dkf@users.sf.net>
+
+ * unix/installManPage: [Tcl Bug 2954638]: Correct behaviour of manual
+ page installer. Also added armouring to check that assumptions about
+ the initial state are actually valid (e.g., look for existing input
+ file).
+
2010-02-19 Stuart Cassoff <stwo@users.sourceforge.net>
- * tcl.m4: Correct compiler/linker flags
- for threaded builds on OpenBSD.
+ * tcl.m4: Correct compiler/linker flags for threaded builds on
+ OpenBSD.
* configure: (regenerated).
2010-02-18 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkButton.h Put all Tk_OptionSpec for buttons and labels
- * generic/tkButton.c in const memory. With some changes to win32
- * win/tkWinButton.c and macosx, preventing direct writes to
- * unix/tkUnixPort.h read-only memory.
- * carbon/tkMacOSXPort.h
- * macosx/tkMacOSXButton.c
+ * generic/tkButton.h: Put all Tk_OptionSpec for buttons and labels
+ * generic/tkButton.c: in const memory. With some changes to win32
+ * win/tkWinButton.c: and macosx, preventing direct writes to
+ * unix/tkUnixPort.h: read-only memory.
+ * carbon/tkMacOSXPort.h:
+ * macosx/tkMacOSXButton.c:
2010-02-17 Joe English <jenglish@users.sourceforge.net>
- * generic/tkMenu.c: Defer TkMenuOptionTables cleanup
- to CallWhenDeleted() time, to ensure that the record
- doesn't get freed until after all widget instance commands
- have been deleted (Fixes [Bug#2952745]).
+ * generic/tkMenu.c: [Bug 2952745]: Defer TkMenuOptionTables cleanup to
+ CallWhenDeleted() time, to ensure that the record doesn't get freed
+ until after all widget instance commands have been deleted.
2010-02-17 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tk.decls CONSTify everything related to Tk_ConfigSpec
- * generic/tk.h
- * generic/tkCanvArc.c Many tables can now be put in const memory
- * generic/tkCanvas.c
- * generic/tkCanvBmap.c
- * generic/tkCanvImg.c
- * generic/tkCanvLine.c
- * generic/tkCanvPoly.c
- * generic/tkCanvPs.c
- * generic/tkCanvText.c
- * generic/tkCanvWind.c
- * generic/tkImgBmap.c
- * generic/tkImgPhoto.c
- * generic/tkOldConfig.c
- * generic/tkRectOval.c
- * generic/tkScrollbar.c
- * generic/tkScrollbar.h
- * generic/tkDecls.h (regenerated)
- * doc/CanvTkwin.3
- * doc/ConfigWidg.3
- * doc/CrtItemType.3
- * win/tkWinScrlbr.c
- * carbon/tkMacOSXScrlbr.c
- * macosx/tkMacOSXScrlbr.c
+ * generic/tk.decls: CONSTify everything related to Tk_ConfigSpec
+ * generic/tk.h:
+ * generic/tkCanvArc.c: Many tables can now be put in const memory
+ * generic/tkCanvas.c:
+ * generic/tkCanvBmap.c:
+ * generic/tkCanvImg.c:
+ * generic/tkCanvLine.c:
+ * generic/tkCanvPoly.c:
+ * generic/tkCanvPs.c:
+ * generic/tkCanvText.c:
+ * generic/tkCanvWind.c:
+ * generic/tkImgBmap.c:
+ * generic/tkImgPhoto.c:
+ * generic/tkOldConfig.c:
+ * generic/tkRectOval.c:
+ * generic/tkScrollbar.c:
+ * generic/tkScrollbar.h:
+ * generic/tkDecls.h: (regenerated)
+ * doc/CanvTkwin.3:
+ * doc/ConfigWidg.3:
+ * doc/CrtItemType.3:
+ * win/tkWinScrlbr.c:
+ * carbon/tkMacOSXScrlbr.c:
+ * macosx/tkMacOSXScrlbr.c:
2010-02-16 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkWindow.c Reverted rename from tkStubs to tkConstStubs
- * generic/tkStubInit.c (regenerated)
- * generic/tkArgv.c make defaultTable const
- * generic/tkScrollbar.c Store default for "-with" in static non-const space
- * win/tkWinInt.h make tkWinProcs const, and 5
- * win/tkWinX.c procs MODULE_SCOPE
- * win/tkWinColor.c make sysColors const
- * win/tkWinKey.c make keymap const
- * win/tkWinScrlbr.c Simplify copying of "-with" default value.
- * unix/tkUnixWm.c make TkSetTransientFor static
- * tests/textImage.test textImage-1.13 depends on hash-order
+ * generic/tkWindow.c: Reverted rename from tkStubs to tkConstStubs
+ * generic/tkStubInit.c: (regenerated)
+ * generic/tkArgv.c: make defaultTable const
+ * generic/tkScrollbar.c:Store default for "-with" in static non-const
+ space
+ * win/tkWinInt.h: Make tkWinProcs const, and 5 procs
+ * win/tkWinX.c: MODULE_SCOPE.
+ * win/tkWinColor.c: Make sysColors const.
+ * win/tkWinKey.c: Make keymap const.
+ * win/tkWinScrlbr.c: Simplify copying of "-with" default value.
+ * unix/tkUnixWm.c: Make TkSetTransientFor static.
+ * tests/textImage.test: textImage-1.13 depends on hash-order
2010-02-12 Jan Nijtmans <nijtmans@users.sf.net>
- * win/tcl.m4 use -pipe for gcc on win32
- * win/configure (mingw/cygwin) (regenerated)
- * unix/tkUnixColor.c make sure that TkpCmapStressed is exported
- * generic/tkImgPhoto.c clean up unused Tk_CreatePhotoOption
- * generic/tkBind.c Make more internal arrays "const"
- * generic/tkBusy.c |
- * generic/tkButton.c
- * generic/tkEvent.c
- * generic/tkGrab.c
- * generic/tkImgBmap.c
- * generic/tkObj.c
- * generic/tkOption.c
- * generic/tkPanedWindow.c
- * generic/tkPointer.c
- * generic/tkWindow.c
- * generic/tkImgPhoto.c Eliminate never used Tk_CreatePhotoOption()
+ * win/tcl.m4: Use -pipe for gcc on win32
+ * win/configure: (mingw/cygwin) (regenerated)
+ * unix/tkUnixColor.c: Make sure that TkpCmapStressed is exported
+ * generic/tkImgPhoto.c: Clean up unused Tk_CreatePhotoOption
+ * generic/tkBind.c: Make more internal arrays "const"
+ * generic/tkBusy.c:
+ * generic/tkButton.c:
+ * generic/tkEvent.c:
+ * generic/tkGrab.c:
+ * generic/tkImgBmap.c:
+ * generic/tkObj.c:
+ * generic/tkOption.c:
+ * generic/tkPanedWindow.c:
+ * generic/tkPointer.c:
+ * generic/tkWindow.c:
+ * generic/tkImgPhoto.c: Eliminate never used Tk_CreatePhotoOption()
2010-02-05 Jan Nijtmans <nijtmans@users.sf.net>
- * carbon/tkMacOSXDialog.c Make more internal
- * macosx/tkMacOSXDialog.c tables "const"
- * unix/tkUnixButton.c
- * unix/tkUnixWm.c
- * win/tkWinDialog.c
- * generic/tkWindow.c
- * generic/tk*Decls.h (regenerated with new
- * generic/tkStubInit.c genStubs.tcl from Tcl)
+ * carbon/tkMacOSXDialog.c: Make more internal tables "const"
+ * macosx/tkMacOSXDialog.c:
+ * unix/tkUnixButton.c:
+ * unix/tkUnixWm.c:
+ * win/tkWinDialog.c:
+ * generic/tkWindow.c:
+ * generic/tk*Decls.h: (regenerated with new
+ * generic/tkStubInit.c: genStubs.tcl from Tcl)
2010-02-05 Joe English <jenglish@users.sourceforge.net>
- * generic/ttk/*.[ch]: Revert contravariant const qualifiers added
- by the previous commit to keep codebase in sync with the Tile
- extension, which must remain 8.4 compatible.
+ * generic/ttk/*.[ch]: Revert contravariant const qualifiers added by
+ the previous commit to keep codebase in sync with the Tile extension,
+ which must remain 8.4 compatible.
2010-02-05 Jan Nijtmans <nijtmans@users.sf.net>
* generic/ttk/ttkGenStubs.tcl: Follow-up to [2010-01-29] commit:
- prevent space within stub table function parameters
- if the parameter type is a pointer. Make the
- various stub tables and hook pointers const,
- just as Tcl and Tk.
- * generic/ttk/ttkDecls.h (regenerated)
- * generic/ttk/ttkStubInit.c (regenerated)
- * generic/ttk/ttk.decls Minor formatting
- * generic/ttk/ttkButton.c Make more internal tables "const"
- * generic/ttk/ttkDefaultTheme.c
- * generic/ttk/ttkEntry.c
- * generic/ttk/ttkImage.c
- * generic/ttk/ttkInit.c
- * generic/ttk/ttkLayout.c
- * generic/ttk/ttkNotebook.c
- * generic/ttk/ttkPanedWindow.c
- * generic/ttk/ttkProgress.c
- * generic/ttk/ttkStubLib.c
- * generic/ttk/ttkTheme.c
- * generic/ttk/ttkTreeview.c
- * generic/ttk/ttkWidget.c
- * generic/ttk/ttkWidget.h
+ prevent space within stub table function parameters if the
+ parameter type is a pointer. Make the various stub tables and
+ hook pointers const, just as Tcl and Tk.
+ * generic/ttk/ttkDecls.h: (regenerated)
+ * generic/ttk/ttkStubInit.c: (regenerated)
+ * generic/ttk/ttk.decls: Minor formatting
+ * generic/ttk/ttkButton.c: Make more internal tables "const"
+ * generic/ttk/ttkDefaultTheme.c:
+ * generic/ttk/ttkEntry.c:
+ * generic/ttk/ttkImage.c:
+ * generic/ttk/ttkInit.c:
+ * generic/ttk/ttkLayout.c:
+ * generic/ttk/ttkNotebook.c:
+ * generic/ttk/ttkPanedWindow.c:
+ * generic/ttk/ttkProgress.c:
+ * generic/ttk/ttkStubLib.c:
+ * generic/ttk/ttkTheme.c:
+ * generic/ttk/ttkTreeview.c:
+ * generic/ttk/ttkWidget.c:
+ * generic/ttk/ttkWidget.h:
2010-01-31 Joe English <jenglish@users.sourceforge.net>
- * generic/ttk/ttkTheme.h, generic/ttk/ttkWidget.h,
- generic/ttk/*.c: Change signature of widget subcommand
- procedures to match Tcl_ObjCmdProc. Merge now-redundant
- ensemble dispatch code.
+ * generic/ttk/ttkTheme.h, generic/ttk/ttkWidget.h, generic/ttk/*.c:
+ Change signature of widget subcommand procedures to match
+ Tcl_ObjCmdProc. Merge now-redundant ensemble dispatch code.
2010-01-29 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/ttk/ttkGenStubs.tcl: No longer generate a space after "*" and
- immediately after a function name, so the
- format of function definitions in *Decls.h
+ * generic/ttk/ttkGenStubs.tcl: No longer generate a space after "*"
+ and immediately after a function name, so the
+ format of function definitions in *Decls.h
match all other *.h header files.
* generic/ttk/ttkDecls.h (re-generated)
* generic/tk.decls Formatting
@@ -146,29 +151,29 @@
2010-01-19 Jan Nijtmans <nijtmans@users.sf.net>
- * generic/tkInt.h Don't depend on <stdio.h> from tcl.h any more
- * generic/tkOldConfig.c
- * generic/ttk/ttkClamTheme.c fix more gcc warnings: missing initializer
- * generic/ttk/ttkClassicTheme.c
- * generic/ttk/ttkDefaultTheme.c
- * generic/ttk/ttkElements.c
- * generic/ttk/ttkEntry.c
- * generic/ttk/ttkInit.c
- * generic/ttk/ttkLabel.c
- * generic/ttk/ttkNotebook.c
- * generic/ttk/ttkPanedwindow.c
- * generic/ttk/ttkSquare.c
- * generic/ttk/ttkTreeview.c
- * win/ttkWinTheme.c
- * win/tkWinMenu.c Add missing #include <string.h>
- * win/tkWinPort.h Fix include files for CYGWIN
- * win/tkWinSend.c
- * win/tkWinSendCom.c
- * win/tkWinTest.c Fix gcc warning
+ * generic/tkInt.h: Don't depend on <stdio.h> from tcl.h any
+ * generic/tkOldConfig.c: more.
+ * generic/ttk/ttkClamTheme.c: Fix more gcc warnings: missing
+ * generic/ttk/ttkClassicTheme.c: initializer.
+ * generic/ttk/ttkDefaultTheme.c:
+ * generic/ttk/ttkElements.c:
+ * generic/ttk/ttkEntry.c:
+ * generic/ttk/ttkInit.c:
+ * generic/ttk/ttkLabel.c:
+ * generic/ttk/ttkNotebook.c:
+ * generic/ttk/ttkPanedwindow.c:
+ * generic/ttk/ttkSquare.c:
+ * generic/ttk/ttkTreeview.c:
+ * win/ttkWinTheme.c:
+ * win/tkWinMenu.c: Add missing #include <string.h>
+ * win/tkWinPort.h: Fix include files for CYGWIN
+ * win/tkWinSend.c:
+ * win/tkWinSendCom.c:
+ * win/tkWinTest.c: Fix gcc warning
* win/winMain.c: Eliminate use of __argc and __argv for CYGWIN
- * win/tcl.m4 Make cygwin configuration error into
- * win/configure.in a warning: CYGWIN compilation works
- * win/configure although there still are test failures.
+ * win/tcl.m4: Make cygwin configuration error into
+ * win/configure.in: a warning: CYGWIN compilation works
+ * win/configure: although there still are test failures.
2010-01-19 Donal K. Fellows <dkf@users.sf.net>
diff --git a/unix/installManPage b/unix/installManPage
index 98cd899..e636db7 100755
--- a/unix/installManPage
+++ b/unix/installManPage
@@ -1,12 +1,29 @@
#!/bin/sh
-ZIP=:
+########################################################################
+### Parse Options
+###
+
+Gzip=:
+SymOrLoc=""
+Gz=""
+Suffix=""
+
while true; do
case $1 in
- -s | --symlinks ) S="-s ";;
- -z | --compress ) ZIP=$2; shift ;;
- -e | --extension ) Z=$2; shift ;;
- -s | --suffix ) SUFFIX=$2; shift ;;
+ -s | --symlinks ) SymOrLoc="-s " ;;
+ -z | --compress ) Gzip=$2; shift ;;
+ -e | --extension ) Gz=$2; shift ;;
+ -x | --suffix ) Suffix=$2; shift ;;
+ -*) cat <<EOF
+Unknown option "$1". Supported options:
+ -s Use symbolic links for manpages with multiple names.
+ -z PROG Use PROG to compress manual pages.
+ -e EXT Defines the extension added by -z PROG when compressing.
+ -x SUFF Defines an extra extension suffix to use.
+Option names may not be combined getopt-style.
+EOF
+ exit 1 ;;
*) break ;;
esac
shift
@@ -16,54 +33,84 @@ if test "$#" != 2; then
exit 1
fi
-MANPAGE=$1
-DIR=$2
-test -z "$S" && S="$DIR/"
+########################################################################
+### Parse Required Arguments
+###
+
+ManPage=$1
+Dir=$2
+if test -f $ManPage ; then : ; else
+ echo "source manual page file must exist"
+ exit 1
+fi
+if test -d $Dir ; then : ; else
+ echo "target directory must exist"
+ exit 1
+fi
+test -z "$SymOrLoc" && SymOrLoc="$Dir/"
+
+########################################################################
+### Extract Target Names from Manual Page
+###
# A sed script to parse the alternative names out of a man page.
#
-# /^\\.SH NAME/{ ;# Look for a line, that starts with .SH NAME
-# s/^.*$// ;# Delete the content of this line from the buffer
-# n ;# Read next line
-# s/,//g ;# Remove all commas ...
-# s/\\\ //g ;# .. and backslash-escaped spaces.
-# s/::/_/g ;# Convert '::' to '_'
-# s/ \\\-.*// ;# Delete from \- to the end of line
-# p ;# print the result
-# q ;# exit
-# }
-#
# Backslashes are trippled in the sed script, because it is in
-# backticks which don't pass backslashes literally.
+# backticks which doesn't pass backslashes literally.
#
-# Please keep the commented version above updated if you
-# change anything to the script below.
-NAMES=`sed -n '
- /^\\.SH NAME/{
- s/^.*$//
+Names=`sed -n '
+# Look for a line, that starts with .SH NAME
+# optionally allow NAME to be surrounded
+# by quotes.
+ /^\.SH NAME/{
+# Read next line
n
+# Remove all commas ...
s/,//g
+# ... and backslash-escaped spaces.
s/\\\ //g
- s/::/_/g
+# Delete from \- to the end of line
s/ \\\-.*//
- p
- q
- }' $MANPAGE`
+# print the result and exit
+ p;q
+ }' $ManPage`
+
+if test -z $Names ; then
+ echo "warning: no target names found in $ManPage"
+fi
+
+########################################################################
+### Remaining Set Up
+###
-SECTION=`echo $MANPAGE | sed 's/.*\(.\)$/\1/'`
-SRCDIR=`dirname $MANPAGE`
-FIRST=""
-for f in $NAMES; do
- f=$f.$SECTION$SUFFIX
- if test -z "$FIRST" ; then
- FIRST=$f
- rm -f $DIR/$FIRST $DIR/$FIRST.*
- sed -e "/man\.macros/r $SRCDIR/man.macros" -e "/man\.macros/d" \
- $MANPAGE > $DIR/$FIRST
- chmod 444 $DIR/$FIRST
- $ZIP $DIR/$FIRST
+case $ManPage in
+ *.1) Section=1 ;;
+ *.3) Section=3 ;;
+ *.n) Section=n ;;
+ *) echo "unknown section for $ManPage"
+ exit 2 ;;
+esac
+
+SrcDir=`dirname $ManPage`
+
+########################################################################
+### Process Page to Create Target Pages
+###
+
+First=""
+for Target in $Names; do
+ Target=$Target.$Section$Suffix
+ rm -f $Dir/$Target $Dir/$Target.*
+ if test -z "$First" ; then
+ First=$Target
+ sed -e "/man\.macros/r $SrcDir/man.macros" -e "/man\.macros/d" \
+ $ManPage > $Dir/$First
+ chmod 444 $Dir/$First
+ $Gzip $Dir/$First
else
- rm -f $DIR/$f $DIR/$f.*
- ln $S$FIRST$Z $DIR/$f$Z
+ ln $SymOrLoc$First$Gz $Dir/$Target$Gz
fi
done
+
+########################################################################
+exit 0
diff --git a/xlib/xutil.c b/xlib/xutil.c
index 103d995..d5e26eb 100644
--- a/xlib/xutil.c
+++ b/xlib/xutil.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: xutil.c,v 1.4 2007/01/02 23:39:40 dkf Exp $
+ * RCS: @(#) $Id: xutil.c,v 1.5 2010/02/19 13:41:49 dkf Exp $
*/
#include <stdlib.h>
@@ -71,6 +71,7 @@ XGetVisualInfo(
int *nitems_return)
{
XVisualInfo *info = (XVisualInfo *) ckalloc(sizeof(XVisualInfo));
+
info->visual = DefaultVisual(display, 0);
info->visualid = info->visual->visualid;
info->screen = 0;