[GNU Manual] [POSIX requirement] [Linux man] [FreeBSD man]
Summary
unlink - remove files via the unlink syscall
Lines of code: 96
Principal syscall: unlink()
Support syscalls: None
Options: 0 (help and version built in to usage()
)
Existed as a syscall since Version 1 UNIX (1971). Wrapper utility unique to coreutils
Added to Coreutils in April 2002 [First version]
Number of revisions: 51 [Code Evolution]
- None
die()
- Exit with mandatory non-zero error and message to stderrerror()
- Outputs error message to standard error with possible process termination
Setup
unlink initializes no parsing options, globals, or additional variables in main()
not already mentioned.
Parsing
Parsing for unlink involves checking that a single argument references a file.
Parsing failures
These failure case is explicitly checked:
- No file provided
- More than one file provided
Failure results in a short error message followed by the usage instructions.
Execution
Successful execution happens with one line of code: unlink (argv[optind])
.
Failure case:
unlink()
returned an error for any reason. The reason for failure is not checked.
All failures at this stage output an error message to STDERR and return without displaying usage help