From 06cb82a8ccc3587dff728321dff5416b18090483 Mon Sep 17 00:00:00 2001 From: katherine Date: Wed, 10 Jul 2019 20:24:08 -0700 Subject: implement deftype get --- src/opt.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src/opt.c') diff --git a/src/opt.c b/src/opt.c index a50f4ca..9aea49b 100644 --- a/src/opt.c +++ b/src/opt.c @@ -43,9 +43,9 @@ void opt_parse(int argc, char **argv) /* help */ if (options[0].was_seen) { simple_opt_print_usage(stdout, 80, argv[0], - "[-i input.confconf] [-o output.h]", - "confconf is a config file parser generator for C", - options); + "[-i input.confconf] [-o output.h]", + "confconf is a config file parser generator for C", + options); exit(EXIT_SUCCESS); } @@ -61,7 +61,7 @@ void opt_parse(int argc, char **argv) if (cend != '"' && cend != '<') { fprintf(stderr, "%s: err: badly-formatted uthash header `%s`\n", - argv[0], options[4].val.v_string); + argv[0], options[4].val.v_string); exit(EXIT_FAILURE); } @@ -69,33 +69,33 @@ void opt_parse(int argc, char **argv) cend = '>'; for (i = 1, c = options[4].val.v_string[1]; - c && c != cend && c != '\n'; - c = options[4].val.v_string[++i] + c && c != cend && c != '\n'; + c = options[4].val.v_string[++i] ); if (c != cend - || options[4].val.v_string[i+1] != '\0' - || strlen(options[4].val.v_string) > TOK_MAX_LEN - || options[4].val.v_string[2] == '\0' + || options[4].val.v_string[i+1] != '\0' + || strlen(options[4].val.v_string) > TOK_MAX_LEN + || options[4].val.v_string[2] == '\0' ) { fprintf(stderr, "%s: err: badly-formatted uthash header `%s`\n", - argv[0], options[4].val.v_string); + argv[0], options[4].val.v_string); exit(EXIT_FAILURE); } } /* check suffix */ if (options[5].was_seen) { - if (options[5].val.v_string[i] == '\0') { + if (options[5].val.v_string[0] == '\0') { fprintf(stderr, "%s: err: badly-formatted name suffix ``\n", - argv[0]); + argv[0]); exit(EXIT_FAILURE); } for (i = 0; options[5].val.v_string[i] != '\0'; i++) { if (!isalnum(options[5].val.v_string[i]) ) { fprintf(stderr, "%s: err: badly-formatted name suffix `%s`\n", - argv[0], options[5].val.v_string); + argv[0], options[5].val.v_string); exit(EXIT_FAILURE); } } @@ -106,27 +106,27 @@ void opt_parse(int argc, char **argv) const char* opt_infile_str(void) { return (options[2].was_seen - ? options[2].val.v_string - : NULL); + ? options[2].val.v_string + : NULL); } const char* opt_outfile_str(void) { return (options[3].was_seen - ? options[3].val.v_string - : NULL); + ? options[3].val.v_string + : NULL); } const char* opt_header_str(void) { return (options[4].was_seen - ? options[4].val.v_string - : NULL); + ? options[4].val.v_string + : NULL); } const char* opt_suffix_str(void) { return (options[5].was_seen - ? options[5].val.v_string - : NULL); + ? options[5].val.v_string + : NULL); } -- cgit v1.2.3