source: golgotha/src/i4/network/login.cc @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 14 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 890 bytes
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#include "network/login.hh"
10#include "string/string.hh"
11
12#ifdef _WINDOWS
13#include <windows.h>
14#else
15#include <unistd.h>
16#endif
17
18
19i4_str *i4_get_user_name()
20{
21  char buf[256];
22
23#ifdef _WINDOWS
24  DWORD s=sizeof(buf);
25  GetUserName(buf, &s);
26#else
27  char *gl=getlogin();
28  if (gl)
29    strcpy(buf,gl);
30  else
31    strcpy(buf,"unknown");
32#endif
33 
34  return i4_from_ascii(buf);
35}
36
37
38
Note: See TracBrowser for help on using the repository browser.