| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: setkey.c,v 1.15 2011/05/27 18:00:21 drochner Exp $ */ | | 1 | /* $NetBSD: setkey.c,v 1.16 2013/06/14 16:29:14 christos Exp $ */ |
2 | | | 2 | |
3 | /* $KAME: setkey.c,v 1.36 2003/09/24 23:52:51 itojun Exp $ */ | | 3 | /* $KAME: setkey.c,v 1.36 2003/09/24 23:52:51 itojun Exp $ */ |
4 | | | 4 | |
5 | /* | | 5 | /* |
6 | * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. | | 6 | * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. |
7 | * All rights reserved. | | 7 | * All rights reserved. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -155,28 +155,30 @@ main(argc, argv) | | | @@ -155,28 +155,30 @@ main(argc, argv) |
155 | thiszone = gmt2local(0); | | 155 | thiszone = gmt2local(0); |
156 | | | 156 | |
157 | while ((c = getopt(argc, argv, "acdf:HlnvxDFPphVrk?")) != -1) { | | 157 | while ((c = getopt(argc, argv, "acdf:HlnvxDFPphVrk?")) != -1) { |
158 | switch (c) { | | 158 | switch (c) { |
159 | case 'c': | | 159 | case 'c': |
160 | f_mode = MODE_STDIN; | | 160 | f_mode = MODE_STDIN; |
161 | #ifdef HAVE_READLINE | | 161 | #ifdef HAVE_READLINE |
162 | /* disable filename completion */ | | 162 | /* disable filename completion */ |
163 | rl_bind_key('\t', rl_insert); | | 163 | rl_bind_key('\t', rl_insert); |
164 | #endif | | 164 | #endif |
165 | break; | | 165 | break; |
166 | case 'f': | | 166 | case 'f': |
167 | f_mode = MODE_SCRIPT; | | 167 | f_mode = MODE_SCRIPT; |
168 | if ((fp = fopen(optarg, "r")) == NULL) { | | 168 | if (strcmp(optarg, "-") == 0) |
169 | err(1, "fopen"); | | 169 | fp = stdin; |
| | | 170 | else if ((fp = fopen(optarg, "r")) == NULL) { |
| | | 171 | err(1, "Can't open `%s'", optarg); |
170 | /*NOTREACHED*/ | | 172 | /*NOTREACHED*/ |
171 | } | | 173 | } |
172 | break; | | 174 | break; |
173 | case 'D': | | 175 | case 'D': |
174 | f_mode = MODE_CMDDUMP; | | 176 | f_mode = MODE_CMDDUMP; |
175 | break; | | 177 | break; |
176 | case 'F': | | 178 | case 'F': |
177 | f_mode = MODE_CMDFLUSH; | | 179 | f_mode = MODE_CMDFLUSH; |
178 | break; | | 180 | break; |
179 | case 'a': | | 181 | case 'a': |
180 | f_all = 1; | | 182 | f_all = 1; |
181 | break; | | 183 | break; |
182 | case 'l': | | 184 | case 'l': |