Directory: | ./ |
---|---|
File: | src/phoenix_whoami.cpp |
Date: | 2024-11-14 16:05:39 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 5 | 5 | 100.0% |
Branches: | 3 | 3 | 100.0% |
Line | Branch | Exec | Source |
---|---|---|---|
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/1✓ Branch 2 taken 1 times.
|
1 | std::string str(""); |
15 |
1/1✓ Branch 1 taken 1 times.
|
1 | str.resize(1024lu); |
16 |
1/1✓ Branch 3 taken 1 times.
|
1 | getlogin_r((char*)str.data(), str.size() - 1lu); |
17 | 1 | return str; | |
18 | } | ||
19 | |||
20 | |||
21 |