Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/dist/ipsec-tools/src/setkey Accept - as stdin



details:   https://anonhg.NetBSD.org/src/rev/1ebd5cc93c90
branches:  trunk
changeset: 787382:1ebd5cc93c90
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jun 14 16:29:14 2013 +0000

description:
Accept - as stdin
Be nice and let the user know which file it could not open.

diffstat:

 crypto/dist/ipsec-tools/src/setkey/setkey.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (22 lines):

diff -r b98db75c17b4 -r 1ebd5cc93c90 crypto/dist/ipsec-tools/src/setkey/setkey.c
--- a/crypto/dist/ipsec-tools/src/setkey/setkey.c       Fri Jun 14 16:28:20 2013 +0000
+++ b/crypto/dist/ipsec-tools/src/setkey/setkey.c       Fri Jun 14 16:29:14 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: setkey.c,v 1.15 2011/05/27 18:00:21 drochner Exp $     */
+/*     $NetBSD: setkey.c,v 1.16 2013/06/14 16:29:14 christos Exp $     */
 
 /*     $KAME: setkey.c,v 1.36 2003/09/24 23:52:51 itojun Exp $ */
 
@@ -165,8 +165,10 @@
                        break;
                case 'f':
                        f_mode = MODE_SCRIPT;
-                       if ((fp = fopen(optarg, "r")) == NULL) {
-                               err(1, "fopen");
+                       if (strcmp(optarg, "-") == 0)
+                               fp = stdin;
+                       else if ((fp = fopen(optarg, "r")) == NULL) {
+                               err(1, "Can't open `%s'", optarg);
                                /*NOTREACHED*/
                        }
                        break;



Home | Main Index | Thread Index | Old Index