HAVE_GETLOGIN not used
mjvankampen opened this issue · comments
HAVE_GETLOGIN does not seem to be used? I can't find it? Same for HAVE_CUSERID.
I will take a look. The code that depended upon that may have gotten replaced with something else that doesn't need those. I think I had some code for an application that attempted to automatically pick a default user identifier. OK, after looking, I found the code in that other application, but it's from stuff about 25 years ago that slightly predates the separation of what are now the Protolib classes from that application and the Makefile macro definitions have just persisted ... So, they can be removed.
Here's the code from that other application code where these macros were/are used. This could be added to Protolib somewhere (e.g. as a static ProtoNet method) if there is merit:
#ifdef WIN32
unsigned long namelen = 16;
char *ptr;
#ifndef _WIN32_WCE
char userName[16];
if (GetUserName(userName, &namelen))
ptr = userName;
else
#endif !_WIN32_WCE
ptr = NULL;
#else
#if HAVE_CUSERID
char* ptr = cuserid((char*)NULL);
#else
#if HAVE_GETLOGIN
char* ptr = getlogin();
#else
#error At least one, HAVE_CUSERID or HAVE_GETLOGIN must be supported
#endif // HAVE_GETLOGIN
#endif // HAVE_CUSERID
#endif // if/else WIN32
Thank you!