Le Wed, 26 Mar 2014 12:19:25 +0100,
"Dmitrij D. Czarkoff" <czark...@gmail.com> a écrit :

Hello,

> For some reason POSIX X/Open Systems Interfaces option requires
> 'unlink' utility to be present in operating system.  Sure, it does
> nothing that 'rm' doesn't already do, but given that 'unlink' is
> already used in some scripts, I wonder if it would be benefitial for
> OpenBSD to include such utility.
> 
> FWIW a simple implementation follows.

On FreeBSD /bin/unlink is a link to /bin/rm 

        /*
         * Test for the special case where the utility is called as
         * "unlink", for which the functionality provided is greatly
         * simplified.
         */
        if ((p = strrchr(argv[0], '/')) == NULL)
                p = argv[0];
        else
                ++p;
        if (strcmp(p, "unlink") == 0) {
                while (getopt(argc, argv, "") != -1)
                        usage();
                argc -= optind;
                argv += optind;
                if (argc != 1)
                        usage();
                rm_file(&argv[0]);
                exit(eval);
        }

>   } else if (unlink(*(argv+1))) {

Hmm the code in rm does more than a simple unlink(2).

Regards,

Reply via email to