Skip to content

Commit

Permalink
lazybox: add 'symlink' helper
Browse files Browse the repository at this point in the history
  • Loading branch information
moodyhunter committed Aug 1, 2024
1 parent 812e7df commit 0e10fe1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions userspace/programs/lazybox/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ lazybox_program(true "Do nothing, successfully")
lazybox_program(clear "Clear the terminal screen")
lazybox_program(rm "Remove files or directories")
lazybox_program(write "A simple text writer")
lazybox_program(symlink "Create a symbolic link")
22 changes: 22 additions & 0 deletions userspace/programs/lazybox/symlink.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: GPL-3.0-or-later

#include <mos_stdio.h>
#include <mosapi.h>

int main(int argc, char *argv[])
{
if (argc < 3)
{
puts("Usage: symlink <link> <target>");
return 1;
}

if (syscall_vfs_symlink(argv[1], argv[2]))
{
printf("Failed to create symlink %s -> %s\n", argv[1], argv[2]);
return 1;
}

printf("Created symlink %s -> %s\n", argv[1], argv[2]);
return 0;
}

0 comments on commit 0e10fe1

Please sign in to comment.