host.rc
author Claus Gittinger <cg@exept.de>
Sun, 17 Nov 1996 13:33:39 +0100
changeset 177 eec6bac738ba
parent 169 08055578224e
child 195 1cf850844da9
permissions -rw-r--r--
stupid SYSV3: renamed rsh to remsh

"*
 * $Header$
 *
 * DONT add site specific things here - use your own h_xxx.rc file instead
 * where xxx stands for your hostname(s)
 *
 * startup configuration for host specific stuff -
 * looks for a host specific init file and loads it.
 *"

|sysType host domain s rshCommand isStupidSYSV3|

sysType := OperatingSystem getSystemType.
isStupidSYSV3 := false.

"/ on some systems, paging in  is so slow, that a SIGALRM
"/ arrives too early to be handled correctly 
"/ (I guess, this is my fault somewhere ... ;-)
"/
"/ This can be worded around by disabling the timer here.
"/ (The sceduler will reenable it later)

(sysType = 'hpux') ifTrue:[
    OperatingSystem disableSignal:(OperatingSystem sigALRM)
].

sysType = 'realIX' ifTrue:[
    "/
    "/ those people must have been brain-damaged;
    "/ They made a whole lot of trouble by renaming
    "/ 'rsh' to 'remsh' (those systems are broken in other places as well ...).
    "/ (who needs a restricted shell named 'rsh' ?)
    "/
    isStupidSYSV3 := true.
].

"/
"/ setup the printer stuff.
"/ the commands below will be offered in the printer-setting box
"/
PostscriptPrinterStream notNil ifTrue:[
    isStupidSYSV3 ifTrue:[
	PostscriptPrinterStream 
	    defaultCommands:#(
				'lpr'
				'cat | remsh <hostname> lpr -h'
				'cat > preview.ps'
				'cat > preview.ps; ghostview preview.ps'
			     ).
    ] ifFalse:[
	PostscriptPrinterStream 
	    defaultCommands:#(
				'lpr -h'
				'cat | rsh <hostname> lpr -h'
				'cat > preview.ps'
				'cat > preview.ps; ghostview preview.ps'
			     ).
    ].
    PostscriptPrinterStream printCommand:'lpr'.
].

PrinterStream notNil ifTrue:[
    isStupidSYSV3 ifTrue:[
	PrinterStream 
	    defaultCommands:#(
				'lpr -h'
				'cat | remsh <hostname> lpr -h'
				'a2ps | remsh <hostname> lpr -h'
				'a2ps > preview.ps; ghostview preview.ps'
			     ).
    ] ifFalse:[
	PrinterStream 
	    defaultCommands:#(
				'lpr -h'
				'cat | rsh <hostname> lpr -h'
				'a2ps | rsh <hostname> lpr -h'
				'a2ps > preview.ps; ghostview preview.ps'
			     ).
    ].
    Printer := PrinterStream.
    PrinterStream printCommand:'lpr'.
].

"/ Printer := PostscriptPrinterStream.

"/ in our home-domain, preset the print command for remote printing
"/ on a host called 'ibm'.
"/ You can change this for your environment and/or make it
"/ unconditional.

domain := OperatingSystem getDomainName.
(domain = 'axept.de' or:[domain = 'exept.de']) ifTrue:[
    isStupidSYSV3 ifTrue:[
	PostscriptPrinterStream printCommand:'cat | remsh ibm lpr -h'.
	PrinterStream printCommand:'cat | remsh ibm lpr -h'.
	PostscriptPrinterStream defaultCommands:#(
					'cat | remsh ibm lpr -h'
					'cat > preview.ps'
					'cat > preview.ps; ghostview preview.ps'
				 ).
	PrinterStream defaultCommands:#(
					'cat | remsh ibm lpr -h'
					'a2ps | remsh ibm lpr -h'
					'a2ps > preview.ps; ghostview preview.ps'
				 ).
    ] ifFalse:[
	PostscriptPrinterStream printCommand:'cat | rsh ibm lpr -h'.
	PrinterStream printCommand:'cat | rsh ibm lpr -h'.
	PostscriptPrinterStream defaultCommands:#(
					'cat | rsh ibm lpr -h'
					'cat > preview.ps'
					'cat > preview.ps; ghostview preview.ps'
				 ).
	PrinterStream defaultCommands:#(
					'cat | rsh ibm lpr -h'
					'a2ps | rsh ibm lpr -h'
					'a2ps > preview.ps; ghostview preview.ps'
				 ).
    ].
].

"/
"/ try host-specific setup
"/ (h_<hostname>.rc
"/
host := OperatingSystem getHostName.
host isNil ifTrue:[
    'cannot determine host I am running on' errorPrintCR.
] ifFalse:[
    "if there is a corresponding file ..."

    (Smalltalk at:#'_ImageHostName') ~= host ifTrue:[
	('trying host setup h_' , host , '.rc ...') infoPrintCR.

	s := Smalltalk systemFileStreamFor:('h_' , host , '.rc').
	s notNil ifTrue:[
	    s fileIn.
	    s close.
	].
	Smalltalk at:#'_ImageHostName' put:host.
    ]
].
!