[GRASS5] cuserid alternative?

William K woklist at charter.net
Sun Aug 1 19:05:11 EDT 2004


I checked the Mac OS X UNIX porting list archives and found a 
suggestion to use getlogin() instead of cuserid (at least for the case 
of passing a null pointer to cuserid).  Any thoughts?  I tried it by 
changing dbmi_base/whoami.c to use that instead of cuserid - compiles 
OK.

Is db_whoami() even used anywhere?  I didn't see it used in any of the 
source.  Without it being used anywhere, I can't really say if 
replacing cuserid() with getlogin() works (it's beyond my C knowledge 
to say if it should work).


FYI, this is my new whoami.c (let me know if anything is wrong with it):

#include <unistd.h>

/*!
  \fn
  \brief
  \return
  \param
*/
char *
db_whoami()
{
     char *getlogin();

     return getlogin();
}

-----
William Kyngesburye <kyngchaos at charter.net>
http://webpages.charter.net/kyngchaos/

[Trillian]  What are you supposed to do WITH a maniacally depressed 
robot?

[Marvin]  You think you have problems?  What are you supposed to do if 
you ARE a maniacally depressed robot?  No, don't try and answer, I'm 
50,000 times more intelligent than you and even I don't know the 
answer...

- HitchHiker's Guide to the Galaxy




More information about the grass-dev mailing list