From d40dfdd0260813ce75242a5d999fa3376e7284b8 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Wed, 31 Jan 2007 11:35:37 +0000 Subject: Have RET for path lengths to mean -1. --- src/certtool-cfg.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/certtool-cfg.c') diff --git a/src/certtool-cfg.c b/src/certtool-cfg.c index f3341bb413..80e8ae8252 100644 --- a/src/certtool-cfg.c +++ b/src/certtool-cfg.c @@ -213,7 +213,7 @@ read_crq_set (gnutls_x509_crq crq, const char *input_str, const char *oid) } int -read_int (const char *input_str) +read_int_with_default (const char *input_str, int def) { char *in; char *endptr; @@ -237,11 +237,20 @@ read_int (const char *input_str) return 0; } + if (in == endptr) + l = def; + free (in); return (int) l; } +int +read_int (const char *input_str) +{ + return read_int_with_default (input_str, 0); +} + const char * read_str (const char *input_str) { @@ -612,8 +621,8 @@ get_path_len (void) } else { - return - read_int ("Path length constraint (decimal, -1 for no constraint): "); + return read_int_with_default + ("Path length constraint (decimal, -1 for no constraint): ", -1); } } -- cgit v1.2.1