* Ingres 11/70. Unix version 6.0
* Local routines that are installation dependent.
* All fiddlers please note: if you make careful note of
* what you change here, I will incorporate your changes and
* you won't have to remake them each release.
static char *SccsId
= "@(#)ing.local.c 2.1 %G%";
* Locate the user's mailbox file (ie, the place where new, unread
* mail is queued). At Ingres, it's in /usr/spool/mail/loginname.
cp
= copy("/usr/spool/mail/", mailname
);
* Get rid of the queued mail.
if (unlink(mailname
) >= 0)
close(creat(mailname
, 0666));
* Get an environment variable. At present, we only support
* "SHELL" and "HOME". This routine makes use of the getpw
* routine in the neighboring getname.c stuff.
if (equal(name
, "SHELL"))
else if (equal(name
, "HOME"))
if (getpwnam(myname
, pwline
) < 0)
for (cp
= pwline
; *cp
&& cc
> 0;)
while (*cp
!= ':' && *cp
!= '\0' && *cp
!= '\n')
* Discover user name. On Ingres, user names are rarely 1-1 with uids,
* so we look for this guy in the utmp file first, then try finding
* him in the passwd file on basis of uid if that fails.
char u_name
[8]; /* User login name. */
char u_tty
; /* typewriter character */
char u_cfill
; /* Unused for now. */
long u_time
; /* Login time */
short u_wfill
; /* Unused also */
* Dammit, I really do have to search the utmp file!
if ((fwho
= fopen("/etc/utmp", "r")) == NULL
)
while (fread(&ubuf
, 1, sizeof ubuf
, fwho
) > 0)
strncpy(namebuf
, ubuf
.u_name
, 8);
cp
= index(namebuf
, ' ');
return(getname(uid
, namebuf
));
* Unix routine to do an "fopen" on file descriptor
* The mode has to be repeated because you can't query its
for (iop
= _iob
; iop
->_flag
&(_IOREAD
|_IOWRT
); iop
++)
* Copy s2 to s1, truncating or null-padding to always copy n bytes
if ((*s1
++ = *s2
++) == '\0') {