Luna/utils/arch.cpp

23 lines
476 B
C++
Raw Normal View History

2024-07-21 11:07:51 +00:00
#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;
}