On Wednesday,  5 May 2004 at  9:10:27 -0400, Bill Moran wrote:
> Thuan Truong wrote:
>> I would like to have the source code of 'ln' (make hard or symbolic
>> links to files) command from Free-BSD ftp site.  Please let me know
>> how and where to unload it.
> If you installed source on your FreeBSD system, it's in /usr/src/bin/ln
> Otherwise, you can download any version you want from cvs:
> http://www.freebsd.org/cgi/cvsweb.cgi/src/bin/ln/

Note that ln(1) is a relatively simple interface to link(2), which is
in the kernel.  Here's the complete source of the version supplied
with the Sixth Edition of UNIX:

main(argc, argv)
char **argv;
        static struct ibuf statb;
        register char *np;

        if (argc<2) {
                write(1, "Usage: ln target [ newname ]\n", 29);
        if (argc==2) {
                np = argv[1];
                while (*--np!='/' && np>argv[1]);
                argv[2] = np;
        stat(argv[1], &statb);
        if ((statb.iflags&FMT) == DIR) {
                write(1, "No directory link\n", 18);
        if (link(argv[1], argv[2])<0) {
                write(1, "Can't link\n", 11);

Note: I discard all HTML mail unseen.
Finger [EMAIL PROTECTED] for PGP public key.
See complete headers for address and phone numbers.

Attachment: pgpeA4RmV3yXs.pgp
Description: PGP signature

Reply via email to