summaryrefslogtreecommitdiffstats
path: root/bin/ln/ln.c
Commit message (Collapse)AuthorAgeFilesLines
* Put some static keywords in the source code.ed2011-10-311-9/+9
| | | | | | For these simple utilities, it doesn't harm to make all global variables static. In fact, this allows the compiler to perform better forms of optimisation and analysis.
* bin: Prefer strrchr() to rindex().jilles2011-03-151-1/+1
| | | | This removes the last index/rindex usage from /bin.
* ln: Allow a trailing slash when creating a link to a directory.jilles2010-04-211-14/+13
| | | | | | | | | | | | | | | | | | | | In the 'ln source... directory' synopsis, the basename of each source determines the name of the created link. Determine this using basename(3) instead of strrchr(..., '/') which is incorrect if the pathname ends in a slash. The patch is somewhat changed to allow for basename(3) implementations that change the passed pathname, and to fix the -w option's checking also. The code to compare directory entries only applies to hard links, which cannot be created to directories using ln. Example: ln -s /etc/defaults/ /tmp This should create a symlink named defaults. PR: 121568 Submitted by: Ighighi MFC after: 1 week
* ln: Refuse deleting a directory entry by hardlinking it to itself.jilles2010-04-171-2/+59
| | | | | | | | | | | | | | Two pathnames refer to the same directory entry iff the directories match and the final components' names match. Example: (assuming file1 is an existing file) ln -f file1 file1 This now fails while leaving file1 intact. It used to delete file1 and then complain it cannot be linked because it is gone. With -i, this error is detected before the question is asked. MFC after: 2 weeks
* Allow creating hard links to symlinks using ln(1).jilles2009-07-191-9/+15
| | | | | | | | This implements the POSIX.1-2008 -L and -P flags. The default remains to create hard links to the target of symlinks. Approved by: re (kib), ed (mentor)
* Unbreak last commit to ln for amd64.keramida2008-06-071-1/+1
| | | | | | | | Cast string precision to `int'. amd64 systems warn about the field precision being `long int' if we don't, and pathnames are normally short enough to fit in an `int'. Noticed by: pav
* Add a -w warning flag to ln(1). When the -w option is enabled,keramida2008-06-061-2/+37
| | | | | | | | | | | ln(1) checks to see if the source of a symlink, i.e. the file it should point to actually exists. The default is the old ln behavior, that does not check, to avoid surprising people who may be using ln(1) in scripts or other non-interactive places. PR: bin/7265 Submitted by: Joel Ray Holveck, detlev!joelh at mail.camalott.com MFC after: 2 weeks
* Express in the usage() and SYNOPSIS that -F depends on -s, andru2007-11-171-2/+2
| | | | that -f and -i are exclusive.
* Swap "source"/"target" where appropriate, to match documentation.ru2007-11-171-38/+38
|
* Add '-F' option which allows to delete existing empty directories, whenglebius2006-02-141-5/+23
| | | | | | | creating symbolic links. PR: bin/92149 Submitted by: Eugene Grosbein <eugen grosbein.pp.ru>
* Sync program's usage() with manpage's SYNOPSIS.ru2005-02-091-3/+3
|
* /*- or .\"- or #- to begin license clauses.imp2005-01-101-1/+1
|
* Remove clause 3 from the UCB licenses.markm2004-04-061-4/+0
| | | | OK'ed by: imp, core
* Quiet warnings about copyright[].obrien2003-05-011-2/+2
|
* Fix an easy WARNS.markm2002-07-311-1/+1
|
* Consistently use __FBSDIDobrien2002-06-301-2/+2
|
* Check that snprintf() does not truncate the destination pathname whentjr2002-06-291-1/+6
| | | | linking into a directory.
* Reject options, handle "--" end-of-options marker in link(1).tjr2002-05-301-4/+7
|
* Add semicolon to empty default case to silence warning.jedgar2002-05-111-0/+1
|
* Fix warnings inspired by lint, a commercial lint and WARNS=4.markm2002-02-221-0/+1
|
* o __P has been reovedimp2002-02-021-11/+6
| | | | | | | | | o Old-style K&R declarations have been converted to new C89 style o register has been removed o prototype for main() has been removed (gcc3 makes it an error) o int main(int argc, char *argv[]) is the preferred main definition. o Attempt to not break style(9) conformance for declarations more than they already are.
* Use PATH_MAX in preference to MAXPATHLEN.imp2001-05-291-1/+2
| | | | | Also sort declarations per style(9) (big arrays come last) while I'm in the area.
* Silence WARNS=2 and BDECFLAGS on i386 and alphakris2001-05-201-4/+5
| | | | MFC After: 1 week
* Bring in `-h' compatability option and its alias `-n' to match NetBSD and GNUsobomax2001-04-261-8/+27
| | | | | | | semantics. style(9) Reviewed by: Obtained from: NetBSD
* Fix style bugs and inconsistencies introduced in rev 1.16.sheldonh2000-08-171-12/+18
| | | | Submitted by: bde
* Don't explicitly declare optarg and optind. These are declared inimp2000-08-161-1/+0
| | | | unistd.h, which is already included.
* Add the -i option, as found in rm(1), which provides an interactivesheldonh2000-08-141-5/+29
| | | | | | | mode in which the user is prompted for confirmation before an existing file is replaced. Submitted by: alex
* Add link(1) and unlink(1) as special cases of ln(1) and rm(1)sheldonh1999-12-201-3/+21
| | | | | | | | | | | | respectively, in accordance with SUSv2. This differs from the approach taken in NetBSD, but provides less obscure error messages in at least the EISDIR case and does not take up additional disk space for new binaries. PR: 13071 PR: 13074 Requested by: James Howard <howardjp@wam.umd.edu>
* Add verbose processing flag.obrien1999-09-111-3/+11
|
* $Id$ -> $FreeBSD$peter1999-08-271-1/+1
|
* Correct use of .Nm. Add rcsid.charnier1998-05-151-3/+5
|
* Cosmetic change in usage string.charnier1997-06-061-3/+4
|
* compare return value from getopt against -1 rather than EOF, per the finalimp1997-03-281-2/+2
| | | | posix standard on the topic.
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* -Wall cleaning.steve1996-12-141-3/+3
|
* Nuke the undocumented -F flag, since it doesn't do anything anymore.peter1996-05-241-9/+6
| | | | | It used to allow root to hard-link directories (and screw up programs that expexted the ".." entry to point to the parent dir)
* Use lstat() instead of stat() for checking if the final source file exists,bde1994-12-061-3/+3
| | | | | so that `ln -fs' works when the source is a symlink pointing to a non- existent file.
* Added $Id$dg1994-09-241-0/+2
|
* fix ln to accept -f again. Thanks Bruce. Seems that Joe Grosch isn'tphk1994-09-201-1/+1
| | | | | quite as safe as I thought. I will have to look much closer on his patches. Damn.
* /home/phk/jgphk1994-09-201-2/+2
|
* BSD 4.4 Lite bin Sourcesrgrimes1994-05-261-0/+164
OpenPOWER on IntegriCloud