diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt index d1db2c3d..0c49dfd8 100644 --- a/apps/CMakeLists.txt +++ b/apps/CMakeLists.txt @@ -28,3 +28,4 @@ luna_app(mount.cpp mount) luna_app(umount.cpp umount) luna_app(ps.cpp ps) luna_app(time.cpp time) +luna_app(ln.cpp ln) diff --git a/apps/ln.cpp b/apps/ln.cpp new file mode 100644 index 00000000..232d4104 --- /dev/null +++ b/apps/ln.cpp @@ -0,0 +1,24 @@ +#include +#include +#include + +Result luna_main(int argc, char** argv) +{ + StringView target; + StringView link; + + os::ArgumentParser parser; + parser.add_description("Create symbolic links."); + parser.add_system_program_info("ln"_sv); + parser.add_positional_argument(target, "target", true); + parser.add_positional_argument(link, "linkpath", true); + parser.parse(argc, argv); + + if (symlink(target.chars(), link.chars()) < 0) + { + perror("ln"); + return 1; + } + + return 0; +}