From d1c5cbfcddaced8d64b23bc3f22bfc4082b58604 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 22 May 1993 02:09:05 +0000 Subject: merge with 3.5.5 --- src/ln.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/ln.c') diff --git a/src/ln.c b/src/ln.c index f9cb92ace..6981e22ed 100644 --- a/src/ln.c +++ b/src/ln.c @@ -38,6 +38,7 @@ enum backup_type get_version (); int isdir (); int yesno (); void error (); +void strip_trailing_slashes (); static void usage (); static int do_link (); @@ -150,7 +151,10 @@ main (argc, argv) } if (flag_version) - fprintf (stderr, "%s\n", version_string); + { + fprintf (stderr, "%s\n", version_string); + exit (0); + } if (flag_help) usage (); @@ -212,8 +216,13 @@ do_link (source, dest) /* Target is a directory; build the full filename. */ char *new_dest; char *source_base; + char *tmp_source; + + tmp_source = (char *) alloca (strlen (source) + 1); + strcpy (tmp_source, source); + strip_trailing_slashes (tmp_source); - source_base = basename (source); + source_base = basename (tmp_source); new_dest = (char *) alloca (strlen (source_base) + 1 + strlen (dest) + 1); sprintf (new_dest, "%s/%s", dest, source_base); -- cgit v1.2.3