diff options
Diffstat (limited to 'miscutils/jn.c')
| -rw-r--r-- | miscutils/jn.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/miscutils/jn.c b/miscutils/jn.c new file mode 100644 index 000000000..db6a3e6d9 --- /dev/null +++ b/miscutils/jn.c | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | /* | ||
| 2 | * directory junction creation for busybox | ||
| 3 | * | ||
| 4 | * Copyright (C) 2017 Denys Vlasenko <vda.linux@googlemail.com> | ||
| 5 | * Copyright (C) 2022 Ron Yorston <rmy@pobox.com> | ||
| 6 | * | ||
| 7 | * Licensed under GPLv2, see file LICENSE in this source tree. | ||
| 8 | */ | ||
| 9 | //config:config JN | ||
| 10 | //config: bool "jn (3.2 kb)" | ||
| 11 | //config: default y | ||
| 12 | //config: depends on PLATFORM_MINGW32 | ||
| 13 | //config: help | ||
| 14 | //config: Creates a directory junction. | ||
| 15 | |||
| 16 | //applet:IF_JN(APPLET_NOEXEC(jn, jn, BB_DIR_USR_BIN, BB_SUID_DROP, jn)) | ||
| 17 | |||
| 18 | //kbuild:lib-$(CONFIG_JN) += jn.o | ||
| 19 | |||
| 20 | //usage:#define jn_trivial_usage | ||
| 21 | //usage: "DIR JUNC" | ||
| 22 | //usage:#define jn_full_usage "\n\n" | ||
| 23 | //usage: "Create directory junction JUNC to DIR" | ||
| 24 | |||
| 25 | #include "libbb.h" | ||
| 26 | |||
| 27 | int jn_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | ||
| 28 | int jn_main(int argc UNUSED_PARAM, char **argv) | ||
| 29 | { | ||
| 30 | getopt32(argv, "^" "" "\0" "=2"); | ||
| 31 | argv += optind; | ||
| 32 | if (create_junction(argv[0], argv[1]) != 0) { | ||
| 33 | bb_perror_msg_and_die("can't create junction '%s' to '%s'", | ||
| 34 | argv[1], argv[0]); | ||
| 35 | } | ||
| 36 | return EXIT_SUCCESS; | ||
| 37 | } | ||
