aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFiles
2015-12-18Merge branch 'clparse' of ssh://git.gnu.org.ua/gitroot/grecs into clparseclparseSergey Poznyakoff0
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-16Merge branch 'master' into clparseSergey Poznyakoff5
* build-aux/getopt.m4: Use separate namespace for internal symbols * src/format.c (grecs_format_node_path) (grecs_format_node_path): don't coredump on NULL values. * src/grecs-lex.l: Improve error reporting.
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 leakSergey Poznyakoff1
* src/grecs-lex.l (yywrap): Close yyin.
2015-11-25Fix descriptor leak.Sergey Poznyakoff1
* src/grecs-lex.l (yywrap): Close yyin.
2015-10-28Minor improvement in wordsplit.Sergey Poznyakoff2
* src/wordsplit.h (WRDSX_WORD, WRDSX_QUOTE): New defines. * src/wordsplit.c: Use them when initializing ws_escape.
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-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-28Update copyright yearsSergey Poznyakoff125
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-16wordsplit: 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-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-26Merge branch 'master' into clparseSergey Poznyakoff18
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-12-03Minor fixes in wordsplit documentationSergey Poznyakoff1
2014-10-31wordsplit: minor fixesSergey Poznyakoff2
2014-10-30wordsplit: 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.
2014-10-30Finish wordsplit docs, improve testsSergey Poznyakoff5
2014-10-28Improve 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.
2014-10-24Improve wordsplit documentation and debug output.Sergey Poznyakoff2

Return to:

Send suggestions and report system problems to the System administrator.