link.c 689 B

1234567891011121314151617181920212223242526
  1. /* SPDX-License-Identifier: BSD-3-Clause */
  2. /*
  3. * Copyright (C) 2022, 2023 Ferass El Hafidi <vitali64pmemail@protonmail.com>
  4. */
  5. #include <unistd.h>
  6. #include <stdio.h>
  7. #include <errno.h>
  8. #define REQ_PRINT_USAGE /* Require print_usage() from ../common/common.h */
  9. #define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
  10. #define DESCRIPTION "Call the link() function."
  11. #define OPERANDS "source dest"
  12. #include "../common/common.h"
  13. int main(int argc, char *const argv[]) {
  14. if (argc == 1) {
  15. print_usage(argv[0], DESCRIPTION, OPERANDS, VERSION);
  16. return 1;
  17. }
  18. if (argc >= 2) {
  19. link(argv[1], argv[2]);
  20. if (errno) return errprint(argv[0], NULL, errno);
  21. }
  22. return 0;
  23. }