Module Name: src
Committed By: wiz
Date: Tue Sep 17 20:00:50 UTC 2013
Modified Files:
src/usr.bin/nl: nl.c
Log Message:
If file argument is '-', read from stdin.
>From Jérémie Courrèges-Anglas <[email protected]>.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/nl/nl.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/nl/nl.c
diff -u src/usr.bin/nl/nl.c:1.11 src/usr.bin/nl/nl.c:1.12
--- src/usr.bin/nl/nl.c:1.11 Tue Aug 16 12:00:46 2011
+++ src/usr.bin/nl/nl.c Tue Sep 17 20:00:50 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: nl.c,v 1.11 2011/08/16 12:00:46 christos Exp $ */
+/* $NetBSD: nl.c,v 1.12 2013/09/17 20:00:50 wiz Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
#ifndef lint
__COPYRIGHT("@(#) Copyright (c) 1999\
The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: nl.c,v 1.11 2011/08/16 12:00:46 christos Exp $");
+__RCSID("$NetBSD: nl.c,v 1.12 2013/09/17 20:00:50 wiz Exp $");
#endif
#include <errno.h>
@@ -240,7 +240,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, "Cannot open `%s'", argv[0]);
break;
default: