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