diff options
author | Jim Meyering <jim@meyering.net> | 1993-05-22 02:09:05 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1993-05-22 02:09:05 +0000 |
commit | d1c5cbfcddaced8d64b23bc3f22bfc4082b58604 (patch) | |
tree | 684956921106115248c1a6e3263fba4309b0d698 /src/ln.c | |
parent | 5ca6750d57a9d89163cd3548758589d4ab14c75c (diff) | |
download | coreutils-d1c5cbfcddaced8d64b23bc3f22bfc4082b58604.tar.gz coreutils-d1c5cbfcddaced8d64b23bc3f22bfc4082b58604.tar.bz2 coreutils-d1c5cbfcddaced8d64b23bc3f22bfc4082b58604.zip |
merge with 3.5.5
Diffstat (limited to 'src/ln.c')
-rw-r--r-- | src/ln.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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); |