Last change
on this file since 57 was
56,
checked in by Sam Hocevar, 14 years ago
|
- Add licensing terms to most C / C++ files (Ref #5).
|
File size:
777 bytes
|
Rev | Line | |
---|
[56] | 1 | /* |
---|
| 2 | * Abuse - dark 2D side-scrolling platform game |
---|
| 3 | * Copyright (c) 1995 Crack dot Com |
---|
| 4 | * |
---|
| 5 | * This software was released into the Public Domain. As with most public |
---|
| 6 | * domain software, no warranty is made or implied by Crack dot Com or |
---|
| 7 | * Jonathan Clark. |
---|
| 8 | */ |
---|
| 9 | |
---|
| 10 | #include "config.h" |
---|
| 11 | |
---|
| 12 | #include <stdio.h> |
---|
| 13 | #include <pwd.h> |
---|
| 14 | #include <sys/types.h> |
---|
| 15 | #include <unistd.h> |
---|
| 16 | |
---|
[2] | 17 | #ifdef __WATCOMC__ |
---|
[39] | 18 | char const *get_username() { return "DOS user"; } |
---|
[2] | 19 | #elif (defined(__APPLE__) && !defined(__MACH__)) |
---|
[39] | 20 | char const *get_username() { return "Mac user"; } |
---|
[2] | 21 | #else |
---|
| 22 | |
---|
[39] | 23 | char const *get_username() |
---|
[2] | 24 | { |
---|
[39] | 25 | struct passwd *pw; |
---|
| 26 | char const *name; |
---|
[2] | 27 | |
---|
| 28 | if (!(name = getlogin())) |
---|
| 29 | { |
---|
| 30 | if ((pw = getpwuid (getuid()))) |
---|
| 31 | return pw->pw_name; |
---|
| 32 | else |
---|
| 33 | return "UNIX user"; |
---|
| 34 | } else return name; |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | #endif |
---|
| 38 | |
---|
| 39 | |
---|
Note: See
TracBrowser
for help on using the repository browser.