At 08:12 AM 4/17/2008, you wrote:
Under Unidata 7.1.x on Solaris (9/10) we're seeing @LOGNAME truncated to 8
characters. Others on different OSes are not seeing this behavior. Does
anyone know if this is a Unidata setting or how Unidata is interacting with a
system call (eg: and therefor cannot be changed)?
Sorry I am a little late in replying. Here is a bit of information I
was able to gather from a IBM engineer some time ago when we
encountered problems with the value returned as well.
@LOGNAME is implemented as a global variable for the udt process. It returns
the same value in both ECL and UniBasic. And it is implemented the same on
all Unix platforms.
@LOGNAME is set by calling cuserid(LOGNAME). However, we have implemented
our own cuserid()function since 08/08/94.
static int U_myuidflag = 0;
static char U_myuidbuf[256] = {0};
char *cuserid(buffer)
d_char buffer[];
{
int uid;
char *p;
struct passwd *pw;
if (U_myuidflag == 0) {
if ((p = getlogin()) == (char *) 0 || p[0] == '\0') {
uid = getuid();
pw = getpwuid(uid);
if (pw != (struct passwd *) 0)
p = pw->pw_name;
else
p = (char *) 0;
}
if (p != (char *) 0)
strcpy(U_myuidbuf, p);
else
U_myuidbuf[0] = '\0';
U_myuidflag = 1;
}
if (buffer != (char *) 0) {
strcpy(buffer, U_myuidbuf);
return (buffer);
}
else {
return (U_myuidbuf);
}
}
Here is output from man page aboput getlogin:
DESCRIPTION
The getlogin() function returns a pointer to the login name
as found in /var/adm/utmp. It may be used in conjunction
with getpwnam(3C) to locate the correct password file entry
when the same user ID is shared by several login names.
If getlogin() is called within a process that is not
attached to a terminal, it returns a null pointer. The
correct procedure for determining the login name is to call
cuserid(3S), or to call getlogin() and if it fails to call
getpwuid(3C)
BTW, the implmentation on NT is different and it is much more complex to
describe here.
HTH,
Doug Miller
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/