AgeCommit message (Collapse)AuthorFiles
2016-07-04Fix prototypes.Sergey Poznyakoff1
2016-07-04Fix prototypes.Sergey Poznyakoff1
2016-07-04Prevent memory leaks when re-processing values of string type.Sergey Poznyakoff1
Port of a3f25ce2 from master. * include/grecs/table.h (GRECS_CONST): New flag. * src/tree.c (grecs_string_convert): For string types, free the old value prior to assigning the new one, unless the GRECS_CONST flag is set. In any case, clear the GRECS_CONST flag after assigning new value.
2016-07-04Unify some typedefs.Sergey Poznyakoff4
Use _ptr_t suffix for typedefs that define pointers.
2016-07-04Split declarations between several header files.Sergey Poznyakoff60
* (SUBDIRS): Add include * am/grecs.m4 (GRECS_INCLUDES): Update (GRECS_COND_BUILD_INSTALL) (GRECS_COND_BUILD_SHARED) (GRECS_COND_BUILD_STATIC): New conditions. Build include/Makefile and include/grecs/Makefile. * Use src/grecs-gram.y as a source validity marker * include/Makefile.a: New file. * src/grecs.hin: Remove. Split into include/*. See below. * include/grecs.h: New file. * include/grecs/.gitignore: New file. * include/grecs/ New file. * include/grecs/doc.h: New file. * include/grecs/error.h: New file. * include/grecs/format.h: New file. * include/grecs/lex.h: New file. * include/grecs/list.h: New file. * include/grecs/mem.h: New file. * include/grecs/node.h: New file. * include/grecs/parser.h: New file. * include/grecs/preproc.h: New file. * include/grecs/sockaddr.h: New file. * include/grecs/symtab.h: New file. * include/grecs/table.h: New file. * include/grecs/tree.h: New file. * include/grecs/txtacc.h: New file. * include/grecs/ New file. * include/grecs/util.h: New file. * include/grecs/value.h: New file. * include/grecs/version.h: New file. * src/grecs-locus.h: Move to ... * include/grecs/locus.h: ... here * src/grecsopt.h: Move to ... * include/grecs/opt.h: ... here * src/json.h: Move to ... * include/grecs/json.h: ... here * src/wordsplit.h: Move to ... * include/wordsplit.h: ... here * src/ (include_HEADERS): Remove. * src/ (grecsinclude_HEADERS) (noinst_HEADERS): Remove. * src/ (noinst_HEADERS): Remove. * src/ Remove header-related stuff * src/bind-gram.y: Fix includes. * src/bind-lex.l: Likewise. * src/cidr.c: Likewise. * src/dhcpd-gram.y: Likewise. * src/dhcpd-lex.l: Likewise. * src/diag.c: Likewise. * src/format.c: Likewise. * src/grecs-gram.y: Likewise. * src/grecs-lex.l: Likewise. * src/json-gram.y: Likewise. * src/json-lex.l: Likewise. * src/jsonfmt.c: Likewise. * src/lookup.c: Likewise. * src/meta1-gram.y: Likewise. * src/meta1-lex.l: Likewise. * src/opthelp.c: Likewise. * src/preproc.c: Likewise. * src/sockaddr.c: Likewise. * src/txtacc.c: Likewise. * src/version.c: Likewise. * tests/gcfenum.c: Likewise. * tests/gcffmt.c: Likewise. * tests/gcfpeek.c: Likewise. * tests/gcfset.c: Likewise. * tests/gcfver.c: Likewise. * tests/json.c: Likewise.
2016-07-04Update copyright yearsSergey Poznyakoff132
2016-06-20Ensure grecs_preproc reentrancy after grecs_preproc_doneSergey Poznyakoff1
* src/preproc.c (grecs_preproc_done): Reset static variables after free.
2016-06-20Avoid closing stdin.Sergey Poznyakoff1
The default grecs parser closes stdin before returning. This might cause grief for programs assuming that open(2) never returns 0. * src/grecs-lex.l (yywrap): Avoid closing stdin. The yyin variable has meaning only if grecs_preprocessor is set. Otherwise, it will be assigned the pointer to stdin by lex-generated code.
2016-06-20Fix grecs_foreach_include_dirSergey Poznyakoff1
2016-06-20Fix grecs_include_path_countSergey Poznyakoff1
* src/preproc.c (grecs_include_path_count): Return count.
2016-06-18Fix prototypes.Sergey Poznyakoff2
2016-06-18Fix handling of undefined escape sequences.Sergey Poznyakoff6
* src/lineacc.c (grecs_line_acc_grow_char_unescape): If the escape sequence is not defined, add the character itself and return 1. Return 0 otherwise. (grecs_line_acc_grow_unescape_last): Take pointer to locus as third argument. If not NULL, print warning about undefined escape sequences. All callers updated. * src/parser.c (grecs_parse): Unless grecs_trace_flags is already set, set it from the value of GRECS_DEBUG environment variable.
2016-03-12Prevent NULL dereferencing when attempting to remove an unexistent symtab entry.Sergey Poznyakoff1
* src/symtab.c (grecs_symtab_remove): Return if no matching entry was found.
2016-03-05Improve dhcpd parserSergey Poznyakoff7
* src/dhcpd-gram.y: Support assignments and conditional expressions. * src/dhcpd-lex.l: New exclusive states BOOL and EXPR. * src/parsertab.c (parser_tab) [ENABLE_DHCPD_PARSER]: Define dhcpd parser. * tests/ New file. * tests/ Add * tests/ Likewise.
2016-02-23Reword some diagnosticsSergey Poznyakoff2
2016-02-21Fix memory leaksSergey Poznyakoff2
2016-02-21Prevent memory leaks when re-processing values of string type.Sergey Poznyakoff2
* src/grecs.hin (GRECS_CONST): New flag. * src/tree.c (grecs_string_convert): For string types, free the old value prior to assigning the new one, unless the GRECS_CONST flag is set. In any case, clear the GRECS_CONST flag after assigning new value.
2016-01-21Implement grecs_list_compare; other minor fixes.Sergey Poznyakoff4
* src/grecs.hin (grecs_list_compare) (grecs_node_unlink): New protos. * src/list.c (grecs_list_compare): New function. * src/wordsplit.c (wordsplit_getwords): Word count is size_t * src/wordsplit.h (wordsplit_getwords): Fix proto.
2016-01-09BugfixSergey Poznyakoff2
* src/meta1-lex.l: Fix erroneous #ifndef
2016-01-09BugfixSergey Poznyakoff1
* src/sockaddr.c (parse_inet): Handle GRECS_AH_PASSIVE
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/ 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/ Add json.h * src/ Likewise. * src/ Likewise. * src/ 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/ New file. * tests/ New file. * tests/ Add new tests; build json * tests/ Add new tests. * tests/.gitignore: Update. * am/grecs.m4: New flag "json" * (GRECS_SETUP): Require json * src/ (include_HEADERS): Assign GRECS_HDR value. * src/Make-shared.a [GRECS_COND_INSTALLHEADERS] (grecsinclude_HEADERS) [!GRECS_COND_INSTALLHEADERS] (noinst_HEADERS): Likewise. * src/ (noinst_HEADERS): Likewise. * src/ [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/ (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/ 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/ Test wordsplit first. If it fails, most other tests will fail too. * tests/ 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/ Add tests for ws_getenv function. Fix rule for gitid.hSergey Poznyakoff1

Return to:

Send suggestions and report system problems to the System administrator.