Commit | Line | Data |
---|---|---|
b79a1bb9 DW |
1 | /* |
2 | char id_link[] = "@(#)link_.c 1.1"; | |
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 | ||
16 | long link_(name1, name2, n1len, n2len) | |
17 | char *name1, *name2; | |
18 | long n1len, n2len; | |
19 | { | |
20 | char buf1[128]; | |
21 | char buf2[128]; | |
22 | ||
23 | if (n1len >= sizeof buf1 || n2len >= sizeof buf2) | |
24 | return((long)(errno=F_ERARG)); | |
25 | g_char(name1, n1len, buf1); | |
26 | g_char(name2, n2len, buf2); | |
27 | if (buf2[0] == '\0') | |
28 | return((long)(errno=F_ERARG)); | |
29 | if (link(buf1, buf2) != 0) | |
30 | return((long)errno); | |
31 | return(0L); | |
32 | } |