From: Niels Möller Date: Sun, 10 Nov 2002 16:27:54 +0000 (+0100) Subject: * tools/sexp-conv.c (sexp_get_token_string): Fixed end of file X-Git-Tag: nettle_1.7_release_20030311~140 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35632b67457f15e27a6414ecbe7fdfaf800beaf7;p=thirdparty%2Fnettle.git * tools/sexp-conv.c (sexp_get_token_string): Fixed end of file handling. (sexp_get_string): Fixed end of encoding/end of file handling. (parse_options): Check for negative width and complain. Rev: src/nettle/tools/sexp-conv.c:1.3 --- diff --git a/tools/sexp-conv.c b/tools/sexp-conv.c index 060c7ab9..0cb0269c 100644 --- a/tools/sexp-conv.c +++ b/tools/sexp-conv.c @@ -302,7 +302,7 @@ sexp_get_token_string(struct sexp_input *input) sexp_push_char(input); sexp_get_char(input); } - while (TOKEN_CHAR(input->c)); + while (input->ctype == SEXP_NORMAL_CHAR && TOKEN_CHAR(input->c)); assert (input->string.size); } @@ -459,7 +459,7 @@ sexp_get_token(struct sexp_input *input, enum sexp_mode mode) case SEXP_END_CHAR: input->token = SEXP_CODING_END; sexp_input_end_coding(input); - sexp_next_char(input); + sexp_get_char(input); return; case SEXP_NORMAL_CHAR: @@ -1022,10 +1022,11 @@ parse_options(struct conv_options *o, case 'w': { char *end; - o->width = strtol(optarg, &end , 0); - if (!*optarg || *end || o->width < 0) - die("sexp-conv: Invalid width `%s'.\n", - optarg); + int width = strtol(optarg, &end , 0); + if (!*optarg || *end || width < 0) + die("sexp-conv: Invalid width `%s'.\n", optarg); + + o->width = width; break; } case 's':