Message-Id: <199903171553.PAA28740@out2.ibm.net> From: "Mark E." To: djgpp-workers AT delorie DOT com Date: Wed, 17 Mar 1999 10:53:38 -0500 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: symlink question References: In-reply-to: X-mailer: Pegasus Mail for Win32 (v3.01d) Reply-To: djgpp-workers AT delorie DOT com How about altering symlink.c that if making a DJGPP-style soft link is impossible but where a Unix style soft link would succeed, call link() to try and make a hard link. Here's a patch that would do that: *** src\libc\posix\unistd\symlink.c.orig Tue Oct 28 14:22:54 1997 --- src\libc\posix\unistd\symlink.c Wed Mar 17 10:37:58 1999 *************** *** 73,84 **** src_base = tail (src_abs); dest_base = tail (dest_abs); ! /* DJGPP symlinks must be in the same directory. */ if (strnicmp (src_abs, dest_abs, src_base - src_abs)) ! { ! errno = EXDEV; ! return -1; ! } /* Any file is already a link to itself. */ if (stricmp (src_abs, dest_abs) == 0) --- 73,82 ---- src_base = tail (src_abs); dest_base = tail (dest_abs); ! /* DJGPP symlinks must be in the same directory. ! Retry by calling link() to make a copy. */ if (strnicmp (src_abs, dest_abs, src_base - src_abs)) ! return link (source, dest); /* Any file is already a link to itself. */ if (stricmp (src_abs, dest_abs) == 0) *************** *** 88,99 **** unstubbed COFF image) */ v2_prog = is_v2_prog(src_abs); ! /* It is an existing file but no v2 executable */ if (v2_prog == 0) ! { ! errno = EXDEV; ! return -1; ! } /* Allow to say `ln -s src dest' when we really mean `src.exe' and `dest.exe' */ --- 86,95 ---- unstubbed COFF image) */ v2_prog = is_v2_prog(src_abs); ! /* It is an existing file but no v2 executable. ! To make the best of things, call link(). */ if (v2_prog == 0) ! return link (source, dest); /* Allow to say `ln -s src dest' when we really mean `src.exe' and `dest.exe' */ *************** *** 106,117 **** v2_prog = v2_prog == 1 ? v2_prog : is_v2_prog(src_abs); } ! /* It is an existing file but no v2 executable */ if (v2_prog == 0) ! { ! errno = EXDEV; ! return -1; ! } /* When we are here, either the file exists and is a v2 executable or it does not exist and we hope, the the user knows what he --- 102,111 ---- v2_prog = v2_prog == 1 ? v2_prog : is_v2_prog(src_abs); } ! /* It is an existing file but no v2 executable. ! Retry by calling link() to make a regular copy. */ if (v2_prog == 0) ! return link (source, dest); /* When we are here, either the file exists and is a v2 executable or it does not exist and we hope, the the user knows what he --- Mark Elbrecht, snowball3 AT usa DOT net http://snowball.digitalspace.net/