summaryrefslogtreecommitdiff
path: root/usr.bin/nl
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2014-05-08 23:54:15 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2014-05-08 23:54:15 +0000
commitcc3f4b99653c34ae64f8a1fddea370abefef680e (patch)
tree8ce0ddd0e6f508bd20c77429c448969589170fae /usr.bin/nl
parentf974b33f6ed6f35170c520d2be111bfc2c3954cd (diff)
parent16aa1f0950a3b4407a36ecc96acc8ca0710ebd91 (diff)
downloadsrc-test2-cc3f4b99653c34ae64f8a1fddea370abefef680e.tar.gz
src-test2-cc3f4b99653c34ae64f8a1fddea370abefef680e.zip
Notes
Diffstat (limited to 'usr.bin/nl')
-rw-r--r--usr.bin/nl/nl.116
-rw-r--r--usr.bin/nl/nl.c3
2 files changed, 12 insertions, 7 deletions
diff --git a/usr.bin/nl/nl.1 b/usr.bin/nl/nl.1
index 554e18d241d0..cb67c046a118 100644
--- a/usr.bin/nl/nl.1
+++ b/usr.bin/nl/nl.1
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd January 26, 2005
+.Dd May 4, 2014
.Dt NL 1
.Os
.Sh NAME
@@ -71,12 +71,16 @@
The
.Nm
utility reads lines from the named
+.Ar file ,
+applies a configurable line numbering filter operation,
+and writes the result to the standard output.
+If
.Ar file
-or the standard input if the
-.Ar file
-argument is omitted,
-applies a configurable line numbering filter operation and writes the result
-to the standard output.
+is a single dash
+.Pq Sq Fl
+or absent,
+.Nm
+reads from the standard input.
.Pp
The
.Nm
diff --git a/usr.bin/nl/nl.c b/usr.bin/nl/nl.c
index 9c2ae64ac913..1770b7808be8 100644
--- a/usr.bin/nl/nl.c
+++ b/usr.bin/nl/nl.c
@@ -242,7 +242,8 @@ main(int argc, char *argv[])
case 0:
break;
case 1:
- if (freopen(argv[0], "r", stdin) == NULL)
+ if (strcmp(argv[0], "-") != 0 &&
+ freopen(argv[0], "r", stdin) == NULL)
err(EXIT_FAILURE, "%s", argv[0]);
break;
default: