| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: setkey.c,v 1.11.6.1 2007/08/01 11:52:23 vanhu Exp $ */ | | 1 | /* $NetBSD: setkey.c,v 1.11.6.2 2009/08/06 04:45:16 tteras 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 |
| @@ -304,28 +304,27 @@ stdin_loop() | | | @@ -304,28 +304,27 @@ stdin_loop() |
304 | | | 304 | |
305 | memset (line, 0, sizeof(line)); | | 305 | memset (line, 0, sizeof(line)); |
306 | | | 306 | |
307 | parse_init(); | | 307 | parse_init(); |
308 | while (1) { | | 308 | while (1) { |
309 | #ifdef HAVE_READLINE | | 309 | #ifdef HAVE_READLINE |
310 | char *rbuf; | | 310 | char *rbuf; |
311 | rbuf = readline (""); | | 311 | rbuf = readline (""); |
312 | if (! rbuf) | | 312 | if (! rbuf) |
313 | break; | | 313 | break; |
314 | #else | | 314 | #else |
315 | char rbuf[1024]; | | 315 | char rbuf[1024]; |
316 | rbuf[0] = '\0'; | | 316 | rbuf[0] = '\0'; |
317 | fgets (rbuf, sizeof(rbuf), stdin); | | 317 | if (fgets(rbuf, sizeof(rbuf), stdin) == NULL) |
318 | if (!rbuf[0]) | | | |
319 | break; | | 318 | break; |
320 | if (rbuf[strlen(rbuf)-1] == '\n') | | 319 | if (rbuf[strlen(rbuf)-1] == '\n') |
321 | rbuf[strlen(rbuf)-1] = '\0'; | | 320 | rbuf[strlen(rbuf)-1] = '\0'; |
322 | #endif | | 321 | #endif |
323 | comment = strchr(rbuf, '#'); | | 322 | comment = strchr(rbuf, '#'); |
324 | if (comment) | | 323 | if (comment) |
325 | *comment = '\0'; | | 324 | *comment = '\0'; |
326 | | | 325 | |
327 | if (!rbuf[0]) | | 326 | if (!rbuf[0]) |
328 | continue; | | 327 | continue; |
329 | | | 328 | |
330 | linelen += snprintf (&line[linelen], sizeof(line) - linelen, | | 329 | linelen += snprintf (&line[linelen], sizeof(line) - linelen, |
331 | "%s%s", linelen > 0 ? " " : "", rbuf); | | 330 | "%s%s", linelen > 0 ? " " : "", rbuf); |