aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFiles
2016-01-09Fix memory leakSergey Poznyakoff2
* 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.
2016-01-05Implement json_array_setSergey Poznyakoff2
2015-12-31Case-insensitive hash functionSergey Poznyakoff2
* src/grecs.hin (grecs_hash_string_ci): New proto. * src/symtab.c (grecs_hash_string_ci): New function.
2015-12-25Cleanup json code.Sergey Poznyakoff4
* 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.
2015-12-20Implement function for formatting JSON valuesSergey Poznyakoff4
* 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.
2015-12-19Bugfix in test suiteSergey Poznyakoff1
* tests/wsp.c (make_env_kv): Fix array size
2015-12-18Minor fixSergey Poznyakoff3
* src/bind-lex.l: Set noinput,nounput options * src/dhcpd-lex.l: Likewise. * src/meta1-lex.l: Likewise.
2015-12-18Add basic JSON support functions.Sergey Poznyakoff17
* 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.
2015-12-17Minor improvement in wordsplit.Sergey Poznyakoff2
* src/wordsplit.h (WRDSX_WORD, WRDSX_QUOTE): New defines. * src/wordsplit.c: Use them when initializing ws_escape.
2015-12-17Update copyright yearsSergey Poznyakoff124
2015-12-17wordsplit: fix ws trimming and return_delim optionSergey Poznyakoff2
* 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.
2015-12-17Minor fixes in wordsplit documentationSergey Poznyakoff1
2015-12-17wordsplit: minor fixesSergey Poznyakoff2
2015-12-17wordsplit: improve docs, add new functionSergey Poznyakoff3
* src/wordsplit.c (wordsplit_getwords): New functon. * src/wordsplit.h (wordsplit_getwords): New proto. * doc/wordsplit.3: Add example section, document wordsplit_getwords.
2015-12-17Finish wordsplit docs, improve testsSergey Poznyakoff5
2015-12-17Improve wordsplitSergey Poznyakoff5
* 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.
2015-12-17Improve wordsplit documentation and debug output.Sergey Poznyakoff2
2015-12-17Test pathname expansionSergey Poznyakoff1
2015-12-17Various improvements in wordsplitSergey Poznyakoff1
* src/wordsplit.c (wordsplit_trimws): Retutn int. (wordsplit_tildexpand,wordsplit_pathexpand): Add missing return. (wordsplit_process_list): Rewrite in a table-driven fashion.
2015-12-17wordsplit: implement tilde and pathname expansionSergey Poznyakoff3
* 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.
2015-12-17wordsplit: perform quote removal before command substitutionSergey Poznyakoff1
2015-12-17cleanup in wordsplitSergey Poznyakoff2
2015-12-17wordsplit: fix variable expansion within commandsSergey Poznyakoff3
* 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.
2015-12-17Change prototypes of ws_getvar and ws_command.Sergey Poznyakoff3
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.
2015-12-17wordsplit: implement command expansionSergey Poznyakoff3
* 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.
2015-12-17Update copyright dates.Sergey Poznyakoff2
2015-12-17Minor changeSergey Poznyakoff1
* tests/wsp.c (main): use additional variable to keep the allocated value in incremental mode.
2015-12-17BugfixSergey Poznyakoff1
2015-12-17Test ws_getvar/ws_closure functionality.Sergey Poznyakoff2
* 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.
2015-12-17Makefile.am: Fix rule for gitid.hSergey Poznyakoff1
2015-12-17wordsplit: Fix expansion of ${...}Sergey Poznyakoff3
* 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.
2015-12-17wordsplit: support ${x:-word}, ${x:+word} and ${x:?word}Sergey Poznyakoff1
* src/wordsplit.c (expvar): Support default value.
2015-12-17wordsplit: ws_getvar allocates memory.Sergey Poznyakoff2
* 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.
2015-12-17Add wordsplit test (from mailutils)Sergey Poznyakoff8
* 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.
2015-12-16Remove unused variableSergey Poznyakoff1
2015-12-16Shut useless compiler warningsSergey Poznyakoff4
2015-12-16Add option to hide configuration statements from help outputSergey Poznyakoff3
* src/format.c (grecs_print_statement_array): Skip elements marked with GRECS_HIDDEN flag. * src/grecs.hin (GRECS_HIDDEN): New flag.
2015-11-25Fix descriptor leak.Sergey Poznyakoff1
* src/grecs-lex.l (yywrap): Close yyin.
2015-05-15Disable preprocessing if unable to find preprocessor.Sergey Poznyakoff1
* am/grecs.m4: Reset DEFAULT_PREPROCESSOR to NULL and emit a warning if the requested preprocessor command couldn't be found.
2015-01-22Fix bugs in getopt.m4Sergey Poznyakoff1
* build-aux/getopt.m4 (OPTION): Pushdef __GETOPT_SELECTOR here (__GATHER_OPTIONS): define __GETOPT_SELECTOR, instead of pushdeffing it.
2015-01-21Use separate namespace for internal symbols in getopt.m4Sergey Poznyakoff1
2015-01-15Bugfix in node formatting codeSergey Poznyakoff1
* src/format.c (grecs_format_node_path) (grecs_format_node_path): don't coredump on NULL values.
2014-12-27Improve error reporting.Sergey Poznyakoff1
2014-12-26Add globbing pattern support to #include and #include_onceSergey Poznyakoff9
* 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.
2014-09-25Fix VPATH builds.Sergey Poznyakoff1
* am/grecs.m4 (GRECS_SETUP): Fix GRECS_INCLUDES
2014-09-25Minor fix.Sergey Poznyakoff1
* src/cidr.c: Include sys/socket.h
2014-09-25Add support for IPv6, multiple addresses and CIDRs.Sergey Poznyakoff9
* 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
2014-09-07Remove gettext markers from test progsSergey Poznyakoff1
2014-08-25Minor fixSergey Poznyakoff4
* src/bind-gram.y (yyerror): arg is char const. * src/dhcpd-gram.y: Likewise. * src/grecs-gram.y: Likewise. * src/meta1-gram.y: Likewise.
2014-03-05Bugfix in getopt.m4Sergey Poznyakoff1
* 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.

Return to:

Send suggestions and report system problems to the System administrator.