.key DEBUG/S,SRV/S,PROV
.bra {
.ket }

.def SRV	""		; Set default to SRV to always autoload InetD
.def DEBUG	""		; Set to DEBUG to always run in debug mode
.def PROV	"SeriaLPPP"	; Set to your favorite Providers/ script

;* YOU MUST GIVE THIS STARTNET A PROVIDER NAME (W/O THE .CONF EXTENSION)
;* OR SET THE DEFAULT CONF FILENAME ABOVE - Look in Amitcp:Providers/
;* The provider file is copied to Amitcp:db/provider.conf, and must be
;* named {PROV}.conf or {PROV}.conf.debug when debug is specified.

;* $VER: Startnet 3.2 (09.03.97)
;* $Id:  Startnet,v 3.2 1997/03/07 DaddyB@@ze $
;*
;* Amitcp/IP 4.3 Startnet Script
;* Copyright © 1996 Amitcp/IP Group,
;*		    NSDi - Network Solutions Development Inc., Finland
;*		    All rights reserved.
;*
;* NOTE: Add utilities in the Amitcp:db/User-Startnet script.
;* NOTE: You can stop these utilities in Amitcp:db/User-Stopnet.

FAILAT 21

Stack 20000 ;Unless you really are short of ram, extra stack is good...

Set fExt ".conf"
IF X NOT EQ "X{DEBUG}"
  IF Exists Amitcp:providers/{PROV}.conf.debug
     Set fExt ".conf.debug"
  ENDIF
ENDIF

IF NOT Exists Amitcp:providers/{PROV}$fExt
  Echo "Can't find Amitcp:providers/{PROV}$fExt,"
  Echo "Exiting..."
  Wait 3
  Quit 20
ENDIF

IF Exists Amitcp:ssrx/Parsedb.ssrx	;for easier to read group/passwd
  Rx Amitcp:ssrx/Parsedb.ssrx		;files, you can ignore safely.
ENDIF

SETENV ATCP N
RX "If Show('P','AMITCP') then address COMMAND 'SETENV ATCP Y'"
IF $ATCP EQ Y
  Echo "AMITCP/IP is already running,"
  Echo "Exiting..."
  Wait 3
  Quit 20
ENDIF

IF Exists Amitcp:Amitcp
  Copy Amitcp:providers/{PROV}$fExt Amitcp:db/provider.conf QUIET
  IF X EQ "X{DEBUG}"
    Run <NIL: >NIL: Amitcp:Amitcp
    Wait 2
  ELSE
    Run Amitcp:Amitcp {DEBUG}
  ENDIF
ENDIF

WaitForPort AMITCP

If NOT WARN

	SETENV ATCP Y

	;Amitcp's log options when in debug mode,
	;overrides what's in AmiTCP.Config

	IF X NOT EQ "X{DEBUG}"
	  Rx "Address AMITCP 'SET' LOG FILTER 7"
	  Rx "Address AMITCP 'SET' CON 'KCON:0/11/656/152/AmiTCP_Log/AUTO/CLOSE/WAIT/INACTIVE'"
	ENDIF

	Amitcp:bin/login -f	;Log in with the default user name (ENV:LOGNAME)

	IF X EQ "X{SRV}"	;Tell Amitcp to configure lo0 if using servers
	  Set LOOPBACK ""
	ELSE
	  Set LOOPBACK LOOPBACK
	ENDIF

	Amitcp:bin/bootpconfig $LOOPBACK {DEBUG}

	IF NOT WARN

		;Mount interface device used by the telnet utility

		Assign TCP: Exists >NIL:
		IF WARN
		  Mount TCP: FROM Amitcp:devs/Inet-Mountlist
		ENDIF

		;Start InetD server if requested

		IF NOT X EQ "X{SRV}"
		  IF X EQ "X{DEBUG}"
		    Run <NIL: >NIL: Amitcp:bin/inetd
		  ELSE
		    Echo "Starting-up iNetD..."
		    Run Amitcp:bin/inetd {DEBUG}
		  ENDIF
		ENDIF

		;Start utilities in Amitcp:db/User-Startnet

		IF Exists Amitcp:db/User-Startnet
		  Execute Amitcp:db/User-Startnet {DEBUG}
		ENDIF

		;Successfull end

		Echo ""
		Echo "Amitcp/IP 4.3 is now on-line."
		Echo "Your host name is $HOSTNAME."

	ELSE
	  Echo ""
	  Echo "Interface Configuration FAILED!"
	  Echo "Stopping Amitcp..."
	  Amitcp:bin/stopnet FLUSH
	ENDIF

ELSE
  Echo ""
  Echo "Unable to start AMITCP/IP,"
  Echo "Exiting..."
ENDIF

;
; CHANGES BY Sylvain Bourcier - 1:167/151.66@fidonet
; 				40:600/151.66@amiganet
; 				Booze@Generation.net
;
