host.rc
author Claus Gittinger <cg@exept.de>
Sun, 19 Apr 1998 19:16:15 +0200
changeset 270 7b4ae16487ae
parent 254 9de729ce1390
child 331 a0be330a1f43
permissions -rw-r--r--
*** empty log message ***

"*
 * $Header$
 *
 * ST/X startup configuration file:
 *
 * 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 worked 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.
].

sysType = 'win32' ifTrue:[
    Compiler ccPath:'cl'
].

"/ only reset the printer setting, if restarted
"/ on another host.

host := OperatingSystem getHostName.
(Smalltalk at:#'_ImageHostName') ~= host ifTrue:[

    "/
    "/ 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.
    "/ Consider the stuff below as an example; you should add
    "/ corresponding setup into a private h_xxxx.rc file.

    domain := OperatingSystem getDomainName.
    (domain = 'exept.de' or:[domain = 'axept.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 isNil ifTrue:[
    'host.rc [warning]: cannot determine host I am running on' errorPrintCR.
] ifFalse:[
    "if there is a corresponding file ..."

    (Smalltalk at:#'_ImageHostName') ~= host ifTrue:[
	('host.rc [info]: 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.
    ]
].
!