1 |
|
|
/*************************************** |
2 |
|
|
Auteur : Pierre Aubert |
3 |
|
|
Mail : pierre.aubert@lapp.in2p3.fr |
4 |
|
|
Licence : CeCILL-C |
5 |
|
|
****************************************/ |
6 |
|
|
|
7 |
|
|
#include "unistd.h" |
8 |
|
|
#include "phoenix_whoami.h" |
9 |
|
|
|
10 |
|
|
///Get the name of the current user |
11 |
|
|
/** @return name of the current user |
12 |
|
|
*/ |
13 |
|
1 |
std::string phoenix_whoami(){ |
14 |
✓ |
1 |
std::string str(""); |
15 |
✓ |
1 |
str.resize(1024lu); |
16 |
✓ |
1 |
getlogin_r((char*)str.data(), str.size() - 1lu); |
17 |
|
1 |
return str; |
18 |
|
|
} |
19 |
|
|
|
20 |
|
|
|