From: bill@Celestial.COM (Bill Campbell)
Subject: Re: Locus PCI "who" strangeness
Organization: Celestial Software, Mercer Island, WA
Date: Sat, 07 Nov 1992 23:28:14 GMT

In <9211060753.aa25735@dlpco.dlpco.COM> Lee Penn  <lee@dlpco.dlpco.COM> writes:

>SCO nor Locus will admit that this can happen.  "Noone" has this
>problem.  So, I am forwarding this problem to a higher level...

>I have ODT 2.0 installed on a DEC 433MP (currently without MPX 
>being installed).  We are actively networked with TCP and PCI and 
>are contemplating the NETCON Novell clone under SCO UNIX.

>When I logged in today using PCI, I tried to run a command which 
>requires a proper user ID.  It failed.  I then did a "who" 
>command and it reported that I was "sue" logged onto ttyp1....

I've found some problems with various commands executed from pci
where the environment isn't as various programs would expect.  I
got around this by using 'set onprefix=/usr/bin/csspci' in my
autoexec.bat files.  This causes /usr/bin/csspci to be executed
prior to any command executed using the ON systemname... command.

/usr/bin/csspci contains:
:
#	PC-Interface general set environment and execute
. /usr/bin/csspath
HOME=`Homedir -i`; export HOME
LANG=english_us.ascii; export LANG
exec $*

/usr/bin/csspath is a file I use with shell scripts to set
systemwide environment variables like PATH and LOCAL so that I
don't have to change much to move things around.  On this system
it contains:
:
# Celestial Software path setup
USR_BIN_CSSPATH=1;			export USR_BIN_CSSPATH
LOCAL=/usr/local;			export LOCAL
TERMINFO=$LOCAL/terminfo;	export TERMINFO
WPBIN=/u/usr/local/wp/bin;	export WPBIN
PATH=$LOCAL/bin:$HOME/bin:/bin:/usr/local/gnubin:$LOCAL/ubin::/usr/bin:$WPBIN
export PATH

Homedir -i returns the home directory by looking at the output of
id(C) to get the id number since there isn't normally a login
name when using ON from pci.  It is a perl program in $LOCAL/bin

:
#!/usr/local/bin/perl
eval ' exec $LOCAL/bin/perl -S $0 "$@" '
	if $running_under_some_shell;
	shift if(join("", @ARGV) eq ""); # Xenix Kludge

( $progname = $0 ) =~ s!.*/!!; # save this very early

do "/usr/bin/csspath.perl" unless $ENV{'USR_BIN_CSSPATH'};

$USAGE = "
#
#   Usage: $progname [-v]
#
# Options   Argument    Description
#   -f                  Print finger info
#   -g                  Print group id
#   -i                  homedir of id(S) command
#   -u                  Print user id
#   -s                  Print users shell
#   -v                  Verbose
#
";

sub usage {
	die join("\n",@_) .
	"\n$USAGE\n";
}
do "getopts.pl";

&usage("Invalid Option") unless do Getopts("fgiusvV");

$verbose = '-v' if $opt_v;
$suffix = $$ if $verbose;

$\ = "\n";	# use newlines as separators.
if($opt_i) {
	( $id = `id` ) =~ s/uid\s*=\s*[^(]*\(([^)]*).*\s+$/$1/;
	unshift(@ARGV, $id);
}
$user = shift || &usage("No user specified");

open(PASSWD, "/etc/passwd");
while(<PASSWD>) {
	next unless(/^$user:/);
	chop;
	(	$user, $passwd, $uid, $gid, $finger, $homedir, $shell) = split(/:/);
	if ($opt_f) {
		print $finger;
	}
	elsif($opt_g) {
		print $gid;
	}
	elsif($opt_s) {
		print $shell;
	}
	else {
		print $homedir;
	}
	exit(0);
}
exit(1);

This has cured all the problems I've encountered so far.

Bill
-- 
INTERNET:  bill@Celestial.COM   Bill Campbell; Celestial Software
UUCP:   ...!thebes!camco!bill   6641 East Mercer Way
             uunet!camco!bill   Mercer Island, WA 98040; (206) 947-5591
SPEED COSTS MONEY -- HOW FAST DO YOU WANT TO GO?