path: root/src
AgeCommit message (Collapse)AuthorFiles
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 Poznyakoff3
* 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-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 Poznyakoff9
* 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 Poznyakoff42
2015-12-17wordsplit: fix ws trimming and return_delim optionSergey Poznyakoff1
* 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-17wordsplit: improve docs, add new functionSergey Poznyakoff2
* 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 Poznyakoff2
2015-12-17Improve wordsplitSergey Poznyakoff2
* 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-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 Poznyakoff2
* 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 Poznyakoff1
* 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 Poznyakoff2
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 Poznyakoff2
* 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-17wordsplit: Fix expansion of ${...}Sergey Poznyakoff1
* src/wordsplit.c (expvar): Ensure value is set. Pass WRDSF_QUOTE to wordsplit (scan_word): Treat ${...} as a single word. * tests/ 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 Poznyakoff1
* (AC_CONFIG_SRCDIR): Fix argument * src/ (include_HEADERS): Add grecsopt.h * tests/.gitignore: Add wsp.c * tests/ Add new tests. * tests/ Likewise. * tests/ 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-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-26Improve error reporting.Sergey Poznyakoff1
2014-12-25Add globbing pattern support to #include and #include_onceSergey Poznyakoff1
* 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/ Add new testes. * tests/ Likewise. * tests/ New test case. * tests/ New test case. * tests/ New test case. * tests/ New test case.
2014-09-25Minor fix.Sergey Poznyakoff1
* src/cidr.c: Include sys/socket.h
2014-09-25Add support for IPv6, multiple addresses and CIDRs.Sergey Poznyakoff8
* am/grecs.m4 (GRECS_SETUP): New option sockaddr-list. Build grecs.h at configure stage. * src/ (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-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.
2013-12-17One more fix.Sergey Poznyakoff1
* src/opthelp.c (grecs_print_usage): Fix buffer offset
2013-12-16Fix --usage output.Sergey Poznyakoff1
* src/opthelp.c (grecs_print_usage): Print positional parameters.
2013-11-27New function for formatting grecs loci.Sergey Poznyakoff2
* src/diag.c (grecs_asprint_locus): New function. * src/grecs.hin (grecs_asprint_locus): New proto.
2013-11-26New text formatting functions.Sergey Poznyakoff2
* src/txtacc.c (grecs_txtacc_grow_string) (grecs_txtacc_grow_string_escape): New functions. * src/grecs.hin: Ditto
2013-11-14Fix coredump when searching in an empty tree.Sergey Poznyakoff1
2013-06-01Minor changeSergey Poznyakoff1
* src/parser.c (grecs_error_count,grecs_adjust_string_locations): Initialize
2013-05-30BugfixesSergey Poznyakoff1
* build-aux/yyrename: Split sed command into three -e options: traditional sed doesn't like semicolons as separators. * src/opthelp.c (grecs_print_help): Remove superfluous const qualifier.
2013-04-25Add support for subcommand names.Sergey Poznyakoff2
This should simplify using grecs in programs that implement a subcommand notion (a la git or svn, e.g. myprod doit -n *). * build-aux/getopt.m4 (STDFUNC): Initialize the subcmd member of struct grecs_proginfo. (OPTIONS_COMMAND_BEGIN): New macro. * src/grecsopt.h (grecs_proginfo) <subcmd>: New member. * src/opthelp.c (grecs_print_help): if defined, print the subcommand and its aliases.
2013-04-24Bugfix.Sergey Poznyakoff1
* src/opthelp.c (grecs_print_usage): Make sure enough buffer space is available if the string width cannot be trimmed to RMARGIN.
2013-03-12Complement bef65e80 for block statements.Sergey Poznyakoff1
* src/format.c (grecs_print_block_statement): If argument name begins with \', omit the surrounding angle brackets and \' itself.
2013-02-26Introduce an alternative callback function calling convention.Sergey Poznyakoff5
Depending on the tree-api option to the GRECS_SETUP macro, the signature of callback functions changes. If the option is supplied, a pointer to grecs_node_t is passwd to callback functions as an argument instead of pointers to the value and locus. * am/grecs.m4 (GRECS_SETUP): New option tree-api. * src/.gitignore: Add grecs.h * src/ Build grecs.h * src/grecs.h: Rename to src/grecs.hin (GRECS_TREE_API): New define (grecs_callback_fn): Provide two alternative signatures depending on the value of GRECS_TREE_API. All uses updated. * src/tree.c (fake_callback): Update signature. (grecs_process_ident) (stmt_begin,stmt_end): Update calls to callback. * tests/gcfset.c: Likewise.
2012-12-30Check returns from pipe and dup2.Sergey Poznyakoff1
2012-12-29Use AM_CPPFLAGS instead of the INCLUDES in Makefiles.Sergey Poznyakoff1

Return to:

Send suggestions and report system problems to the System administrator.