BuildSystem: Cleanup userspace directory layout
userspace programs are now in userspace/programs userspace tests are now in userspace/tests This makes listing userspace projects much cleaner. Libraries were already separated to their own directory, so other programs should also.
This commit is contained in:
9
userspace/programs/whoami/CMakeLists.txt
Normal file
9
userspace/programs/whoami/CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
set(SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(whoami ${SOURCES})
|
||||
banan_include_headers(whoami ban)
|
||||
banan_link_library(whoami libc)
|
||||
|
||||
install(TARGETS whoami OPTIONAL)
|
||||
14
userspace/programs/whoami/main.cpp
Normal file
14
userspace/programs/whoami/main.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char* login = getlogin();
|
||||
if (login == nullptr)
|
||||
{
|
||||
printf("unknown user %d\n", geteuid());
|
||||
return 1;
|
||||
}
|
||||
printf("%s\n", login);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user