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/fiodefs.h"
15: #include <sys/param.h>
16: #ifndef MAXPATHLEN
17: #define MAXPATHLEN 128
18: #endif
19:
20: ftnint link_(name1, name2, n1len, n2len)
21: char *name1, *name2;
22: ftnlen n1len, n2len;
23: {
24: char buf1[MAXPATHLEN];
25: char buf2[MAXPATHLEN];
26:
27: if (n1len >= sizeof buf1 || n2len >= sizeof buf2)
28: return((ftnint)(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((ftnint)(errno=F_ERARG));
33: if (link(buf1, buf2) != 0)
34: return((ftnint)errno);
35: return((ftnint) 0);
36: }
Defined functions
link_
defined in line
20;
never used
Defined macros