some patches to assist startup and portability to SunOS-4.1+BIND-4.9.4

Greg A. Woods (woods@most.weird.com)
Tue, 18 Jun 96 10:18:04 -0400 (EDT)

These patches do not include the changes to "configure". As you'll see
from my ChangeLog entry I've removed it from my own local repository and
regenerate it as needed.

The primary motivation for most of these changes is that I thought it
ludicrous that I had to tell configure where I wanted to install the
product, then I had to further set an extra environment variable to tell
the application where it was installed. Things like this *should* be
self-configuring, and sure enough I read in the Tcl/Tk manual pages that
applications should arrange to have "auto_path" set up themselves, and
only as a last resort is the environment variable TCLLIBPATH searched.

These changes also fix a minor portability problem for SunOS-4.1 systems
where the local shared library has had a recent BIND resolver integrated.

All else seems to be working fine. I had some trouble understanding the
limits of the tkined edit pane when the media type was smaller than the
displayed area -- there's no visible indication of the media boundary.
Also, once when I left it running overnight it some of the IP_Monitor
jobs seemed to stop updating the display even though the proccesses
seemed to all still be running and accumulating CPU time.

Thanks for a wonderful tool that's very easy to configure and install.
I hope you'll find my patches further ease the efforts of the user.

WARNING: apply these patches within the top directory of the scotty
sources by feeding the diffs to "patch -p2" (i.e. tell patch to strip
the first two directories from each pathname).

Tue Jun 18 13:03:28 1996 Greg A. Woods <woods@planix.com>

* unix/.cvsignore: - first time in

* unix/configure.in:
- add PACKAGE and VERSION ala what automake would want
- use "test $foo -eq 0" not "test $foo = 0" when doing numeric
comparisons (XXX FIXME not done globally)
- add TKI_VERSION_NO_MINOR for the benefit of tkined.in
- fix detection and configuration of -lresolv for SunOS-4 + BIND
- add tkined to list of files in AC_OUTPUT

* unix/Makefile.in:
- collapse some continued lines to prevent weirdness by make on blank
continuations (some makes can't handle empty continued lines)
- remove tkined -- generated by configure now
- define TKINEDLIB and TNMLIB for the scotty.c compile

* unix/scotty.c: - add TKINEDLIB and TNMLIB to auto_path on startup

* unix/tkined.in: - first time in, with edits to make it configurable

* unix/Attic/tkined: - renamed tkined.in

* unix/Attic/configure:
- don't keep this in the repository -- generate as needed, we have autoconf

Index: misc/scotty/unix/.cvsignore
diff -c /dev/null misc/scotty/unix/.cvsignore:1.1
*** /dev/null Tue Jun 18 09:49:21 1996
--- misc/scotty/unix/.cvsignore Tue Jun 18 09:02:23 1996
***************
*** 0 ****
--- 1,25 ----
+ Makefile
+ config.cache
+ config.h
+ config.log
+ config.status
+ ether.h
+ ether.x
+ ether_clnt.c
+ ether_xdr.c
+ mount.h
+ mount.x
+ mount_clnt.c
+ mount_xdr.c
+ ntping
+ pcnfsd.h
+ pcnfsd.x
+ pcnfsd_clnt.c
+ pcnfsd_xdr.c
+ rstat.h
+ rstat.x
+ rstat_clnt.c
+ rstat_xdr.c
+ scotty
+ straps
+ tkined
Index: misc/scotty/unix/Makefile.in
diff -c misc/scotty/unix/Makefile.in:1.1.1.1 misc/scotty/unix/Makefile.in:1.2
*** misc/scotty/unix/Makefile.in:1.1.1.1 Fri Jun 14 12:43:01 1996
--- misc/scotty/unix/Makefile.in Tue Jun 18 08:54:59 1996
***************
*** 348,357 ****
tkiUtil.o \
tkiInit.o @TKI_NCC_O@

! TNM_SRCS = $(TNM_GENERIC_SRCS) $(SNMP_SRCS) @GDMO_SRCS@ @CMIP_SRCS@ \
! @MSQL_SRCS@
! TNM_OBJS = $(TNM_GENERIC_OBJS) $(SNMP_OBJS) @GDMO_OBJS@ @CMIP_OBJS@ \
! @MSQL_OBJS@
TKI_SRCS = $(TKI_GENERIC_SRCS)

TKI_OBJS = $(TKI_GENERIC_OBJS)
--- 348,355 ----
tkiUtil.o \
tkiInit.o @TKI_NCC_O@

! TNM_SRCS = $(TNM_GENERIC_SRCS) $(SNMP_SRCS) @GDMO_SRCS@ @CMIP_SRCS@ @MSQL_SRCS@
! TNM_OBJS = $(TNM_GENERIC_OBJS) $(SNMP_OBJS) @GDMO_OBJS@ @CMIP_OBJS@ @MSQL_OBJS@
TKI_SRCS = $(TKI_GENERIC_SRCS)

TKI_OBJS = $(TKI_GENERIC_OBJS)
***************
*** 681,687 ****
clean:
@rm -f $(TNM_OBJS) $(TKI_OBJS) scotty.o ntping.o straps.o
@rm -f tnmGdmoScan.c tnmGdmoParser.c tnmGdmoParser.h
! @rm -f scotty ntping straps
@rm -f tnm$(SHLIB_SUFFIX) tkined$(SHLIB_SUFFIX)
@rm -f core *_svc.c *~ *.bak so_locations lmake.???

--- 679,685 ----
clean:
@rm -f $(TNM_OBJS) $(TKI_OBJS) scotty.o ntping.o straps.o
@rm -f tnmGdmoScan.c tnmGdmoParser.c tnmGdmoParser.h
! @rm -f scotty ntping straps tkined
@rm -f tnm$(SHLIB_SUFFIX) tkined$(SHLIB_SUFFIX)
@rm -f core *_svc.c *~ *.bak so_locations lmake.???

***************
*** 760,766 ****
$(LD) $(LD_FLAGS) -o straps straps.o $(LIBS)

scotty.o: $(UNIX_DIR)/scotty.c
! $(CC) -c $(TNM_CC_SWITCHES) -I. -I$(TNM_GENERIC_DIR) $(TCL_INCLUDES) $(UNIX_DIR)/scotty.c

tnmEvent.o: $(TNM_GENERIC_DIR)/tnmEvent.c
$(CC) -c $(TNM_CC_SWITCHES) $(TNM_GENERIC_DIR)/tnmEvent.c
--- 758,764 ----
$(LD) $(LD_FLAGS) -o straps straps.o $(LIBS)

scotty.o: $(UNIX_DIR)/scotty.c
! $(CC) -c $(TNM_CC_SWITCHES) -I. -I$(TNM_GENERIC_DIR) $(TCL_INCLUDES) -DTNMLIB=\"$(TNM_INSTALL_DIR)\" -DTKINEDLIB=\"$(TKI_INSTALL_DIR)\" $(UNIX_DIR)/scotty.c

tnmEvent.o: $(TNM_GENERIC_DIR)/tnmEvent.c
$(CC) -c $(TNM_CC_SWITCHES) $(TNM_GENERIC_DIR)/tnmEvent.c
Index: misc/scotty/unix/configure.in
diff -c misc/scotty/unix/configure.in:1.1.1.1 misc/scotty/unix/configure.in:1.2
*** misc/scotty/unix/configure.in:1.1.1.1 Fri Jun 14 12:43:01 1996
--- misc/scotty/unix/configure.in Tue Jun 18 08:58:58 1996
***************
*** 4,9 ****
--- 4,12 ----
AC_INIT(scotty.c)
AC_CONFIG_HEADER(config.h)

+ PACKAGE=scotty
+ VERSION=2.1.0
+
#----------------------------------------------------------------------------
# Check if we should use gcc if available on this machine.
#----------------------------------------------------------------------------
***************
*** 14,19 ****
--- 17,23 ----

TNM_VERSION=2.1.0
TKI_VERSION=1.4.0
+ TKI_VERSION_NO_MINOR=1.4

AC_PREFIX_PROGRAM(scotty)
if test "$prefix" = "NONE" ; then
***************
*** 236,242 ****
LIBS="$LIBS -lsocket"
AC_CHECK_LIB(nsl, main, , tk_both=0)
LIBS=$tk_oldLibs
! if test "$tk_both" = 1; then
echo "need -lsocket and -lnsl together"
LIBS="$LIBS -lsocket -lnsl"
else
--- 240,246 ----
LIBS="$LIBS -lsocket"
AC_CHECK_LIB(nsl, main, , tk_both=0)
LIBS=$tk_oldLibs
! if test "$tk_both" -eq 1; then
echo "need -lsocket and -lnsl together"
LIBS="$LIBS -lsocket -lnsl"
else
***************
*** 247,254 ****
AC_CHECK_LIB(ieee, main, [LIBS="$LIBS -lieee"])
AC_CHECK_LIB(rpc, main, [LIBS="$LIBS -lrpc"])
AC_CHECK_LIB(rpcsvc, main, [LIBS="$LIBS -lrpcsvc"])
AC_CHECK_FUNC(res_mkquery, ,
! AC_CHECK_LIB(resolv, res_mkquery, [LIBS="$LIBS -lresolv"]))

#----------------------------------------------------------------------------
# Checks for various include files missing on some machines.
--- 251,284 ----
AC_CHECK_LIB(ieee, main, [LIBS="$LIBS -lieee"])
AC_CHECK_LIB(rpc, main, [LIBS="$LIBS -lrpc"])
AC_CHECK_LIB(rpcsvc, main, [LIBS="$LIBS -lrpcsvc"])
+
+ # The BIND 4.9.3/4.9.4 shared library for SunOS-4.1 doesn't make _res
+ # publicly available, so if we don't find it we need to link with
+ # -lresolv statically.
+ #
+ AC_CACHE_CHECK(_res without -lresolv, tk_cv_var__res, [
+ AC_TRY_LINK([#include <sys/types.h>
+ #include <netinet/in.h>
+ #include <arpa/nameser.h>
+ #include <resolv.h>], [_res.options = RES_INIT;],
+ tk_cv_var__res=yes, tk_cv_var__res=no)
+ ])
+ if test "$tk_cv_var__res" = "no"; then
+ LIBS="$LIBS -lresolv"
+ #
+ # Check again verbosely and make sure it is really there now...
+ #
+ AC_CACHE_CHECK(-lresolv, tk_cv_var__res_lresolv, [
+ AC_TRY_LINK([#include <sys/types.h>
+ #include <netinet/in.h>
+ #include <arpa/nameser.h>
+ #include <resolv.h>], [_res.options = RES_INIT;],
+ tk_cv_var__res_lresolv=yes,
+ AC_MSG_ERROR(need resolver _res global but not in -lresolv; giving up))
+ ])
+ fi
AC_CHECK_FUNC(res_mkquery, ,
! AC_MSG_ERROR(bizzare -- _res but no res_mkquery; giving up))

#----------------------------------------------------------------------------
# Checks for various include files missing on some machines.
***************
*** 317,322 ****
--- 347,353 ----

AC_SUBST(TNM_VERSION)
AC_SUBST(TKI_VERSION)
+ AC_SUBST(TKI_VERSION_NO_MINOR)
AC_SUBST(TKI_NCC_O)
AC_SUBST(TARGET)

***************
*** 325,331 ****
AC_SUBST(TCL_VERSION)
AC_SUBST(TK_INCLUDES)
AC_SUBST(TK_LIB_SPEC)
AC_SUBST(TK_XINCLUDES)
AC_SUBST(TK_XLIBSW)

! AC_OUTPUT(Makefile)
--- 356,363 ----
AC_SUBST(TCL_VERSION)
AC_SUBST(TK_INCLUDES)
AC_SUBST(TK_LIB_SPEC)
+ AC_SUBST(TK_VERSION)
AC_SUBST(TK_XINCLUDES)
AC_SUBST(TK_XLIBSW)

! AC_OUTPUT([Makefile tkined])
Index: misc/scotty/unix/scotty.c
diff -c misc/scotty/unix/scotty.c:1.1.1.1 misc/scotty/unix/scotty.c:1.2
*** misc/scotty/unix/scotty.c:1.1.1.1 Fri Jun 14 12:42:59 1996
--- misc/scotty/unix/scotty.c Tue Jun 18 08:52:53 1996
***************
*** 14,19 ****
--- 14,31 ----
#include "tnmInt.h"
#include "tnmPort.h"

+ /*
+ * Define some default places where we expect our own files.
+ */
+
+ #ifndef TKINEDLIB
+ # define TKINEDLIB "/usr/local/lib/tkined"
+ #endif
+
+ #ifndef TNMLIB
+ # define TNMLIB "/usr/local/lib/tnm"
+ #endif
+
static Tcl_Interp *interp; /* Interpreter for this application. */
static Tcl_DString command; /* Used to assemble lines of terminal input
* into Tcl commands. */
***************
*** 92,97 ****
--- 104,114 ----
if (Tcl_Init(interp) != TCL_OK) {
return TCL_ERROR;
}
+
+ Tcl_SetVar(interp, "auto_path", TKINEDLIB,
+ TCL_GLOBAL_ONLY | TCL_APPEND_VALUE | TCL_LIST_ELEMENT);
+ Tcl_SetVar(interp, "auto_path", TNMLIB,
+ TCL_GLOBAL_ONLY | TCL_APPEND_VALUE | TCL_LIST_ELEMENT);

if (Tcl_PkgRequire(interp, "scotty", "2.1.0", 1) == NULL) {
Tcl_AppendResult(interp, "\n",
Index: misc/scotty/unix/tkined
diff -c misc/scotty/unix/tkined:1.1.1.1 misc/scotty/unix/tkined:removed
*** misc/scotty/unix/tkined:1.1.1.1 Fri Jun 14 12:43:02 1996
--- misc/scotty/unix/tkined Tue Jun 18 09:49:38 1996
***************
*** 1,52 ****
- #!/bin/sh
- # the next line restarts using wish \
- exec wish4.1 "$0" "$@"
-
- # Load all the packages that make up Tkined. Note, the order is
- # important here because the Tkined package initializes the search
- # path so that the Tcl modules are found automatically.
-
- package require Tcl 7.5
- package require Tk 4.1
-
- package require Tkined 1.4
- package require TkinedCommand 1.4
- package require TkinedDiagram 1.4
- package require TkinedDialog 1.4
- package require TkinedEditor 1.4
- package require TkinedEvent 1.4
- package require TkinedHelp 1.4
- package require TkinedMisc 1.4
- package require TkinedObjects 1.4
- package require TkinedTool 1.4
-
- # I dont like the fat font Tk uses per default. So here
- # is good old fixed font.
-
- option add Tkined*Text.font fixed startupFile
-
- # Read the site specific initialization file.
-
- if [file exists $tkined(library)/site/init.tcl] {
- source $tkined(library)/site/init.tcl
- }
-
- # And here we start. Unmap the . widget and start an editor
- # for each file metioned in the command line.
-
- wm withdraw .
-
- foreach f $argv {
- if [file readable $f] {
- lappend views [EDITOR $f]
- }
- }
- if {! [info exists views]} {
- set views [EDITOR]
- }
-
- if {[info exists geometry]} {
- foreach view $views {
- puts "should set geometry of $view to $geometry"
- }
- }
--- 0 ----
Index: misc/scotty/unix/tkined.in
diff -c /dev/null misc/scotty/unix/tkined.in:1.1
*** /dev/null Tue Jun 18 09:49:42 1996
--- misc/scotty/unix/tkined.in Tue Jun 18 08:51:19 1996
***************
*** 0 ****
--- 1,55 ----
+ #! /bin/sh
+ # the next line restarts using wish \
+ exec wish@TK_VERSION@ "$0" "$@"
+
+ # Load all the packages that make up Tkined. Note, the order is
+ # important here because the Tkined package initializes the search
+ # path so that the Tcl modules are found automatically.
+
+ package require Tcl @TCL_VERSION@
+ package require Tk @TK_VERSION@
+
+ lappend auto_path @prefix@/lib/tnm@TNM_VERSION@
+ lappend auto_path @prefix@/lib/tkined@TKI_VERSION@
+
+ package require Tkined @TKI_VERSION_NO_MINOR@
+ package require TkinedCommand @TKI_VERSION_NO_MINOR@
+ package require TkinedDiagram @TKI_VERSION_NO_MINOR@
+ package require TkinedDialog @TKI_VERSION_NO_MINOR@
+ package require TkinedEditor @TKI_VERSION_NO_MINOR@
+ package require TkinedEvent @TKI_VERSION_NO_MINOR@
+ package require TkinedHelp @TKI_VERSION_NO_MINOR@
+ package require TkinedMisc @TKI_VERSION_NO_MINOR@
+ package require TkinedObjects @TKI_VERSION_NO_MINOR@
+ package require TkinedTool @TKI_VERSION_NO_MINOR@
+
+ # I dont like the fat font Tk uses per default. So here
+ # is good old fixed font.
+
+ option add Tkined*Text.font fixed startupFile
+
+ # Read the site specific initialization file.
+
+ if [file exists $tkined(library)/site/init.tcl] {
+ source $tkined(library)/site/init.tcl
+ }
+
+ # And here we start. Unmap the . widget and start an editor
+ # for each file metioned in the command line.
+
+ wm withdraw .
+
+ foreach f $argv {
+ if [file readable $f] {
+ lappend views [EDITOR $f]
+ }
+ }
+ if {! [info exists views]} {
+ set views [EDITOR]
+ }
+
+ if {[info exists geometry]} {
+ foreach view $views {
+ puts "should set geometry of $view to $geometry"
+ }
+ }

-- 
							Greg A. Woods

+1 416 443-1734 VE3TCP robohack!woods Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>