Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/nl If file argument is '-', read from stdin.
details: https://anonhg.NetBSD.org/src/rev/1bed6b8e837f
branches: trunk
changeset: 790087:1bed6b8e837f
user: wiz <wiz%NetBSD.org@localhost>
date: Tue Sep 17 20:00:50 2013 +0000
description:
If file argument is '-', read from stdin.
>From J?r?mie Courr?ges-Anglas <jca%wxcvbn.org@localhost>.
diffstat:
usr.bin/nl/nl.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (28 lines):
diff -r 1275b5c20dcb -r 1bed6b8e837f usr.bin/nl/nl.c
--- a/usr.bin/nl/nl.c Tue Sep 17 19:58:03 2013 +0000
+++ b/usr.bin/nl/nl.c Tue Sep 17 20:00:50 2013 +0000
@@ -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 @@
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:
Home |
Main Index |
Thread Index |
Old Index