Age | Commit message (Collapse) | Author | Files |
|
* src/list.c (grecs_list_remove_entry): Free the entry, but not its data.
All callers updated.
* src/txtacc.c (grecs_txtacc_free_string): Free the txtacc entry after
removal.
|
|
|
|
* src/grecs.hin (grecs_hash_string_ci): New proto.
* src/symtab.c (grecs_hash_string_ci): New function.
|
|
* src/json-gram.y (json_new_string)
(json_new_number,json_new_bool,json_new_null)
(json_new_object),json_new_null)
(json_new_object,json_new_array)
(json_object_set,json_object_get)
(json_array_size,json_array_flatten)
(json_array_insert,json_array_append)
(json_array_get): New functions.
* src/json.h (json_array): New member ol.
(json_unescape): Change signature.
Add new prototypes.
* src/json-lex.l: Return allocated string as T_STRING.
(json_unescape): Change signature.
* src/jsonfmt.c: Use new accessors. Don't escape / in strings.
|
|
* src/Make.am: Add jsonfmt.c
* src/json.h (json_format): New struct.
(json_format_value): New proto.
* src/jsonfmt.c: New file.
* tests/json.c: Use json_format_value.
|
|
* tests/wsp.c (make_env_kv): Fix array size
|
|
* src/bind-lex.l: Set noinput,nounput options
* src/dhcpd-lex.l: Likewise.
* src/meta1-lex.l: Likewise.
|
|
* src/Make-inst.am: Add json.h
* src/Make-shared.am: Likewise.
* src/Make-static.am: Likewise.
* src/Make.am: Likewise.
* src/json-gram.y: New file.
* src/json-lex.l: New file.
* src/json.h: New file.
* src/yytrans: Translate json prefixes.
* src/.gitignore: Update.
* tests/json.c: New file.
* tests/json00.at: New file.
* tests/json01.at: New file.
* tests/Makefile.am: Add new tests; build json
* tests/testsuite.at: Add new tests.
* tests/.gitignore: Update.
* am/grecs.m4: New flag "json"
* configure.ac (GRECS_SETUP): Require json
* src/Make-inst.am (include_HEADERS): Assign GRECS_HDR value.
* src/Make-shared.a [GRECS_COND_INSTALLHEADERS] (grecsinclude_HEADERS)
[!GRECS_COND_INSTALLHEADERS] (noinst_HEADERS): Likewise.
* src/Make-static.am (noinst_HEADERS): Likewise.
* src/Make.am [GRECS_COND_JSON]: Define GRECS_JSON and GRECS_EXTRA_JSON.
|
|
* src/wordsplit.h (WRDSX_WORD, WRDSX_QUOTE): New defines.
* src/wordsplit.c: Use them when initializing ws_escape.
|
|
|
|
* src/wordsplit.c (_WSNF_DELIM): New node flag
(wsnode_flagstr): Print 'd' for that flag.
(expvar): Don't set WRDSF_WS when expanding variable
value. This fixes, e.g., expansion of a$x if x begins with
a whitespace.
(wsnode_nullelim): A _WSNF_DELIM node breaks join chain.
(wordsplit_trimws): Don't affect nodes within join chains.
(scan_word): Set _WSNF_DELIM for returned delimiters.
* tests/wordsplit.at (TESTWSP): 8th argument - prologue
shell code. Use it to unset environment variables in
env/getenv tests.
Test ws elimination with return_delims set.
|
|
|
|
|
|
* src/wordsplit.c (wordsplit_getwords): New functon.
* src/wordsplit.h (wordsplit_getwords): New proto.
* doc/wordsplit.3: Add example section, document wordsplit_getwords.
|
|
|
|
* src/wordsplit.c: Implement default assignment, word
expansion in variable defaults, distinction between
${variable:-word} and ${variable-word}.
* doc/wordsplit.3: New file.
* src/wordsplit.h (wordsplit)<ws_envbuf,ws_envidx>
<ws_envsiz>: New members.
(WRDSF_ARGV): Remove.
(WRDSF_OPTIONS): New flag.
(WRDSO_ARGV): New option bit.
* tests/wordsplit.at: Add new tests.
* tests/wsp.c: Set WRDSF_OPTIONS flag if one of the options is requested.
|
|
|
|
|
|
* src/wordsplit.c (wordsplit_trimws): Retutn int.
(wordsplit_tildexpand,wordsplit_pathexpand): Add missing return.
(wordsplit_process_list): Rewrite in a table-driven fashion.
|
|
* src/wordsplit.c (wordsplit_tildexpand)
(wordsplit_pathexpand): New functions.
(wordsplit_process_list): Run tilde and pathname expansion
if WRDSF_PATHEXPAND flag is set.
* src/wordsplit.h (wordsplit)<ws_options>: New member.
(WRDSF_PATHEXPAND): New flag.
(WRDSO_NULLGLOB,WRDSO_FAILGLOB)
(WRDSO_DOTGLOB): New defines.
* tests/wsp.c: New options pathexpand, nullglob, failglob,
dotglob. Fix help output.
|
|
|
|
|
|
* src/wordsplit.c (_wsplt_seterr): New static function. Use instead
of assigning value to ws_errno.
(coalesce_segment): Propagate _WSNF_QUOTE flag to the resulting node.
(wordsplit_process_list): Coalesce the list before running
command expansion.
* tests/testsuite.at: Test wordsplit first. If it fails, most other
tests will fail too.
* tests/wordsplit.at: Test command expansion.
|
|
New invocation sequence ensures proper error handling.
This is an incompatible change. Authors using ws_getvar member will
have to rewrite their ws_getvar function accordingly.
* src/wordsplit.c (wordsplit_init0): Call wordsplit_clearerr
on reuse.
(wordsplit_init): Fix ws_errno
(expvar): Change invocation of ws_getvar.
(expcmd): Change invocation of ws_command.
(wordsplit_clearerr): New function.
(wordsplit_strerror): Handle WRDSE_USERERR.
* src/wordsplit.h (ws_getvar): Change return value and signature of
ws_getvar and ws_command.
New member 'ws_usererr'.
(WRDSF_ARGV): New flag.
(WRDSE_OK): New define. Same as WRDSE_EOF.
(WRDSE_USERERR): New error code.
(wordsplit_clearerr): New proto.
* tests/wsp.c (wsp_getvar, wsp_runcmd): Rewrite.
|
|
* src/wordsplit.c (wordsplit_init): Change handling of lacking
WRDSF_NOCMD.
(find_closing_cbrace): Rename to find_closing_paren, take additional
argument. All uses changed.
(node_expand_vars): Rewrite as a generalized function node_expand.
(wordsplit_varexp): Use node_expand.
(expcmd, wordsplit_cmdexp): New functions.
(scan_word): Handle $(command) notation
(wordsplit_process_list): Command expansion.
* src/wordsplit.h (wordsplit) <ws_command>: New member.
* tests/wsp.c (wsp_runcmd): New function.
(main): Set ws_command unless WRDSF_NOCMD flag is set.
|
|
|
|
* tests/wsp.c (main): use additional variable to keep the
allocated value in incremental mode.
|
|
|
|
* tests/wsp.c (help): Update.
(wsp_getvar): New function.
(main): Callect all arguments in form X=Y to an array
and set ws_getvar member if this array is not empty.
* tests/wordsplit.at: Add tests for ws_getenv function.
|
|
|
|
* src/wordsplit.c (expvar): Ensure value is set.
Pass WRDSF_QUOTE to wordsplit
(scan_word): Treat ${...} as a single word.
* tests/wordsplit.at: Add more tests.
* tests/wsp.c: Fix error message.
|
|
* src/wordsplit.c (expvar): Support default value.
|
|
* src/wordsplit.c (ISVARBEG,ISVARCHR): New macros.
(expvar): ws_getvar allocates memory.
* src/wordsplit.h (wordsplit)<ws_getvar>: Remove const
from the return value: the function should allocate memory.
|
|
* configure.ac (AC_CONFIG_SRCDIR): Fix argument
* src/Make-inst.am (include_HEADERS): Add grecsopt.h
* tests/.gitignore: Add wsp.c
* tests/Makefile.am: Add new tests.
* tests/testsuite.at: Likewise.
* tests/wordsplit.at: New testcase.
* tests/wsp.c: New test program.
|
|
|
|
|
|
* src/format.c (grecs_print_statement_array): Skip elements
marked with GRECS_HIDDEN flag.
* src/grecs.hin (GRECS_HIDDEN): New flag.
|
|
* src/grecs-lex.l (yywrap): Close yyin.
|
|
* am/grecs.m4: Reset DEFAULT_PREPROCESSOR to NULL and emit a warning
if the requested preprocessor command couldn't be found.
|
|
* build-aux/getopt.m4 (OPTION): Pushdef __GETOPT_SELECTOR here
(__GATHER_OPTIONS): define __GETOPT_SELECTOR, instead of
pushdeffing it.
|
|
|
|
* src/format.c (grecs_format_node_path)
(grecs_format_node_path): don't coredump on NULL values.
|
|
|
|
* doc/grecs-syntax.texi: Document changes to the #include statement.
* doc/grecs_config.5: Likewise.
* src/preproc.c (include_glob, include_pos)
(include_once): New statics.
(pp_list_find): Return 0 if list is NULL.
(incl_copy): New statics.
(source_lookup): Use incl_copy as the copy function.
(pop_source): If more glob expansions are available, push next one
onto input stack.
(isglob): New static.
(parse_include): Support globbing patterns.
* tests/Makefile.am: Add new testes.
* tests/testsuite.at: Likewise.
* tests/incl00.at: New test case.
* tests/incl01.at: New test case.
* tests/incl02.at: New test case.
* tests/incl03.at: New test case.
|
|
* am/grecs.m4 (GRECS_SETUP): Fix GRECS_INCLUDES
|
|
* src/cidr.c: Include sys/socket.h
|
|
* am/grecs.m4 (GRECS_SETUP): New option sockaddr-list.
Build grecs.h at configure stage.
* src/Make.am (GRECS_SRC): Add cidr.c and ipstr.c
[GRECS_COND_SOCKADDR_LIST] (GRECS_SRC): Add sockaddr.c
Remove rule for building grecs.h (see above).
* src/cidr.c: New file.
* src/ipstr.c: New file.
* src/sockaddr.c: New file.
* src/format.c (grecs_data_type_string): Change spelling of sockaddr.
* src/grecs-lex.l: Treat square brackets as part of word.
* src/grecs.hin (GRECS_SOCKADDR_LIST): New define.
[GRECS_SOCKADDR_LIST] (grecs_sockaddr): New member: next.
(grecs_str_is_ipv4,grecs_str_is_ipv6)
(grecs_str_is_ipaddr,grecs_str_is_num): New functions.
[GRECS_SOCKADDR_LIST] (grecs_sockaddr_hints): New struct.
[GRECS_SOCKADDR_LIST] (grecs_sockaddr_new,grecs_sockaddr_free)
(grecs_str_to_sockaddr): New protos.
(grecs_cidr): New struct.
(grecs_str_to_cidr,grecs_sockaddr_to_cidr)
(grecs_sockadd_cidr_match): New protos.
* src/tree.c [GRECS_SOCKADDR_LIST] (grecs_sockaddr_hints): New global.
[!GRECS_SOCKADDR_LIST] (string_to_sockaddr): Retain for backward
compatibility.
[GRECS_SOCKADDR_LIST] (grecs_string_convert): Use grecs_str_to_sockaddr.
(grecs_prop_tab): Add entry for grecs_type_cidr
|
|
|
|
* src/bind-gram.y (yyerror): arg is char const.
* src/dhcpd-gram.y: Likewise.
* src/grecs-gram.y: Likewise.
* src/meta1-gram.y: Likewise.
|
|
* build-aux/getopt.m4 (__GATHER_OPTIONS): Properly quote SHORT_OPTS.
In the course of construction it may happen to end in sequence "dnl",
so care should be taken to quote it.
|