This commit is contained in:
parent
d10cb10404
commit
829f455129
@ -53,3 +53,4 @@ luna_app(startui.cpp startui)
|
||||
luna_app(launch.cpp launch)
|
||||
luna_app(run.cpp run)
|
||||
luna_app(sha256sum.cpp sha256sum)
|
||||
luna_app(arch.cpp arch)
|
||||
|
22
apps/arch.cpp
Normal file
22
apps/arch.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include <os/ArgumentParser.h>
|
||||
#include <os/File.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
Result<int> luna_main(int argc, char** argv)
|
||||
{
|
||||
os::ArgumentParser parser;
|
||||
parser.add_description("Print the current machine's architecture name."_sv);
|
||||
parser.add_system_program_info("arch"_sv);
|
||||
parser.parse(argc, argv);
|
||||
|
||||
struct utsname info;
|
||||
if (uname(&info) < 0)
|
||||
{
|
||||
perror("uname");
|
||||
return 1;
|
||||
}
|
||||
|
||||
os::println("%s", info.machine);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user