|
|
1.1 ! root 1: /* ! 2: char id_link[] = "@(#)link_.c 1.2"; ! 3: * ! 4: * make a link to an existing file ! 5: * ! 6: * calling sequence: ! 7: * ierror = link(name1, name2) ! 8: * where: ! 9: * name1 is the pathname of an existing file ! 10: * name2 is a pathname to be linked to file name1 ! 11: * ierror will be 0 if successful; a system error code otherwise. ! 12: */ ! 13: ! 14: #include "../libI77/f_errno.h" ! 15: #include <sys/param.h> ! 16: #ifndef MAXPATHLEN ! 17: #define MAXPATHLEN 128 ! 18: #endif ! 19: ! 20: long link_(name1, name2, n1len, n2len) ! 21: char *name1, *name2; ! 22: long n1len, n2len; ! 23: { ! 24: char buf1[MAXPATHLEN]; ! 25: char buf2[MAXPATHLEN]; ! 26: ! 27: if (n1len >= sizeof buf1 || n2len >= sizeof buf2) ! 28: return((long)(errno=F_ERARG)); ! 29: g_char(name1, n1len, buf1); ! 30: g_char(name2, n2len, buf2); ! 31: if (buf1[0] == '\0' || buf2[0] == '\0') ! 32: return((long)(errno=F_ERARG)); ! 33: if (link(buf1, buf2) != 0) ! 34: return((long)errno); ! 35: return(0L); ! 36: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.