]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
* tools/sexp-conv.c (sexp_get_token_string): Fixed end of file
authorNiels Möller <nisse@lysator.liu.se>
Sun, 10 Nov 2002 16:27:54 +0000 (17:27 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Sun, 10 Nov 2002 16:27:54 +0000 (17:27 +0100)
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

tools/sexp-conv.c

index 060c7ab94320fb8ea7ae4747e52ca304a6ae0b60..0cb0269c8cb610d7262f65352ccea50c57a9bf79 100644 (file)
@@ -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':