ftp.nice.ch/pub/next/unix/communication/TransSys-PNI.1.13.NI.b.tar.gz#/PNI-1.13/PNI.pkg/_PNI/PNI/pnid.tcl

This is pnid.tcl in view mode; [Download] [Up]

#
#  Copyright 1993 by TransSys, Inc.
#  All rights reserved.
#
#  $Header: /local/SRCS/slip2/pnid/pnid.tcl,v 1.8 1994/10/03 03:50:17 louie Exp $
#
#  This configuration file is loaded and evaluated when the daemon begins
#  running.  We'll define some stuff here, and just invoke a file with 
#  specific configuration informations.

# note the time that we started
set startTime [lindex [gettimeofday] 0]

# get support functions
source ${mainBundle}/support/init.tcl

set reginfo [registrationInfo]
set expires [keylget reginfo expires]

syslog LOG_DEBUG "pnid: Operation mode is $mode"

if [info exists testMode] {
    syslog LOG_NOTICE "pnid: Test mode"
}

if [info exists Option(priority)] {
    set oldpri [priority]
    if [scan $Option(priority) %d pri]==1 {
	set pnidPriority $pri
    } else {
	set pnidPriority -5
    }
    priority $pnidPriority

    syslog LOG_DEBUG "pnid: set process priority from $oldpri to [priority]"
    unset oldpri
    if [info exists pri] { unset pri }
}

#
#  
#  The configFile variable can be specified by the -f option to the program.
#  We could presumably search a number of directories to find the file
#  specifed, or do whatever action we'd like at this point to configure
#  the software.
#
if {[info exists configFile]==0} {
    if {[info exists testMode] && [file exists "config.test"]} {
	set configFile "config.test"
    } else {
	set configFile "config"
    }
}

if {[file exists $configFile] && [file isfile $configFile]} {
    dlog "pnid: using configuration in $configFile"
    source $configFile
} else {
    error "init: no configuration file `$configFile' present"
}

# set default action to take if a hangup signal is caught
set PNIHOOKS(HANGUP)	{ do_hangup "SIGHUP signal" }
set PNIHOOKS(LOSTDCD)	{ do_hangup "Lost DCD" }

#
#  Now call the standard configuration proc for each encapsulation
#
foreach encap $encapList {
    if {[debug]>5} {
	syslog LOG_DEBUG "Module type [$encap encapType]: $encap"
    }
    
    if {[$encap debug]<[debug]} {
	$encap debug [debug]
    }
    
    if [known ${encap}_configure] {
	syslog LOG_DEBUG "--> configure: $encap"
	${encap}_configure $encap
    }
}

#
#  Once more for the local ones
#
foreach encap $encapList {
    if [known ${encap}_local_configure] {
	if [debug] {
	    syslog LOG_DEBUG "--> local configure: $encap"
	}
	${encap}_local_configure $encap
    }
}

if {![info exists Config(CMD:password)]} {
    if {[file readable /etc/pni/config/password]} {
	set pf [open /etc/pni/config/password r]
	gets $pf Config(CMD:password)
	close $pf
	unset pf
    } else {
	set Config(CMD:password) "default secret word"
    }
}

# start off the periodic polling function
periodic_poll

#
#  When this flow of control returns from the end of this file, the
#  encapsulations will be started by the pnid C code.  This will result
#  in invocations for the various encap_start TCL procs if they exist.
#
syslog LOG_INFO "Configuration complete"

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.