Annotation of 42BSD/usr.lib/libU77/symlnk_.c, revision 1.1

1.1     ! root        1: /*
        !             2: char id_symlnk[] = "@(#)symlnk_.c      1.1";
        !             3:  *
        !             4:  * make a symbolic link to a file
        !             5:  *
        !             6:  * calling sequence:
        !             7:  *     ierror = symlnk(name1, name2)
        !             8:  * where:
        !             9:  *     name1 is the pathname of an existing file
        !            10:  *     name2 is a pathname that will become a symbolic link to name1
        !            11:  *     ierror will be 0 if successful; a system error code otherwise.
        !            12:  */
        !            13: 
        !            14: #include <sys/param.h>
        !            15: #include "../libI77/f_errno.h"
        !            16: 
        !            17: #ifndef        MAXPATHLEN
        !            18: #define        MAXPATHLEN      128
        !            19: #endif
        !            20: 
        !            21: long symlnk_(name1, name2, n1len, n2len)
        !            22: char *name1, *name2;
        !            23: long n1len, n2len;
        !            24: {
        !            25:        char buf1[MAXPATHLEN];
        !            26:        char buf2[MAXPATHLEN];
        !            27: 
        !            28:        if (n1len >= sizeof buf1 || n2len >= sizeof buf2)
        !            29:                return((long)(errno=F_ERARG));
        !            30:        g_char(name1, n1len, buf1);
        !            31:        g_char(name2, n2len, buf2);
        !            32:        if (buf1[0] == '\0' || buf2[0] == '\0')
        !            33:                return((long)(errno=F_ERARG));
        !            34:        if (symlink(buf1, buf2) != 0)
        !            35:                return((long)errno);
        !            36:        return(0L);
        !            37: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.