1 /*- 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)symlnk_.c 5.2 (Berkeley) 04/12/91"; 10 #endif /* not lint */ 11 12 /* 13 * make a symbolic link to a file 14 * 15 * calling sequence: 16 * ierror = symlnk(name1, name2) 17 * where: 18 * name1 is the pathname of an existing file 19 * name2 is a pathname that will become a symbolic link to name1 20 * ierror will be 0 if successful; a system error code otherwise. 21 */ 22 23 #include <sys/param.h> 24 #include "../libI77/f_errno.h" 25 26 #ifndef MAXPATHLEN 27 #define MAXPATHLEN 128 28 #endif 29 30 long symlnk_(name1, name2, n1len, n2len) 31 char *name1, *name2; 32 long n1len, n2len; 33 { 34 char buf1[MAXPATHLEN]; 35 char buf2[MAXPATHLEN]; 36 37 if (n1len >= sizeof buf1 || n2len >= sizeof buf2) 38 return((long)(errno=F_ERARG)); 39 g_char(name1, n1len, buf1); 40 g_char(name2, n2len, buf2); 41 if (buf1[0] == '\0' || buf2[0] == '\0') 42 return((long)(errno=F_ERARG)); 43 if (symlink(buf1, buf2) != 0) 44 return((long)errno); 45 return(0L); 46 } 47