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